Abort closing the app if saving a database failed.

This commit is contained in:
Felix Geyer 2015-07-18 17:36:08 +02:00
parent b9fe2c1bf9
commit c6fe0da569

View File

@ -234,7 +234,9 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
} }
if (dbStruct.modified) { if (dbStruct.modified) {
if (config()->get("AutoSaveOnExit").toBool()) { if (config()->get("AutoSaveOnExit").toBool()) {
saveDatabase(db); if (!saveDatabase(db)) {
return false;
}
} }
else { else {
QMessageBox::StandardButton result = QMessageBox::StandardButton result =
@ -243,7 +245,9 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
tr("\"%1\" was modified.\nSave changes?").arg(dbName), tr("\"%1\" was modified.\nSave changes?").arg(dbName),
QMessageBox::Yes | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Yes); QMessageBox::Yes | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Yes);
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
saveDatabase(db); if (!saveDatabase(db)) {
return false;
}
} }
else if (result == QMessageBox::Cancel) { else if (result == QMessageBox::Cancel) {
return false; return false;