on xenial help sign in
Indicators close when menu items are activated. Fixes: https://bugs.launchpad.net/bugs/1238182.

Approved by Andrea Cimitan, PS Jenkins bot.

commit4f3b20042d8d50aea99fda274ced26e44be4d21d authorNick Dedekind <nicholas.dedekind@gmail.com> dateWed 11 Dec 2013, 11:45 (13 years ago) parentd2a9bc1c2ea397
5 files changed+49
Panel/Panel.qml+22 Shell.qml+4 plugins/Unity/Indicators/Messaging/qml/MessageMenuItemFactory.qml+3 plugins/Unity/Indicators/qml/MenuItemFactory.qml+6 tests/qmltests/Panel/tst_Panel.qml+14
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/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}