@@ -15,10 +15,12 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Application 0.1
19import Ubuntu.Application 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
21import Ubuntu.Gestures 0.1
21import LightDM 0.1 as LightDM
22import LightDM 0.1 as LightDM
22import "Dash"
24import "Dash"
23import "Greeter"
25import "Greeter"
24import "Launcher"
26import "Launcher"
@@ -40,8 +42,8 @@ FocusScope {
40 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
42 height: tablet ? units.gu(100) : applicationArguments.hasGeometry() ? applicationArguments.height() : units.gu(71)
42 property real edgeSize: units.gu(2)
44 property real edgeSize: units.gu(2)
43− property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45+ property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
44− property url background: default_background
46+ property url background: backgroundSettings.pictureUri
45 readonly property real panelHeight: panel.panelHeight
47 readonly property real panelHeight: panel.panelHeight
47 property bool dashShown: dash.shown
49 property bool dashShown: dash.shown
@@ -114,6 +116,11 @@ FocusScope {
120+ id: backgroundSettings
121+ schema.id: "org.gnome.desktop.background"
117 VolumeControl {
124 VolumeControl {
118 id: volumeControl
125 id: volumeControl
@@ -121,12 +128,6 @@ FocusScope {
121 Keys.onVolumeUpPressed: volumeControl.volumeUp()
128 Keys.onVolumeUpPressed: volumeControl.volumeUp()
122 Keys.onVolumeDownPressed: volumeControl.volumeDown()
129 Keys.onVolumeDownPressed: volumeControl.volumeDown()
125− if (event.key == Qt.Key_PowerOff) {
131 id: underlay
132 id: underlay
132 objectName: "underlay"
133 objectName: "underlay"
@@ -144,12 +145,16 @@ FocusScope {
144 // through the translucent parts of the shell surface.
145 // through the translucent parts of the shell surface.
145 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
146 visible: !fullyCovered && !applicationSurfaceShouldBeSeen
147− Image {
148+ CrossFadeImage {
148 id: backgroundImage
149 id: backgroundImage
150+ objectName: "backgroundImage"
149 source: shell.background
151 source: shell.background
150− sourceSize.width: parent.width
151− sourceSize.height: parent.height
152 anchors.fill: parent
152 anchors.fill: parent
154+ if (status == Image.Error) {
155+ backgroundSettings.pictureUri = shell.defaultBackground
155 Rectangle {
160 Rectangle {
@@ -194,7 +199,6 @@ FocusScope {
199 id: stagesOuterContainer
203 id: stagesOuterContainer
@@ -259,7 +263,6 @@ FocusScope {
259 ignoreUnknownSignals: true
263 ignoreUnknownSignals: true
264 id: mainStage
267 id: mainStage
@@ -420,9 +423,6 @@ FocusScope {
421 dragHandleWidth: shell.edgeSize
424 dragHandleWidth: shell.edgeSize
423− property var previousMainApp: null
424− property var previousSideApp: null
426 onShownChanged: {
426 onShownChanged: {
427 if (shown) {
427 if (shown) {
428 lockscreen.reset();
428 lockscreen.reset();
@@ -432,27 +432,13 @@ FocusScope {
432 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
432 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
434 greeter.forceActiveFocus();
434 greeter.forceActiveFocus();
435− // FIXME: *FocusedApplication are not updated when unfocused, hence the need to check whether
436− // the stage was actually shown
437− if (mainStage.fullyShown) greeter.previousMainApp = applicationManager.mainStageFocusedApplication;
438− if (sideStage.fullyShown) greeter.previousSideApp = applicationManager.sideStageFocusedApplication;
439− applicationManager.unfocusCurrentApplication();
441− if (greeter.previousMainApp) {
442− applicationManager.focusApplication(greeter.previousMainApp);
443− greeter.previousMainApp = null;
445− if (greeter.previousSideApp) {
446− applicationManager.focusApplication(greeter.previousSideApp);
447− greeter.previousSideApp = null;
452 onUnlocked: greeter.hide()
438 onUnlocked: greeter.hide()
453 onSelected: {
439 onSelected: {
454 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
440 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
455− shell.background = bgPath ? bgPath : default_background
441+ shell.background = bgPath ? bgPath : defaultBackground
458 onLeftTeaserPressedChanged: {
444 onLeftTeaserPressedChanged: {
@@ -467,6 +453,42 @@ FocusScope {
467 blockInput: greeter.shown || lockscreen.shown
453 blockInput: greeter.shown || lockscreen.shown
460+ property var previousMainApp: null
461+ property var previousSideApp: null
463+ function setFocused(focused) {
465+ // FIXME: *FocusedApplication are not updated when unfocused, hence the need to check whether
466+ // the stage was actually shown
467+ if (mainStage.fullyShown) powerConnection.previousMainApp = applicationManager.mainStageFocusedApplication;
468+ if (sideStage.fullyShown) powerConnection.previousSideApp = applicationManager.sideStageFocusedApplication;
469+ applicationManager.unfocusCurrentApplication();
471+ if (powerConnection.previousMainApp) {
472+ applicationManager.focusApplication(powerConnection.previousMainApp);
473+ powerConnection.previousMainApp = null;
475+ if (powerConnection.previousSideApp) {
476+ applicationManager.focusApplication(powerConnection.previousSideApp);
477+ powerConnection.previousSideApp = null;
482+ onPowerStateChange: {
483+ if (state == 0) { // suspend
484+ powerConnection.setFocused(false);
486+ } else if (state == 1) { // active
487+ powerConnection.setFocused(true);
471 id: overlay
493 id: overlay
@@ -552,7 +574,7 @@ FocusScope {
552 anchors.bottom: parent.bottom
574 anchors.bottom: parent.bottom
553 width: parent.width
575 width: parent.width
554 dragAreaWidth: shell.edgeSize
576 dragAreaWidth: shell.edgeSize
555− available: !greeter.locked
577+ available: !greeter.shown || greeter.narrowMode
556 onDashItemSelected: {
578 onDashItemSelected: {
557 greeter.hide()
579 greeter.hide()
558 // Animate if moving between application and dash
580 // Animate if moving between application and dash