@@ -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