summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/DiveDetails.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qt-mobile/qml/DiveDetails.qml')
-rw-r--r--qt-mobile/qml/DiveDetails.qml32
1 files changed, 28 insertions, 4 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 69c30e4ae..3f637784e 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -45,16 +45,40 @@ MobileComponents.Page {
}
]
+
+ function endAddMode() {
+ // edit was canceled - so remove the dive from the dive list
+ manager.addDiveAborted(dive_id)
+ state = "view"
+ Qt.inputMethod.hide()
+ }
+
+ contextualActions: [
+ Action {
+ text: state === "view" ? "Back to dive list" : "Cancel"
+ iconName: "dialog-cancel"
+ onTriggered: {
+ if (state === "view") {
+ stackView.pop()
+ contextDrawer.close()
+ } else if (state === "edit") {
+ endEditMode()
+ contextDrawer.close()
+ } else {
+ endAddMode()
+ contextDrawer.close()
+ }
+ }
+ }
+ ]
+
mainAction: Action {
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
onTriggered: {
if (state === "edit") {
endEditMode()
} else if (state === "add") {
- // edit was canceled - so remove the dive from the dive list
- manager.addDiveAborted(dive_id)
- state = "view"
- Qt.inputMethod.hide()
+ endAddMode()
} else {
startEditMode()
}