on xenial help sign in
Implement bare-bones shellMode=greeter and shellMode=shell
0eb7df9Josh Arenson
qml/Greeter/ShimGreeter.qmlnew file+45
@@ -0,0 +1,45 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+
19+/*
20+ * This is a shim greeter that is only used to provide a shell,
21+ * running without a greeter, the requisite information
22+ *
23+ */
24+
25+/* FIXME: this shuld be fine as a QtObject, but bug lp:1447391
26+ * dictates wrapping as an item instead
27+ */
28+Item {
29+ id: shimGreeter
30+
31+ readonly property bool active: false
32+ readonly property bool hasLockedApp: lockedApp !== ""
33+ readonly property bool locked: false
34+ readonly property bool shown: false
35+ readonly property bool waiting: false
36+
37+ property string lockedApp: ""
38+
39+ // Since ShimGreeter is never active, these can just return
40+ property var forceShow: (function() { return; })
41+ property var notifyAboutToFocusApp: (function(appId) { return; })
42+ property var notifyAppFocused: (function(appId) { return; })
43+ property var notifyShowingDashFromDrag: (function(appId) { return false; })
44+
45+}
qml/Shell.qml+47−34
@@ -111,6 +111,8 @@ Item {
111 // This is _only_ used to expose the property to autopilot tests
111 // This is _only_ used to expose the property to autopilot tests
112 readonly property string testShellMode: shellMode
112 readonly property string testShellMode: shellMode
113
113
114+ readonly property alias greeter: greeterLoader.item
115+
114 function activateApplication(appId) {
116 function activateApplication(appId) {
115 if (ApplicationManager.findApplication(appId)) {
117 if (ApplicationManager.findApplication(appId)) {
116 ApplicationManager.requestFocusApplication(appId);
118 ApplicationManager.requestFocusApplication(appId);
@@ -262,7 +264,9 @@ Item {
262 ? "phone"
264 ? "phone"
263 : shell.usageScenario
265 : shell.usageScenario
264 source: {
266 source: {
267+ if(shellMode === "greeter") {
268+ return "Stages/ShimStage.qml"
265− if (applicationsDisplayLoader.usageScenario === "phone") {
269+ } else if (applicationsDisplayLoader.usageScenario === "phone") {
266 return "Stages/PhoneStage.qml";
270 return "Stages/PhoneStage.qml";
267 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
271 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
268 return "Stages/TabletStage.qml";
272 return "Stages/TabletStage.qml";
@@ -414,50 +418,59 @@ Item {
414 }
418 }
415 }
419 }
416
420
417− Greeter {
421+ Loader {
418− id: greeter
422+ id: greeterLoader
419− objectName: "greeter"
420−
421− hides: [launcher, panel.indicators]
422− tabletMode: shell.usageScenario !== "phone"
423− launcherOffset: launcher.progress
424− forcedUnlock: tutorial.running
425− background: shell.background
426−
427 anchors.fill: parent
423 anchors.fill: parent
428 anchors.topMargin: panel.panelHeight
424 anchors.topMargin: panel.panelHeight
425+ sourceComponent: shellMode != "shell" ? integratedGreeter :
426+ Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
427+ onLoaded: {
428+ item.objectName = "greeter"
429+ }
430+ }
429
431
430− // avoid overlapping with Launcher's edge drag area
432+ Component {
431− // FIXME: Fix TouchRegistry & friends and remove this workaround
433+ id: integratedGreeter
432− // Issue involves launcher's DDA getting disabled on a long
434+ Greeter {
433− // left-edge drag
434− dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
435
435
436− onSessionStarted: {
436+ hides: [launcher, panel.indicators]
437− launcher.hide();
437+ tabletMode: shell.sideStageEnabled
438− }
438+ launcherOffset: launcher.progress
439+ forcedUnlock: tutorial.running
440+ background: shell.background
439
441
442+ // avoid overlapping with Launcher's edge drag area
443+ // FIXME: Fix TouchRegistry & friends and remove this workaround
444+ // Issue involves launcher's DDA getting disabled on a long
445+ // left-edge drag
446+ dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
447+
448+ onSessionStarted: {
449+ launcher.hide();
450+ }
451+
440− onTease: {
452+ onTease: {
441− if (!tutorial.running) {
453+ if (!tutorial.running) {
442− launcher.tease();
454+ launcher.tease();
455+ }
443 }
456 }
444− }
445
457
446− onEmergencyCall: startLockedApp("dialer-app")
458+ onEmergencyCall: startLockedApp("dialer-app")
447
459
448− Timer {
460+ Binding {
449− // See powerConnection for why this is useful
461+ target: ApplicationManager
450− id: showGreeterDelayed
462+ property: "suspended"
451− interval: 1
452− onTriggered: {
453− greeter.forceShow();
463+ value: greeter.shown
454 }
464 }
455 }
465 }
466+ }
456
467
457− Binding {
468+ Timer {
458− target: ApplicationManager
469+ // See powerConnection for why this is useful
459− property: "suspended"
470+ id: showGreeterDelayed
471+ interval: 1
472+ onTriggered: {
460− value: greeter.shown
473+ greeter.forceShow();
461 }
474 }
462 }
475 }
463
476
qml/Stages/ShimStage.qmlnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+import QtQuick 2.3
18+import Ubuntu.Components 0.1
19+
20+Rectangle {
21+ id: shimStage
22+
23+ anchors.fill: parent
24+ color: UbuntuColors.lightAubergine
25+
26+ Text {
27+ id: greeterModeText
28+
29+ anchors.horizontalCenter: parent.horizontalCenter
30+ anchors.top: parent.top
31+ anchors.topMargin: units.gu(10)
32+ font.bold: true
33+ horizontalAlignment: Text.AlignHCenter
34+ text: "Shell is in \"greeter\" mode"
35+ }
36+
37+ Text {
38+ anchors.centerIn: parent
39+ color: UbuntuColors.orange
40+ font.pointSize: units.gu(8)
41+ horizontalAlignment: Text.AlignHCenter
42+ text: "Shim \nStage"
43+ }
44+}
tests/qmltests/Tutorial/tst_Tutorial.qml+1
@@ -73,6 +73,7 @@ Item {
73 sourceComponent: Component {
73 sourceComponent: Component {
74 Shell {
74 Shell {
75 property string indicatorProfile: "phone"
75 property string indicatorProfile: "phone"
76+ property string shellMode: "full-greeter" /* default */
76
77
77 Component.onDestruction: {
78 Component.onDestruction: {
78 shellLoader.itemDestroyed = true;
79 shellLoader.itemDestroyed = true;
tests/qmltests/tst_Shell.qml+2
@@ -81,6 +81,8 @@ Rectangle {
81 property bool itemDestroyed: false
81 property bool itemDestroyed: false
82 sourceComponent: Component {
82 sourceComponent: Component {
83 Shell {
83 Shell {
84+ property string shellMode: "full-greeter" /* default */
85+
84 usageScenario: "phone"
86 usageScenario: "phone"
85 orientation: Qt.PortraitOrientation
87 orientation: Qt.PortraitOrientation
86 primaryOrientation: Qt.PortraitOrientation
88 primaryOrientation: Qt.PortraitOrientation
tests/qmltests/tst_ShellWithPin.qml+2
@@ -69,6 +69,8 @@ Item {
69 property bool itemDestroyed: false
69 property bool itemDestroyed: false
70 sourceComponent: Component {
70 sourceComponent: Component {
71 Shell {
71 Shell {
72+ property string shellMode: "full-greeter" /* default */
73+
72 Component.onDestruction: {
74 Component.onDestruction: {
73 shellLoader.itemDestroyed = true
75 shellLoader.itemDestroyed = true
74 }
76 }