Merge lp:~aacid/unity8/disabledMenus into lp:unity8
- disabledMenus
- Merge into trunk
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 |
Related bugs: |
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-
Silo available at https:/
* Are there any related MPs required for this MP to build/function as expected?
https:/
https:/
* 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
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2849
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
- 2850. By Albert Astals Cid
-
Merge
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2850
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Lukáš Tinkl (lukas-kde) wrote : | # |
This too works fine, think you can add some test?
- 2851. By Albert Astals Cid
-
Merge
- 2852. By Albert Astals Cid
-
Add tests
Albert Astals Cid (aacid) wrote : | # |
> This too works fine, think you can add some test?
added.
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2851
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
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
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2852
https:/
Executed test runs:
SUCCESS: https:/
UNSTABLE: https:/
UNSTABLE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2852
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
FAILED: Continuous integration, rev:2852
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
ABORTED: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
Unity8 CI Bot (unity8-ci-bot) wrote : | # |
PASSED: Continuous integration, rev:2852
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Preview Diff
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 | } |
FAILED: Continuous integration, rev:2849 /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3306/ /unity8- jenkins. ubuntu. com/job/ build/4352/ console /unity8- jenkins. ubuntu. com/job/ build-0- fetch/4380 /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 4213/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=amd64, release= zesty/4213/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 4213/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=armhf, release= zesty/4213/ console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 4213/console /unity8- jenkins. ubuntu. com/job/ build-2- binpkg/ arch=i386, release= zesty/4213/ console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /unity8- jenkins. ubuntu. com/job/ lp-unity8- ci/3306/ rebuild
https:/