@@ -19,7 +19,6 @@ import AccountsService 0.1
1919import LightDM 0.1 as LightDM
2020import Ubuntu.Components 1.1
2121import Ubuntu.SystemImage 0.1
22−import Ubuntu.Telephony 0.1 as Telephony
2322import Unity.Launcher 0.1
2423import "../Components"
2524
@@ -42,10 +41,8 @@ Showable {
4241 property string lockedApp: ""
4342 property bool hasLockedApp: lockedApp !== ""
4443
45− showAnimation: StandardAnimation { property: "dragOffset"; to: 0; duration: UbuntuAnimation.FastDuration }
46− hideAnimation: __leftHideAnimation
47−
48− property alias lockscreen: lockscreen
44+ showAnimation: d.showAnimation
45+ hideAnimation: d.leftHideAnimation
4946
5047 readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
5148 property bool forcedUnlock
@@ -57,9 +54,6 @@ Showable {
5754
5855 readonly property int currentIndex: greeterContentLoader.currentIndex
5956
60− property var __leftHideAnimation: StandardAnimation { property: "dragOffset"; to: -width }
61− property var __rightHideAnimation: StandardAnimation { property: "dragOffset"; to: width }
62−
6357 property real dragOffset
6458
6559 // We define a proxy and "is valid" property for launcherOffset because of
@@ -84,35 +78,13 @@ Showable {
8478
8579 function hideRight() {
8680 if (shown) {
87− hideAnimation = __rightHideAnimation
81+ hideAnimation = d.rightHideAnimation;
8882 hide()
8983 }
9084 }
9185
92− function reset() {
93− if (greeterContentLoader.item) {
94− greeterContentLoader.item.reset()
95− }
96− }
97−
98− function login() {
99− enabled = false;
100− if (LightDM.Greeter.startSessionSync()) {
101− sessionStarted();
102− hide();
103− lockscreen.hide();
104− }
105− enabled = true;
106− }
107−
10886 function notifyAppFocused(appId) {
10987 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− }
11688 if (hasLockedApp) {
11789 if (appId === lockedApp) {
11890 lockscreen.hide(); // show locked app
@@ -168,7 +140,7 @@ Showable {
168140 // Reset hide animation to default once we're finished with it
169141 if (required) {
170142 // Reset hide animation so that a hide() call is reliably left
171− hideAnimation = __leftHideAnimation
143+ hideAnimation = d.leftHideAnimation;
172144 }
173145 }
174146
@@ -179,7 +151,7 @@ Showable {
179151 if (narrowMode) {
180152 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
181153 } else {
182− reset();
154+ d.reset();
183155 }
184156 lockedApp = "";
185157 forceActiveFocus();
@@ -197,7 +169,7 @@ Showable {
197169 onShowProgressChanged: {
198170 if (showProgress === 0) {
199171 if ((LightDM.Greeter.promptless && LightDM.Greeter.authenticated) || forcedUnlock) {
200− greeter.login();
172+ d.login();
201173 } else if (narrowMode) {
202174 lockscreen.clear(false); // to reset focus if necessary
203175 }
@@ -207,12 +179,32 @@ Showable {
207179 QtObject {
208180 id: d
209181
182+ property var showAnimation: StandardAnimation { property: "dragOffset"; to: 0; duration: UbuntuAnimation.FastDuration }
183+ property var leftHideAnimation: StandardAnimation { property: "dragOffset"; to: -width }
184+ property var rightHideAnimation: StandardAnimation { property: "dragOffset"; to: width }
185+
210186 function selectUser(uid) {
211187 // Update launcher items for new user
212188 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
213189 AccountsService.user = user;
214190 LauncherModel.setUser(user);
215191 }
192+
193+ function reset() {
194+ if (greeterContentLoader.item) {
195+ greeterContentLoader.item.reset()
196+ }
197+ }
198+
199+ function login() {
200+ enabled = false;
201+ if (LightDM.Greeter.startSessionSync()) {
202+ sessionStarted();
203+ hide();
204+ lockscreen.hide();
205+ }
206+ enabled = true;
207+ }
216208 }
217209
218210 Lockscreen {
@@ -321,7 +313,7 @@ Showable {
321313 target: LightDM.Greeter
322314
323315 onShowGreeter: greeter.show()
324− onHideGreeter: greeter.login()
316+ onHideGreeter: d.login()
325317
326318 onShowPrompt: {
327319 waiting = false;
@@ -364,7 +356,7 @@ Showable {
364356 }
365357
366358 if (LightDM.Greeter.authenticated) {
367− greeter.login();
359+ d.login();
368360 } else {
369361 AccountsService.failedLogins++
370362 if (maxFailedLogins >= 2) { // require at least a warning
@@ -397,6 +389,6 @@ Showable {
397389 Binding {
398390 target: LightDM.Greeter
399391 property: "active"
400− value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
392+ value: greeter.fullyShown || greeter.hasLockedApp
401393 }
402394}