summaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/DiveDetails.qml
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-23 14:05:28 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-02-23 14:07:49 +0100
commit6d52d0f7618f4b4b42c3b0e543ef5891abdd4f0d (patch)
tree09000da5099e59267ca8194ca3fe78ddb1ba5c0b /qt-mobile/qml/DiveDetails.qml
parent2772ab8764ff1bab1baf77f13ebb0845db21a7d4 (diff)
downloadsubsurface-6d52d0f7618f4b4b42c3b0e543ef5891abdd4f0d.tar.gz
QML UI: add context menu to delete dive
This allows the user to delete the currently shown dive. This action takes effect right away, no confirmation, it gets right away written to the local git cache. One idea for an undo operation here could be to simply reset the git tree to HEAD^ and reload. Not elegant, but would work. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile/qml/DiveDetails.qml')
-rw-r--r--qt-mobile/qml/DiveDetails.qml26
1 files changed, 11 insertions, 15 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml
index 1877feb09..83a8b3a93 100644
--- a/qt-mobile/qml/DiveDetails.qml
+++ b/qt-mobile/qml/DiveDetails.qml
@@ -31,16 +31,19 @@ MobileComponents.Page {
states: [
State {
name: "view"
+ PropertyChanges { target: diveDetailsPage; contextualActions: deleteAction }
PropertyChanges { target: diveDetailList; visible: true }
PropertyChanges { target: detailsEditScroll; visible: false }
},
State {
name: "edit"
+ PropertyChanges { target: diveDetailsPage; contextualActions: null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
},
State {
name: "add"
+ PropertyChanges { target: diveDetailsPage; contextualActions: null }
PropertyChanges { target: diveDetailList; visible: false }
PropertyChanges { target: detailsEditScroll; visible: true }
}
@@ -53,26 +56,19 @@ MobileComponents.Page {
state = "view"
Qt.inputMethod.hide()
}
-/* this can be done by hitting the back key
- contextualActions: [
+
+ property list<QtObject> deleteAction: [
Action {
- text: state === "view" ? "Back to dive list" : "Cancel"
- iconName: "dialog-cancel"
+ text: "Delete dive"
+ iconName: "trash-empty"
onTriggered: {
- if (state === "view") {
- stackView.pop()
- contextDrawer.close()
- } else if (state === "edit") {
- endEditMode()
- contextDrawer.close()
- } else {
- endAddMode()
- contextDrawer.close()
- }
+ manager.deleteDive(diveDetailsListView.currentItem.modelData.dive.id)
+ stackView.pop()
+ contextDrawer.close()
}
}
]
- */
+
mainAction: Action {
iconName: state !== "view" ? "document-save" : "document-edit"
onTriggered: {