on xenial help sign in
Hook up AccountsService; fix top and left skip buttons not working
commit889e2a55000b06ffb03067b7582acfde314740dd authorMichael Terry <michael.terry@canonical.com> dateTue 30 Jul 2013, 10:59 (13 years ago) parent862b2da
4 files changed+92−53
Components/DemoOverlay.qml+11−16 Greeter/Greeter.qml+6−2 Shell.qml+75−34 plugins/AccountsService/CMakeLists.txt−1
Components/DemoOverlay.qml+11−16
@@ -16,7 +16,6 @@
1616
1717import QtQuick 2.0
1818import QtGraphicalEffects 1.0
19−import GSettings 1.0
2019import Ubuntu.Application 0.1
2120import Ubuntu.Components 0.1
2221
@@ -38,26 +37,24 @@ Item {
3837 */
3938 property string text
4039
40+ /*
41+ * Whether this demo is even enabled at all.
42+ */
43+ property bool enabled: true
44+
4145 property color __orange: Qt.hsla(16.0/360.0, 0.83, 0.47, 1.0)
4246 property color __orange_transparent: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4)
4347 property int __edge_margin: units.gu(4)
4448 property int __text_margin: units.gu(3)
4549
46− function __isDemoSkipped() {
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− }
50+ signal skip()
5551
5652 Rectangle {
5753 id: backgroundShade
5854 anchors.fill: parent
5955 color: "black"
6056 opacity: 0.8
57+ visible: overlay.enabled
6158 }
6259
6360 Item {
@@ -66,6 +63,7 @@ Item {
6663 y: 0
6764 width: parent.width
6865 height: parent.height
66+ visible: overlay.enabled
6967
7068 Column {
7169 id: labelGroup
@@ -82,7 +80,6 @@ Item {
8280 Label {
8381 id: titleLabel
8482 text: overlay.title
85− color: "#B7B3AC"
8683 fontSize: "x-large"
8784 width: units.gu(25)
8885 wrapMode: Text.WordWrap
@@ -91,7 +88,6 @@ Item {
9188 Label {
9289 id: textLabel
9390 text: overlay.text
94− color: "#B7B3AC"
9591 width: units.gu(25)
9692 wrapMode: Text.WordWrap
9793 }
@@ -106,9 +102,8 @@ Item {
106102 MouseArea {
107103 anchors.fill: parent
108104 onClicked: {
109− console.log("Clicked!");
110− __setDemoSkipped();
111− overlay.visible = false;
105+ overlay.enabled = false;
106+ skip();
112107 }
113108 }
114109 }
@@ -156,7 +151,7 @@ Item {
156151
157152 SequentialAnimation {
158153 id: wholeAnimation
159− running: overlay.visible
154+ running: overlay.visible && overlay.enabled
160155
161156 ParallelAnimation {
162157 id: fadeInAnimation
Greeter/Greeter.qml+6−2
@@ -44,6 +44,8 @@ Showable {
4444 readonly property bool rightTeaserPressed: greeterContentLoader.status == Loader.Ready &&
4545 greeterContentLoader.item.rightTeaserPressed
4646
47+ readonly property int currentIndex: greeterContentLoader.currentIndex
48+
4749 signal selected(int uid)
4850 signal unlocked(int uid)
4951
@@ -64,11 +66,13 @@ Showable {
6466
6567 source: required ? "GreeterContent.qml" : ""
6668
67−
6869 Connections {
6970 target: greeterContentLoader.item
7071
71− onSelected: greeter.selected(uid);
72+ onSelected: {
73+ greeter.selected(uid);
74+ greeterContentLoader.currentIndex = uid;
75+ }
7276 onUnlocked: greeter.unlocked(uid);
7377 }
7478 }
Shell.qml+75−34
@@ -19,6 +19,7 @@ import Ubuntu.Application 0.1
1919import Ubuntu.Components 0.1
2020import Ubuntu.Gestures 0.1
2121import LightDM 0.1 as LightDM
22+import AccountsService 0.1
2223import "Dash"
2324import "Greeter"
2425import "Launcher"
@@ -57,6 +58,19 @@ FocusScope {
5758 }
5859 }
5960
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+
6074 property ListModel searchHistory: SearchHistoryModel {}
6175
6276 property var applicationManager: ApplicationManagerWrapper {}
@@ -179,44 +193,53 @@ FocusScope {
179193 // FIXME: only necessary because stagesRevealer.animatedProgress and
180194 // greeterRevealer.animatedProgress are not animated
181195 Behavior on disappearingAnimationProgress { SmoothedAnimation { velocity: 5 }}
196+ }
182197
183− DemoOverlay {
184− id: topEdgeDemo
198+ DemoOverlay {
199+ id: topEdgeDemo
185200
186− edge: "top"
187− title: "Top edge"
188− text: "Try swiping from the top edge to access the indicators"
189− anchors.fill: parent
190− visible: false
201+ edge: "top"
202+ title: i18n.tr("Top edge")
203+ text: i18n.tr("Try swiping from the top edge to access the indicators")
204+ anchors.fill: dash
205+ visible: false
206+ enabled: shell.showEdgeDemo
207+ onSkip: shell.hideEdgeDemo()
191208
192− Connections {
193− target: greeter
194− onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
195− }
209+ Connections {
210+ target: greeter
211+ onShownChanged: if (!greeter.shown) topEdgeDemo.visible = true
212+ }
196213
197− Connections {
198− target: panel.indicators
199− onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.visible = false
200− }
214+ Connections {
215+ target: panel.indicators
216+ onFullyOpenedChanged: if (panel.indicators.fullyOpened) topEdgeDemo.visible = false
201217 }
218+ }
202219
203− DemoOverlay {
204− id: leftEdgeDemo
220+ DemoOverlay {
221+ id: leftEdgeDemo
205222
206− edge: "left"
207− title: "Left edge"
208− text: "Swipe from the left to reveal the launcher for quick access to apps"
209− anchors.fill: parent
210− visible: false
223+ edge: "left"
224+ title: i18n.tr("Left edge")
225+ text: i18n.tr("Swipe from the left to reveal the launcher for quick access to apps")
226+ anchors.fill: dash
227+ visible: false
228+ enabled: shell.showEdgeDemo
229+ onSkip: shell.hideEdgeDemo()
211230
212− Connections {
213− target: bottomEdgeDemo
214− onVisibleChanged: if (!bottomEdgeDemo.visible) leftEdgeDemo.visible = true
215− }
231+ Connections {
232+ target: bottomEdgeDemo
233+ onVisibleChanged: if (!bottomEdgeDemo.visible) leftEdgeDemo.visible = true
234+ }
216235
217− Connections {
218− target: launcher
219− onProgressChanged: if (launcher.progress >= 1.0) leftEdgeDemo.visible = false
236+ Connections {
237+ target: launcher
238+ onProgressChanged: {
239+ if (launcher.progress >= 1.0) {
240+ leftEdgeDemo.visible = false;
241+ shell.hideEdgeDemo();
242+ }
220243 }
221244 }
222245 }
@@ -408,6 +431,7 @@ FocusScope {
408431 Component.onCompleted: {
409432 if (LightDM.Users.count == 1) {
410433 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
434+ greeter.selected(0)
411435 }
412436 }
413437 }
@@ -452,6 +476,7 @@ FocusScope {
452476 // If there are more users, the Greeter will handle that
453477 if (LightDM.Users.count == 1) {
454478 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
479+ greeter.selected(0);
455480 }
456481 greeter.forceActiveFocus();
457482 // FIXME: *FocusedApplication are not updated when unfocused, hence the need to check whether
@@ -473,8 +498,12 @@ FocusScope {
473498
474499 onUnlocked: greeter.hide()
475500 onSelected: {
501+ // Update background
476502 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
477503 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")
478507 }
479508
480509 onLeftTeaserPressedChanged: {
@@ -487,14 +516,24 @@ FocusScope {
487516 id: rightEdgeDemo
488517
489518 edge: "right"
490− title: "Right edge"
491− text: "Try swiping from the right edge to unlock the phone"
519+ title: i18n.tr("Right edge")
520+ text: i18n.tr("Try swiping from the right edge to unlock the phone")
492521 anchors.fill: parent
522+ enabled: shell.showEdgeDemoInGreeter
523+ onSkip: {
524+ shell.hideEdgeDemoInGreeter()
525+ shell.hideEdgeDemo()
526+ }
493527
494528 Connections {
495529 target: greeter
496530 onUnlocked: rightEdgeDemo.visible = false
497− onShownChanged: if (!greeter.shown) rightEdgeDemo.visible = false
531+ onShownChanged: {
532+ if (!greeter.shown) {
533+ rightEdgeDemo.visible = false
534+ shell.hideEdgeDemoInGreeter()
535+ }
536+ }
498537 }
499538 }
500539 }
@@ -529,10 +568,12 @@ FocusScope {
529568 id: bottomEdgeDemo
530569
531570 edge: "bottom"
532− title: "Close"
533− text: "Swipe up again to close the settings screen"
571+ title: i18n.tr("Close")
572+ text: i18n.tr("Swipe up again to close the settings screen")
534573 anchors.fill: panel.indicators
535574 visible: false
575+ enabled: shell.showEdgeDemo
576+ onSkip: shell.hideEdgeDemo()
536577
537578 Connections {
538579 target: panel.indicators
plugins/AccountsService/CMakeLists.txt−1
@@ -9,7 +9,6 @@ add_library(AccountsService-qml MODULE
99
1010qt5_use_modules(AccountsService-qml DBus Qml)
1111
12−export_qmlfiles(AccountsService AccountsService)
1312export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
1413
1514set(POLICYKIT_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")