From a82411b67cb71833c7d35bd8d075956c1f5e03ea Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 3 Jun 2014 18:17:32 -0700 Subject: Dive edit: when asked ti quit while editing, offer to discard current edit This is equivalent behavior to what we do when planning a dive. Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index cda6e349d..92d5f6d7c 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -317,8 +317,10 @@ void MainWindow::on_actionPreferences_triggered() void MainWindow::on_actionQuit_triggered() { if (ui.InfoWidget->isEditing()) { - QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file.")); - return; + ui.InfoWidget->rejectChanges(); + if (ui.InfoWidget->isEditing()) + // didn't discard the edits + return; } if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING) { DivePlannerPointsModel::instance()->cancelPlan(); -- cgit v1.2.3-70-g09d2