From fe88a2a4765c45bcea8387438574f9c1014997b8 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 16 Dec 2013 16:37:44 -0800 Subject: Don't quit while dive is edited If the user edits a dive and then quits we try to ask them to finish editing, first. If the user did this by either clicking the little 'x' in the window decoration or by hitting Alt-F4 (or similar), we didn't have that question (only the 'save changes' question in case the dive list had already been modified. Fixes #374 Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'qt-ui') diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 1ea115fc7..fbe37793b 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -700,6 +700,13 @@ void MainWindow::writeSettings() void MainWindow::closeEvent(QCloseEvent *event) { + if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || + ui.InfoWidget->isEditing()) { + QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before closing the file.")); + event->ignore(); + return; + } + if (helpView && helpView->isVisible()){ helpView->close(); helpView->deleteLater(); -- cgit v1.2.3-70-g09d2