on xenial help sign in
fixed tests
06214ddNick Dedekind
qml/ApplicationMenus/MenuBar.qml+29−29
@@ -18,6 +18,7 @@ import QtQuick 2.4
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import Utils 0.1
19import Utils 0.1
20import Ubuntu.Components 1.3
20import Ubuntu.Components 1.3
21+import GlobalShortcut 1.0
21
22
22Item {
23Item {
23 id: root
24 id: root
@@ -27,9 +28,9 @@ Item {
27
28
28 readonly property bool valid: rowRepeater.count > 0
29 readonly property bool valid: rowRepeater.count > 0
29
30
30− property alias enableKeyFilter: altFilter.enabled
31+ property bool enableKeyFilter: false
31
32
32− readonly property bool showRequested: altFilter.longAltPressed || d.currentItem != null
33+ readonly property bool showRequested: d.longAltPressed || d.currentItem != null
33
34
34 implicitWidth: row.width + units.gu(1)
35 implicitWidth: row.width + units.gu(1)
35 height: parent.height
36 height: parent.height
@@ -38,36 +39,32 @@ Item {
38 d.dismissAll();
39 d.dismissAll();
39 }
40 }
40
41
41− WindowInputFilter {
42+ // Need 2 shortcuts because Alt press gives a different event to Alt release.
42− id: altFilter
43+ GlobalShortcut {
43− property bool altPressed: false
44+ shortcut: Qt.Key_Alt|Qt.AltModifier
44− property bool longAltPressed: false
45+ active: enableKeyFilter
45− Keys.onPressed: {
46+ onTriggered: {
46− if (event.key === Qt.Key_Alt && !event.isAutoRepeat) {
47− altPressed = true;
47+ d.altPressed = true;
48− longAltPressed = false;
48+ d.longAltPressed = false;
49− menuBarShortcutTimer.start();
49+ menuBarShortcutTimer.start();
50− return;
51− }
52− event.accepted = false;
53 }
50 }
54− Keys.onReleased: {
51+ }
52+ GlobalShortcut {
55− if (event.key === Qt.Key_Alt) {
53+ shortcut: Qt.Key_Alt
54+ active: enableKeyFilter
55+ onReleased: {
56− menuBarShortcutTimer.stop();
56+ menuBarShortcutTimer.stop();
57− altPressed = false;
57+ d.altPressed = false;
58− longAltPressed = false;
58+ d.longAltPressed = false;
59− return;
60− }
61− event.accepted = false
62 }
59 }
60+ }
63
61
64− Timer {
62+ Timer {
65− id: menuBarShortcutTimer
63+ id: menuBarShortcutTimer
66− interval: 200
64+ interval: 200
67− repeat: false
65+ repeat: false
68− onTriggered: {
66+ onTriggered: {
69− altFilter.longAltPressed = true;
67+ d.longAltPressed = true;
70− }
71 }
68 }
72 }
69 }
73
70
@@ -210,6 +207,9 @@ Item {
210 property Item hoveredItem: null
207 property Item hoveredItem: null
211 property Item prevCurrentItem: null
208 property Item prevCurrentItem: null
212
209
210+ property bool altPressed: false
211+ property bool longAltPressed: false
212+
213 signal dismissAll()
213 signal dismissAll()
214
214
215 onCurrentItemChanged: {
215 onCurrentItemChanged: {
qml/Panel/Panel.qml+5−1
@@ -104,7 +104,7 @@ Item {
104 fill: panelAreaBackground
104 fill: panelAreaBackground
105 bottomMargin: -units.gu(1)
105 bottomMargin: -units.gu(1)
106 }
106 }
107− visible: PanelState.dropShadow && !callHint.visible
107+ visible: PanelState.dropShadow
108 source: "graphics/rectangular_dropshadow.sci"
108 source: "graphics/rectangular_dropshadow.sci"
109 }
109 }
110
110
@@ -231,6 +231,8 @@ Item {
231
231
232 ActiveCallHint {
232 ActiveCallHint {
233 id: callHint
233 id: callHint
234+ objectName: "callHint"
235+
234 x: __applicationMenus.x + __applicationMenus.barWidth
236 x: __applicationMenus.x + __applicationMenus.barWidth
235 height: parent.height
237 height: parent.height
236
238
@@ -371,6 +373,8 @@ Item {
371
373
372 ActiveCallHint {
374 ActiveCallHint {
373 id: callHint
375 id: callHint
376+ objectName: "callHint"
377+
374 anchors.centerIn: parent
378 anchors.centerIn: parent
375 height: minimizedPanelHeight
379 height: minimizedPanelHeight
376
380
qml/Stage/DecoratedWindow.qml−2
@@ -254,8 +254,6 @@ FocusScope {
254 property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []
254 property var menus: surface ? ApplicationMenuRegistry.getMenusForSurface(surface.persistentId) : []
255 property var menuService: menus.length > 0 ? menus[0] : undefined
255 property var menuService: menus.length > 0 ? menus[0] : undefined
256
256
257− onMenuServiceChanged: console.log("MENU!", menuService.service, menuService.menuPath, menuService.actionPath)
258−
259 busName: menuService ? menuService.service : ""
257 busName: menuService ? menuService.service : ""
260 menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""
258 menuObjectPath: menuService && menuService.menuPath ? menuService.menuPath : ""
261 actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}
259 actions: menuService && menuService.actionPath ? { "unity": menuService.actionPath } : {}
qml/Stage/WindowDecoration.qml+5−7
@@ -57,12 +57,10 @@ MouseArea {
57 id: priv
57 id: priv
58 property var menuBar: menuBarLoader.item
58 property var menuBar: menuBarLoader.item
59
59
60− property bool enableMenus: root.enableMenus &&
60+ property bool shouldShowMenus: root.enableMenus &&
61− menuBar &&
61+ menuBar &&
62− menuBar.valid
62+ menuBar.valid &&
63−
64− property bool shouldShowMenus : enableMenus &&
65− (menuBar.showRequested || root.containsMouse)
63+ (menuBar.showRequested || root.containsMouse)
66 }
64 }
67
65
68 Rectangle {
66 Rectangle {
@@ -144,7 +142,7 @@ MouseArea {
144 MenuBar {
142 MenuBar {
145 id: menuBar
143 id: menuBar
146 height: menuBarLoader.height
144 height: menuBarLoader.height
147− enableKeyFilter: priv.enableMenus
145+ enableKeyFilter: root.active && valid
148 unityMenuModel: root.menu
146 unityMenuModel: root.menu
149 }
147 }
150 }
148 }
tests/qmltests/CMakeLists.txt+1−1
@@ -86,7 +86,7 @@ add_unity8_qmltest(Panel MenuContent)
86add_unity8_qmltest(Panel Panel)
86add_unity8_qmltest(Panel Panel)
87add_unity8_qmltest(Panel/Indicators IndicatorItem)
87add_unity8_qmltest(Panel/Indicators IndicatorItem)
88add_unity8_qmltest(Panel/Indicators IndicatorsLight)
88add_unity8_qmltest(Panel/Indicators IndicatorsLight)
89−add_unity8_qmltest(Panel/Indicators MenuItemFactory)
89+add_unity8_qmltest(Panel/Indicators IndicatorMenuItemFactory)
90add_unity8_qmltest(Panel/Indicators MessageMenuItemFactory)
90add_unity8_qmltest(Panel/Indicators MessageMenuItemFactory)
91add_unity8_qmltest(Stage ApplicationWindow)
91add_unity8_qmltest(Stage ApplicationWindow)
92add_unity8_qmltest(Stage DesktopStage)
92add_unity8_qmltest(Stage DesktopStage)
tests/qmltests/tst_Shell.qml+1−3
@@ -53,9 +53,7 @@ Rectangle {
53 shellLoader.active = true;
53 shellLoader.active = true;
54 }
54 }
55
55
56− DesktopMenuData {
56+ ApplicationMenuDataLoader {}
57− id: appMenuData
58− }
59
57
60 property var shell: shellLoader.item ? shellLoader.item : null
58 property var shell: shellLoader.item ? shellLoader.item : null
61
59
tests/qmltests/tst_ShellWithPin.qml+3−1
@@ -463,7 +463,9 @@ Item {
463
463
464 ApplicationManager.requestFocusApplication("unity8-dash");
464 ApplicationManager.requestFocusApplication("unity8-dash");
465 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
465 tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
466+ var callHint = findChild(panel, "callHint");
466− tryCompare(panel.callHint, "visible", true);
467+ tryCompare(callHint, "visible", true);
468+ wait(10000)
467
469
468 // simulate a callHint press, the real thing requires dialer: url support
470 // simulate a callHint press, the real thing requires dialer: url support
469 ApplicationManager.requestFocusApplication("dialer-app");
471 ApplicationManager.requestFocusApplication("dialer-app");