summaryrefslogtreecommitdiffstats
path: root/qt-ui/maintab.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-01 11:19:23 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-01 11:19:23 -0700
commit9e635392373cdc56fb3a897ea491e7c33fdbd424 (patch)
treef774d955632b301428088365d41abe62badfdd26 /qt-ui/maintab.cpp
parent1a4d098ef2062923bbe09538cc01c1d130989640 (diff)
parent0e96c9f62e3a7030d9208f32e59390cb3fd20bbe (diff)
downloadsubsurface-9e635392373cdc56fb3a897ea491e7c33fdbd424.tar.gz
Merge branch 'editMode' of github.com:tcanabrava/subsurface
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r--qt-ui/maintab.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 8d2324382..ddcdc6c63 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -113,7 +113,7 @@ void MainTab::addDiveStarted()
editMode = ADD;
}
-void MainTab::enableEdition()
+void MainTab::enableEdition(EditMode newEditMode)
{
if (selected_dive < 0 || editMode != NONE)
return;
@@ -170,7 +170,8 @@ void MainTab::enableEdition()
notesBackup[mydive].weightsystem[i] = mydive->weightsystem[i];
}
}
- editMode = DIVE;
+
+ editMode = newEditMode != NONE ? newEditMode : DIVE;
}
}
@@ -449,7 +450,7 @@ void MainTab::acceptChanges()
}
}
- if (editMode == ADD) {
+ if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) {
// clean up the dive data (get duration, depth information from samples)
fixup_dive(current_dive);
if (dive_table.nr == 1)
@@ -506,6 +507,9 @@ void MainTab::rejectChanges()
delete_single_dive(selected_dive);
DivePlannerPointsModel::instance()->cancelPlan();
}
+ else if (editMode == MANUALLY_ADDED_DIVE ){
+ DivePlannerPointsModel::instance()->undoEdition();
+ }
struct dive *curr = current_dive;
ui.notes->setText(notesBackup[curr].notes );
ui.location->setText(notesBackup[curr].location);
@@ -563,7 +567,7 @@ void MainTab::rejectChanges()
ui.equipmentButtonBox->hide();
notesBackup.clear();
resetPallete();
- if (editMode == ADD) {
+ if (editMode == ADD || editMode == MANUALLY_ADDED_DIVE) {
// more clean up
updateDiveInfo(selected_dive);
mainWindow()->showProfile();