diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-01-29 16:15:17 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-04-02 13:53:23 -0700 |
commit | 4d60662531b3c4ad1ce17c0fd2d7f9844cf52ece (patch) | |
tree | 5822c82b24314c9caafe5b0c8b40252ccfe334af /desktop-widgets | |
parent | 2789bb05b133a7cf54081d58d4f5c51c8977e951 (diff) | |
download | subsurface-4d60662531b3c4ad1ce17c0fd2d7f9844cf52ece.tar.gz |
desktop: remove check for editMode in maintab
The accept / reject message is only shown in edit-mode, no
need to check it. This is a step in simplification / removal
of the edit mode.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets')
-rw-r--r-- | desktop-widgets/tab-widgets/maintab.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp index 78784de46..b849a3ead 100644 --- a/desktop-widgets/tab-widgets/maintab.cpp +++ b/desktop-widgets/tab-widgets/maintab.cpp @@ -504,19 +504,15 @@ void MainTab::acceptChanges() ui.dateEdit->setEnabled(true); hideMessage(); - if (editMode) { - MainWindow::instance()->showProfile(); - DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING); - Command::editProfile(&displayed_dive); - } + MainWindow::instance()->showProfile(); + DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING); + Command::editProfile(&displayed_dive); + int scrolledBy = MainWindow::instance()->diveList->verticalScrollBar()->sliderPosition(); - if (editMode) { - MainWindow::instance()->diveList->reload(); - MainWindow::instance()->refreshDisplay(); - MainWindow::instance()->refreshProfile(); - } else { - MainWindow::instance()->refreshDisplay(); - } + MainWindow::instance()->diveList->reload(); + MainWindow::instance()->refreshDisplay(); + MainWindow::instance()->refreshProfile(); + DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING); MainWindow::instance()->diveList->verticalScrollBar()->setSliderPosition(scrolledBy); MainWindow::instance()->diveList->setFocus(); @@ -528,13 +524,12 @@ void MainTab::acceptChanges() void MainTab::rejectChanges() { - if (editMode && current_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; - } + 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; } + ui.dateEdit->setEnabled(true); editMode = false; hideMessage(); @@ -544,6 +539,7 @@ void MainTab::rejectChanges() updateDiveInfo(); // show the profile and dive info + MainWindow::instance()->refreshDisplay(); MainWindow::instance()->refreshProfile(); MainWindow::instance()->setEnabledToolbar(true); ui.editDiveSiteButton->setEnabled(!ui.location->text().isEmpty()); |