From a4050c2a714861797f3e46d55f3eda1541053387 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 12 Jun 2014 13:34:57 -0700 Subject: Don't copy the current dive ontop of editedDive after edit has started If you switch to edit mode by making a change to cylinders or weights, then the data in the editedDive was changed and afterwards the current dive was once again copied into the editedDive - even though we already did that earlier when setting up the display. Fixes #539 Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'qt-ui/maintab.cpp') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 5a718ef17..1a30d84e1 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -273,8 +273,8 @@ void MainTab::enableEdition(EditMode newEditMode) } else { displayMessage(tr("This dive is being edited.")); } - // copy the current dive into editedDive and edit that - editedDive = *current_dive; + // editedDive already contains the current dive (we set this up in updateDiveInfo), + // so all we need to do is update the editMode if necessary editMode = newEditMode != NONE ? newEditMode : DIVE; } } @@ -449,6 +449,9 @@ void MainTab::updateDiveInfo(int dive) ui.LocationLabel->setText(tr("Location")); ui.NotesLabel->setText(tr("Notes")); ui.equipmentTab->setEnabled(true); + // now copy the current dive over to editedDive and use THAT to show the + // cylinder and weight model (this way edits on the equipment tab happen in the + // editedDive and not on the real data (until the user hits save) editedDive = *d; cylindersModel->setDive(&editedDive); weightModel->setDive(&editedDive); -- cgit v1.2.3-70-g09d2