mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a35a28ab38
commit
74faca5d43
1 changed files with 10 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue