@@ -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 {
61+ property bool showEdgeDemo: true
62+ property bool showEdgeDemoInGreeter: showEdgeDemo //AccountsService.getUserProperty("lightdm", "demo-edges")
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;
69+ function hideEdgeDemoInGreeter() {
70+ //AccountsService.setUserProperty("lightdm", "demo-edges", false);
71+ shell.showEdgeDemoInGreeter = false;
60 property ListModel searchHistory: SearchHistoryModel {}
74 property ListModel searchHistory: SearchHistoryModel {}
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 }}
183− DemoOverlay {
198+ DemoOverlay {
184− id: topEdgeDemo
199+ id: topEdgeDemo
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()
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
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
203− DemoOverlay {
220+ DemoOverlay {
204− id: leftEdgeDemo
221+ id: leftEdgeDemo
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()
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
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();
@@ -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))
@@ -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);
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 {
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")
480 onLeftTeaserPressedChanged: {
509 onLeftTeaserPressedChanged: {
@@ -487,14 +516,24 @@ FocusScope {
487 id: rightEdgeDemo
516 id: rightEdgeDemo
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
524+ shell.hideEdgeDemoInGreeter()
525+ shell.hideEdgeDemo()
494 Connections {
528 Connections {
495 target: greeter
529 target: greeter
496 onUnlocked: rightEdgeDemo.visible = false
530 onUnlocked: rightEdgeDemo.visible = false
532+ if (!greeter.shown) {
497− onShownChanged: if (!greeter.shown) rightEdgeDemo.visible = false
533+ rightEdgeDemo.visible = false
534+ shell.hideEdgeDemoInGreeter()
@@ -529,10 +568,12 @@ FocusScope {
529 id: bottomEdgeDemo
568 id: bottomEdgeDemo
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()
537 Connections {
578 Connections {
538 target: panel.indicators
579 target: panel.indicators