on xenial help sign in
Merge
commitbf744631a31bf001dba654dc418ede4033c22caa authorAlbert Astals <albert.astals@canonical.com> dateWed 11 Dec 2013, 13:23 (13 years ago) parent2892bd54f3b200
8 files changed+89−9
Dash/DashFilterGrid.qml+3−2 Dash/DashRenderer.qml+2−2 Panel/Panel.qml+22 Shell.qml+4 plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+3 plugins/Unity/Indicators/qml/MenuItemFactory.qml+6 tests/qmltests/Dash/tst_GenericScopeView.qml+35−5 tests/qmltests/Panel/tst_Panel.qml+14
Dash/DashFilterGrid.qml+3−2
@@ -35,8 +35,6 @@ DashRenderer {
3535 rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
3636 currentItem: filterGrid.currentItem
3737 expandable: filterGrid.expandable
38− delegateCreationBegin: filterGrid.delegateCreationBegin
39− delegateCreationEnd: filterGrid.delegateCreationEnd
4038 height: filterGrid.height
4139 margins: filterGrid.margins
4240 uncollapsedHeight: filterGrid.uncollapsedHeight
@@ -56,9 +54,12 @@ DashRenderer {
5654 model: dashFilterGrid.model
5755 filter: dashFilterGrid.filter
5856 highlightIndex: dashFilterGrid.highlightIndex
57+ delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58+ delegateCreationEnd: dashFilterGrid.delegateCreationEnd
5959
6060 onFilterChanged: {
6161 dashFilterGrid.filter = filter
62+ filter = Qt.binding(function() { return dashFilterGrid.filter })
6263 }
6364 }
6465}
Dash/DashRenderer.qml+2−2
@@ -38,9 +38,9 @@ Item {
3838
3939 property int uncollapsedHeight: height
4040
41− property real delegateCreationBegin
41+ property var delegateCreationBegin: undefined
4242
43− property real delegateCreationEnd
43+ property var delegateCreationEnd: undefined
4444
4545 property real verticalSpacing: 0
4646
Panel/Panel.qml+22
@@ -31,6 +31,28 @@ Item {
3131
3232 signal searchClicked
3333
34+ function hideIndicatorMenu(delay) {
35+ if (delay !== undefined) {
36+ hideTimer.interval = delay;
37+ hideTimer.start();
38+ } else {
39+ indicatorsMenu.hide();
40+ }
41+ }
42+
43+ Timer {
44+ id: hideTimer
45+ running: false
46+ onTriggered: {
47+ indicatorsMenu.hide();
48+ }
49+ }
50+
51+ Connections {
52+ target: indicatorsMenu
53+ onShown: hideTimer.stop()
54+ }
55+
3456 PanelBackground {
3557 id: panelBackground
3658 anchors {
Shell.qml+4
@@ -576,6 +576,10 @@ FocusScope {
576576 stages.hide()
577577 }
578578
579+ function hideIndicatorMenu(delay) {
580+ panel.hideIndicatorMenu(delay);
581+ }
582+
579583 Item {
580584 id: overlay
581585
plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+3
@@ -50,6 +50,7 @@ Indicators.BaseMenuItem {
5050
5151 onActivateApp: {
5252 menuItem.model.activate(modelIndex, true);
53+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
5354 }
5455 onDismiss: {
5556 menuItem.model.activate(modelIndex, false);
@@ -82,6 +83,7 @@ Indicators.BaseMenuItem {
8283
8384 onActivateApp: {
8485 menuItem.model.activate(modelIndex, true);
86+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
8587 }
8688 onDismiss: {
8789 menuItem.model.activate(modelIndex, false);
@@ -125,6 +127,7 @@ Indicators.BaseMenuItem {
125127
126128 onActivateApp: {
127129 menuItem.model.activate(modelIndex, true);
130+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
128131 }
129132 onDismiss: {
130133 menuItem.model.activate(modelIndex, false);
plugins/Unity/Indicators/qml/MenuItemFactory.qml+6
@@ -22,6 +22,7 @@ import Unity.Indicators 0.1 as Indicators
2222import Unity.Indicators.Network 0.1 as ICNetwork
2323import Unity.Indicators.Messaging 0.1 as ICMessaging
2424import QMenuModel 0.1 as QMenuModel
25+import Ubuntu.Components 0.1
2526
2627Item {
2728 id: menuFactory
@@ -95,6 +96,7 @@ Item {
9596
9697 onActivate: {
9798 model.activate(modelIndex);
99+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
98100 }
99101 }
100102 }
@@ -132,6 +134,7 @@ Item {
132134
133135 onActivate: {
134136 model.activate(modelIndex);
137+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
135138 }
136139 }
137140 }
@@ -148,6 +151,7 @@ Item {
148151
149152 onActivate: {
150153 model.activate(modelIndex);
154+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
151155 }
152156 }
153157 }
@@ -190,6 +194,7 @@ Item {
190194 }
191195 onActivate: {
192196 model.activate(modelIndex);
197+ shell.hideIndicatorMenu(UbuntuAnimation.BriskDuration);
193198 }
194199 }
195200 }
@@ -225,6 +230,7 @@ Item {
225230 }
226231 onActivateApp: {
227232 model.activate(modelIndex, true);
233+ shell.hideIndicatorMenu(UbuntuAnimation.FastDuration);
228234 }
229235 onDismiss: {
230236 model.activate(modelIndex, false);
tests/qmltests/Dash/tst_GenericScopeView.qml+35−5
@@ -99,11 +99,11 @@ Item {
9999 categoryListView.positionAtBeginning();
100100
101101 tryCompareFunction(function() {
102− var tile = findChild(genericScopeView, "delegate0");
102+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
103103 return tile != undefined;
104104 },
105105 true);
106− var tile = findChild(genericScopeView, "delegate0");
106+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
107107 mouseClick(tile, tile.width / 2, tile.height / 2);
108108 tryCompare(previewListView, "open", true);
109109 tryCompare(openEffect, "gap", 1);
@@ -111,11 +111,11 @@ Item {
111111
112112 function checkArrowPosition(index) {
113113 tryCompareFunction(function() {
114− var tile = findChild(genericScopeView, "delegate" + index);
114+ var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
115115 return tile != undefined;
116116 },
117117 true);
118− var tile = findChild(genericScopeView, "delegate" + index);
118+ var tile = findChild(findChild(genericScopeView, "0"), "delegate" + index);
119119 var tileCenter = tile.x + tile.width/2;
120120 var pointerArrow = findChild(previewListView, "pointerArrow");
121121 var pointerArrowCenter = pointerArrow.x + pointerArrow.width/2;
@@ -167,7 +167,7 @@ Item {
167167 categoryListView.flick(0, -units.gu(60));
168168 tryCompare(categoryListView.flicking, false);
169169
170− var tile = findChild(genericScopeView, "delegate0");
170+ var tile = findChild(findChild(genericScopeView, "0"), "delegate0");
171171 mouseClick(tile, tile.width / 2, tile.height - 1);
172172 tryCompare(openEffect, "gap", 1);
173173
@@ -298,6 +298,36 @@ Item {
298298 closePreview();
299299 tryCompare(previewListView, "open", false);
300300 }
301+
302+ function test_filter_expand_expand() {
303+ // wait for the item to be there
304+ tryCompareFunction(function() { return findChild(genericScopeView, "dashSectionHeader2") != undefined; }, true);
305+
306+ var categoryListView = findChild(genericScopeView, "categoryListView");
307+ categoryListView.contentY = categoryListView.height;
308+
309+ var header2 = findChild(genericScopeView, "dashSectionHeader2")
310+ var category2 = findChild(genericScopeView, "dashCategory2")
311+ var category2FilterGrid = category2.children[0].children[0].children[0];
312+ verify(UT.Util.isInstanceOf(category2FilterGrid, "FilterGrid"));
313+
314+ waitForRendering(header2);
315+ verify(category2.expandable);
316+ verify(category2.filtered);
317+
318+ mouseClick(header2, header2.width / 2, header2.height / 2);
319+ tryCompare(category2, "filtered", false);
320+ tryCompare(category2FilterGrid, "filter", false);
321+
322+ categoryListView.positionAtBeginning();
323+
324+ var header0 = findChild(genericScopeView, "dashSectionHeader0")
325+ var category0 = findChild(genericScopeView, "dashCategory0")
326+ mouseClick(header0, header0.width / 2, header0.height / 2);
327+ tryCompare(category0, "filtered", false);
328+ tryCompare(category2, "filtered", true);
329+ tryCompare(category2FilterGrid, "filter", true);
330+ }
301331 }
302332 }
303333}
tests/qmltests/Panel/tst_Panel.qml+14
@@ -264,5 +264,19 @@ Item {
264264
265265 compare(indicatorRow.currentItem, indicatorItemFirst, "First indicator should still be the current item");
266266 }
267+
268+ function test_hideIndicatorMenu_data() {
269+ return [ {tag: "no-delay", delay: undefined },
270+ {tag: "delayed", delay: 200 }
271+ ];
272+ }
273+
274+ function test_hideIndicatorMenu(data) {
275+ panel.indicators.show();
276+ compare(panel.indicators.shown, true);
277+
278+ panel.hideIndicatorMenu(data.delay);
279+ tryCompare(panel.indicators, "shown", false);
280+ }
267281 }
268282}