on xenial help sign in
reverted rebase
commit2ec7b986a8baa078019bfd1117afbac969b2b96c authorNick Dedekind <nick.dedekind@canonical.com> dateMon 30 Jan 2017, 15:42 (10 years ago) parent15bf2d0
3 files changed+5−55
qml/ApplicationMenus/MenuBar.qml−1 qml/ApplicationMenus/MenuPopup.qml+5−19 tests/qmltests/ApplicationMenus/tst_MenuBar.qml−35
qml/ApplicationMenus/MenuBar.qml−1
@@ -119,7 +119,6 @@ Item {
119119 function show() {
120120 if (!__popup) {
121121 __popup = menuComponent.createObject(root, { objectName: visualItem.objectName + "-menu" });
122− __popup.childActivated.connect(dismiss);
123122 // force the current item to be the newly popped up menu
124123 } else {
125124 __popup.show();
qml/ApplicationMenus/MenuPopup.qml+5−19
@@ -26,8 +26,6 @@ UbuntuShape {
2626 objectName: "menu"
2727 backgroundColor: theme.palette.normal.overlay
2828
29− signal childActivated()
30−
3129 property alias unityMenuModel: repeater.model
3230
3331 function show() {
@@ -276,22 +274,16 @@ UbuntuShape {
276274 return mapToItem(container, 0, y).y;
277275 })
278276 });
279− popup.retreat.connect(function() {
280− popup.destroy();
281− popup = null;
282− menuItem.forceActiveFocus();
283− });
284− popup.childActivated.connect(function() {
285− popup.destroy();
286− popup = null;
287− root.childActivated();
288− });
289277 } else if (popup) {
290278 popup.visible = true;
291279 }
280+ popup.retreat.connect(function() {
281+ popup.destroy();
282+ popup = null;
283+ menuItem.forceActiveFocus();
284+ })
292285 } else {
293286 root.unityMenuModel.activate(__ownIndex);
294− root.childActivated();
295287 }
296288 }
297289
@@ -407,7 +399,6 @@ UbuntuShape {
407399
408400 property var unityMenuModel: null
409401 signal retreat()
410− signal childActivated()
411402
412403 Binding {
413404 target: item
@@ -423,11 +414,6 @@ UbuntuShape {
423414
424415 Keys.onLeftPressed: retreat()
425416
426− Connections {
427− target: item
428− onChildActivated: childActivated();
429− }
430−
431417 Component.onCompleted: item.select(0);
432418 onVisibleChanged: if (visible) { item.select(0); }
433419 }
tests/qmltests/ApplicationMenus/tst_MenuBar.qml−35
@@ -180,41 +180,6 @@ Item {
180180 tryCompare(priv, "currentItem", menuItem);
181181 }
182182
183− function test_menuActivateClosesMenu() {
184− menuBackend.modelData = appMenuData.generateTestData(3,3,0,0,"menu");
185− var priv = findInvisibleChild(menuBar, "d");
186−
187− var menuItem = findChild(menuBar, "menuBar-item0");
188− menuItem.show();
189− compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
190− compare(priv.currentItem.popupVisible, true, "Popup should be visible");
191−
192− var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
193− mouseClick(actionItem);
194− compare(priv.currentItem, null, "CurrentItem should be null");
195− }
196−
197− function test_subMenuActivateClosesMenu() {
198− menuBackend.modelData = appMenuData.generateTestData(3,4,1,0,"menu");
199− var priv = findInvisibleChild(menuBar, "d");
200−
201− var menuItem = findChild(menuBar, "menuBar-item0");
202− menuItem.show();
203− compare(priv.currentItem, menuItem, "CurrentItem should be set to item 0");
204− compare(priv.currentItem.popupVisible, true, "Popup should be visible");
205−
206− var actionItem = findChild(menuBar, "menuBar-item0-menu-item0-actionItem");
207− mouseClick(actionItem);
208−
209− actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-actionItem");
210− mouseClick(actionItem);
211−
212− actionItem = findChild(menuBar, "menuBar-item0-menu-item0-menu-item0-menu-item0-actionItem");
213− mouseClick(actionItem);
214−
215− compare(priv.currentItem, null, "CurrentItem should be null");
216− }
217−
218183 function test_openAppMenuShortcut() {
219184 var priv = findInvisibleChild(menuBar, "d");
220185