on xenial help sign in
merge prereq
commitab993036e182ab2b2779b6d47ff19b88f01077e9 authorMichael Zanetti <michael.zanetti@canonical.com> dateThu 14 Jan 2016, 16:14 (11 years ago) parentb0ac4d50cb4615
3 files changed+37−5
qml/Launcher/Launcher.qml+5−1 qml/Launcher/LauncherPanel.qml+7−1 tests/qmltests/Launcher/tst_Launcher.qml+25−3
qml/Launcher/Launcher.qml+5−1
@@ -142,7 +142,6 @@ FocusScope {
142142 panel.highlightIndex = -1; // The BFB
143143 root.focus = true;
144144 switchToNextState("visible")
145− root.focus = true;
146145 }
147146
148147 Keys.onPressed: {
@@ -381,6 +380,11 @@ FocusScope {
381380 }
382381 }
383382
383+ onKbdNavigationCancelled: {
384+ root.state = "";
385+ root.focus = false;
386+ }
387+
384388 Behavior on x {
385389 enabled: !dragArea.dragging && !launcherDragArea.drag.active && panel.animate;
386390 NumberAnimation {
qml/Launcher/LauncherPanel.qml+7−1
@@ -40,6 +40,7 @@ Rectangle {
4040
4141 signal applicationSelected(string appId)
4242 signal showDashHome()
43+ signal kbdNavigationCancelled()
4344
4445 onXChanged: {
4546 if (quickList.state == "open") {
@@ -661,7 +662,10 @@ Rectangle {
661662 enabled: quickList.state == "open" || pressed
662663
663664 onClicked: {
664− quickList.state = ""
665+ quickList.state = "";
666+ quickList.focus = false;
667+ root.highlightIndex = -2;
668+ root.kbdNavigationCancelled();
665669 }
666670
667671 // Forward for dragging to work when quickList is open
@@ -788,6 +792,8 @@ Rectangle {
788792 // Unsetting model to prevent showing changing entries during fading out
789793 // that may happen because of triggering an action.
790794 LauncherModel.quickListActionInvoked(quickList.appId, index);
795+ quickList.focus = false;
796+ root.kbdNavigationCancelled();
791797 quickList.model = undefined;
792798 }
793799 }
tests/qmltests/Launcher/tst_Launcher.qml+25−3
@@ -1179,9 +1179,9 @@ Item {
11791179
11801180 function test_hideNotWorkingWhenLockedOut_data() {
11811181 return [
1182− {tag: "locked visible", locked: true},
1183− {tag: "no locked visible", locked: false},
1184− ]
1182+ {tag: "locked visible", locked: true},
1183+ {tag: "no locked visible", locked: false},
1184+ ]
11851185 }
11861186
11871187 function test_hideNotWorkingWhenLockedOut(data) {
@@ -1200,5 +1200,27 @@ Item {
12001200 verify(launcher.state == "");
12011201 }
12021202 }
1203+
1204+ function test_cancelKbdNavigationWitMouse() {
1205+ launcher.openForKeyboardNavigation();
1206+ waitForRendering(launcher);
1207+
1208+ var launcherPanel = findChild(launcher, "launcherPanel");
1209+ tryCompare(launcherPanel, "x", 0);
1210+
1211+ var quickList = findChild(launcher, "quickList");
1212+
1213+ keyClick(Qt.Key_Down); // Down to launcher item 0
1214+ keyClick(Qt.Key_Down); // Down to launcher item 1
1215+ keyClick(Qt.Key_Right); // Into quicklist
1216+
1217+ waitForRendering(launcher)
1218+ tryCompare(quickList, "visible", true)
1219+
1220+ mouseClick(root, root.width / 2, units.gu(2));
1221+
1222+ tryCompare(launcher, "state", "");
1223+ tryCompare(launcherPanel, "highlightIndex", -2);
1224+ }
12031225 }
12041226}