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.
This commit is contained in:
Martin Kleusberg
2013-05-10 13:21:52 +02:00
parent 729773d345
commit 11a2d321d8

View File

@@ -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."));