summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-27 08:18:53 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-12-27 17:12:38 -0800
commit74faca5d43f856b9f72a9023ef0b5b1ace238285 (patch)
tree03af7501a3ad34cd19c99b8fdd4979443ad7d35a /qt-ui
parenta35a28ab389c1ef8d680bb736697224b029ce8c9 (diff)
downloadsubsurface-74faca5d43f856b9f72a9023ef0b5b1ace238285.tar.gz
Handle editing a manually added dive consistently
Regardless of whether the user clicks in the info tab, makes a change to equipment or starts by editing the profile (i.e., clicking on the little penguin), we should get into the same state and behave the same way. This means that when editing a manually added dive we are always in editMode == MANUALLY_ADDED_DIVE - and editMode == DIVE means we are editing a dive that came from another source. Fixes #379 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ae4cf534c..40dcf9b48 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -178,8 +178,7 @@ void MainTab::toggleTriggeredColumn()
void MainTab::addDiveStarted()
{
- enableEdition();
- editMode = ADD;
+ enableEdition(ADD);
}
void MainTab::addMessageAction(QAction* action)
@@ -221,9 +220,15 @@ void MainTab::displayMessage(QString str)
void MainTab::enableEdition(EditMode newEditMode)
{
- if (selected_dive < 0 || editMode != NONE)
+ if (current_dive == NULL || editMode != NONE)
return;
-
+ if ((newEditMode == DIVE || newEditMode == NONE) &&
+ strcmp(current_dive->dc.model, "manually added dive") == 0) {
+ // editCurrentDive will call enableEdition with newEditMode == MANUALLY_ADDED_DIVE
+ // so exit this function here after editCurrentDive() returns
+ mainWindow()->editCurrentDive();
+ return;
+ }
mainWindow()->dive_list()->setEnabled(false);
mainWindow()->globe()->prepareForGetDiveCoordinates();
// We may be editing one or more dives here. backup everything.
@@ -915,7 +920,7 @@ void MainTab::on_notes_textChanged()
// we are editing a trip
dive_trip_t *currentTrip = *mainWindow()->dive_list()->selectedTrips().begin();
EDIT_TEXT(currentTrip->notes, ui.notes->toPlainText());
- } else if (editMode == DIVE || editMode == ADD) {
+ } else if (editMode == DIVE || editMode == ADD || editMode == MANUALLY_ADDED_DIVE) {
EDIT_SELECTED_DIVES( EDIT_TEXT(mydive->notes, ui.notes->toPlainText()) );
}
markChangedWidget(ui.notes);