aboutsummaryrefslogtreecommitdiffstats
path: root/qt-mobile/qml/mobilecomponents/ContextDrawer.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qt-mobile/qml/mobilecomponents/ContextDrawer.qml')
-rw-r--r--qt-mobile/qml/mobilecomponents/ContextDrawer.qml31
1 files changed, 10 insertions, 21 deletions
diff --git a/qt-mobile/qml/mobilecomponents/ContextDrawer.qml b/qt-mobile/qml/mobilecomponents/ContextDrawer.qml
index aea4a5ca5..575ac3679 100644
--- a/qt-mobile/qml/mobilecomponents/ContextDrawer.qml
+++ b/qt-mobile/qml/mobilecomponents/ContextDrawer.qml
@@ -25,14 +25,15 @@ import org.kde.plasma.mobilecomponents 0.2
OverlayDrawer {
id: root
- property string title
+ property string title: typeof i18n !== "undefined" ? i18n("Actions") : "Actions"
//This can be any type of object that a ListView can accept as model. It expects items compatible with either QAction or QQC Action
- property var actions
+ property var actions: pageStack.lastVisiblePage ? pageStack.lastVisiblePage.contextualActions : null
enabled: menu.count > 0
edge: Qt.RightEdge
contentItem: QtControls.ScrollView {
+ implicitWidth: Units.gridUnit * 20
ListView {
id: menu
interactive: contentHeight > height
@@ -49,9 +50,8 @@ OverlayDrawer {
root.actions[0];
}
}
- verticalLayoutDirection: ListView.BottomToTop
- //in bottomtotop all is flipped
- footer: Item {
+ topMargin: menu.height - menu.contentHeight
+ header: Item {
height: heading.height
width: menu.width
Heading {
@@ -66,23 +66,11 @@ OverlayDrawer {
text: root.title
}
}
- delegate: ListItem {
+ delegate: BasicListItem {
enabled: true
- RowLayout {
- height: implicitHeight + Units.smallSpacing * 2
- anchors {
- left: parent.left
- margins: Units.largeSpacing
- }
- Icon {
- height: parent.height
- width: height
- source: modelData.iconName
- }
- Label {
- text: model ? model.text : modelData.text
- }
- }
+ checked: modelData.checked
+ icon: modelData.iconName
+ label: model ? model.text : modelData.text
onClicked: {
if (modelData && modelData.trigger !== undefined) {
modelData.trigger();
@@ -92,6 +80,7 @@ OverlayDrawer {
} else {
console.warning("Don't know how to trigger the action")
}
+ root.opened = false;
}
}
}