From bc44dd8db1defa8db05588991fec4f40855ba44a Mon Sep 17 00:00:00 2001 From: "Lubomir I. Ivanov" Date: Thu, 26 Mar 2015 02:23:43 +0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'qt-ui') 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)); -- cgit v1.2.3-70-g09d2