From 11a2d321d855ebc0aae32dc7e5e6b572350aed3e Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Fri, 10 May 2013 13:21:52 +0200 Subject: [PATCH] Don't set dirty flag after SQL import to new DB file When creating a new database to import a SQL file into don't set the dirty flag. --- src/MainWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index a66424e7..558f421d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -820,6 +820,7 @@ void MainWindow::importDatabaseFromSQL() return; // If there is already a database file opened ask the user wether to import into this one or a new one. If no DB is opened just ask for a DB name directly + bool importToNewDb = false; if((db.isOpen() && QMessageBox::question(this, QApplication::applicationName(), tr("Do you want to create a new database file to hold the imported data?\n" @@ -839,13 +840,14 @@ void MainWindow::importDatabaseFromSQL() } db.create(newDBfile); + importToNewDb = true; } // Open, read, execute and close file QApplication::setOverrideCursor(Qt::WaitCursor); QFile f(fileName); f.open(QIODevice::ReadOnly); - if(!db.executeMultiSQL(f.readAll())) + if(!db.executeMultiSQL(f.readAll(), !importToNewDb)) QMessageBox::warning(this, QApplication::applicationName(), tr("Error importing data: %1").arg(db.lastErrorMessage)); else QMessageBox::information(this, QApplication::applicationName(), tr("Import completed."));