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>
This commit is contained in:
Dirk Hohndel 2020-03-26 11:47:18 -07:00
parent f2a48e813f
commit 0301fc6905

View file

@ -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();