mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: experimentally enable context menu on each page
This is necessary to allow all user interaction when removing action buttons from the top bar. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a738174a45
commit
d9d1b58e6a
6 changed files with 83 additions and 4 deletions
|
@ -8,6 +8,17 @@ MobileComponents.Page {
|
||||||
id: aboutPage
|
id: aboutPage
|
||||||
property int pageWidth: subsurfaceTheme.columnWidth - MobileComponents.Units.gridUnit
|
property int pageWidth: subsurfaceTheme.columnWidth - MobileComponents.Units.gridUnit
|
||||||
|
|
||||||
|
contextualActions: [
|
||||||
|
Action {
|
||||||
|
text: "Close About"
|
||||||
|
iconName: "dialog-cancel"
|
||||||
|
onTriggered: {
|
||||||
|
stackView.pop()
|
||||||
|
contextDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
mainAction: Action {
|
||||||
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
|
iconName: state !== "view" ? "dialog-cancel" : "document-edit"
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (state === "edit") {
|
if (state === "edit") {
|
||||||
endEditMode()
|
endEditMode()
|
||||||
} else if (state === "add") {
|
} else if (state === "add") {
|
||||||
// edit was canceled - so remove the dive from the dive list
|
endAddMode()
|
||||||
manager.addDiveAborted(dive_id)
|
|
||||||
state = "view"
|
|
||||||
Qt.inputMethod.hide()
|
|
||||||
} else {
|
} else {
|
||||||
startEditMode()
|
startEditMode()
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,17 @@ MobileComponents.Page {
|
||||||
height: parent.height
|
height: parent.height
|
||||||
Layout.fillWidth: true;
|
Layout.fillWidth: true;
|
||||||
|
|
||||||
|
contextualActions: [
|
||||||
|
Action {
|
||||||
|
text: "Close Preferences"
|
||||||
|
iconName: "dialog-cancel"
|
||||||
|
onTriggered: {
|
||||||
|
stackView.pop()
|
||||||
|
contextDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
|
@ -14,6 +14,16 @@ MobileComponents.Page {
|
||||||
anchors.margins: MobileComponents.Units.gridUnit / 2
|
anchors.margins: MobileComponents.Units.gridUnit / 2
|
||||||
objectName: "gpsList"
|
objectName: "gpsList"
|
||||||
|
|
||||||
|
contextualActions: [
|
||||||
|
Action {
|
||||||
|
text: "Close GPS list"
|
||||||
|
iconName: "dialog-cancel"
|
||||||
|
onTriggered: {
|
||||||
|
stackView.pop()
|
||||||
|
contextDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
Component {
|
Component {
|
||||||
id: gpsDelegate
|
id: gpsDelegate
|
||||||
MobileComponents.ListItemWithActions {
|
MobileComponents.ListItemWithActions {
|
||||||
|
|
|
@ -14,6 +14,17 @@ MobileComponents.Page {
|
||||||
anchors.margins: MobileComponents.Units.gridUnit / 2
|
anchors.margins: MobileComponents.Units.gridUnit / 2
|
||||||
objectName: "Log"
|
objectName: "Log"
|
||||||
|
|
||||||
|
contextualActions: [
|
||||||
|
Action {
|
||||||
|
text: "Close Log"
|
||||||
|
iconName: "dialog-cancel"
|
||||||
|
onTriggered: {
|
||||||
|
stackView.pop()
|
||||||
|
contextDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
ScrollView {
|
ScrollView {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
Flickable {
|
Flickable {
|
||||||
|
|
|
@ -7,6 +7,18 @@ import org.kde.plasma.mobilecomponents 0.2 as MobileComponents
|
||||||
import org.subsurfacedivelog.mobile 1.0
|
import org.subsurfacedivelog.mobile 1.0
|
||||||
|
|
||||||
MobileComponents.Page {
|
MobileComponents.Page {
|
||||||
|
|
||||||
|
contextualActions: [
|
||||||
|
Action {
|
||||||
|
text: "Close Preferences"
|
||||||
|
iconName: "dialog-cancel"
|
||||||
|
onTriggered: {
|
||||||
|
stackView.pop()
|
||||||
|
contextDrawer.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
|
||||||
signal accept
|
signal accept
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue