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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-12 13:34:57 -07:00
parent 748198891d
commit a4050c2a71

View file

@ -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);