@@ -21,28 +21,19 @@ import Unity.Application 0.1
2121import Ubuntu.Components 0.1
2222import Ubuntu.Gestures 0.1
2323import Unity.Launcher 0.1
24−import LightDM 0.1 as LightDM
2524import Powerd 0.1
2625import SessionBroadcast 0.1
26+import SessionManager 0.1
2727import "Dash"
28−import "Greeter"
2928import "Launcher"
3029import "Panel"
3130import "Components"
3231import "Notifications"
3332import Unity.Notifications 1.0 as NotificationBackend
3433
35−FocusScope {
34+BasicShell {
3635 id: shell
3736
38− // this is only here to select the width / height of the window if not running fullscreen
39− property bool tablet: false
40− width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
41− height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
42−
43− property real edgeSize: units.gu(2)
44− property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
45− property url background
4637 readonly property real panelHeight: panel.panelHeight
4738
4839 property bool dashShown: dash.shown
@@ -78,17 +69,7 @@ FocusScope {
7869 id: backgroundSettings
7970 schema.id: "org.gnome.desktop.background"
8071 }
81− property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
82− onGSettingsPictureChanged: {
83− shell.background = gSettingsPicture
84− }
85−
86− VolumeControl {
87− id: volumeControl
88− }
89−
90− Keys.onVolumeUpPressed: volumeControl.volumeUp()
91− Keys.onVolumeDownPressed: volumeControl.volumeDown()
72+ backgroundSource: backgroundSettings.pictureUri
9273
9374 Item {
9475 id: underlayClipper
@@ -135,10 +116,9 @@ FocusScope {
135116 id: dash
136117 objectName: "dash"
137118
138− available: !greeter.shown && !lockscreen.shown
139119 hides: [stages, launcher, panel.indicators]
140− shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
141− enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
120+ shown: disappearingAnimationProgress !== 1.0
121+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
142122
143123 anchors {
144124 fill: parent
@@ -226,7 +206,6 @@ FocusScope {
226206 shown = true;
227207 panel.indicators.hide();
228208 edgeDemo.stopDemo();
229− greeter.hide();
230209 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
231210 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
232211 }
@@ -267,6 +246,12 @@ FocusScope {
267246 }
268247 }
269248
249+ Binding {
250+ target: ApplicationManager
251+ property: "suspended"
252+ value: !SessionManager.active
253+ }
254+
270255 Loader {
271256 id: applicationsDisplayLoader
272257 anchors.fill: parent
@@ -291,132 +276,9 @@ FocusScope {
291276 }
292277 }
293278
294− Lockscreen {
295− id: lockscreen
296− objectName: "lockscreen"
297−
298− readonly property int backgroundTopMargin: -panel.panelHeight
299−
300− hides: [launcher, panel.indicators]
301− shown: false
302− enabled: true
303− showAnimation: StandardAnimation { property: "opacity"; to: 1 }
304− hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
305− y: panel.panelHeight
306− x: required ? 0 : - width
307− width: parent.width
308− height: parent.height - panel.panelHeight
309− background: shell.background
310− minPinLength: 4
311− maxPinLength: 4
312−
313− onEntered: LightDM.Greeter.respond(passphrase);
314− onCancel: greeter.show()
315−
316− Component.onCompleted: {
317− if (LightDM.Users.count == 1) {
318− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
319− }
320− }
321− }
322−
323− Connections {
324− target: LightDM.Greeter
325−
326− onShowPrompt: {
327− if (LightDM.Users.count == 1) {
328− // TODO: There's no better way for now to determine if its a PIN or a passphrase.
329− if (text == "PIN") {
330− lockscreen.alphaNumeric = false
331− } else {
332− lockscreen.alphaNumeric = true
333− }
334− lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
335− lockscreen.show();
336− }
337− }
338−
339− onAuthenticationComplete: {
340− if (LightDM.Greeter.promptless) {
341− return;
342− }
343− if (LightDM.Greeter.authenticated) {
344− lockscreen.hide();
345− } else {
346− lockscreen.clear(true);
347− }
348− }
349− }
350−
351− Rectangle {
352− anchors.fill: parent
353− color: "black"
354− opacity: greeterWrapper.showProgress * 0.8
355− }
356−
357− Item {
358− // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
359− id: greeterWrapper
360− x: launcher.progress
361− y: panel.panelHeight
362− width: parent.width
363− height: parent.height - panel.panelHeight
364−
365− Behavior on x {
366− enabled: !launcher.dashSwipe
367− StandardAnimation {}
368− }
369−
370− readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
371−
372− Greeter {
373− id: greeter
374− objectName: "greeter"
375−
376− available: true
377− hides: [launcher, panel.indicators]
378− shown: true
379−
380− defaultBackground: shell.background
381−
382− width: parent.width
383− height: parent.height
384−
385− dragHandleWidth: shell.edgeSize
386−
387− onShownChanged: {
388− if (shown) {
389− lockscreen.reset();
390− // If there is only one user, we start authenticating with that one here.
391− // If there are more users, the Greeter will handle that
392− if (LightDM.Users.count == 1) {
393− LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
394− }
395− greeter.forceActiveFocus();
396− }
397− }
398−
399− onUnlocked: greeter.hide()
400− onSelected: {
401− // Update launcher items for new user
402− var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
403− AccountsService.user = user;
404− LauncherModel.setUser(user);
405− }
406−
407− onTease: launcher.tease()
408−
409− Binding {
410− target: ApplicationManager
411− property: "suspended"
412− value: greeter.shown && greeterWrapper.showProgress == 1
413− }
414− }
415− }
416−
417279 InputFilterArea {
418280 anchors.fill: parent
419− blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
281+ blockInput: ApplicationManager.focusedApplicationId.length === 0 || launcher.shown
420282 || panel.indicators.shown
421283 }
422284
@@ -428,7 +290,7 @@ FocusScope {
428290 // We ignore any display-off signals when the proximity sensor
429291 // is active. This usually indicates something like a phone call.
430292 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
431− greeter.showNow();
293+ SessionManager.lock();
432294 }
433295
434296 // No reason to chew demo CPU when user isn't watching
@@ -440,17 +302,12 @@ FocusScope {
440302 }
441303 }
442304
443− function showHome() {
444− var animate = !greeter.shown && !stages.shown
445− greeter.hide()
305+ function showHome(fromLauncher) {
306+ var animate = fromLauncher && !stages.shown
446307 dash.setCurrentScope("clickscope", animate, false)
447308 stages.hide()
448309 }
449310
450− function hideIndicatorMenu(delay) {
451− panel.hideIndicatorMenu(delay);
452− }
453−
454311 Item {
455312 id: overlay
456313
@@ -467,8 +324,8 @@ FocusScope {
467324 }
468325 property string focusedAppId: ApplicationManager.focusedApplicationId
469326 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
470− fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
471− searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
327+ fullscreenMode: focusedApplication && stages.fullscreen
328+ searchVisible: dash.shown && dash.searchable
472329
473330 InputFilterArea {
474331 anchors {
@@ -506,8 +363,9 @@ FocusScope {
506363 if (edgeDemo.running)
507364 return;
508365
509− showHome()
366+ showHome(true)
510367 }
368+
511369 onDash: {
512370 if (stages.shown && !stages.overlayMode) {
513371 if (!stages.locked) {
@@ -515,10 +373,6 @@ FocusScope {
515373 launcher.hide();
516374 }
517375 }
518− if (greeter.shown) {
519− greeter.hideRight();
520− launcher.hide();
521− }
522376 }
523377 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
524378 onLauncherApplicationSelected: {
@@ -535,7 +389,7 @@ FocusScope {
535389 Rectangle {
536390 id: modalNotificationBackground
537391
538− visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
392+ visible: notifications.useModal && (notifications.state == "narrow")
539393 color: "#000000"
540394 anchors.fill: parent
541395 opacity: 0.5
@@ -582,10 +436,17 @@ FocusScope {
582436 blockInput: height > 0
583437 }
584438 }
585− }
586439
587− focus: true
588− onFocusChanged: if (!focus) forceActiveFocus();
440+ Connections {
441+ target: SessionManager
442+ onActiveChanged: {
443+ if (!SessionManager.active) {
444+ launcher.hide()
445+ panel.indicators.hide()
446+ }
447+ }
448+ }
449+ }
589450
590451 InputFilterArea {
591452 anchors {
@@ -607,12 +468,6 @@ FocusScope {
607468 blockInput: true
608469 }
609470
610− Binding {
611− target: i18n
612− property: "domain"
613− value: "unity8"
614− }
615−
616471 OSKController {
617472 anchors.topMargin: panel.panelHeight
618473 anchors.fill: parent // as needs to know the geometry of the shell
@@ -644,7 +499,6 @@ FocusScope {
644499
645500 EdgeDemo {
646501 id: edgeDemo
647− greeter: greeter
648502 launcher: launcher
649503 dash: dash
650504 indicators: panel.indicators
@@ -653,6 +507,6 @@ FocusScope {
653507
654508 Connections {
655509 target: SessionBroadcast
656− onShowHome: showHome()
510+ onShowHome: showHome(false)
657511 }
658512}