53
53
property url background
54
54
readonly property real panelHeight: panel.panelHeight
56
readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated
56
readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
57
readonly property bool forcedUnlock: edgeDemo.running
58
onForcedUnlockChanged: if (forcedUnlock) lockscreen.hide()
58
60
property bool sideStageEnabled: shell.width >= units.gu(100)
59
61
readonly property string focusedApplicationId: ApplicationManager.focusedApplicationId
90
function setFakeActiveForApp(app) {
92
greeter.fakeActiveForApp = app
92
function startLockedApp(app) {
94
console.warn("Called startLockedApp(%1) when not locked, ignoring".arg(app))
97
greeter.lockedApp = app
98
shell.activateApplication(app)
170
174
target: ApplicationManager
171
175
onFocusRequested: {
172
if (appId === "dialer-app") {
173
// Always let the dialer-app through. Either user asked
174
// for an emergency call or accepted an incoming call.
175
setFakeActiveForApp(appId)
176
} else if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
176
if (greeter.narrowMode) {
177
if (appId === "dialer-app" && callManager.hasCalls) {
178
// If we are in the middle of a call, make dialer lockedApp and show it.
179
// This can happen if user backs out of dialer back to greeter, then
180
// launches dialer again.
181
greeter.lockedApp = appId;
183
if (greeter.hasLockedApp) {
184
if (appId === greeter.lockedApp) {
185
lockscreen.hide() // show locked app
187
greeter.startUnlock() // show lockscreen if necessary
192
if (LightDM.Greeter.active) {
193
greeter.startUnlock()
182
198
onFocusedApplicationIdChanged: {
183
if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
199
if (greeter.hasLockedApp && greeter.lockedApp !== ApplicationManager.focusedApplicationId) {
200
greeter.startUnlock()
186
202
panel.indicators.hide();
189
205
onApplicationAdded: {
190
206
if (greeter.shown && appId != "unity8-dash") {
207
greeter.startUnlock()
193
if (appId === "dialer-app") {
194
// Always let the dialer-app through. Either user asked
195
// for an emergency call or accepted an incoming call.
196
setFakeActiveForApp(appId)
209
if (greeter.narrowMode && greeter.hasLockedApp && appId === greeter.lockedApp) {
210
lockscreen.hide() // show locked app
203
217
id: applicationsDisplayLoader
218
objectName: "applicationsDisplayLoader"
204
219
anchors.fill: parent
206
source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
221
// When we have a locked app, we only want to show that one app.
222
// FIXME: do this in a less traumatic way. We currently only allow
223
// locked apps in phone mode (see FIXME in Lockscreen component in
224
// this same file). When that changes, we need to do something
225
// nicer here. But this code is currently just to prevent a
226
// theoretical attack where user enters lockedApp mode, then makes
227
// the screen larger (maybe connects to monitor) and tries to enter
229
property bool tabletMode: shell.sideStageEnabled && !greeter.hasLockedApp
230
source: tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
209
233
target: applicationsDisplayLoader.item
230
254
target: applicationsDisplayLoader.item
231
255
property: "spreadEnabled"
232
value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
256
value: edgeDemo.stagesEnabled && !greeter.hasLockedApp
235
259
target: applicationsDisplayLoader.item
304
328
// and wider screens are tablets which don't. When we do allow this
305
329
// on devices with a side stage and a SIM, work should be done to
306
330
// ensure that the main stage is disabled while the dialer is present
307
// in the side stage.
331
// in the side stage. See the FIXME in the stage loader in this file.
308
332
showEmergencyCallButton: !shell.sideStageEnabled
310
334
onEntered: LightDM.Greeter.respond(passphrase);
311
335
onCancel: greeter.show()
312
onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter fake-active mode
314
onShownChanged: if (shown) greeter.fakeActiveForApp = ""
336
onEmergencyCall: startLockedApp("dialer-app")
338
onShownChanged: if (shown) greeter.lockedApp = ""
340
function maybeShow() {
341
if (!shell.forcedUnlock) {
317
347
id: forcedDelayTimer
355
385
lockscreen.errorText = i18n.tr("Sorry, incorrect %1").arg(text.toLowerCase())
388
lockscreen.maybeShow();
362
392
onPromptlessChanged: {
363
if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
393
if (greeter.narrowMode) {
394
if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
398
lockscreen.maybeShow();
439
472
property bool fullyShown: showProgress === 1.0
440
473
onFullyShownChanged: {
441
474
// Wait until the greeter is completely covering lockscreen before resetting it.
442
if (fullyShown && !LightDM.Greeter.authenticated) {
475
if (greeter.narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
443
476
lockscreen.reset();
477
lockscreen.maybeShow();
448
481
readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
449
482
onShowProgressChanged: {
450
483
if (showProgress === 0) {
451
if (LightDM.Greeter.authenticated) {
484
if ((LightDM.Greeter.promptless && LightDM.Greeter.authenticated) || shell.forcedUnlock) {
453
486
} else if (greeter.narrowMode) {
454
487
lockscreen.clear(false) // to reset focus if necessary
463
496
signal sessionStarted() // helpful for tests
465
property string fakeActiveForApp: ""
498
property string lockedApp: ""
499
property bool hasLockedApp: lockedApp !== ""
468
502
hides: [launcher, panel.indicators]
470
504
loadContent: required || lockscreen.required // keeps content in memory for quick show()
472
508
defaultBackground: shell.background
474
510
width: parent.width
492
540
if (greeter.narrowMode) {
493
541
LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
495
greeter.fakeActiveForApp = "";
545
greeter.lockedApp = "";
496
546
greeter.forceActiveFocus();
578
if (shell.locked && callManager.hasCalls) {
579
// We just received an incoming call while locked. The
580
// indicator will have already launched dialer-app for us, but
581
// there is a race between "hasCalls" changing and the dialer
582
// starting up. So in case we lose that race, we'll start/
583
// focus the dialer ourselves here too. Even if the indicator
584
// didn't launch the dialer for some reason (or maybe a call
585
// started via some other means), if an active call is
586
// happening, we want to be in the dialer.
587
startLockedApp("dialer-app")
524
593
id: powerConnection
576
643
anchors.fill: parent //because this draws indicator menus
578
645
hides: [launcher]
579
available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && greeter.fakeActiveForApp === ""
646
available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && !greeter.hasLockedApp
580
647
contentEnabled: edgeDemo.panelContentEnabled
581
648
width: parent.width > units.gu(60) ? units.gu(40) : parent.width
582
649
panelHeight: units.gu(3)
600
667
anchors.bottom: parent.bottom
601
668
width: parent.width
602
669
dragAreaWidth: shell.edgeSize
603
available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && greeter.fakeActiveForApp === ""
670
available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
605
672
onShowDashHome: showHome()
606
673
onDash: showDash()