on xenial help sign in
Hook up AccountsService; fix top and left skip buttons not working
889e2a5Michael Terry
Components/DemoOverlay.qml+11−16
@@ -16,7 +16,6 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import QtGraphicalEffects 1.0
18import QtGraphicalEffects 1.0
19−import GSettings 1.0
20import Ubuntu.Application 0.1
19import Ubuntu.Application 0.1
21import Ubuntu.Components 0.1
20import Ubuntu.Components 0.1
22
21
@@ -38,26 +37,24 @@ Item {
38 */
37 */
39 property string text
38 property string text
40
39
40+ /*
41+ * Whether this demo is even enabled at all.
42+ */
43+ property bool enabled: true
44+
41 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
45 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
42 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
46 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
43 property int __edge_margin: units.gu(4)
47 property int __edge_margin: units.gu(4)
44 property int __text_margin: units.gu(3)
48 property int __text_margin: units.gu(3)
45
49
46− function __isDemoSkipped() {
50+ signal skip()
47− // Check global spot, then check gsettings
48− }
49−
50− function __setDemoSkipped() {
51− // We are running in one of two modes:
52− // 1) As a greeter as the lightdm user
53− // 2) As a shell as session user
54− }
55
51
56 Rectangle {
52 Rectangle {
57 id: backgroundShade
53 id: backgroundShade
58 anchors.fill: parent
54 anchors.fill: parent
59 color: "black"
55 color: "black"
60 opacity: 0.8
56 opacity: 0.8
57+ visible: overlay.enabled
61 }
58 }
62
59
63 Item {
60 Item {
@@ -66,6 +63,7 @@ Item {
66 y: 0
63 y: 0
67 width: parent.width
64 width: parent.width
68 height: parent.height
65 height: parent.height
66+ visible: overlay.enabled
69
67
70 Column {
68 Column {
71 id: labelGroup
69 id: labelGroup
@@ -82,7 +80,6 @@ Item {
82 Label {
80 Label {
83 id: titleLabel
81 id: titleLabel
84 text: overlay.title
82 text: overlay.title
85− color: "#B7B3AC"
86 fontSize: "x-large"
83 fontSize: "x-large"
87 width: units.gu(25)
84 width: units.gu(25)
88 wrapMode: Text.WordWrap
85 wrapMode: Text.WordWrap
@@ -91,7 +88,6 @@ Item {
91 Label {
88 Label {
92 id: textLabel
89 id: textLabel
93 text: overlay.text
90 text: overlay.text
94− color: "#B7B3AC"
95 width: units.gu(25)
91 width: units.gu(25)
96 wrapMode: Text.WordWrap
92 wrapMode: Text.WordWrap
97 }
93 }
@@ -106,9 +102,8 @@ Item {
106 MouseArea {
102 MouseArea {
107 anchors.fill: parent
103 anchors.fill: parent
108 onClicked: {
104 onClicked: {
109− console.log("Clicked!");
110− __setDemoSkipped();
111− overlay.visible = false;
105+ overlay.enabled = false;
106+ skip();
112 }
107 }
113 }
108 }
114 }
109 }
@@ -156,7 +151,7 @@ Item {
156
151
157 SequentialAnimation {
152 SequentialAnimation {
158 id: wholeAnimation
153 id: wholeAnimation
159− running: overlay.visible
154+ running: overlay.visible && overlay.enabled
160
155
161 ParallelAnimation {
156 ParallelAnimation {
162 id: fadeInAnimation
157 id: fadeInAnimation
Greeter/Greeter.qml+6−2
@@ -44,6 +44,8 @@ Showable {
44 readonly property bool rightTeaserPressed: greeterContentLoader.status == Loader.Ready &&
44 readonly property bool rightTeaserPressed: greeterContentLoader.status == Loader.Ready &&
45 greeterContentLoader.item.rightTeaserPressed
45 greeterContentLoader.item.rightTeaserPressed
46
46
47+ readonly property int currentIndex: greeterContentLoader.currentIndex
48+
47 signal selected(int uid)
49 signal selected(int uid)
48 signal unlocked(int uid)
50 signal unlocked(int uid)
49
51
@@ -64,11 +66,13 @@ Showable {
64
66
65 source: required ? "GreeterContent.qml" : ""
67 source: required ? "GreeterContent.qml" : ""
66
68
67−
68 Connections {
69 Connections {
69 target: greeterContentLoader.item
70 target: greeterContentLoader.item
70
71
72+ onSelected: {
71− onSelected: greeter.selected(uid);
73+ greeter.selected(uid);
74+ greeterContentLoader.currentIndex = uid;
75+ }
72 onUnlocked: greeter.unlocked(uid);
76 onUnlocked: greeter.unlocked(uid);
73 }
77 }
74 }
78 }
Shell.qml+75−34
@@ -19,6 +19,7 @@ import Ubuntu.Application 0.1
19import Ubuntu.Components 0.1
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
20import Ubuntu.Gestures 0.1
21import LightDM 0.1 as LightDM
21import LightDM 0.1 as LightDM
22+import AccountsService 0.1
22import "Dash"
23import "Dash"
23import "Greeter"
24import "Greeter"
24import "Launcher"
25import "Launcher"
@@ -57,6 +58,19 @@ FocusScope {
57 }
58 }
58 }
59 }
59
60
61+ property bool showEdgeDemo: true
62+ property bool showEdgeDemoInGreeter: showEdgeDemo //AccountsService.getUserProperty("lightdm", "demo-edges")
63+
64+ function hideEdgeDemo() {
65+ var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole);
66+ AccountsService.setUserProperty(user, "demo-edges", false);
67+ shell.showEdgeDemo = false;
68+ }
69+ function hideEdgeDemoInGreeter() {
70+ //AccountsService.setUserProperty("lightdm", "demo-edges", false);
71+ shell.showEdgeDemoInGreeter = false;
72+ }
73+
60 property ListModel searchHistory: SearchHistoryModel {}
74 property ListModel searchHistory: SearchHistoryModel {}
61
75
62 property var applicationManager: ApplicationManagerWrapper {}
76 property var applicationManager: ApplicationManagerWrapper {}
@@ -179,44 +193,53 @@ FocusScope {
179 // FIXME: only necessary because stagesRevealer.animatedProgress and
193 // FIXME: only necessary because stagesRevealer.animatedProgress and
180 // greeterRevealer.animatedProgress are not animated
194 // greeterRevealer.animatedProgress are not animated
181 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
195 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
196+ }
182
197
183− DemoOverlay {
198+ DemoOverlay {
184− id: topEdgeDemo
199+ id: topEdgeDemo
185
200
186− edge: "top"
201+ edge: "top"
187− title: "Top edge"
202+ title: i18n.tr("Top edge")
188− text: "Try swiping from the top edge to access the indicators"
203+ text: i18n.tr("Try swiping from the top edge to access the indicators")
189− anchors.fill: parent
204+ anchors.fill: dash
190− visible: false
205+ visible: false
206+ enabled: shell.showEdgeDemo
207+ onSkip: shell.hideEdgeDemo()
191
208
192− Connections {
209+ Connections {
193− target: greeter
210+ target: greeter
194− onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
211+ onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
195− }
212+ }
196
213
197− Connections {
214+ Connections {
198− target: panel.indicators
215+ target: panel.indicators
199− onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.visible = false
216+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.visible = false
200− }
201 }
217 }
218+ }
202
219
203− DemoOverlay {
220+ DemoOverlay {
204− id: leftEdgeDemo
221+ id: leftEdgeDemo
205
222
206− edge: "left"
223+ edge: "left"
207− title: "Left edge"
224+ title: i18n.tr("Left edge")
208− text: "Swipe from the left to reveal the launcher for quick access to apps"
225+ text: i18n.tr("Swipe from the left to reveal the launcher for quick access to apps")
209− anchors.fill: parent
226+ anchors.fill: dash
210− visible: false
227+ visible: false
228+ enabled: shell.showEdgeDemo
229+ onSkip: shell.hideEdgeDemo()
211
230
212− Connections {
231+ Connections {
213− target: bottomEdgeDemo
232+ target: bottomEdgeDemo
214− onVisibleChanged: if (!bottomEdgeDemo.visible) leftEdgeDemo.visible = true
233+ onVisibleChanged: if (!bottomEdgeDemo.visible) leftEdgeDemo.visible = true
215− }
234+ }
216
235
217− Connections {
236+ Connections {
218− target: launcher
237+ target: launcher
238+ onProgressChanged: {
239+ if (launcher.progress >= 1.0) {
219− onProgressChanged: if (launcher.progress >= 1.0) leftEdgeDemo.visible = false
240+ leftEdgeDemo.visible = false;
241+ shell.hideEdgeDemo();
242+ }
220 }
243 }
221 }
244 }
222 }
245 }
@@ -408,6 +431,7 @@ FocusScope {
408 Component.onCompleted: {
431 Component.onCompleted: {
409 if (LightDM.Users.count == 1) {
432 if (LightDM.Users.count == 1) {
410 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
433 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
434+ greeter.selected(0)
411 }
435 }
412 }
436 }
413 }
437 }
@@ -452,6 +476,7 @@ FocusScope {
452 // If there are more users, the Greeter will handle that
476 // If there are more users, the Greeter will handle that
453 if (LightDM.Users.count == 1) {
477 if (LightDM.Users.count == 1) {
454 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
478 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
479+ greeter.selected(0);
455 }
480 }
456 greeter.forceActiveFocus();
481 greeter.forceActiveFocus();
457 // FIXME: *FocusedApplication are not updated when unfocused, hence the need to check whether
482 // FIXME: *FocusedApplication are not updated when unfocused, hence the need to check whether
@@ -473,8 +498,12 @@ FocusScope {
473
498
474 onUnlocked: greeter.hide()
499 onUnlocked: greeter.hide()
475 onSelected: {
500 onSelected: {
501+ // Update background
476 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
502 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
477 shell.background = bgPath ? bgPath : default_background
503 shell.background = bgPath ? bgPath : default_background
504+ // Update edge demo hint
505+ var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
506+ shell.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
478 }
507 }
479
508
480 onLeftTeaserPressedChanged: {
509 onLeftTeaserPressedChanged: {
@@ -487,14 +516,24 @@ FocusScope {
487 id: rightEdgeDemo
516 id: rightEdgeDemo
488
517
489 edge: "right"
518 edge: "right"
490− title: "Right edge"
519+ title: i18n.tr("Right edge")
491− text: "Try swiping from the right edge to unlock the phone"
520+ text: i18n.tr("Try swiping from the right edge to unlock the phone")
492 anchors.fill: parent
521 anchors.fill: parent
522+ enabled: shell.showEdgeDemoInGreeter
523+ onSkip: {
524+ shell.hideEdgeDemoInGreeter()
525+ shell.hideEdgeDemo()
526+ }
493
527
494 Connections {
528 Connections {
495 target: greeter
529 target: greeter
496 onUnlocked: rightEdgeDemo.visible = false
530 onUnlocked: rightEdgeDemo.visible = false
531+ onShownChanged: {
532+ if (!greeter.shown) {
497− onShownChanged: if (!greeter.shown) rightEdgeDemo.visible = false
533+ rightEdgeDemo.visible = false
534+ shell.hideEdgeDemoInGreeter()
535+ }
536+ }
498 }
537 }
499 }
538 }
500 }
539 }
@@ -529,10 +568,12 @@ FocusScope {
529 id: bottomEdgeDemo
568 id: bottomEdgeDemo
530
569
531 edge: "bottom"
570 edge: "bottom"
532− title: "Close"
571+ title: i18n.tr("Close")
533− text: "Swipe up again to close the settings screen"
572+ text: i18n.tr("Swipe up again to close the settings screen")
534 anchors.fill: panel.indicators
573 anchors.fill: panel.indicators
535 visible: false
574 visible: false
575+ enabled: shell.showEdgeDemo
576+ onSkip: shell.hideEdgeDemo()
536
577
537 Connections {
578 Connections {
538 target: panel.indicators
579 target: panel.indicators
plugins/AccountsService/CMakeLists.txt−1
@@ -9,7 +9,6 @@ add_library(AccountsService-qml MODULE
9
9
10qt5_use_modules(AccountsService-qml DBus Qml)
10qt5_use_modules(AccountsService-qml DBus Qml)
11
11
12−export_qmlfiles(AccountsService AccountsService)
13export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
12export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
14
13
15set(POLICYKIT_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
14set(POLICYKIT_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")