diff options
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 525031da7..4bdd052e4 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -50,13 +50,6 @@ MobileComponents.Page { ] - function endAddMode() { - // edit was canceled - so remove the dive from the dive list - manager.addDiveAborted(dive_id) - state = "view" - Qt.inputMethod.hide() - } - property QtObject deleteAction: Action { text: "Delete dive" iconName: "trash-empty" @@ -77,12 +70,10 @@ MobileComponents.Page { iconName: "dialog-cancel" onTriggered: { contextDrawer.close() - if (state === "edit") { - endEditMode() - } else if (state === "add") { - endAddMode() + if (state === "add") returnTopPage() - } + else + endEditMode() } } @@ -111,7 +102,7 @@ MobileComponents.Page { endEditMode() event.accepted = true; } else if (state === "add") { - endAddMode() + endEditMode() stackView.pop() event.accepted = true; } @@ -124,7 +115,10 @@ MobileComponents.Page { } function endEditMode() { - // just cancel the edit state + // if we were adding a dive, we need to remove it + if (state === "add") + manager.addDiveAborted(dive_id) + // just cancel the edit/add state state = "view"; Qt.inputMethod.hide(); } |