From a12b10c008c4cce58db3b128349b7d9ce1a61296 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 3 Jun 2014 18:01:00 -0700 Subject: Ask before discarding edits This is equivalent to what we do for the planner. Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index fe579acb9..63e5d3a67 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -27,6 +27,7 @@ #include #include #include +#include MainTab::MainTab(QWidget *parent) : QTabWidget(parent), weightModel(new WeightModel(this)), @@ -780,6 +781,13 @@ void MainTab::resetPallete() void MainTab::rejectChanges() { EditMode lastMode = editMode; + if (lastMode != NONE && current_dive && memcmp(&editedDive, current_dive, sizeof(struct dive))) { + if (QMessageBox::warning(MainWindow::instance(), TITLE_OR_TEXT(tr("Discard the Changes?"), + tr("You are about to discard your changes.")), + QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Discard) != QMessageBox::Discard) { + return; + } + } editMode = NONE; tabBar()->setTabIcon(0, QIcon()); // Notes tabBar()->setTabIcon(1, QIcon()); // Equipment -- cgit v1.2.3-70-g09d2