on xenial help sign in
Panel bidnings for app menus
5d5daa3Nick Dedekind
qml/ApplicationMenus/ApplicationMenuItemFactory.qml+4−4
@@ -45,7 +45,7 @@ Object {
45
45
46 Action {
46 Action {
47 id: action
47 id: action
48− text: menuData.label.replace("_", "&")
48+ text: menuData && menuData.label.replace("_", "&") || ""
49 }
49 }
50
50
51 ListItemLayout {
51 ListItemLayout {
@@ -59,8 +59,8 @@ Object {
59 }
59 }
60
60
61 Label {
61 Label {
62− text: menuData.shortcut
62+ text: menuData && menuData.shortcut || ""
63− visible: menuData.shortcut && QuickUtils.keyboardAttached
63+ visible: menuData && menuData.shortcut && QuickUtils.keyboardAttached
64 SlotsLayout.position: SlotsLayout.Trailing
64 SlotsLayout.position: SlotsLayout.Trailing
65 color: enabled ? theme.palette.normal.backgroundSecondaryText :
65 color: enabled ? theme.palette.normal.backgroundSecondaryText :
66 theme.palette.disabled.backgroundSecondaryText
66 theme.palette.disabled.backgroundSecondaryText
@@ -86,7 +86,7 @@ Object {
86
86
87 Action {
87 Action {
88 id: action
88 id: action
89− text: menuData.label.replace("_", "&")
89+ text: menuData && menuData.label.replace("_", "&") || ""
90 }
90 }
91
91
92 ListItemLayout {
92 ListItemLayout {
qml/ApplicationMenus/MenuBar.qml+5−1
@@ -19,6 +19,7 @@ import QtQuick.Layouts 1.1
19import Utils 0.1
19import Utils 0.1
20import Ubuntu.Components 1.3
20import Ubuntu.Components 1.3
21import GlobalShortcut 1.0
21import GlobalShortcut 1.0
22+import "../Components/PanelState"
22
23
23Item {
24Item {
24 id: root
25 id: root
@@ -29,6 +30,7 @@ Item {
29 property bool enableKeyFilter: false
30 property bool enableKeyFilter: false
30 property real overflowWidth: width
31 property real overflowWidth: width
31 property bool windowMoving: false
32 property bool windowMoving: false
33+ property PanelState panelState
32
34
33 // read from outside
35 // read from outside
34 readonly property bool valid: rowRepeater.count > 0
36 readonly property bool valid: rowRepeater.count > 0
@@ -106,7 +108,9 @@ Item {
106
108
107 Component {
109 Component {
108 id: menuComponent
110 id: menuComponent
109− MenuPopup { }
111+ MenuPopup {
112+ panelState: root.panelState
113+ }
110 }
114 }
111
115
112 Repeater {
116 Repeater {
qml/ApplicationMenus/MenuItem.qml+2
@@ -17,6 +17,7 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Ubuntu.Components 1.3
19import Ubuntu.Components 1.3
20+import "../Components/PanelState"
20
21
21ActionItem {
22ActionItem {
22 id: root
23 id: root
@@ -24,6 +25,7 @@ ActionItem {
24 implicitWidth: requiredWidth
25 implicitWidth: requiredWidth
25
26
26 property var menuData: undefined
27 property var menuData: undefined
28+ property PanelState panelState
27
29
28 readonly property real requiredWidth: {
30 readonly property real requiredWidth: {
29 var val = 0;
31 var val = 0;
qml/ApplicationMenus/MenuPopup.qml+4−1
@@ -64,6 +64,7 @@ UbuntuShape {
64 }
64 }
65
65
66 property alias unityMenuModel: repeater.model
66 property alias unityMenuModel: repeater.model
67+ property PanelState panelState
67
68
68 function show() {
69 function show() {
69 visible = true;
70 visible = true;
@@ -103,7 +104,7 @@ UbuntuShape {
103 property real __minimumWidth: units.gu(20)
104 property real __minimumWidth: units.gu(20)
104 property real __maximumWidth: ApplicationMenusLimits.screenWidth * 0.7
105 property real __maximumWidth: ApplicationMenusLimits.screenWidth * 0.7
105 property real __minimumHeight: units.gu(2)
106 property real __minimumHeight: units.gu(2)
106− property real __maximumHeight: ApplicationMenusLimits.screenHeight - PanelState.panelHeight
107+ property real __maximumHeight: ApplicationMenusLimits.screenHeight - panelState.panelHeight
107
108
108 signal dismissAll()
109 signal dismissAll()
109
110
@@ -293,6 +294,7 @@ UbuntuShape {
293 // Parent will be loader
294 // Parent will be loader
294 id: menuItem
295 id: menuItem
295 menuData: parent.__menuData
296 menuData: parent.__menuData
297+ panelState: root.panelState
296 objectName: parent.objectName + "-actionItem"
298 objectName: parent.objectName + "-actionItem"
297
299
298 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
300 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
@@ -483,6 +485,7 @@ UbuntuShape {
483
485
484 onLoaded: {
486 onLoaded: {
485 item.unityMenuModel = Qt.binding(function() { return submenuLoader.unityMenuModel; });
487 item.unityMenuModel = Qt.binding(function() { return submenuLoader.unityMenuModel; });
488+ item.panelState = Qt.binding(function() { return root.panelState; });
486 item.objectName = Qt.binding(function() { return submenuLoader.objectName + "menu"; });
489 item.objectName = Qt.binding(function() { return submenuLoader.objectName + "menu"; });
487 item.desiredX = Qt.binding(function() { return submenuLoader.desiredX; });
490 item.desiredX = Qt.binding(function() { return submenuLoader.desiredX; });
488 item.desiredY = Qt.binding(function() { return submenuLoader.desiredY; });
491 item.desiredY = Qt.binding(function() { return submenuLoader.desiredY; });
qml/Panel/Panel.qml+3−2
@@ -221,11 +221,12 @@ Item {
221 sourceComponent: MenuBar {
221 sourceComponent: MenuBar {
222 id: bar
222 id: bar
223 objectName: "menuBar"
223 objectName: "menuBar"
224− anchors.left: parent.left
224+ anchors.left: menuBarLoader.left
225 anchors.margins: units.gu(1)
225 anchors.margins: units.gu(1)
226 height: menuBarLoader.height
226 height: menuBarLoader.height
227 enableKeyFilter: valid && panelState.decorationsVisible
227 enableKeyFilter: valid && panelState.decorationsVisible
228 unityMenuModel: __applicationMenus.model
228 unityMenuModel: __applicationMenus.model
229+ panelState: root.panelState
229
230
230 Connections {
231 Connections {
231 target: __applicationMenus
232 target: __applicationMenus
@@ -344,7 +345,7 @@ Item {
344 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
345 opacity: __applicationMenus.visible && !__applicationMenus.expanded ? 1 : 0
345 visible: opacity != 0
346 visible: opacity != 0
346 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
347 Behavior on opacity { NumberAnimation { duration: UbuntuAnimation.SnapDuration } }
347− text: PanelState.title
348+ text: panelState.title
348 }
349 }
349
350
350 PanelMenu {
351 PanelMenu {
qml/Shell.qml+1−2
@@ -801,10 +801,9 @@ StyledItem {
801
801
802 Cursor {
802 Cursor {
803 id: cursor
803 id: cursor
804− objectName: "Pointer-"+screenWindow.objectName
804+ objectName: "cursor"
805
805
806 z: itemGrabber.z + 1
806 z: itemGrabber.z + 1
807− opacity: 0
808 topBoundaryOffset: panel.panelHeight
807 topBoundaryOffset: panel.panelHeight
809 enabled: shell.hasMouse && screenWindow.active
808 enabled: shell.hasMouse && screenWindow.active
810 visible: enabled
809 visible: enabled