Desktop: On dive edit from the dive list or map, switch to new state

If "Edit dive" is selected from the dive list or the map view, switch
to a new mode, which shows the dive infos and the profile.

After the edit, switch back to the previous state.

Fixes #1213

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-05-03 19:19:54 +02:00 committed by Dirk Hohndel
parent 9d342d0e1a
commit 57bf174c4f
3 changed files with 65 additions and 19 deletions

View file

@ -334,6 +334,7 @@ void MainTab::enableEdition(EditMode newEditMode)
ui.editDiveSiteButton->setEnabled(false);
MainWindow::instance()->dive_list()->setEnabled(false);
MainWindow::instance()->setEnabledToolbar(false);
MainWindow::instance()->enterEditState();
if (isTripEdit) {
// we are editing trip location and notes
@ -991,6 +992,7 @@ void MainTab::acceptChanges()
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
MainWindow::instance()->dive_list()->verticalScrollBar()->setSliderPosition(scrolledBy);
MainWindow::instance()->dive_list()->setFocus();
MainWindow::instance()->exitEditState();
cylindersModel->changed = false;
weightModel->changed = false;
MainWindow::instance()->setEnabledToolbar(true);
@ -1058,6 +1060,7 @@ void MainTab::rejectChanges()
// show the profile and dive info
MainWindow::instance()->graphics()->replot();
MainWindow::instance()->setEnabledToolbar(true);
MainWindow::instance()->exitEditState();
cylindersModel->changed = false;
weightModel->changed = false;
cylindersModel->updateDive();