mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
mobile UI: allow adding a dive to a trip from context menu
Right now this is only available on the DiveDetails screen. The menu entries are only enabled if there is such a trip to add the dive to (and if the dive isn't already part of a trip). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a4043401c9
commit
2c8f962ecc
1 changed files with 18 additions and 3 deletions
|
|
@ -61,13 +61,28 @@ Kirigami.Page {
|
||||||
|
|
||||||
property QtObject removeDiveFromTripAction: Kirigami.Action {
|
property QtObject removeDiveFromTripAction: Kirigami.Action {
|
||||||
text: qsTr ("Remove this dive from trip")
|
text: qsTr ("Remove this dive from trip")
|
||||||
enabled: currentItem && currentItem.modelData.diveInTrip
|
enabled: currentItem && currentItem.modelData && currentItem.modelData.diveInTrip
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
manager.appendTextToLog("remove dive #" + currentItem.modelData.number + " from its trip")
|
manager.appendTextToLog("remove dive #" + currentItem.modelData.number + " from its trip")
|
||||||
manager.removeDiveFromTrip(currentItem.modelData.id)
|
manager.removeDiveFromTrip(currentItem.modelData.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
property QtObject addDiveToTripAction: Kirigami.Action { text: qsTr ("Add dive to trip <TBD>") }
|
property QtObject addDiveToTripAboveAction: Kirigami.Action {
|
||||||
|
text: qsTr ("Add dive to trip above")
|
||||||
|
enabled: currentItem && currentItem.modelData && !currentItem.modelData.diveInTrip && currentItem.modelData.tripAbove !== -1
|
||||||
|
onTriggered: {
|
||||||
|
manager.appendTextToLog("add dive #" + currentItem.modelData.number + " to trip with id " + currentItem.modelData.tripAbove)
|
||||||
|
manager.addDiveToTrip(currentItem.modelData.id, currentItem.modelData.tripAbove)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
property QtObject addDiveToTripBelowAction: Kirigami.Action {
|
||||||
|
text: qsTr ("Add dive to trip below")
|
||||||
|
enabled: currentItem && currentItem.modelData && !currentItem.modelData.diveInTrip && currentItem.modelData.tripBelow !== -1
|
||||||
|
onTriggered: {
|
||||||
|
manager.appendTextToLog("add dive #" + currentItem.modelData.number + " to trip with id " + currentItem.modelData.tripBelow)
|
||||||
|
manager.addDiveToTrip(currentItem.modelData.id, currentItem.modelData.tripBelow)
|
||||||
|
}
|
||||||
|
}
|
||||||
property QtObject undoAction: Kirigami.Action {
|
property QtObject undoAction: Kirigami.Action {
|
||||||
text: qsTr("Undo") + " " + manager.undoText
|
text: qsTr("Undo") + " " + manager.undoText
|
||||||
enabled: manager.undoText !== ""
|
enabled: manager.undoText !== ""
|
||||||
|
|
@ -78,7 +93,7 @@ Kirigami.Page {
|
||||||
enabled: manager.redoText !== ""
|
enabled: manager.redoText !== ""
|
||||||
onTriggered: manager.redo()
|
onTriggered: manager.redo()
|
||||||
}
|
}
|
||||||
property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAction, undoAction, redoAction ]
|
property variant contextactions: [ removeDiveFromTripAction, addDiveToTripAboveAction, addDiveToTripBelowAction, undoAction, redoAction ]
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
State {
|
State {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue