Removed inconsistency when user tried to add dive while planning.

The user could add a dive, and in the middle click on the 'plan'
button. Since we didn't cared about that on the widget, a lot of
inconsistencies could occour. this fixes that by setting a flag
on the Planner, that has now three modes: nothing, plan and add.
(maybe in the future an edit mode will be valid too.)

If in 'NOTHING' mode, user can enter the addition, edition and
planning. If in any other mode, user can't do a thing. The mode
gets back to NOTHING when user accepts or cancels a plan / add
/ edition.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2013-11-08 22:09:46 -02:00 committed by Dirk Hohndel
parent f850a0817c
commit 8a970c64c2
4 changed files with 46 additions and 25 deletions

View file

@ -497,6 +497,7 @@ void MainTab::acceptChanges()
mainWindow()->showProfile();
mainWindow()->refreshDisplay();
mark_divelist_changed(TRUE);
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
}
editMode = NONE;
@ -610,6 +611,7 @@ void MainTab::rejectChanges()
updateDiveInfo(selected_dive);
mainWindow()->showProfile();
mainWindow()->refreshDisplay();
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::NOTHING);
}
editMode = NONE;
}