on xenial help sign in
Remove all traces of lockscreen from Shell
de65f6eMichael Terry
qml/Greeter/Greeter.qml+139−49
@@ -18,6 +18,9 @@ import QtQuick 2.3
18import AccountsService 0.1
18import AccountsService 0.1
19import LightDM 0.1 as LightDM
19import LightDM 0.1 as LightDM
20import Ubuntu.Components 1.1
20import Ubuntu.Components 1.1
21+import Ubuntu.SystemImage 0.1
22+import Ubuntu.Telephony 0.1 as Telephony
23+import Unity.Launcher 0.1
21import "../Components"
24import "../Components"
22
25
23Showable {
26Showable {
@@ -30,11 +33,15 @@ Showable {
30 property real launcherOffset
33 property real launcherOffset
31
34
32 // 1 when fully shown and 0 when fully hidden
35 // 1 when fully shown and 0 when fully hidden
33− property real showProgress: MathUtils.clamp((width - Math.abs(greeterContentLoader.x)) / width, 0, 1)
36+ readonly property real showProgress: MathUtils.clamp((width - Math.abs(greeterContentLoader.x)) / width, 0, 1)
37+ readonly property bool fullyShown: showProgress === 1 || lockscreen.shown
34
38
35 // True when the greeter is waiting for PAM or other setup process
39 // True when the greeter is waiting for PAM or other setup process
36 property bool waiting: true
40 property bool waiting: true
37
41
42+ property string lockedApp: ""
43+ property bool hasLockedApp: lockedApp !== ""
44+
38 showAnimation: StandardAnimation { property: "dragOffset"; to: 0; duration: UbuntuAnimation.FastDuration }
45 showAnimation: StandardAnimation { property: "dragOffset"; to: 0; duration: UbuntuAnimation.FastDuration }
39 hideAnimation: __leftHideAnimation
46 hideAnimation: __leftHideAnimation
40
47
@@ -60,21 +67,20 @@ Showable {
60 // back to zero (on a release of the drag). But by defining a Behavior,
67 // back to zero (on a release of the drag). But by defining a Behavior,
61 // we delay the property from reaching zero until it's too late. So we set
68 // we delay the property from reaching zero until it's too late. So we set
62 // a proxy bound to launcherOffset, which lets us see the target value of
69 // a proxy bound to launcherOffset, which lets us see the target value of
63− // zero as we also slowly adjust the value down to zero. But Qml will send
70+ // zero as we also slowly adjust the proxy down to zero. But Qml will send
64 // change notifications in declaration order. So unless we define the
71 // change notifications in declaration order. So unless we define the
65 // proxy first, we need a little "is valid" property defined above the
72 // proxy first, we need a little "is valid" property defined above the
66 // proxy, so we know when to enable the proxy behavior. Phew!
73 // proxy, so we know when to enable the proxy behavior. Phew!
67 readonly property bool launcherOffsetValid: launcherOffset > 0
74 readonly property bool launcherOffsetValid: launcherOffset > 0
68− property real launcherOffsetProxy: launcherOffset
75+ property real launcherOffsetProxy: shown ? launcherOffset : 0
69 Behavior on launcherOffsetProxy {
76 Behavior on launcherOffsetProxy {
70 enabled: !launcherOffsetValid
77 enabled: !launcherOffsetValid
71 StandardAnimation {}
78 StandardAnimation {}
72 }
79 }
73
80
74− signal selected(int uid)
75− signal unlocked(int uid)
76 signal tease()
81 signal tease()
77 signal sessionStarted()
82 signal sessionStarted()
83+ signal emergencyCall()
78
84
79 function hideRight() {
85 function hideRight() {
80 if (shown) {
86 if (shown) {
@@ -83,12 +89,6 @@ Showable {
83 }
89 }
84 }
90 }
85
91
86− function tryToUnlock() {
87− if (greeterContentLoader.item) {
88− greeterContentLoader.item.tryToUnlock()
89− }
90− }
91−
92 function reset() {
92 function reset() {
93 if (greeterContentLoader.item) {
93 if (greeterContentLoader.item) {
94 greeterContentLoader.item.reset()
94 greeterContentLoader.item.reset()
@@ -99,10 +99,71 @@ Showable {
99 enabled = false;
99 enabled = false;
100 if (LightDM.Greeter.startSessionSync()) {
100 if (LightDM.Greeter.startSessionSync()) {
101 sessionStarted();
101 sessionStarted();
102+ hide();
103+ lockscreen.hide();
102 }
104 }
103 enabled = true;
105 enabled = true;
104 }
106 }
105
107
108+ function notifyAppFocused(appId) {
109+ if (narrowMode) {
110+ if (appId === "dialer-app" && callManager.hasCalls && locked) {
111+ // If we are in the middle of a call, make dialer lockedApp and show it.
112+ // This can happen if user backs out of dialer back to greeter, then
113+ // launches dialer again.
114+ lockedApp = appId;
115+ }
116+ if (hasLockedApp) {
117+ if (appId === lockedApp) {
118+ lockscreen.hide(); // show locked app
119+ } else {
120+ startUnlock(); // show lockscreen if necessary
121+ }
122+ }
123+ hide();
124+ } else {
125+ if (LightDM.Greeter.active) {
126+ startUnlock();
127+ }
128+ }
129+ }
130+
131+ // Do we need these next two functions, really?
132+ function notifyFocusChanged(appId) {
133+ if (hasLockedApp && lockedApp !== appId) {
134+ startUnlock();
135+ }
136+ }
137+
138+ function notifyAppAdded(appId) {
139+ if (shown && appId != "unity8-dash") {
140+ startUnlock();
141+ }
142+ if (narrowMode && hasLockedApp && appId === lockedApp) {
143+ lockscreen.hide(); // show locked app
144+ }
145+ }
146+
147+ function notifyAboutToStartApp(appId) {
148+ if (hasLockedApp) {
149+ startUnlock();
150+ }
151+ }
152+
153+ function startUnlock() {
154+ if (narrowMode) {
155+ if (!LightDM.Greeter.authenticated) {
156+ lockscreen.maybeShow();
157+ }
158+ hide();
159+ } else {
160+ show();
161+ if (greeterContentLoader.item) {
162+ greeterContentLoader.item.tryToUnlock();
163+ }
164+ }
165+ }
166+
106 onRequiredChanged: {
167 onRequiredChanged: {
107 // Reset hide animation to default once we're finished with it
168 // Reset hide animation to default once we're finished with it
108 if (required) {
169 if (required) {
@@ -125,6 +186,35 @@ Showable {
125 }
186 }
126 }
187 }
127
188
189+ onFullyShownChanged: {
190+ // Wait until the greeter is completely covering lockscreen before resetting it.
191+ if (narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
192+ lockscreen.reset();
193+ lockscreen.maybeShow();
194+ }
195+ }
196+
197+ onShowProgressChanged: {
198+ if (showProgress === 0) {
199+ if ((LightDM.Greeter.promptless && LightDM.Greeter.authenticated) || forcedUnlock) {
200+ greeter.login();
201+ } else if (narrowMode) {
202+ lockscreen.clear(false); // to reset focus if necessary
203+ }
204+ }
205+ }
206+
207+ QtObject {
208+ id: d
209+
210+ function selectUser(uid) {
211+ // Update launcher items for new user
212+ var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
213+ AccountsService.user = user;
214+ LauncherModel.setUser(user);
215+ }
216+ }
217+
128 Lockscreen {
218 Lockscreen {
129 id: lockscreen
219 id: lockscreen
130 objectName: "lockscreen"
220 objectName: "lockscreen"
@@ -160,7 +250,7 @@ Showable {
160
250
161 onEntered: LightDM.Greeter.respond(passphrase);
251 onEntered: LightDM.Greeter.respond(passphrase);
162 onCancel: greeter.show()
252 onCancel: greeter.show()
163− onEmergencyCall: startLockedApp("dialer-app")
253+ onEmergencyCall: greeter.emergencyCall()
164
254
165 onShownChanged: if (shown) greeter.lockedApp = ""
255 onShownChanged: if (shown) greeter.lockedApp = ""
166
256
@@ -190,6 +280,43 @@ Showable {
190 }
280 }
191 }
281 }
192
282
283+ Rectangle {
284+ anchors.fill: parent
285+ color: "black"
286+ opacity: greeter.showProgress * 0.8
287+ }
288+
289+ Loader {
290+ id: greeterContentLoader
291+ objectName: "greeterContentLoader"
292+
293+ x: launcherOffsetProxy + dragOffset
294+ width: parent.width
295+ height: parent.height
296+
297+ property var model: LightDM.Users
298+ property int currentIndex: 0
299+ property var infographicModel: LightDM.Infographic
300+ readonly property int backgroundTopMargin: -greeter.y
301+
302+ source: (greeter.required || lockscreen.required) ? "GreeterContent.qml" : ""
303+
304+ onLoaded: {
305+ d.selectUser(currentIndex);
306+ }
307+
308+ Connections {
309+ target: greeterContentLoader.item
310+
311+ onSelected: {
312+ d.selectUser(uid);
313+ greeterContentLoader.currentIndex = uid;
314+ }
315+ onUnlocked: greeter.hide()
316+ onTease: greeter.tease()
317+ }
318+ }
319+
193 Connections {
320 Connections {
194 target: LightDM.Greeter
321 target: LightDM.Greeter
195
322
@@ -272,41 +399,4 @@ Showable {
272 property: "active"
399 property: "active"
273 value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
400 value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
274 }
401 }
275−
276− Rectangle {
277− anchors.fill: parent
278− color: "black"
279− opacity: greeter.showProgress * 0.8
280− }
281−
282− Loader {
283− id: greeterContentLoader
284− objectName: "greeterContentLoader"
285−
286− x: launcherOffsetProxy + dragOffset
287− width: parent.width
288− height: parent.height
289−
290− property var model: LightDM.Users
291− property int currentIndex: 0
292− property var infographicModel: LightDM.Infographic
293− readonly property int backgroundTopMargin: -greeter.y
294−
295− source: (greeter.required || lockscreen.required) ? "GreeterContent.qml" : ""
296−
297− onLoaded: {
298− selected(currentIndex);
299− }
300−
301− Connections {
302− target: greeterContentLoader.item
303−
304− onSelected: {
305− greeter.selected(uid);
306− greeterContentLoader.currentIndex = uid;
307− }
308− onUnlocked: greeter.unlocked(uid);
309− onTease: greeter.tease()
310− }
311− }
312}
402}
qml/Greeter/LoginList.qml+2−2
@@ -14,8 +14,8 @@
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
15 */
16
16
17−import QtQuick 2.0
17+import QtQuick 2.3
18−import Ubuntu.Components 0.1
18+import Ubuntu.Components 1.1
19import LightDM 0.1 as LightDM
19import LightDM 0.1 as LightDM
20import "../Components"
20import "../Components"
21
21
qml/Shell.qml+18−97
@@ -22,7 +22,6 @@ import Unity.Application 0.1
22import Ubuntu.Components 0.1
22import Ubuntu.Components 0.1
23import Ubuntu.Components.Popups 1.0
23import Ubuntu.Components.Popups 1.0
24import Ubuntu.Gestures 0.1
24import Ubuntu.Gestures 0.1
25−import Ubuntu.SystemImage 0.1
26import Ubuntu.Telephony 0.1 as Telephony
25import Ubuntu.Telephony 0.1 as Telephony
27import Unity.Connectivity 0.1
26import Unity.Connectivity 0.1
28import Unity.Launcher 0.1
27import Unity.Launcher 0.1
@@ -59,8 +58,6 @@ Item {
59 readonly property real panelHeight: panel.panelHeight
58 readonly property real panelHeight: panel.panelHeight
60
59
61 readonly property alias locked: greeter.locked
60 readonly property alias locked: greeter.locked
62− readonly property alias hasLockedApp: greeter.hasLockedApp
63− property alias lockscreen: greeter.lockscreen
64
61
65 property bool sideStageEnabled: shell.width >= units.gu(100)
62 property bool sideStageEnabled: shell.width >= units.gu(100)
66 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
63 readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
@@ -140,6 +137,7 @@ Item {
140 if (orientationLockEnabled) {
137 if (orientationLockEnabled) {
141 orientation = OrientationLock.savedOrientation;
138 orientation = OrientationLock.savedOrientation;
142 }
139 }
140+ Connectivity.unlockAllModems();
143 }
141 }
144
142
145 VolumeControl {
143 VolumeControl {
@@ -201,51 +199,24 @@ Item {
201
199
202 Connections {
200 Connections {
203 target: ApplicationManager
201 target: ApplicationManager
202+
204− onFocusRequested: {
203+ onFocusRequested: greeter.notifyAppFocused(appId)
205− if (greeter.narrowMode) {
206− if (appId === "dialer-app" && callManager.hasCalls && shell.locked) {
207− // If we are in the middle of a call, make dialer lockedApp and show it.
208− // This can happen if user backs out of dialer back to greeter, then
209− // launches dialer again.
210− greeter.lockedApp = appId;
211− }
212− if (greeter.hasLockedApp) {
213− if (appId === greeter.lockedApp) {
214− lockscreen.hide() // show locked app
215− } else {
216− greeter.startUnlock() // show lockscreen if necessary
217− }
218− }
219− greeter.hide();
220− } else {
221− if (LightDM.Greeter.active) {
222− greeter.startUnlock()
223− }
224− }
225− }
226
204
227 onFocusedApplicationIdChanged: {
205 onFocusedApplicationIdChanged: {
228− if (greeter.hasLockedApp && greeter.lockedApp !== ApplicationManager.focusedApplicationId) {
206+ greeter.notifyFocusChanged(ApplicationManager.focusedApplicationId);
229− greeter.startUnlock()
230− }
231 panel.indicators.hide();
207 panel.indicators.hide();
232 }
208 }
233
209
234 onApplicationAdded: {
210 onApplicationAdded: {
235− if (greeter.shown && appId != "unity8-dash") {
211+ if (edgeDemo.running && appId != "unity8-dash") {
236− greeter.startUnlock()
237−
238 // If this happens on first boot, we may be in edge
212 // If this happens on first boot, we may be in edge
239 // tutorial or wizard while receiving a call. But a call
213 // tutorial or wizard while receiving a call. But a call
240 // is more important than wizard so just bail out of those.
214 // is more important than wizard so just bail out of those.
241− if (edgeDemo.running) {
242− edgeDemo.hideEdgeDemos();
215+ edgeDemo.hideEdgeDemos();
243− wizard.hide();
216+ wizard.hide();
244− }
245− }
246− if (greeter.narrowMode && greeter.hasLockedApp && appId === greeter.lockedApp) {
247− lockscreen.hide() // show locked app
248 }
217 }
218+
219+ greeter.notifyAppAdded(appId);
249 launcher.hide();
220 launcher.hide();
250 }
221 }
251 }
222 }
@@ -285,7 +256,7 @@ Item {
285 Binding {
256 Binding {
286 target: applicationsDisplayLoader.item
257 target: applicationsDisplayLoader.item
287 property: "interactive"
258 property: "interactive"
288− value: edgeDemo.stagesEnabled && !greeter.shown && !lockscreen.shown && panel.indicators.fullyClosed && launcher.progress == 0 && !notifications.useModal
259+ value: edgeDemo.stagesEnabled && !greeter.fullyShown && panel.indicators.fullyClosed && launcher.progress == 0 && !notifications.useModal
289 }
260 }
290 Binding {
261 Binding {
291 target: applicationsDisplayLoader.item
262 target: applicationsDisplayLoader.item
@@ -345,75 +316,26 @@ Item {
345 id: greeter
316 id: greeter
346 objectName: "greeter"
317 objectName: "greeter"
347
318
348− property string lockedApp: ""
349− property bool hasLockedApp: lockedApp !== ""
350−
351− available: true
352 hides: [launcher, panel.indicators]
319 hides: [launcher, panel.indicators]
353 tabletMode: shell.sideStageEnabled
320 tabletMode: shell.sideStageEnabled
354 launcherOffset: narrowMode ? launcher.progress : 0
321 launcherOffset: narrowMode ? launcher.progress : 0
355 forcedUnlock: edgeDemo.running
322 forcedUnlock: edgeDemo.running
356 background: shell.background
323 background: shell.background
357
324
358− y: panel.panelHeight
325+ anchors.fill: parent
359− width: parent.width
360− height: parent.height - panel.panelHeight
326+ anchors.topMargin: panel.panelHeight
361−
362− property bool fullyShown: showProgress === 1.0
363− onFullyShownChanged: {
364− // Wait until the greeter is completely covering lockscreen before resetting it.
365− if (narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
366− lockscreen.reset();
367− lockscreen.maybeShow();
368− }
369− }
370−
371− onShowProgressChanged: {
372− if (showProgress === 0) {
373− if ((LightDM.Greeter.promptless && LightDM.Greeter.authenticated) || forcedUnlock) {
374− greeter.login()
375− } else if (narrowMode) {
376− lockscreen.clear(false) // to reset focus if necessary
377− }
378− }
379− }
380
327
381 onSessionStarted: {
328 onSessionStarted: {
382− hide();
383− lockscreen.hide();
384 launcher.hide();
329 launcher.hide();
385 }
330 }
386
331
387− function startUnlock() {
388− if (narrowMode) {
389− if (!LightDM.Greeter.authenticated) {
390− lockscreen.maybeShow()
391− }
392− hide()
393− } else {
394− show()
395− tryToUnlock()
396− }
397− }
398−
399− Component.onCompleted: {
400− Connectivity.unlockAllModems()
401− }
402−
403− onUnlocked: greeter.hide()
404− onSelected: {
405− // Update launcher items for new user
406− var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
407− AccountsService.user = user;
408− LauncherModel.setUser(user);
409− }
410−
411 onTease: launcher.tease()
332 onTease: launcher.tease()
333+ onEmergencyCall: startLockedApp("dialer-app")
412
334
413 Binding {
335 Binding {
414 target: ApplicationManager
336 target: ApplicationManager
415 property: "suspended"
337 property: "suspended"
416− value: (greeter.shown && greeter.fullyShown) || lockscreen.shown
338+ value: greeter.fullyShown
417 }
339 }
418 }
340 }
419
341
@@ -507,7 +429,7 @@ Item {
507 Component.onCompleted: initialise(indicatorProfile)
429 Component.onCompleted: initialise(indicatorProfile)
508 }
430 }
509 callHint {
431 callHint {
510− greeterShown: greeter.shown || lockscreen.shown
432+ greeterShown: greeter.fullyShown
511 }
433 }
512
434
513 property bool topmostApplicationIsFullscreen:
435 property bool topmostApplicationIsFullscreen:
@@ -538,11 +460,10 @@ Item {
538 }
460 }
539 }
461 }
540 onLauncherApplicationSelected: {
462 onLauncherApplicationSelected: {
541− if (greeter.hasLockedApp) {
542− greeter.startUnlock()
543− }
544− if (!edgeDemo.running)
463+ if (!edgeDemo.running) {
464+ greeter.notifyAboutToStartApp(appId);
545 shell.activateApplication(appId)
465 shell.activateApplication(appId)
466+ }
546 }
467 }
547 onShownChanged: {
468 onShownChanged: {
548 if (shown) {
469 if (shown) {
tests/qmltests/tst_TabletShell.qml+2−1
@@ -149,6 +149,7 @@ Row {
149
149
150 unlockAllModemsSpy.clear()
150 unlockAllModemsSpy.clear()
151 AccountsService.demoEdges = false
151 AccountsService.demoEdges = false
152+ LightDM.Greeter.authenticate(""); // reset greeter
152
153
153 // reload our test subject to get it in a fresh state once again
154 // reload our test subject to get it in a fresh state once again
154 shellLoader.active = true
155 shellLoader.active = true
@@ -185,7 +186,7 @@ Row {
185
186
186 function selectUser(name) {
187 function selectUser(name) {
187 // Find index of user with the right name
188 // Find index of user with the right name
188− var greeter = findChild(shell, "greeter")
189+ var greeter = findChild(shell, "greeterContentLoader")
189 for (var i = 0; i < greeter.model.count; i++) {
190 for (var i = 0; i < greeter.model.count; i++) {
190 if (greeter.model.data(i, LightDM.UserRoles.NameRole) == name) {
191 if (greeter.model.data(i, LightDM.UserRoles.NameRole) == name) {
191 break
192 break