@@ -18,13 +18,13 @@ import QtQuick 2.4
18import AccountsService 0.1
18import AccountsService 0.1
19import Biometryd 0.0
19import Biometryd 0.0
20import GSettings 1.0
20import GSettings 1.0
21+import LightDM 0.1 as LightDM
21import Powerd 0.1
22import Powerd 0.1
22import Ubuntu.Components 1.3
23import Ubuntu.Components 1.3
23import Ubuntu.SystemImage 0.1
24import Ubuntu.SystemImage 0.1
24import Unity.Launcher 0.1
25import Unity.Launcher 0.1
25import Unity.Session 0.1
26import Unity.Session 0.1
28import "../Components"
28import "../Components"
@@ -51,7 +51,7 @@ Showable {
51 readonly property bool hasLockedApp: lockedApp !== ""
51 readonly property bool hasLockedApp: lockedApp !== ""
53 property bool forcedUnlock
53 property bool forcedUnlock
54− readonly property bool locked: LightDMService.greeter.active && !LightDMService.greeter.authenticated && !forcedUnlock
54+ readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
56 property bool tabletMode
56 property bool tabletMode
57 property url viewSource // only used for testing
57 property url viewSource // only used for testing
@@ -137,16 +137,15 @@ Showable {
139 function sessionToStart() {
139 function sessionToStart() {
140− for (var i = 0; i < LightDMService.sessions.count; i++) {
140+ for (var i = 0; i < LightDM.Sessions.count; i++) {
141− var session = LightDMService.sessions.data(i,
141+ var session = LightDM.Sessions.data(i, LightDM.SessionRoles.KeyRole);
142− LightDMService.sessionRoles.KeyRole);
143 if (loader.item.sessionToStart === session) {
142 if (loader.item.sessionToStart === session) {
144 return session;
143 return session;
148− if (loader.item.sessionToStart === LightDMService.greeter.defaultSession) {
147+ if (loader.item.sessionToStart === LightDM.Greeter.defaultSession) {
149− return LightDMService.greeter.defaultSession;
148+ return LightDM.Greeter.defaultSession;
151 return "ubuntu"; // The default / fallback
150 return "ubuntu"; // The default / fallback
@@ -155,8 +154,8 @@ Showable {
155 QtObject {
154 QtObject {
158− readonly property bool multiUser: LightDMService.users.count > 1
157+ readonly property bool multiUser: LightDM.Users.count > 1
159− readonly property int selectUserIndex: d.getUserIndex(LightDMService.greeter.selectUser)
158+ readonly property int selectUserIndex: d.getUserIndex(LightDM.Greeter.selectUser)
160 property int currentIndex: Math.max(selectUserIndex, 0)
159 property int currentIndex: Math.max(selectUserIndex, 0)
161 property bool waiting
160 property bool waiting
162 property bool isLockscreen // true when we are locking an active session, rather than first user login
161 property bool isLockscreen // true when we are locking an active session, rather than first user login
@@ -184,8 +183,8 @@ Showable {
184 return -1;
183 return -1;
186 // Find index for requested user, if it exists
185 // Find index for requested user, if it exists
187− for (var i = 0; i < LightDMService.users.count; i++) {
186+ for (var i = 0; i < LightDM.Users.count; i++) {
188− if (username === LightDMService.users.data(i, LightDMService.userRoles.NameRole)) {
187+ if (username === LightDM.Users.data(i, LightDM.UserRoles.NameRole)) {
189 return i;
188 return i;
@@ -194,17 +193,17 @@ Showable {
196 function selectUser(index, reset) {
195 function selectUser(index, reset) {
197− if (index < 0 || index >= LightDMService.users.count)
196+ if (index < 0 || index >= LightDM.Users.count)
199 d.waiting = true;
198 d.waiting = true;
200 if (reset) {
199 if (reset) {
201 loader.item.reset(false /* forceShow */);
200 loader.item.reset(false /* forceShow */);
203 currentIndex = index;
202 currentIndex = index;
204− var user = LightDMService.users.data(index, LightDMService.userRoles.NameRole);
203+ var user = LightDM.Users.data(index, LightDM.UserRoles.NameRole);
205 AccountsService.user = user;
204 AccountsService.user = user;
206 LauncherModel.setUser(user);
205 LauncherModel.setUser(user);
207− LightDMService.greeter.authenticate(user); // always resets auth state
206+ LightDM.Greeter.authenticate(user); // always resets auth state
210 function hideView() {
209 function hideView() {
@@ -212,18 +211,22 @@ Showable {
212 loader.item.enabled = false; // drop OSK and prevent interaction
211 loader.item.enabled = false; // drop OSK and prevent interaction
213 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
212 loader.item.notifyAuthenticationSucceeded(false /* showFakePassword */);
214 loader.item.hide();
213 loader.item.hide();
218 function login() {
218 function login() {
219 d.waiting = true;
219 d.waiting = true;
220− if (LightDMService.greeter.startSessionSync(root.sessionToStart())) {
220+ var success = LightDM.Greeter.startSessionSync(root.sessionToStart());
221− sessionStarted();
221+ d.waiting = false;
223− } else if (loader.item) {
223+ // If successful as a lockscreen, we don't need to hide ourselves.
224+ // logind will tell us to unlock if our current user logged in.
224 loader.item.notifyAuthenticationFailed();
227 loader.item.notifyAuthenticationFailed();
228+ d.selectUser(d.currentIndex, false);
229 function startUnlock(toTheRight) {
232 function startUnlock(toTheRight) {
@@ -236,6 +239,7 @@ Showable {
237 function checkForcedUnlock(hideNow) {
240 function checkForcedUnlock(hideNow) {
238 if (forcedUnlock && shown) {
241 if (forcedUnlock && shown) {
239 hideView();
243 hideView();
240 if (hideNow) {
244 if (hideNow) {
241 root.hideNow(); // skip hide animation
245 root.hideNow(); // skip hide animation
@@ -382,7 +386,7 @@ Showable {
382 root.lockedApp = "";
386 root.lockedApp = "";
383 item.forceActiveFocus();
387 item.forceActiveFocus();
384 d.selectUser(d.currentIndex, true);
388 d.selectUser(d.currentIndex, true);
385− LightDMService.infographic.readyForDataChange();
389+ LightDM.Infographic.readyForDataChange();
388 Connections {
392 Connections {
@@ -392,7 +396,7 @@ Showable {
393 onResponded: {
397 onResponded: {
394 if (root.locked) {
398 if (root.locked) {
395− LightDMService.greeter.respond(response);
399+ LightDM.Greeter.respond(response);
397 d.login();
401 d.login();
@@ -469,18 +473,18 @@ Showable {
469 Binding {
473 Binding {
470 target: loader.item
474 target: loader.item
471 property: "userModel"
475 property: "userModel"
472− value: LightDMService.users
476+ value: LightDM.Users
475 Binding {
479 Binding {
476 target: loader.item
480 target: loader.item
477 property: "infographicModel"
481 property: "infographicModel"
478− value: LightDMService.infographic
482+ value: LightDM.Infographic
482 Connections {
486 Connections {
483− target: LightDMService.greeter
487+ target: LightDM.Greeter
485 onShowGreeter: root.forceShow()
489 onShowGreeter: root.forceShow()
486 onHideGreeter: root.forcedUnlock = true
490 onHideGreeter: root.forcedUnlock = true
@@ -498,12 +502,12 @@ Showable {
498 onAuthenticationComplete: {
502 onAuthenticationComplete: {
499 d.waiting = false;
503 d.waiting = false;
501− if (LightDMService.greeter.authenticated) {
505+ if (LightDM.Greeter.authenticated) {
502− if (!LightDMService.greeter.promptless) {
506+ if (!LightDM.Greeter.promptless) {
503 d.login();
507 d.login();
506− if (!LightDMService.greeter.promptless) {
510+ if (!LightDM.Greeter.promptless) {
507 AccountsService.failedLogins++;
511 AccountsService.failedLogins++;
@@ -524,7 +528,7 @@ Showable {
526 loader.item.notifyAuthenticationFailed();
530 loader.item.notifyAuthenticationFailed();
527− if (!LightDMService.greeter.promptless) {
531+ if (!LightDM.Greeter.promptless) {
528 d.selectUser(d.currentIndex, false);
532 d.selectUser(d.currentIndex, false);
@@ -543,20 +547,20 @@ Showable {
545 Binding {
549 Binding {
546− target: LightDMService.greeter
550+ target: LightDM.Greeter
547 property: "active"
551 property: "active"
548 value: root.active
552 value: root.active
551 Binding {
555 Binding {
552− target: LightDMService.infographic
556+ target: LightDM.Infographic
553 property: "username"
557 property: "username"
554− value: AccountsService.statsWelcomeScreen ? LightDMService.users.data(d.currentIndex, LightDMService.userRoles.NameRole) : ""
558+ value: AccountsService.statsWelcomeScreen ? LightDM.Users.data(d.currentIndex, LightDM.UserRoles.NameRole) : ""
557 Connections {
561 Connections {
558 target: i18n
562 target: i18n
559− onLanguageChanged: LightDMService.infographic.readyForDataChange()
563+ onLanguageChanged: LightDM.Infographic.readyForDataChange()
562 Observer {
566 Observer {
@@ -606,7 +610,7 @@ Showable {
606 failOperation("fingerprint reader is locked");
610 failOperation("fingerprint reader is locked");
609− if (result !== LightDMService.users.data(d.currentIndex, LightDMService.userRoles.UidRole)) {
613+ if (result !== LightDM.Users.data(d.currentIndex, LightDM.UserRoles.UidRole)) {
610 AccountsService.failedFingerprintLogins++;
614 AccountsService.failedFingerprintLogins++;
611 failOperation("not the selected user");
615 failOperation("not the selected user");