diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-03-26 11:47:18 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-26 11:49:12 -0700 |
commit | 0301fc6905c2ed982365cdaaf47f5a3b6c9c5c35 (patch) | |
tree | 7eb33636e7b94b6b957d8e6119da36e97c44d6aa /mobile-widgets/qml | |
parent | f2a48e813f6967bd6b02f5e7f92d82534b175959 (diff) | |
download | subsurface-0301fc6905c2ed982365cdaaf47f5a3b6c9c5c35.tar.gz |
mobile UI: undo partial dive add when canceling
When we start adding a dive, we actually create a diveAdd undo command
so we have a dive that the user can edit. Which means we need to undo
this action if we cancel.
Also, for a more consistent UI, we should pop the dive details page that
we used to edit this dive and bring the user back to the dive list.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets/qml')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 57ef6c884..b70bb0045 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -260,7 +260,15 @@ Kirigami.Page { } function endEditMode() { - // just cancel the edit/add state + // we need to clean up either an edit or an add - and in case this + // was an add, we need to undo the addDive action that created the empty dive + // and we should also go back to the DiveDetails where we came from... + manager.appendTextToLog("endEditMode called with state " + state) + if (state === "add") { + manager.undo() + pageStack.pop() + } + // now all that is left is to cancel the edit/add state state = "view"; focus = false; Qt.inputMethod.hide(); |