add a contextdrawer

This item can be dragged in from the right hand side and provides
contextual actions for a page. It will be used in the dive details edit.
If there are actions, the floating button on the bottom shows an arrow
indicating that one can drag it in from the right hand side to the left.

Also clean up a bit of a noisy print that's not needed anymore.

Signed-off-by: Sebastian Kügler <sebas@kde.org>
This commit is contained in:
Sebastian Kügler 2015-12-04 03:32:52 +01:00
parent 8cf4725742
commit 49eb7d841d
2 changed files with 26 additions and 8 deletions

View file

@ -43,6 +43,26 @@ MobileComponents.Page {
}
]
contextualActions: [
Action {
text: "Save Changes"
enabled: diveDetailsWindow.state == "edit"
iconName: "document-save"
onTriggered: {
manager.saveChanges();
}
},
Action {
text: checked ? "View" : "Edit"
checkable: true
iconName: checked ? "view-readermode" : "document-edit"
onTriggered: {
diveDetailsWindow.state = checked ? "edit" : "view"
}
}
]
ScrollView {
anchors.fill: parent
Flickable {

View file

@ -61,13 +61,6 @@ MobileComponents.ApplicationWindow {
}
},
Action {
text: "Save Changes"
onTriggered: {
manager.saveChanges();
}
},
MobileComponents.ActionGroup {
text: "GPS"
Action {
@ -146,6 +139,12 @@ MobileComponents.ApplicationWindow {
}
}
contextDrawer: MobileComponents.ContextDrawer {
id: contextDrawer
actions: rootItem.pageStack.currentPage ? rootItem.pageStack.currentPage.contextualActions : null
title: "Actions"
}
QtObject {
id: subsurfaceTheme
property int titlePointSize: Math.round(fontMetrics.font.pointSize * 1.5)
@ -200,7 +199,6 @@ MobileComponents.ApplicationWindow {
}
Component.onCompleted: {
print("MobileComponents.Units.gridUnit is: " + MobileComponents.Units.gridUnit);
manager.finishSetup();
}
}