diff options
author | Lubomir I. Ivanov <neolit123@gmail.com> | 2015-03-26 02:23:43 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-03-30 12:54:36 -0700 |
commit | bc44dd8db1defa8db05588991fec4f40855ba44a (patch) | |
tree | 75a59649bdd6d57316d2cbdb72fef0919c308dd4 /qt-ui/maintab.cpp | |
parent | 412238720806e1d66f6a94418f2af7d6785d4452 (diff) | |
download | subsurface-bc44dd8db1defa8db05588991fec4f40855ba44a.tar.gz |
maintab.cpp: fix editing dive profiles from trips
Once a manually added dive is part of a trip and this trip
is edited, applying the modifications leaves the dive profile
in edit mode (e.g. points can be dragged and gas swapping can
be applied).
The issue can be viewed from another angle. Why enable
profile edits of a manually added dive which is in a trip,
while the trip is being edited in the first place?
If there are more than one manually added dives in said trip
we are enabled to edit one of the dive but probably
it's not intended to modify all manually added dives after the
changes are applied for the trip.
This patch disables the functionality in question and it also...
Fixes #864
Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index abf1382ad..2deca04de 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -280,11 +280,15 @@ void MainTab::updateTextLabels(bool showUnits) void MainTab::enableEdition(EditMode newEditMode) { + const bool isTripEdit = MainWindow::instance() && + MainWindow::instance()->dive_list()->selectedTrips().count() == 1; + if (((newEditMode == DIVE || newEditMode == NONE) && current_dive == NULL) || editMode != NONE) return; modified = false; copyPaste = false; if ((newEditMode == DIVE || newEditMode == NONE) && + !isTripEdit && current_dive->dc.model && strcmp(current_dive->dc.model, "manually added dive") == 0) { // editCurrentDive will call enableEdition with newEditMode == MANUALLY_ADDED_DIVE @@ -306,7 +310,7 @@ void MainTab::enableEdition(EditMode newEditMode) if (amount_selected == 1 && newEditMode != ADD) MainWindow::instance()->globe()->prepareForGetDiveCoordinates(); - if (MainWindow::instance() && MainWindow::instance()->dive_list()->selectedTrips().count() == 1) { + if (isTripEdit) { // we are editing trip location and notes displayMessage(tr("This trip is being edited.")); memset(&displayedTrip, 0, sizeof(displayedTrip)); |