mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2772ab8764
commit
6d52d0f761
1 changed files with 11 additions and 15 deletions
|
@ -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: {
|
||||
|
|
Loading…
Add table
Reference in a new issue