on xenial help sign in
To let the user log in if a mouse is connected, hide the greeter cover page on a mouse click (but NOT a touch click). Fixes: #1540497

Approved by: Unity8 CI Bot, Lukáš Tinkl

commitc35b9e31b6c872ff7400889be5fb488eeacb5b07 authorMichael Terry <michael.terry@canonical.com> dateThu 10 Mar 2016, 22:39 (11 years ago) parent80878284449c5e
4 files changed+26−4
qml/Greeter/CoverPage.qml+13−2 qml/Greeter/Infographics.qml+2−1 qml/Greeter/NarrowView.qml+2−1 tests/qmltests/Greeter/tst_NarrowView.qml+9
qml/Greeter/CoverPage.qml+13−2
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013,2014,2015 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ Showable {
3434 readonly property real showProgress: MathUtils.clamp((width - Math.abs(x)) / width, 0, 1)
3535
3636 signal tease()
37+ signal clicked()
3738
3839 function hideRight() {
3940 d.forceRightOnNextHideAnimation = true;
@@ -55,7 +56,17 @@ Showable {
5556 // instead, we can get a little extra horizontal push by using transforms.
5657 transform: Translate { id: translation; x: root.draggable ? launcherOffset : 0 }
5758
58− MouseArea { anchors.fill: parent; }
59+ // Eat events elsewhere on the coverpage, except mouse clicks which we pass
60+ // up (they are used in the NarrowView to hide the cover page)
61+ MouseArea {
62+ anchors.fill: parent
63+ onClicked: root.clicked()
64+
65+ MultiPointTouchArea {
66+ anchors.fill: parent
67+ mouseEnabled: false
68+ }
69+ }
5970
6071 Rectangle {
6172 // In case background fails to load
qml/Greeter/Infographics.qml+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2013 Canonical, Ltd.
2+ * Copyright (C) 2013-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -402,6 +402,7 @@ Item {
402402
403403 MouseArea {
404404 anchors.fill: dataCircle
405+ enabled: notification.text != ""
405406
406407 onDoubleClicked: {
407408 if (!d.animating) {
qml/Greeter/NarrowView.qml+2−1
@@ -1,5 +1,5 @@
11/*
2− * Copyright (C) 2015 Canonical, Ltd.
2+ * Copyright (C) 2015-2016 Canonical, Ltd.
33 *
44 * This program is free software; you can redistribute it and/or modify
55 * it under the terms of the GNU General Public License as published by
@@ -145,6 +145,7 @@ FocusScope {
145145 width: parent.width
146146 background: root.background
147147 onTease: root.tease()
148+ onClicked: hide()
148149
149150 onShowProgressChanged: {
150151 if (showProgress === 1) {
tests/qmltests/Greeter/tst_NarrowView.qml+9
@@ -518,5 +518,14 @@ Item {
518518 tryCompare(coverPage, "shown", false);
519519 tryCompare(coverPage, "showProgress", 0);
520520 }
521+
522+ // Make sure that if user has a mouse, they can still get rid of cover page
523+ function test_mouseClickHidesCoverPage() {
524+ var coverPage = findChild(view, "coverPage");
525+
526+ verify(coverPage.shown);
527+ mouseClick(coverPage, coverPage.width/2, coverPage.height - units.gu(2));
528+ verify(!coverPage.shown);
529+ }
521530 }
522531}