Fix various issues with the dive add / edit manual dive code

- get_gas_from_events does NOT always set o2/he. It only updates them IFF
  a matching event is found; so we need to make sure we start out with a
  valid gas mix
- the way we tried to restore the edited dive in case of an edit to a
  manually added that is cancelled was completely bogus. Way too complex
  when we can simply and reliably simply store the dive and then copy it
  back

Fixes #270

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-11-18 11:55:56 -08:00
parent 3801b765ff
commit 8ae8c81d3d
4 changed files with 22 additions and 26 deletions

View file

@ -565,7 +565,9 @@ void MainTab::rejectChanges()
// clean up
DivePlannerPointsModel::instance()->cancelPlan();
} else if (lastMode == MANUALLY_ADDED_DIVE ) {
DivePlannerPointsModel::instance()->undoEdition(); // that's BOGUS... just copy the original dive back and be done with it...
// when we tried to edit a manually added dive, we destroyed
// the dive we edited, so let's just restore it from backup
DivePlannerPointsModel::instance()->restoreBackupDive();
}
struct dive *curr = current_dive;
ui.notes->setText(notesBackup[curr].notes );