aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 20:33:17 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 21:15:01 -0700
commitb16e8e7b4e0ed00725a6af4309e1142dfbefb2f3 (patch)
treeab58be7a80e9c771b2963812630895e9c59db3c5 /qt-mobile
parentfb157b873af7c3d9183bfdb66769051fb0843f85 (diff)
downloadsubsurface-b16e8e7b4e0ed00725a6af4309e1142dfbefb2f3.tar.gz
QML UI: work around missing back button on iOS
Especially when showing the dive details and editing dive details, having the option to go back in the context menu is nicer on iOS. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r--qt-mobile/qml/DiveDetails.qml55
1 files changed, 38 insertions, 17 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index d7db35227..525031da7 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -31,19 +31,19 @@ MobileComponents.Page {
states: [
State {
name: "view"
- PropertyChanges { target: diveDetailsPage; contextualActions: deleteAction }
+ PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ deleteAction, backAction ] : [ deleteAction ] }
PropertyChanges { target: diveDetailList; visible: true }
PropertyChanges { target: detailsEditScroll; visible: false }
},
State {
name: "edit"
- PropertyChanges { target: diveDetailsPage; contextualActions: null }
+ PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
},
State {
name: "add"
- PropertyChanges { target: diveDetailsPage; contextualActions: null }
+ PropertyChanges { target: diveDetailsPage; contextualActions: Qt.platform.os == "ios" ? [ cancelAction ] : null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
}
@@ -57,22 +57,43 @@ MobileComponents.Page {
Qt.inputMethod.hide()
}
- property list<QtObject> deleteAction: [
- Action {
- text: "Delete dive"
- iconName: "trash-empty"
- onTriggered: {
- contextDrawer.close()
- var deletedId = diveDetailsListView.currentItem.modelData.dive.id
- manager.deleteDive(deletedId)
- stackView.pop()
- showPassiveNotification("Dive deleted", 3000, "Undo",
- function() {
- manager.undoDelete(deletedId)
- });
+ property QtObject deleteAction: Action {
+ text: "Delete dive"
+ iconName: "trash-empty"
+ onTriggered: {
+ contextDrawer.close()
+ var deletedId = diveDetailsListView.currentItem.modelData.dive.id
+ manager.deleteDive(deletedId)
+ stackView.pop()
+ showPassiveNotification("Dive deleted", 3000, "Undo",
+ function() {
+ manager.undoDelete(deletedId)
+ });
+ }
+ }
+
+ property QtObject cancelAction: Action {
+ text: state === "edit" ? "Cancel edit" : "Cancel dive add"
+ iconName: "dialog-cancel"
+ onTriggered: {
+ contextDrawer.close()
+ if (state === "edit") {
+ endEditMode()
+ } else if (state === "add") {
+ endAddMode()
+ returnTopPage()
}
}
- ]
+ }
+
+ property QtObject backAction: Action {
+ text: "Back to dive list"
+ iconName: "go-previous"
+ onTriggered: {
+ contextDrawer.close()
+ returnTopPage()
+ }
+ }
mainAction: Action {
iconName: state !== "view" ? "document-save" : "document-edit"