mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
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>
This commit is contained in:
parent
4122387208
commit
bc44dd8db1
1 changed files with 5 additions and 1 deletions
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue