@@ -21,10 +21,11 @@ import Unity.Application 0.1
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22import Ubuntu.Gestures 0.1
22import Ubuntu.Gestures 0.1
23import Unity.Launcher 0.1
23import Unity.Launcher 0.1
24+import LightDM 0.1 as LightDM
24import Powerd 0.1
25import Powerd 0.1
25import SessionBroadcast 0.1
26import SessionBroadcast 0.1
26−import SessionManager 0.1
27import "Dash"
27import "Dash"
28import "Launcher"
29import "Launcher"
29import "Panel"
30import "Panel"
30import "Components"
31import "Components"
@@ -32,9 +33,17 @@ import "Notifications"
32import Unity.Notifications 1.0 as NotificationBackend
33import Unity.Notifications 1.0 as NotificationBackend
33import Unity.Session 0.1
34import Unity.Session 0.1
35−BasicShell {
36+FocusScope {
39+ // this is only here to select the width / height of the window if not running fullscreen
40+ property bool tablet: false
41+ width: tablet ? units.gu(160) : applicationArguments.hasGeometry() ? applicationArguments.width() : units.gu(40)
42+ height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
44+ property real edgeSize: units.gu(2)
45+ property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
46+ property url background
38 readonly property real panelHeight: panel.panelHeight
47 readonly property real panelHeight: panel.panelHeight
40 property bool dashShown: dash.shown
49 property bool dashShown: dash.shown
@@ -70,7 +79,17 @@ BasicShell {
70 id: backgroundSettings
79 id: backgroundSettings
71 schema.id: "org.gnome.desktop.background"
80 schema.id: "org.gnome.desktop.background"
73− backgroundSource: backgroundSettings.pictureUri
82+ property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
83+ onGSettingsPictureChanged: {
84+ shell.background = gSettingsPicture
91+ Keys.onVolumeUpPressed: volumeControl.volumeUp()
92+ Keys.onVolumeDownPressed: volumeControl.volumeDown()
76 id: underlayClipper
95 id: underlayClipper
@@ -117,9 +136,10 @@ BasicShell {
118 objectName: "dash"
137 objectName: "dash"
139+ available: !greeter.shown && !lockscreen.shown
120 hides: [stages, launcher, panel.indicators]
140 hides: [stages, launcher, panel.indicators]
121− shown: disappearingAnimationProgress !== 1.0
141+ shown: disappearingAnimationProgress !== 1.0 && greeterWrapper.showProgress !== 1.0
122− enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
142+ enabled: disappearingAnimationProgress === 0.0 && greeterWrapper.showProgress === 0.0 && edgeDemo.dashEnabled
124 anchors {
144 anchors {
125 fill: parent
145 fill: parent
@@ -207,6 +227,7 @@ BasicShell {
207 shown = true;
227 shown = true;
208 panel.indicators.hide();
228 panel.indicators.hide();
209 edgeDemo.stopDemo();
229 edgeDemo.stopDemo();
210 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
231 if (!ApplicationManager.focusedApplicationId && ApplicationManager.count > 0 && focusApp) {
211 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
232 ApplicationManager.focusApplication(ApplicationManager.get(0).appId);
@@ -271,12 +292,6 @@ BasicShell {
275− target: ApplicationManager
276− property: "suspended"
277− value: !SessionManager.active
281 id: applicationsDisplayLoader
296 id: applicationsDisplayLoader
282 anchors.fill: parent
297 anchors.fill: parent
@@ -301,9 +316,132 @@ BasicShell {
321+ objectName: "lockscreen"
323+ readonly property int backgroundTopMargin: -panel.panelHeight
325+ hides: [launcher, panel.indicators]
328+ showAnimation: StandardAnimation { property: "opacity"; to: 1 }
329+ hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
330+ y: panel.panelHeight
331+ x: required ? 0 : - width
333+ height: parent.height - panel.panelHeight
334+ background: shell.background
338+ onEntered: LightDM.Greeter.respond(passphrase);
339+ onCancel: greeter.show()
341+ Component.onCompleted: {
342+ if (LightDM.Users.count == 1) {
343+ LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
349+ target: LightDM.Greeter
352+ if (LightDM.Users.count == 1) {
353+ // TODO: There's no better way for now to determine if its a PIN or a passphrase.
354+ if (text == "PIN") {
355+ lockscreen.alphaNumeric = false
357+ lockscreen.alphaNumeric = true
359+ lockscreen.placeholderText = i18n.tr("Please enter %1").arg(text);
364+ onAuthenticationComplete: {
365+ if (LightDM.Greeter.promptless) {
368+ if (LightDM.Greeter.authenticated) {
371+ lockscreen.clear(true);
377+ anchors.fill: parent
379+ opacity: greeterWrapper.showProgress * 0.8
383+ // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
385+ x: launcher.progress
386+ y: panel.panelHeight
388+ height: parent.height - panel.panelHeight
391+ enabled: !launcher.dashSwipe
392+ StandardAnimation {}
395+ readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
399+ objectName: "greeter"
402+ hides: [launcher, panel.indicators]
405+ defaultBackground: shell.background
408+ height: parent.height
410+ dragHandleWidth: shell.edgeSize
415+ // If there is only one user, we start authenticating with that one here.
416+ // If there are more users, the Greeter will handle that
417+ if (LightDM.Users.count == 1) {
418+ LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
420+ greeter.forceActiveFocus();
424+ onUnlocked: greeter.hide()
426+ // Update launcher items for new user
427+ var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
428+ AccountsService.user = user;
429+ LauncherModel.setUser(user);
432+ onTease: launcher.tease()
435+ target: ApplicationManager
436+ property: "suspended"
437+ value: greeter.shown && greeterWrapper.showProgress == 1
304 InputFilterArea {
442 InputFilterArea {
305 anchors.fill: parent
443 anchors.fill: parent
306− blockInput: ApplicationManager.focusedApplicationId.length === 0 || launcher.shown
444+ blockInput: ApplicationManager.focusedApplicationId.length === 0 || greeter.shown || lockscreen.shown || launcher.shown
307 || panel.indicators.shown
445 || panel.indicators.shown
@@ -315,7 +453,7 @@ BasicShell {
315 // We ignore any display-off signals when the proximity sensor
453 // We ignore any display-off signals when the proximity sensor
316 // is active. This usually indicates something like a phone call.
454 // is active. This usually indicates something like a phone call.
317 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
455 if (status == Powerd.Off && (flags & Powerd.UseProximity) == 0) {
318− SessionManager.lock();
456+ greeter.showNow();
321 // No reason to chew demo CPU when user isn't watching
459 // No reason to chew demo CPU when user isn't watching
@@ -327,12 +465,17 @@ BasicShell {
330− function showHome(fromLauncher) {
468+ function showHome() {
331− var animate = fromLauncher && !stages.shown
469+ var animate = !greeter.shown && !stages.shown
332 dash.setCurrentScope("clickscope", animate, false)
471 dash.setCurrentScope("clickscope", animate, false)
333 stages.hide()
472 stages.hide()
475+ function hideIndicatorMenu(delay) {
476+ panel.hideIndicatorMenu(delay);
337 id: overlay
480 id: overlay
@@ -349,8 +492,8 @@ BasicShell {
350 property string focusedAppId: ApplicationManager.focusedApplicationId
493 property string focusedAppId: ApplicationManager.focusedApplicationId
351 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
494 property var focusedApplication: ApplicationManager.findApplication(focusedAppId)
352− fullscreenMode: focusedApplication && stages.fullscreen
495+ fullscreenMode: focusedApplication && stages.fullscreen && !greeter.shown && !lockscreen.shown
353− searchVisible: dash.shown && dash.searchable
496+ searchVisible: !greeter.shown && !lockscreen.shown && dash.shown && dash.searchable
355 InputFilterArea {
498 InputFilterArea {
356 anchors {
499 anchors {
@@ -388,9 +531,8 @@ BasicShell {
388 if (edgeDemo.running)
531 if (edgeDemo.running)
391− showHome(true)
534+ showHome()
394 onDash: {
536 onDash: {
395 if (stages.shown && !stages.overlayMode) {
537 if (stages.shown && !stages.overlayMode) {
396 if (!stages.locked) {
538 if (!stages.locked) {
@@ -398,6 +540,10 @@ BasicShell {
398 launcher.hide();
540 launcher.hide();
543+ if (greeter.shown) {
544+ greeter.hideRight();
402 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
548 onDashSwipeChanged: if (dashSwipe && stages.shown) dash.setCurrentScope("clickscope", false, true)
403 onLauncherApplicationSelected: {
549 onLauncherApplicationSelected: {
@@ -414,7 +560,7 @@ BasicShell {
414 Rectangle {
560 Rectangle {
415 id: modalNotificationBackground
561 id: modalNotificationBackground
417− visible: notifications.useModal && (notifications.state == "narrow")
563+ visible: notifications.useModal && !greeter.shown && (notifications.state == "narrow")
418 color: "#000000"
564 color: "#000000"
419 anchors.fill: parent
565 anchors.fill: parent
420 opacity: 0.5
566 opacity: 0.5
@@ -461,18 +607,11 @@ BasicShell {
461 blockInput: height > 0
607 blockInput: height > 0
466− target: SessionManager
468− if (!SessionManager.active) {
470− panel.indicators.hide()
613+ onFocusChanged: if (!focus) forceActiveFocus();
476 InputFilterArea {
615 InputFilterArea {
477 anchors {
616 anchors {
478 top: parent.top
617 top: parent.top
@@ -493,6 +632,12 @@ BasicShell {
493 blockInput: true
632 blockInput: true
496 OSKController {
641 OSKController {
497 anchors.topMargin: panel.panelHeight
642 anchors.topMargin: panel.panelHeight
498 anchors.fill: parent // as needs to know the geometry of the shell
643 anchors.fill: parent // as needs to know the geometry of the shell
@@ -524,6 +669,7 @@ BasicShell {
525 EdgeDemo {
670 EdgeDemo {
526 id: edgeDemo
671 id: edgeDemo
527 launcher: launcher
673 launcher: launcher
528 dash: dash
674 dash: dash
529 indicators: panel.indicators
675 indicators: panel.indicators
@@ -532,6 +678,6 @@ BasicShell {
533 Connections {
679 Connections {
534 target: SessionBroadcast
680 target: SessionBroadcast
535− onShowHome: showHome(false)
681+ onShowHome: showHome()