From cf72bfbb1c842213db2fd699b4c40eba8825ca51 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Wed, 8 May 2013 21:50:35 +0200 Subject: [PATCH] MainWindow: Improve SQL tab behaviour Don't allow opening and saving when no database file is opened. Close all tabs when the database is closed. --- src/MainWindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index c3c6f477..a2aa3a61 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -149,6 +149,7 @@ void MainWindow::fileOpen(const QString & fileName) resetBrowser(); if(ui->mainTab->currentIndex() == 2) loadPragmas(); + openSqlTab(true); } } @@ -170,6 +171,7 @@ void MainWindow::fileNew() loadExtensionsFromSettings(); populateStructure(); resetBrowser(); + openSqlTab(true); createTable(); } } @@ -363,7 +365,6 @@ void MainWindow::fileClose() ui->buttonLogClear->click(); for(int i=ui->tabSqlAreas->count()-1;i>=0;i--) closeSqlTab(i, true); - openSqlTab(true); } void MainWindow::fileExit() @@ -1006,6 +1007,9 @@ void MainWindow::activateFields(bool enable) ui->actionExecuteSql->setEnabled(enable); ui->actionLoadExtension->setEnabled(enable); ui->actionSqlExecuteLine->setEnabled(enable); + ui->actionSqlOpenFile->setEnabled(enable); + ui->actionSqlOpenTab->setEnabled(enable); + ui->actionSqlSaveFile->setEnabled(enable); } void MainWindow::browseTableHeaderClicked(int logicalindex)