Merge lp:~aacid/unity8/disabledMenus into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 2852
Merged at revision: 2887
Proposed branch: lp:~aacid/unity8/disabledMenus
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/aboutToShow
Diff against target: 221 lines (+102/-11)
8 files modified
qml/Panel/MenuContent.qml (+2/-2)
qml/Panel/Panel.qml (+1/-0)
qml/Panel/PanelBar.qml (+16/-0)
qml/Panel/PanelItemRow.qml (+32/-6)
qml/Panel/PanelMenu.qml (+2/-2)
qml/Panel/PanelMenuPage.qml (+1/-1)
tests/qmltests/ApplicationMenus/tst_MenuBar.qml (+24/-0)
tests/qmltests/Panel/tst_Panel.qml (+24/-0)
To merge this branch: bzr merge lp:~aacid/unity8/disabledMenus
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Lukáš Tinkl (community) Approve
Review via email: mp+319288@code.launchpad.net

Commit message

Support Panel top level items to be disabled

I needed to change the way MenuContent changes its position
from using the highlight to simply setting the contentX directly
since otherwise in some reset cases the position was wrong

Description of the change

Prereq-archive: ppa:ci-train-ppa-service/2548

Silo available at https://bileto.ubuntu.com/#/ticket/2548

* Are there any related MPs required for this MP to build/function as expected?
https://code.launchpad.net/~aacid/qmenumodel/disabledMenus/+merge/319286
https://code.launchpad.net/~aacid/qtubuntu/disabledMenus/+merge/319287

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2849
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3313/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4361
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2607
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2607
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4389
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4222/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4222/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4222/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4222/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4222/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4222
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4222/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3313/rebuild

review: Needs Fixing (continuous-integration)
lp:~aacid/unity8/disabledMenus updated
2850. By Albert Astals Cid

Merge

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2850
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3349/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4405
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2637
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2637
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4433
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4267/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4267/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4267/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4267/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4267/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4267
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4267/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3349/rebuild

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

This too works fine, think you can add some test?

review: Needs Information
lp:~aacid/unity8/disabledMenus updated
2851. By Albert Astals Cid

Merge

2852. By Albert Astals Cid

Add tests

Revision history for this message
Albert Astals Cid (aacid) wrote :

> This too works fine, think you can add some test?

added.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2851
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3392/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4471
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2686
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2686
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4499
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4326/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4326/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4326/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4326/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4326/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4326
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4326/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3392/rebuild

review: Approve (continuous-integration)
Revision history for this message
Lukáš Tinkl (lukas-kde) wrote :

* Did you perform an exploratory manual test run of the code change and any related functionality?

Yes

* Did CI run pass? If not, please explain why.

Yes

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2852
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3396/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4475
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2689
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2689
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4503
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4330/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4330/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4330/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4330/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4330/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4330
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4330/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3396/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2852
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3427/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4519
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2718
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2718
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4547
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4374/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4374/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4374/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4374/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4374/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4374
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4374/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3427/rebuild

review: Approve (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2852
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3460/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4563
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2748
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2748
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4591
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4418/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4418/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4418/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4418/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4418/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4418
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4418/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/3460/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Panel/MenuContent.qml'
2--- qml/Panel/MenuContent.qml 2016-10-04 11:44:43 +0000
3+++ qml/Panel/MenuContent.qml 2017-03-15 14:33:59 +0000
4@@ -44,9 +44,9 @@
5 anchors.fill: parent
6 model: content.model
7
8- highlightFollowsCurrentItem: true
9+ highlightFollowsCurrentItem: false
10+ contentX: currentIndex * width
11 interactive: false
12- highlightMoveDuration: 0
13 orientation: ListView.Horizontal
14 // Load all the indicator menus (a big number)
15 cacheBuffer: 1073741823
16
17=== modified file 'qml/Panel/Panel.qml'
18--- qml/Panel/Panel.qml 2017-03-15 14:33:59 +0000
19+++ qml/Panel/Panel.qml 2017-03-15 14:33:59 +0000
20@@ -272,6 +272,7 @@
21 id: actionItem
22 property int ownIndex: index
23 objectName: "appMenuItem"+index
24+ enabled: model.sensitive
25
26 width: _title.width + units.gu(2)
27 height: parent.height
28
29=== modified file 'qml/Panel/PanelBar.qml'
30--- qml/Panel/PanelBar.qml 2017-01-16 08:51:52 +0000
31+++ qml/Panel/PanelBar.qml 2017-03-15 14:33:59 +0000
32@@ -44,6 +44,22 @@
33 row.selectItemAt(mapped.x);
34 }
35
36+ function selectPreviousItem() {
37+ if (!expanded) {
38+ row.resetCurrentItem();
39+ }
40+ row.selectPreviousItem();
41+ d.alignIndicators();
42+ }
43+
44+ function selectNextItem() {
45+ if (!expanded) {
46+ row.resetCurrentItem();
47+ }
48+ row.selectNextItem();
49+ d.alignIndicators();
50+ }
51+
52 function setCurrentItemIndex(index) {
53 if (!expanded) {
54 row.resetCurrentItem();
55
56=== modified file 'qml/Panel/PanelItemRow.qml'
57--- qml/Panel/PanelItemRow.qml 2017-01-24 17:34:19 +0000
58+++ qml/Panel/PanelItemRow.qml 2017-03-15 14:33:59 +0000
59@@ -96,31 +96,57 @@
60 row.currentIndex = -1;
61 }
62
63+ function selectPreviousItem() {
64+ var indexToSelect = currentItemIndex - 1;
65+ while (indexToSelect >= 0) {
66+ if (setCurrentItemIndex(indexToSelect))
67+ return;
68+ indexToSelect = indexToSelect - 1;
69+ }
70+ }
71+
72+ function selectNextItem() {
73+ var indexToSelect = currentItemIndex + 1;
74+ while (indexToSelect < row.contentItem.children.length) {
75+ if (setCurrentItemIndex(indexToSelect))
76+ return;
77+ indexToSelect = indexToSelect + 1;
78+ }
79+ }
80+
81 function setCurrentItemIndex(index) {
82 for (var i = 0; i < row.contentItem.children.length; i++) {
83 var item = row.contentItem.children[i];
84- if (item.hasOwnProperty("ownIndex") && item.ownIndex === index) {
85- if (currentItem !== item) row.currentIndex = index;
86- break;
87+ if (item.hasOwnProperty("ownIndex") && item.ownIndex === index && item.enabled) {
88+ if (currentItem !== item) {
89+ row.currentIndex = index;
90+ }
91+ return true;
92 }
93 }
94+ return false;
95 }
96
97 function selectItemAt(lateralPosition) {
98 var item = indicatorAt(lateralPosition, 0);
99- if (item && item.opacity > 0) {
100+ if (item && item.opacity > 0 && item.enabled) {
101 row.currentIndex = item.ownIndex;
102 } else {
103 // Select default item.
104 var searchIndex = lateralPosition >= width ? row.count - 1 : 0;
105
106 for (var i = 0; i < row.contentItem.children.length; i++) {
107- if (row.contentItem.children[i].hasOwnProperty("ownIndex") && row.contentItem.children[i].ownIndex === searchIndex) {
108+ if (row.contentItem.children[i].hasOwnProperty("ownIndex") &&
109+ row.contentItem.children[i].ownIndex === searchIndex &&
110+ row.contentItem.children[i].enabled)
111+ {
112 item = row.contentItem.children[i];
113 break;
114 }
115 }
116- if (currentItem !== item) row.currentIndex = item ? item.ownIndex : -1;
117+ if (item && currentItem !== item) {
118+ row.currentIndex = item.ownIndex;
119+ }
120 }
121 }
122
123
124=== modified file 'qml/Panel/PanelMenu.qml'
125--- qml/Panel/PanelMenu.qml 2017-03-15 14:33:59 +0000
126+++ qml/Panel/PanelMenu.qml 2017-03-15 14:33:59 +0000
127@@ -143,10 +143,10 @@
128
129 Keys.onPressed: {
130 if (event.key === Qt.Key_Left) {
131- bar.setCurrentItemIndex(bar.currentItemIndex - 1);
132+ bar.selectPreviousItem();
133 event.accepted = true;
134 } else if (event.key === Qt.Key_Right) {
135- bar.setCurrentItemIndex(bar.currentItemIndex + 1);
136+ bar.selectNextItem();
137 event.accepted = true;
138 } else if (event.key === Qt.Key_Escape) {
139 root.hide();
140
141=== modified file 'qml/Panel/PanelMenuPage.qml'
142--- qml/Panel/PanelMenuPage.qml 2017-03-15 14:33:59 +0000
143+++ qml/Panel/PanelMenuPage.qml 2017-03-15 14:33:59 +0000
144@@ -63,7 +63,7 @@
145 if (model) {
146 push(pageComponent, { "menuModel": model });
147 }
148- } else {
149+ } else if (root.currentPage) {
150 root.currentPage.reset();
151 }
152 }
153
154=== modified file 'tests/qmltests/ApplicationMenus/tst_MenuBar.qml'
155--- tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-15 14:33:59 +0000
156+++ tests/qmltests/ApplicationMenus/tst_MenuBar.qml 2017-03-15 14:33:59 +0000
157@@ -226,6 +226,30 @@
158 keyRelease(data.tag, Qt.AltModifier, 100);
159 }
160
161+ function test_disabledTopLevel() {
162+ var modelData = appMenuData.generateTestData(3,3,0,0,"menu");
163+ modelData[1].rowData.sensitive = false;
164+ menuBackend.modelData = modelData;
165+
166+ var priv = findInvisibleChild(menuBar, "d");
167+
168+ var menuItem0 = findChild(menuBar, "menuBar-item0"); verify(menuItem0);
169+ var menuItem2 = findChild(menuBar, "menuBar-item2"); verify(menuItem2);
170+
171+ menuItem0.show();
172+ compare(menuItem0.popupVisible, true, "Popup should be visible");
173+
174+ keyClick(Qt.Key_Right);
175+ compare(priv.currentItem, menuItem2);
176+ compare(menuItem2.popupVisible, true);
177+ compare(menuItem0.popupVisible, false);
178+
179+ keyClick(Qt.Key_Left);
180+ compare(priv.currentItem, menuItem0);
181+ compare(menuItem2.popupVisible, false);
182+ compare(menuItem0.popupVisible, true);
183+ }
184+
185 function test_menuActivateClosesMenu() {
186 menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu");
187 var priv = findInvisibleChild(menuBar, "d");
188
189=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
190--- tests/qmltests/Panel/tst_Panel.qml 2017-03-15 14:33:59 +0000
191+++ tests/qmltests/Panel/tst_Panel.qml 2017-03-15 14:33:59 +0000
192@@ -872,5 +872,29 @@
193 keyClick(Qt.Key_Enter);
194 compare(aboutToShowCalledSpy.count, 1);
195 }
196+
197+ function test_disabledTopLevel() {
198+ var modelData = appMenuData.generateTestData(3,3,0,0,"menu");
199+ modelData[1].rowData.sensitive = false;
200+ panel.applicationMenus.model.modelData = modelData;
201+
202+ waitForRendering(panel);
203+
204+ aboutToShowCalledSpy.target = panel.applicationMenus.model
205+ aboutToShowCalledSpy.clear();
206+
207+ var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
208+
209+ PanelState.title = "Fake Title"
210+ pullDownApplicationsMenu();
211+
212+ tryCompare(indicatorsBar, "currentItemIndex", 0);
213+
214+ keyClick(Qt.Key_Right);
215+ tryCompare(indicatorsBar, "currentItemIndex", 2);
216+
217+ keyClick(Qt.Key_Left);
218+ tryCompare(indicatorsBar, "currentItemIndex", 0);
219+ }
220 }
221 }

Subscribers

People subscribed via source and target branches