on xenial help sign in
Properly fade in new prompts; don't show double prompts when using mocks
7d7cfaeMichael Terry
plugins/LightDM/PromptsModel.cpp+1−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2016 Canonical, Ltd.
2+ * Copyright (C) 2017 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
plugins/LightDM/PromptsModel.h+1−1
@@ -1,5 +1,5 @@
1/*
1/*
2− * Copyright (C) 2016 Canonical, Ltd.
2+ * Copyright (C) 2017 Canonical, Ltd.
3 *
3 *
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
qml/Greeter/Circle.qml+1−1
@@ -27,7 +27,7 @@ Canvas {
27 onCenterCircleChanged: requestPaint()
27 onCenterCircleChanged: requestPaint()
28
28
29 onPaint: {
29 onPaint: {
30− if (circleScale <= 0) {
30+ if (circleScale <= 0 || width <= 0 || height <= 0) {
31 return;
31 return;
32 }
32 }
33
33
qml/Greeter/LoginList.qml−1
@@ -266,7 +266,6 @@ StyledItem {
266 margins: units.gu(2)
266 margins: units.gu(2)
267 }
267 }
268 width: highlightItem.width - anchors.margins * 2
268 width: highlightItem.width - anchors.margins * 2
269− opacity: userList.movingInternally ? 0 : 1
270
269
271 onClicked: {
270 onClicked: {
272 interactive = false;
271 interactive = false;
qml/Greeter/PromptList.qml+7−4
@@ -30,10 +30,6 @@ FocusScope {
30 signal clicked()
30 signal clicked()
31 signal canceled()
31 signal canceled()
32
32
33− Behavior on opacity {
34− NumberAnimation { duration: 100 }
35− }
36−
37 function showFakePassword() {
33 function showFakePassword() {
38 for (var i = 0; i < repeater.count; i++) {
34 for (var i = 0; i < repeater.count; i++) {
39 var item = repeater.itemAt(i).item;
35 var item = repeater.itemAt(i).item;
@@ -81,6 +77,7 @@ FocusScope {
81 break;
77 break;
82 }
78 }
83 }
79 }
80+ loader.item.opacity = 1;
84 }
81 }
85
82
86 Binding {
83 Binding {
@@ -107,6 +104,9 @@ FocusScope {
107 fontSize: "small"
104 fontSize: "small"
108 textFormat: Text.PlainText
105 textFormat: Text.PlainText
109 text: model.text
106 text: model.text
107+
108+ Behavior on opacity { UbuntuNumberAnimation {} }
109+ opacity: 0
110 }
110 }
111 }
111 }
112
112
@@ -140,6 +140,9 @@ FocusScope {
140 d.sendResponse();
140 d.sendResponse();
141 }
141 }
142 onCanceled: root.canceled()
142 onCanceled: root.canceled()
143+
144+ Behavior on opacity { UbuntuNumberAnimation {} }
145+ opacity: 0
143 }
146 }
144 }
147 }
145}
148}
tests/mocks/liblightdm/MockGreeter.cpp+12−3
@@ -29,12 +29,18 @@ public:
29 bool authenticated = false;
29 bool authenticated = false;
30 QString authenticationUser;
30 QString authenticationUser;
31 bool twoFactorDone = false;
31 bool twoFactorDone = false;
32+ QTimer authCallbackTimer;
32};
33};
33
34
34Greeter::Greeter(QObject *parent)
35Greeter::Greeter(QObject *parent)
35 : QObject(parent)
36 : QObject(parent)
36 , d_ptr(new GreeterPrivate)
37 , d_ptr(new GreeterPrivate)
37{
38{
39+ Q_D(Greeter);
40+
41+ d->authCallbackTimer.setSingleShot(true);
42+ connect(&d->authCallbackTimer, &QTimer::timeout,
43+ this, &QLightDM::Greeter::handleAuthenticate);
38}
44}
39
45
40Greeter::~Greeter()
46Greeter::~Greeter()
@@ -134,7 +140,7 @@ void Greeter::authenticate(const QString &username)
134 d->authenticated = false;
140 d->authenticated = false;
135 d->authenticationUser = username;
141 d->authenticationUser = username;
136 d->twoFactorDone = false;
142 d->twoFactorDone = false;
137− QTimer::singleShot(0, this, &Greeter::handleAuthenticate);
143+ d->authCallbackTimer.start();
138}
144}
139
145
140void Greeter::handleAuthenticate()
146void Greeter::handleAuthenticate()
@@ -190,7 +196,7 @@ void Greeter::authenticateAsGuest()
190 d->authenticated = true;
196 d->authenticated = true;
191 d->authenticationUser = QString(); // this is what the real liblightdm does
197 d->authenticationUser = QString(); // this is what the real liblightdm does
192 d->twoFactorDone = false;
198 d->twoFactorDone = false;
193− QTimer::singleShot(0, this, &Greeter::authenticationComplete);
199+ d->authCallbackTimer.start();
194}
200}
195
201
196void Greeter::authenticateAutologin()
202void Greeter::authenticateAutologin()
@@ -203,7 +209,10 @@ void Greeter::authenticateRemote(const QString &session, const QString &username
203}
209}
204
210
205void Greeter::cancelAuthentication()
211void Greeter::cancelAuthentication()
206−{}
212+{
213+ Q_D(Greeter);
214+ d->authCallbackTimer.stop();
215+}
207
216
208void Greeter::setLanguage (const QString &language)
217void Greeter::setLanguage (const QString &language)
209{
218{