on xenial help sign in
Panel bidnings for app menus
commit5d5daa3f73ceb10c86c070ae244f2a195fb750bd authorNick Dedekind <nick.dedekind@canonical.com> dateTue 28 Mar 2017, 16:15 (10 years ago) parente1ba4b7
6 files changed+19−10
qml/ApplicationMenus/ApplicationMenuItemFactory.qml+4−4 qml/ApplicationMenus/MenuBar.qml+5−1 qml/ApplicationMenus/MenuItem.qml+2 qml/ApplicationMenus/MenuPopup.qml+4−1 qml/Panel/Panel.qml+3−2 qml/Shell.qml+1−2
qml/ApplicationMenus/ApplicationMenuItemFactory.qml+4−4
@@ -45,7 +45,7 @@ Object {
4545
4646 Action {
4747 id: action
48− text: menuData.label.replace("_", "&")
48+ text: menuData && menuData.label.replace("_", "&") || ""
4949 }
5050
5151 ListItemLayout {
@@ -59,8 +59,8 @@ Object {
5959 }
6060
6161 Label {
62− text: menuData.shortcut
63− visible: menuData.shortcut && QuickUtils.keyboardAttached
62+ text: menuData && menuData.shortcut || ""
63+ visible: menuData && menuData.shortcut && QuickUtils.keyboardAttached
6464 SlotsLayout.position: SlotsLayout.Trailing
6565 color: enabled ? theme.palette.normal.backgroundSecondaryText :
6666 theme.palette.disabled.backgroundSecondaryText
@@ -86,7 +86,7 @@ Object {
8686
8787 Action {
8888 id: action
89− text: menuData.label.replace("_", "&")
89+ text: menuData && menuData.label.replace("_", "&") || ""
9090 }
9191
9292 ListItemLayout {
qml/ApplicationMenus/MenuBar.qml+5−1
@@ -19,6 +19,7 @@ import QtQuick.Layouts 1.1
1919import Utils 0.1
2020import Ubuntu.Components 1.3
2121import GlobalShortcut 1.0
22+import "../Components/PanelState"
2223
2324Item {
2425 id: root
@@ -29,6 +30,7 @@ Item {
2930 property bool enableKeyFilter: false
3031 property real overflowWidth: width
3132 property bool windowMoving: false
33+ property PanelState panelState
3234
3335 // read from outside
3436 readonly property bool valid: rowRepeater.count > 0
@@ -106,7 +108,9 @@ Item {
106108
107109 Component {
108110 id: menuComponent
109− MenuPopup { }
111+ MenuPopup {
112+ panelState: root.panelState
113+ }
110114 }
111115
112116 Repeater {
qml/ApplicationMenus/MenuItem.qml+2
@@ -17,6 +17,7 @@
1717import QtQuick 2.4
1818import QtQuick.Layouts 1.1
1919import Ubuntu.Components 1.3
20+import "../Components/PanelState"
2021
2122ActionItem {
2223 id: root
@@ -24,6 +25,7 @@ ActionItem {
2425 implicitWidth: requiredWidth
2526
2627 property var menuData: undefined
28+ property PanelState panelState
2729
2830 readonly property real requiredWidth: {
2931 var val = 0;
qml/ApplicationMenus/MenuPopup.qml+4−1
@@ -64,6 +64,7 @@ UbuntuShape {
6464 }
6565
6666 property alias unityMenuModel: repeater.model
67+ property PanelState panelState
6768
6869 function show() {
6970 visible = true;
@@ -103,7 +104,7 @@ UbuntuShape {
103104 property real __minimumWidth: units.gu(20)
104105 property real __maximumWidth: ApplicationMenusLimits.screenWidth * 0.7
105106 property real __minimumHeight: units.gu(2)
106− property real __maximumHeight: ApplicationMenusLimits.screenHeight - PanelState.panelHeight
107+ property real __maximumHeight: ApplicationMenusLimits.screenHeight - panelState.panelHeight
107108
108109 signal dismissAll()
109110
@@ -293,6 +294,7 @@ UbuntuShape {
293294 // Parent will be loader
294295 id: menuItem
295296 menuData: parent.__menuData
297+ panelState: root.panelState
296298 objectName: parent.objectName + "-actionItem"
297299
298300 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
@@ -483,6 +485,7 @@ UbuntuShape {
483485
484486 onLoaded: {
485487 item.unityMenuModel = Qt.binding(function() { return submenuLoader.unityMenuModel; });
488+ item.panelState = Qt.binding(function() { return root.panelState; });
486489 item.objectName = Qt.binding(function() { return submenuLoader.objectName + "menu"; });
487490 item.desiredX = Qt.binding(function() { return submenuLoader.desiredX; });
488491 item.desiredY = Qt.binding(function() { return submenuLoader.desiredY; });
qml/Panel/Panel.qml+3−2
@@ -221,11 +221,12 @@ Item {
221221 sourceComponent: MenuBar {
222222 id: bar
223223 objectName: "menuBar"
224− anchors.left: parent.left
224+ anchors.left: menuBarLoader.left
225225 anchors.margins: units.gu(1)
226226 height: menuBarLoader.height
227227 enableKeyFilter: valid && panelState.decorationsVisible
228228 unityMenuModel: __applicationMenus.model
229+ panelState: root.panelState
229230
230231 Connections {
231232 target: __applicationMenus
@@ -344,7 +345,7 @@ Item {
344345 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
345346 visible: opacity != 0
346347 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
347− text: PanelState.title
348+ text: panelState.title
348349 }
349350
350351 PanelMenu {
qml/Shell.qml+1−2
@@ -801,10 +801,9 @@ StyledItem {
801801
802802 Cursor {
803803 id: cursor
804− objectName: "Pointer-"+screenWindow.objectName
804+ objectName: "cursor"
805805
806806 z: itemGrabber.z + 1
807− opacity: 0
808807 topBoundaryOffset: panel.panelHeight
809808 enabled: shell.hasMouse && screenWindow.active
810809 visible: enabled