Close database without asking when unmodified.

Don't ask for confirmation when closing/locking a database and
- it's in edit entry mode
- there haven't been any modifications

Refs #511
This commit is contained in:
Felix Geyer
2016-08-01 00:22:04 +02:00
committed by Jonathan White
parent cf8186312a
commit 8a50ee8b22
5 changed files with 32 additions and 2 deletions

View File

@@ -223,7 +223,7 @@ bool DatabaseTabWidget::closeDatabase(Database* db)
if (dbName.right(1) == "*") {
dbName.chop(1);
}
if (dbStruct.dbWidget->isInEditMode() && db->hasKey()) {
if (dbStruct.dbWidget->isInEditMode() && db->hasKey() && dbStruct.dbWidget->isEditWidgetModified()) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Close?"),
@@ -654,7 +654,7 @@ void DatabaseTabWidget::lockDatabases()
// show the correct tab widget before we are asking questions about it
setCurrentWidget(dbWidget);
if (mode == DatabaseWidget::EditMode) {
if (mode == DatabaseWidget::EditMode && dbWidget->isEditWidgetModified()) {
QMessageBox::StandardButton result =
MessageBox::question(
this, tr("Lock database"),