on xenial help sign in
Implement edge demos on first boot.
69aaebeMichael Terry
Components/EdgeDemo.qmlnew file+231
@@ -0,0 +1,231 @@
1+/*
2+ * Copyright (C) 2013 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 AccountsService 0.1
18+import LightDM 0.1 as LightDM
19+import QtQuick 2.0
20+
21+Item {
22+ id: demo
23+
24+ property Item greeter
25+ property Item dash
26+ property Item launcher
27+ property Item indicators
28+ property Item underlay
29+
30+ property bool launcherEnabled: true
31+ property bool dashEnabled: true
32+ property bool panelEnabled: true
33+ property bool panelContentEnabled: true
34+
35+ property bool paused: false
36+
37+ onPausedChanged: {
38+ if (d.rightEdgeDemo) d.rightEdgeDemo.paused = paused
39+ if (d.topEdgeDemo) d.topEdgeDemo.paused = paused
40+ if (d.bottomEdgeDemo) d.bottomEdgeDemo.paused = paused
41+ if (d.leftEdgeDemo) d.leftEdgeDemo.paused = paused
42+ if (d.finalEdgeDemo) d.finalEdgeDemo.paused = paused
43+ }
44+
45+ function hideEdgeDemoInShell() {
46+ var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole);
47+ AccountsService.setUserProperty(user, "demo-edges", false);
48+ d.showEdgeDemo = false;
49+ stopDemo();
50+ }
51+
52+ function hideEdgeDemoInGreeter() {
53+ // TODO: AccountsService.setUserProperty("lightdm", "demo-edges", false);
54+ d.showEdgeDemoInGreeter = false;
55+ }
56+
57+ function hideEdgeDemos() {
58+ hideEdgeDemoInGreeter();
59+ hideEdgeDemoInShell();
60+ }
61+
62+ function stopDemo() {
63+ launcherEnabled = true
64+ dashEnabled = true
65+ panelEnabled = true
66+ panelContentEnabled = true
67+ if (d.rightEdgeDemo) d.rightEdgeDemo.destroy()
68+ if (d.topEdgeDemo) d.topEdgeDemo.destroy()
69+ if (d.bottomEdgeDemo) d.bottomEdgeDemo.destroy()
70+ if (d.leftEdgeDemo) d.leftEdgeDemo.destroy()
71+ if (d.finalEdgeDemo) d.finalEdgeDemo.destroy()
72+ }
73+
74+ QtObject {
75+ id: d
76+ property Component overlay
77+ property QtObject rightEdgeDemo
78+ property QtObject topEdgeDemo
79+ property QtObject bottomEdgeDemo
80+ property QtObject leftEdgeDemo
81+ property QtObject finalEdgeDemo
82+ property bool showEdgeDemo: false
83+ property bool showEdgeDemoInGreeter: d.showEdgeDemo // TODO: AccountsService.getUserProperty("lightdm", "demo-edges")
84+
85+ onShowEdgeDemoInGreeterChanged: {
86+ if (!d.overlay && d.showEdgeDemoInGreeter) {
87+ d.overlay = Qt.createComponent("EdgeDemoOverlay.qml")
88+ startRightEdgeDemo()
89+ }
90+ }
91+ }
92+
93+ function startRightEdgeDemo() {
94+ launcherEnabled = false;
95+ demo.dashEnabled = false;
96+ demo.panelEnabled = false;
97+ demo.panelContentEnabled = false;
98+ if (demo.greeter) {
99+ d.rightEdgeDemo = d.overlay.createObject(demo.greeter, {
100+ "edge": "right",
101+ "title": i18n.tr("Right edge"),
102+ "text": i18n.tr("Try swiping from the right edge to unlock the phone"),
103+ "anchors.fill": demo.greeter,
104+ });
105+ }
106+ if (d.rightEdgeDemo) {
107+ d.rightEdgeDemo.onSkip.connect(demo.hideEdgeDemos)
108+ } else {
109+ stopDemo();
110+ }
111+ }
112+
113+ Connections {
114+ target: demo.greeter
115+
116+ function hide() {
117+ if (d.rightEdgeDemo && d.rightEdgeDemo.available) {
118+ d.rightEdgeDemo.hide()
119+ hideEdgeDemoInGreeter()
120+ startTopEdgeDemo()
121+ }
122+ }
123+
124+ onUnlocked: hide()
125+ onShownChanged: if (!greeter.shown) hide()
126+
127+ onSelected: {
128+ var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
129+ d.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
130+ }
131+ }
132+
133+ function startTopEdgeDemo() {
134+ demo.panelEnabled = true;
135+ if (demo.dash && demo.underlay) {
136+ d.topEdgeDemo = d.overlay.createObject(demo.underlay, {
137+ "edge": "top",
138+ "title": i18n.tr("Top edge"),
139+ "text": i18n.tr("Try swiping from the top edge to access the indicators"),
140+ "anchors.fill": demo.dash,
141+ });
142+ }
143+ if (d.topEdgeDemo) {
144+ d.topEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
145+ } else {
146+ stopDemo();
147+ }
148+ }
149+
150+ Connections {
151+ target: demo.indicators
152+ onFullyOpenedChanged: {
153+ if (d.topEdgeDemo && d.topEdgeDemo.available && demo.indicators.fullyOpened) {
154+ d.topEdgeDemo.hideNow()
155+ startBottomEdgeDemo()
156+ }
157+ }
158+ }
159+
160+ function startBottomEdgeDemo() {
161+ if (demo.indicators) {
162+ d.bottomEdgeDemo = d.overlay.createObject(demo.indicators, {
163+ "edge": "bottom",
164+ "title": i18n.tr("Close"),
165+ "text": i18n.tr("Swipe up again to close the settings screen"),
166+ "anchors.fill": demo.indicators,
167+ });
168+ }
169+ if (d.bottomEdgeDemo) {
170+ d.bottomEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
171+ } else {
172+ stopDemo();
173+ }
174+ }
175+
176+ Connections {
177+ target: demo.indicators
178+ onPartiallyOpenedChanged: {
179+ if (d.bottomEdgeDemo && d.bottomEdgeDemo.available && !demo.indicators.partiallyOpened && !demo.indicators.fullyOpened) {
180+ d.bottomEdgeDemo.hideNow()
181+ startLeftEdgeDemo()
182+ }
183+ }
184+ }
185+
186+ function startLeftEdgeDemo() {
187+ demo.panelEnabled = false;
188+ demo.launcherEnabled = true;
189+ if (demo.dash && demo.underlay) {
190+ d.leftEdgeDemo = d.overlay.createObject(demo.underlay, {
191+ "edge": "left",
192+ "title": i18n.tr("Left edge"),
193+ "text": i18n.tr("Swipe from the left to reveal the launcher for quick access to apps"),
194+ "anchors.fill": demo.dash,
195+ });
196+ }
197+ if (d.leftEdgeDemo) {
198+ d.leftEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
199+ } else {
200+ stopDemo();
201+ }
202+ }
203+
204+ Connections {
205+ target: demo.launcher
206+ onStateChanged: {
207+ if (d.leftEdgeDemo && d.leftEdgeDemo.available && launcher.state == "visible") {
208+ d.leftEdgeDemo.hide()
209+ launcher.hide()
210+ startFinalEdgeDemo()
211+ }
212+ }
213+ }
214+
215+ function startFinalEdgeDemo() {
216+ demo.launcherEnabled = false;
217+ if (demo.dash && demo.underlay) {
218+ d.finalEdgeDemo = d.overlay.createObject(demo.underlay, {
219+ "edge": "none",
220+ "title": i18n.tr("Well done"),
221+ "text": i18n.tr("You have now mastered the edge gestures and can start using the phone"),
222+ "anchors.fill": demo.dash,
223+ });
224+ }
225+ if (d.finalEdgeDemo) {
226+ d.finalEdgeDemo.onSkip.connect(demo.hideEdgeDemoInShell)
227+ } else {
228+ stopDemo();
229+ }
230+ }
231+}
Components/EdgeDemoOverlay.qmlnew file+256
@@ -0,0 +1,256 @@
1+/*
2+ * Copyright (C) 2013 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 Powerd 0.1
18+import QtQuick 2.0
19+import QtGraphicalEffects 1.0
20+import Ubuntu.Application 0.1
21+import Ubuntu.Components 0.1
22+
23+Showable {
24+ id: overlay
25+
26+ /*
27+ * Valid values are "left", "right", "top", "bottom", or "none".
28+ */
29+ property string edge: "top"
30+
31+ /*
32+ * This is the header displayed, like "Right edge".
33+ */
34+ property alias title: titleLabel.text
35+
36+ /*
37+ * This is the block of text displayed below the header.
38+ */
39+ property alias text: textLabel.text
40+
41+ /*
42+ * This is the text for the skip button.
43+ */
44+ property alias skipText: skipLabel.text
45+
46+ /*
47+ * Whether this demo is running currently.
48+ */
49+ readonly property bool active: available && visible
50+
51+ /*
52+ * Whether animations are paused.
53+ */
54+ property alias paused: wholeAnimation.paused
55+
56+ /*
57+ * Whether animations are running.
58+ */
59+ readonly property alias running: wholeAnimation.running
60+
61+ signal skip()
62+
63+ function doSkip() {
64+ d.skipOnHide = true;
65+ hide();
66+ }
67+
68+ function hideNow() {
69+ overlay.visible = false;
70+ overlay.available = false;
71+ if (d.skipOnHide) {
72+ overlay.skip();
73+ }
74+ }
75+
76+ showAnimation: StandardAnimation {
77+ property: "opacity"
78+ to: 1
79+ onRunningChanged: if (running) overlay.visible = true
80+ }
81+ hideAnimation: StandardAnimation {
82+ property: "opacity"
83+ to: 0
84+ duration: UbuntuAnimation.BriskDuration
85+ onRunningChanged: if (!running) overlay.hideNow()
86+ }
87+
88+ QtObject {
89+ id: d
90+ property bool skipOnHide: false
91+ property int edgeMargin: units.gu(4)
92+ }
93+
94+ Rectangle {
95+ objectName: "backgroundShade"
96+
97+ anchors.fill: parent
98+ color: "black"
99+ opacity: 0.8
100+ visible: overlay.active
101+
102+ MouseArea {
103+ anchors.fill: parent
104+ enabled: overlay.edge == "none" && overlay.opacity == 1.0
105+ onClicked: overlay.doSkip()
106+ }
107+ }
108+
109+ Item {
110+ id: hintGroup
111+ x: 0
112+ y: 0
113+ width: parent.width
114+ height: parent.height
115+ visible: overlay.active
116+
117+ Column {
118+ id: labelGroup
119+ layer.enabled: true // otherwise the underlining on "Skip intro" jumps
120+ spacing: units.gu(3)
121+
122+ anchors {
123+ margins: d.edgeMargin
124+ left: parent.left
125+ top: overlay.edge == "bottom" ? undefined : parent.top
126+ bottom: overlay.edge == "bottom" ? parent.bottom : undefined
127+ }
128+
129+ Label {
130+ id: titleLabel
131+ fontSize: "x-large"
132+ width: units.gu(25)
133+ wrapMode: Text.WordWrap
134+ }
135+
136+ Label {
137+ id: textLabel
138+ width: units.gu(25)
139+ wrapMode: Text.WordWrap
140+ }
141+
142+ Label {
143+ id: skipLabel
144+ objectName: "skipLabel"
145+ text: i18n.tr("Skip intro")
146+ color: UbuntuColors.orange
147+ fontSize: "small"
148+ font.underline: true
149+
150+ MouseArea {
151+ anchors.fill: parent
152+ onClicked: overlay.doSkip()
153+ }
154+ }
155+ }
156+
157+ LinearGradient {
158+ id: edgeHint
159+ property int size: 1
160+ cached: false
161+ visible: overlay.edge != "none"
162+ gradient: Gradient {
163+ GradientStop {
164+ position: 0.0
165+ color: Qt.hsla(16.0/360.0, 0.83, 0.47, 0.4) // UbuntuColors.orange, but transparent
166+ }
167+ GradientStop {
168+ position: 1.0
169+ color: "transparent"
170+ }
171+ }
172+ anchors.fill: parent
173+ start: {
174+ if (overlay.edge == "right") {
175+ return Qt.point(width, 0);
176+ } else if (overlay.edge == "left") {
177+ return Qt.point(0, 0);
178+ } else if (overlay.edge == "top") {
179+ return Qt.point(0, 0);
180+ } else {
181+ return Qt.point(0, height);
182+ }
183+ }
184+ end: {
185+ if (overlay.edge == "right") {
186+ return Qt.point(width - size, 0);
187+ } else if (overlay.edge == "left") {
188+ return Qt.point(size, 0);
189+ } else if (overlay.edge == "top") {
190+ return Qt.point(0, size);
191+ } else {
192+ return Qt.point(0, height - size);
193+ }
194+ }
195+ }
196+ }
197+
198+ SequentialAnimation {
199+ id: wholeAnimation
200+ objectName: "wholeAnimation"
201+ running: overlay.active
202+
203+ ParallelAnimation {
204+ id: fadeInAnimation
205+
206+ StandardAnimation {
207+ target: labelGroup
208+ property: {
209+ if (overlay.edge == "right" || overlay.edge == "left") {
210+ return "anchors.leftMargin";
211+ } else if (overlay.edge == "bottom") {
212+ return "anchors.bottomMargin";
213+ } else {
214+ return "anchors.topMargin";
215+ }
216+ }
217+ from: {
218+ if (overlay.edge == "right") {
219+ return d.edgeMargin + units.gu(3)
220+ } else {
221+ return d.edgeMargin - units.gu(3)
222+ }
223+ }
224+ to: d.edgeMargin
225+ duration: overlay.edge == "none" ? 0 : UbuntuAnimation.SleepyDuration
226+ }
227+ StandardAnimation {
228+ target: overlay
229+ property: "opacity"
230+ from: 0.0
231+ to: 1.0
232+ duration: UbuntuAnimation.SleepyDuration
233+ }
234+ }
235+
236+ SequentialAnimation {
237+ id: hintAnimation
238+ loops: Animation.Infinite
239+ property string prop: (overlay.edge == "left" || overlay.edge == "right") ? "x" : "y"
240+ property double endVal: units.dp(5) * ((overlay.edge == "left" || overlay.edge == "top") ? 1 : -1)
241+ property double maxGlow: units.dp(20)
242+ property int duration: overlay.edge == "none" ? 0 : UbuntuAnimation.SleepyDuration
243+
244+ ParallelAnimation {
245+ StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: 0; to: hintAnimation.endVal; duration: hintAnimation.duration }
246+ StandardAnimation { target: edgeHint; property: "size"; from: 1; to: hintAnimation.maxGlow; duration: hintAnimation.duration }
247+ }
248+
249+ // Undo the above
250+ ParallelAnimation {
251+ StandardAnimation { target: hintGroup; property: hintAnimation.prop; from: hintAnimation.endVal; to: 0; duration: hintAnimation.duration }
252+ StandardAnimation { target: edgeHint; property: "size"; from: hintAnimation.maxGlow; to: 1; duration: hintAnimation.duration }
253+ }
254+ }
255+ }
256+}
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
@@ -63,11 +65,13 @@ Showable {
63
65
64 source: required ? "GreeterContent.qml" : ""
66 source: required ? "GreeterContent.qml" : ""
65
67
66−
67 Connections {
68 Connections {
68 target: greeterContentLoader.item
69 target: greeterContentLoader.item
69
70
71+ onSelected: {
70− onSelected: greeter.selected(uid);
72+ greeter.selected(uid);
73+ greeterContentLoader.currentIndex = uid;
74+ }
71 onUnlocked: greeter.unlocked(uid);
75 onUnlocked: greeter.unlocked(uid);
72 }
76 }
73 }
77 }
Launcher/Launcher.qml+1
@@ -145,6 +145,7 @@ Item {
145 LauncherPanel {
145 LauncherPanel {
146 id: panel
146 id: panel
147 objectName: "launcherPanel"
147 objectName: "launcherPanel"
148+ enabled: root.available
148 width: root.panelWidth
149 width: root.panelWidth
149 anchors {
150 anchors {
150 top: parent.top
151 top: parent.top
Panel/Indicators.qml+4−2
@@ -34,6 +34,7 @@ Showable {
34 property bool fullyOpened: height == openedHeight
34 property bool fullyOpened: height == openedHeight
35 property bool partiallyOpened: height > panelHeight && !fullyOpened
35 property bool partiallyOpened: height > panelHeight && !fullyOpened
36 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
36 property real visualBottom: Math.max(y+height, y+indicatorRow.y+indicatorRow.height)
37+ property bool contentEnabled: true
37
38
38 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
39 // TODO: Perhaps we need a animation standard for showing/hiding? Each showable seems to
39 // use its own values. Need to ask design about this.
40 // use its own values. Need to ask design about this.
@@ -178,6 +179,7 @@ Showable {
178 indicatorsModel: indicatorsModel
179 indicatorsModel: indicatorsModel
179 clip: !indicators.fullyOpened
180 clip: !indicators.fullyOpened
180 activeHeader: indicators.state == "hint" || indicators.state == "reveal"
181 activeHeader: indicators.state == "hint" || indicators.state == "reveal"
182+ enabled: contentEnabled
181
183
182 Connections {
184 Connections {
183 target: indicatorRow
185 target: indicatorRow
@@ -301,7 +303,7 @@ Showable {
301 anchors.right: parent.right
303 anchors.right: parent.right
302 height: panelHeight
304 height: panelHeight
303 direction: Direction.Downwards
305 direction: Direction.Downwards
304− enabled: !indicators.shown
306+ enabled: !indicators.shown && indicators.available
305 hintDisplacement: pinnedMode ? indicators.hintValue : 0
307 hintDisplacement: pinnedMode ? indicators.hintValue : 0
306 autoCompleteDragThreshold: maxTotalDragDistance / 2
308 autoCompleteDragThreshold: maxTotalDragDistance / 2
307 stretch: true
309 stretch: true
@@ -318,7 +320,7 @@ Showable {
318 id: hideDragHandle
320 id: hideDragHandle
319 anchors.fill: handle
321 anchors.fill: handle
320 direction: Direction.Upwards
322 direction: Direction.Upwards
321− enabled: indicators.shown
323+ enabled: indicators.shown && indicators.available
322 hintDisplacement: indicators.hintValue
324 hintDisplacement: indicators.hintValue
323 autoCompleteDragThreshold: maxTotalDragDistance / 6
325 autoCompleteDragThreshold: maxTotalDragDistance / 6
324 stretch: true
326 stretch: true
Shell.qml+24−3
@@ -195,7 +195,7 @@ FocusScope {
195 available: !greeter.shown && !lockscreen.shown
195 available: !greeter.shown && !lockscreen.shown
196 hides: [stages, launcher, panel.indicators]
196 hides: [stages, launcher, panel.indicators]
197 shown: disappearingAnimationProgress !== 1.0
197 shown: disappearingAnimationProgress !== 1.0
198− enabled: disappearingAnimationProgress === 0.0
198+ enabled: disappearingAnimationProgress === 0.0 && edgeDemo.dashEnabled
199 // FIXME: unfocus all applications when going back to the dash
199 // FIXME: unfocus all applications when going back to the dash
200 onEnabledChanged: {
200 onEnabledChanged: {
201 if (enabled) {
201 if (enabled) {
@@ -386,6 +386,7 @@ FocusScope {
386
386
387 width: shell.edgeSize
387 width: shell.edgeSize
388 direction: Direction.Leftwards
388 direction: Direction.Leftwards
389+ enabled: edgeDemo.dashEnabled
389 property bool haveApps: mainStage.applications.count > 0 || sideStage.applications.count > 0
390 property bool haveApps: mainStage.applications.count > 0 || sideStage.applications.count > 0
390
391
391 maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
392 maxTotalDragDistance: haveApps ? parent.width : parent.width * 0.7
@@ -414,6 +415,7 @@ FocusScope {
414 Component.onCompleted: {
415 Component.onCompleted: {
415 if (LightDM.Users.count == 1) {
416 if (LightDM.Users.count == 1) {
416 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
417 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole))
418+ greeter.selected(0)
417 }
419 }
418 }
420 }
419 }
421 }
@@ -456,6 +458,7 @@ FocusScope {
456 // If there are more users, the Greeter will handle that
458 // If there are more users, the Greeter will handle that
457 if (LightDM.Users.count == 1) {
459 if (LightDM.Users.count == 1) {
458 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
460 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
461+ greeter.selected(0);
459 }
462 }
460 greeter.forceActiveFocus();
463 greeter.forceActiveFocus();
461 }
464 }
@@ -510,6 +513,13 @@ FocusScope {
510 } else if (status == Powerd.On) {
513 } else if (status == Powerd.On) {
511 powerConnection.setFocused(true);
514 powerConnection.setFocused(true);
512 }
515 }
516+
517+ // No reason to chew demo CPU when user isn't watching
518+ if (status == Powerd.Off) {
519+ edgeDemo.paused = true;
520+ } else if (status == Powerd.On) {
521+ edgeDemo.paused = false;
522+ }
513 }
523 }
514 }
524 }
515
525
@@ -524,6 +534,8 @@ FocusScope {
524 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
534 indicatorsMenuWidth: parent.width > units.gu(60) ? units.gu(40) : parent.width
525 indicators {
535 indicators {
526 hides: [launcher]
536 hides: [launcher]
537+ available: edgeDemo.panelEnabled
538+ contentEnabled: edgeDemo.panelContentEnabled
527 }
539 }
528 fullscreenMode: shell.fullscreenMode
540 fullscreenMode: shell.fullscreenMode
529 searchVisible: !greeter.shown && !lockscreen.shown
541 searchVisible: !greeter.shown && !lockscreen.shown
@@ -540,7 +552,7 @@ FocusScope {
540 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
552 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
541 height: parent.height
553 height: parent.height
542
554
543− available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown
555+ available: !greeter.shown && !panel.indicators.shown && !lockscreen.shown && edgeDemo.dashEnabled
544 shown: false
556 shown: false
545 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
557 showAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: 0; easing.type: Easing.Linear }
546 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
558 hideAnimation: StandardAnimation { property: "y"; duration: hud.showableAnimationDuration; to: hudRevealer.closedValue; easing.type: Easing.Linear }
@@ -598,7 +610,7 @@ FocusScope {
598 anchors.bottom: parent.bottom
610 anchors.bottom: parent.bottom
599 width: parent.width
611 width: parent.width
600 dragAreaWidth: shell.edgeSize
612 dragAreaWidth: shell.edgeSize
601− available: !greeter.shown || greeter.narrowMode
613+ available: (!greeter.shown || greeter.narrowMode) && edgeDemo.launcherEnabled
602 onDashItemSelected: {
614 onDashItemSelected: {
603 greeter.hide()
615 greeter.hide()
604 // Animate if moving between application and dash
616 // Animate if moving between application and dash
@@ -707,4 +719,13 @@ FocusScope {
707 rotation: -45
719 rotation: -45
708 scale: Math.min(parent.width, parent.height) / width
720 scale: Math.min(parent.width, parent.height) / width
709 }
721 }
722+
723+ EdgeDemo {
724+ id: edgeDemo
725+ greeter: greeter
726+ launcher: launcher
727+ dash: dash
728+ indicators: panel.indicators
729+ underlay: underlay
730+ }
710}
731}
debian/control+2
@@ -3,6 +3,7 @@ Section: x11
3Priority: optional
3Priority: optional
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
4Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
5Build-Depends: cmake,
5Build-Depends: cmake,
6+ dbus-test-runner,
6 debhelper (>= 9),
7 debhelper (>= 9),
7 libdee-qt5-dev (>= 3.2),
8 libdee-qt5-dev (>= 3.2),
8 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
9 libgl1-mesa-dev[!armhf] | libgl-dev[!armhf],
@@ -31,6 +32,7 @@ Build-Depends: cmake,
31 python3:any,
32 python3:any,
32 qt5-default,
33 qt5-default,
33 qtbase5-dev,
34 qtbase5-dev,
35+ qtbase5-dev-tools,
34 qtbase5-private-dev,
36 qtbase5-private-dev,
35 qtdeclarative5-dev,
37 qtdeclarative5-dev,
36 qtdeclarative5-dev-tools,
38 qtdeclarative5-dev-tools,
debian/rules+5
@@ -16,6 +16,11 @@ override_dh_auto_clean:
16 dh_auto_clean
16 dh_auto_clean
17 rm -rf builddir
17 rm -rf builddir
18
18
19+override_dh_auto_configure:
20+ # Debian defines CMAKE_INSTALL_LOCALSTATEDIR as /usr/var, which is wrong.
21+ # So until Debian bug 719148 is fixed, do it ourselves.
22+ dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var"
23+
19override_dh_install:
24override_dh_install:
20 # install autopilot tests
25 # install autopilot tests
21 cd tests/autopilot; \
26 cd tests/autopilot; \
debian/unity8-private.install+5
@@ -1,3 +1,4 @@
1+usr/lib/*/unity8/qml/AccountsService
1usr/lib/*/unity8/qml/HudClient
2usr/lib/*/unity8/qml/HudClient
2usr/lib/*/unity8/qml/LightDM
3usr/lib/*/unity8/qml/LightDM
3usr/lib/*/unity8/qml/ListViewWithPageHeader
4usr/lib/*/unity8/qml/ListViewWithPageHeader
@@ -5,3 +6,7 @@ usr/lib/*/unity8/qml/Powerd
5usr/lib/*/unity8/qml/Ubuntu
6usr/lib/*/unity8/qml/Ubuntu
6usr/lib/*/unity8/qml/Unity
7usr/lib/*/unity8/qml/Unity
7usr/lib/*/unity8/qml/Utils
8usr/lib/*/unity8/qml/Utils
9+usr/share/accountsservice/interfaces
10+usr/share/dbus-1/interfaces
11+usr/share/polkit-1
12+var/lib/polkit-1
plugins/AccountsService/50-com.canonical.unity.AccountsService.pklanew file+6
@@ -0,0 +1,6 @@
1+[Allow LightDM to set Unity AccountsService fields]
2+Identity=unix-user:lightdm
3+Action=com.canonical.unity.AccountsService.ModifyAnyUser
4+ResultActive=yes
5+ResultInactive=yes
6+ResultAny=yes
plugins/AccountsService/AccountsService.cppnew file+74
@@ -0,0 +1,74 @@
1+/*
2+ * Copyright (C) 2013 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+ * Author: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+#include "AccountsService.h"
20+#include <QDBusConnection>
21+#include <QDBusConnectionInterface>
22+#include <QDBusMessage>
23+#include <QDBusVariant>
24+
25+AccountsService::AccountsService(QObject* parent)
26+ : QObject(parent),
27+ accounts_manager(NULL),
28+ users()
29+{
30+ auto connection = QDBusConnection::SM_BUSNAME();
31+ auto interface = connection.interface();
32+ interface->startService("org.freedesktop.Accounts");
33+ accounts_manager = new QDBusInterface("org.freedesktop.Accounts",
34+ "/org/freedesktop/Accounts",
35+ "org.freedesktop.Accounts",
36+ connection, this);
37+}
38+
39+QVariant AccountsService::getUserProperty(const QString &user, const QString &property)
40+{
41+ auto iface = getUserInterface(user);
42+ if (iface != nullptr && iface->isValid()) {
43+ auto answer = iface->call("Get", "com.canonical.unity.AccountsService", property);
44+ if (answer.type() == QDBusMessage::ReplyMessage) {
45+ return answer.arguments()[0].value<QDBusVariant>().variant();
46+ }
47+ }
48+ return QVariant();
49+}
50+
51+void AccountsService::setUserProperty(const QString &user, const QString &property, const QVariant &value)
52+{
53+ auto iface = getUserInterface(user);
54+ if (iface != nullptr && iface->isValid()) {
55+ // The value needs to be carefully wrapped
56+ iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value)));
57+ }
58+}
59+
60+QDBusInterface *AccountsService::getUserInterface(const QString &user)
61+{
62+ auto iface = users.value(user);
63+ if (iface == nullptr && accounts_manager->isValid()) {
64+ auto answer = accounts_manager->call("FindUserByName", user);
65+ if (answer.type() == QDBusMessage::ReplyMessage) {
66+ iface = new QDBusInterface("org.freedesktop.Accounts",
67+ answer.arguments()[0].value<QDBusObjectPath>().path(),
68+ "org.freedesktop.DBus.Properties",
69+ accounts_manager->connection(), this);
70+ users.insert(user, iface);
71+ }
72+ }
73+ return iface;
74+}
plugins/AccountsService/AccountsService.hnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+#ifndef UNITY_ACCOUNTSSERVICE_H
20+#define UNITY_ACCOUNTSSERVICE_H
21+
22+#include <QDBusInterface>
23+#include <QMap>
24+#include <QObject>
25+#include <QString>
26+
27+class AccountsService: public QObject
28+{
29+ Q_OBJECT
30+
31+public:
32+ explicit AccountsService(QObject *parent = 0);
33+
34+ Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &property);
35+ Q_INVOKABLE void setUserProperty(const QString &user, const QString &property, const QVariant &value);
36+
37+private:
38+ QDBusInterface *getUserInterface(const QString &user);
39+
40+ QDBusInterface *accounts_manager;
41+ QMap<QString, QDBusInterface *> users;
42+};
43+
44+#endif
plugins/AccountsService/CMakeLists.txtnew file+36
@@ -0,0 +1,36 @@
1+include(Plugins)
2+
3+add_definitions(-DSM_BUSNAME=systemBus)
4+
5+add_library(AccountsService-qml MODULE
6+ AccountsService.cpp
7+ plugin.cpp
8+ )
9+
10+qt5_use_modules(AccountsService-qml DBus Qml)
11+
12+export_qmlfiles(AccountsService AccountsService)
13+export_qmlplugin(AccountsService 0.1 AccountsService TARGETS AccountsService-qml)
14+
15+set(POLKIT_LIB_DIR "${CMAKE_INSTALL_LOCALSTATEDIR}/lib/polkit-1")
16+set(POLKIT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/polkit-1")
17+set(DBUS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces")
18+set(ACCOUNTS_IFACE_DIR "${CMAKE_INSTALL_PREFIX}/share/accountsservice/interfaces")
19+
20+install(FILES com.canonical.unity.AccountsService.xml
21+ DESTINATION "${DBUS_IFACE_DIR}"
22+ )
23+
24+# Create accountsservice symlink for above dbus interface
25+install(CODE "
26+execute_process(COMMAND mkdir -p \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
27+execute_process(COMMAND ln -sf ../../dbus-1/interfaces/com.canonical.unity.AccountsService.xml \"\$ENV{DESTDIR}${ACCOUNTS_IFACE_DIR}\")
28+ ")
29+
30+install(FILES com.canonical.unity.AccountsService.policy
31+ DESTINATION "${POLKIT_DATA_DIR}/actions"
32+ )
33+
34+install(FILES 50-com.canonical.unity.AccountsService.pkla
35+ DESTINATION "${POLKIT_LIB_DIR}/localauthority/10-vendor.d"
36+ )
plugins/AccountsService/com.canonical.unity.AccountsService.policynew file+24
@@ -0,0 +1,24 @@
1+<?xml version="1.0" encoding="UTF-8"?>
2+
3+<policyconfig>
4+ <action id="com.canonical.unity.AccountsService.ModifyOwnUser">
5+ <description>Set properties of own user</description>
6+ <message>Authentication is required to set one's own unity properties.</message>
7+ <defaults>
8+ <allow_any>yes</allow_any>
9+ <allow_inactive>yes</allow_inactive>
10+ <allow_active>yes</allow_active>
11+ </defaults>
12+ </action>
13+
14+ <action id="com.canonical.unity.AccountsService.ModifyAnyUser">
15+ <description>Set properties of any user</description>
16+ <message>Authentication is required to set another user's unity
17+properties.</message>
18+ <defaults>
19+ <allow_any>no</allow_any>
20+ <allow_inactive>no</allow_inactive>
21+ <allow_active>no</allow_active>
22+ </defaults>
23+ </action>
24+</policyconfig>
plugins/AccountsService/com.canonical.unity.AccountsService.xmlnew file+17
@@ -0,0 +1,17 @@
1+<node>
2+ <interface name="com.canonical.unity.AccountsService">
3+
4+ <annotation name="org.freedesktop.Accounts.VendorExtension" value="true"/>
5+
6+ <annotation name="org.freedesktop.Accounts.Authentication.ChangeOwn"
7+ value="com.canonical.unity.AccountsService.ModifyOwnUser"/>
8+
9+ <annotation name="org.freedesktop.Accounts.Authentication.ChangeAny"
10+ value="com.canonical.unity.AccountsService.ModifyAnyUser"/>
11+
12+ <property name="demo-edges" type="b" access="readwrite">
13+ <annotation name="org.freedesktop.Accounts.DefaultValue" value="true"/>
14+ </property>
15+
16+ </interface>
17+</node>
plugins/AccountsService/plugin.cppnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+#include "plugin.h"
20+#include "AccountsService.h"
21+
22+#include <QtQml>
23+
24+static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
25+{
26+ Q_UNUSED(engine)
27+ Q_UNUSED(scriptEngine)
28+ return new AccountsService();
29+}
30+
31+void AccountsServicePlugin::registerTypes(const char *uri)
32+{
33+ Q_ASSERT(uri == QLatin1String("AccountsService"));
34+ qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
35+}
plugins/AccountsService/plugin.hnew file+34
@@ -0,0 +1,34 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+#ifndef ACCOUNTSSERVICE_PLUGIN_H
20+#define ACCOUNTSSERVICE_PLUGIN_H
21+
22+#include <QQmlEngine>
23+#include <QQmlExtensionPlugin>
24+
25+class AccountsServicePlugin : public QQmlExtensionPlugin
26+{
27+ Q_OBJECT
28+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
29+
30+public:
31+ void registerTypes(const char *uri);
32+};
33+
34+#endif
plugins/AccountsService/qmldirnew file+3
@@ -0,0 +1,3 @@
1+module AccountsService
2+plugin AccountsService-qml
3+typeinfo plugin.qmltypes
plugins/CMakeLists.txt+4−3
@@ -1,7 +1,8 @@
1−add_subdirectory(Ubuntu)
1+add_subdirectory(AccountsService)
2−add_subdirectory(Utils)
3−add_subdirectory(Unity)
4add_subdirectory(HudClient)
2add_subdirectory(HudClient)
5add_subdirectory(LightDM)
3add_subdirectory(LightDM)
6add_subdirectory(ListViewWithPageHeader)
4add_subdirectory(ListViewWithPageHeader)
7add_subdirectory(Powerd)
5add_subdirectory(Powerd)
6+add_subdirectory(Ubuntu)
7+add_subdirectory(Unity)
8+add_subdirectory(Utils)
po/unity8.pot+51−43
@@ -8,7 +8,7 @@ msgid ""
8msgstr ""
8msgstr ""
9"Project-Id-Version: unity8\n"
9"Project-Id-Version: unity8\n"
10"Report-Msgid-Bugs-To: \n"
10"Report-Msgid-Bugs-To: \n"
11−"POT-Creation-Date: 2013-08-09 12:18+0200\n"
11+"POT-Creation-Date: 2013-08-27 13:36-0400\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -86,25 +86,69 @@ msgstr ""
86msgid "YouTube"
86msgid "YouTube"
87msgstr ""
87msgstr ""
88
88
89+#: Components/EdgeDemoOverlay.qml:145
90+msgid "Skip intro"
91+msgstr ""
92+
93+#: Components/EdgeDemo.qml:98
94+msgid "Right edge"
95+msgstr ""
96+
97+#: Components/EdgeDemo.qml:99
98+msgid "Try swiping from the right edge to unlock the phone"
99+msgstr ""
100+
101+#: Components/EdgeDemo.qml:135
102+msgid "Top edge"
103+msgstr ""
104+
105+#: Components/EdgeDemo.qml:136
106+msgid "Try swiping from the top edge to access the indicators"
107+msgstr ""
108+
109+#: Components/EdgeDemo.qml:161
110+msgid "Close"
111+msgstr ""
112+
113+#: Components/EdgeDemo.qml:162
114+msgid "Swipe up again to close the settings screen"
115+msgstr ""
116+
117+#: Components/EdgeDemo.qml:189
118+msgid "Left edge"
119+msgstr ""
120+
121+#: Components/EdgeDemo.qml:190
122+msgid "Swipe from the left to reveal the launcher for quick access to apps"
123+msgstr ""
124+
125+#: Components/EdgeDemo.qml:217
126+msgid "Well done"
127+msgstr ""
128+
129+#: Components/EdgeDemo.qml:218
130+msgid "You have now mastered the edge gestures and can start using the phone"
131+msgstr ""
132+
89#: Components/PageHeader.qml:298
133#: Components/PageHeader.qml:298
90msgid "Recent searches"
134msgid "Recent searches"
91msgstr ""
135msgstr ""
92
136
93#. TRANSLATORS: Number of persons who rated this app
137#. TRANSLATORS: Number of persons who rated this app
94−#: Dash/Apps/AppInfo.qml:72
138+#: Dash/Apps/AppInfo.qml:73
95#, qt-format
139#, qt-format
96msgid "(%1)"
140msgid "(%1)"
97msgstr ""
141msgstr ""
98
142
99#. TRANSLATORS: Number of persons who wrote reviews for this app
143#. TRANSLATORS: Number of persons who wrote reviews for this app
100−#: Dash/Apps/AppInfo.qml:84 tests/qmltests/Dash/Apps/tst_AppPreview.qml:115
144+#: Dash/Apps/AppInfo.qml:85
101#, qt-format
145#, qt-format
102msgid "%1 review"
146msgid "%1 review"
103msgid_plural "%1 reviews"
147msgid_plural "%1 reviews"
104msgstr[0] ""
148msgstr[0] ""
105msgstr[1] ""
149msgstr[1] ""
106
150
107−#: Dash/Apps/AppPreview.qml:181
151+#: Dash/Apps/AppPreview.qml:175
108msgid "Rate this"
152msgid "Rate this"
109msgstr ""
153msgstr ""
110
154
@@ -124,42 +168,6 @@ msgstr ""
124msgid "Comments:"
168msgid "Comments:"
125msgstr ""
169msgstr ""
126
170
127−#: Dash/DashApps.qml:65
128−msgid "Running apps"
129−msgstr ""
130−
131−#: Dash/DashApps.qml:68
132−msgid "Frequently used"
133−msgstr ""
134−
135−#: Dash/DashApps.qml:71
136−msgid "Installed"
137−msgstr ""
138−
139−#: Dash/DashApps.qml:74
140−msgid "Available for download"
141−msgstr ""
142−
143−#: Dash/DashApps.qml:168
144−msgid "Apps"
145−msgstr ""
146−
147−#: Dash/DashHome.qml:41
148−msgid "Frequent Apps"
149−msgstr ""
150−
151−#: Dash/DashHome.qml:44
152−msgid "Recent Music"
153−msgstr ""
154−
155−#: Dash/DashHome.qml:47
156−msgid "Videos Popular Online"
157−msgstr ""
158−
159−#: Dash/DashHome.qml:151
160−msgid "Home"
161−msgstr ""
162−
163#: Dash/DashMusic.qml:27 Dash/DashVideos.qml:28
171#: Dash/DashMusic.qml:27 Dash/DashVideos.qml:28
164msgid "Featured"
172msgid "Featured"
165msgstr ""
173msgstr ""
@@ -200,7 +208,7 @@ msgstr ""
200msgid "Author:"
208msgid "Author:"
201msgstr ""
209msgstr ""
202
210
203−#: Greeter/Lockscreen.qml:133
211+#: Greeter/Lockscreen.qml:134
204msgid "Emergency Call"
212msgid "Emergency Call"
205msgstr ""
213msgstr ""
206
214
@@ -237,11 +245,11 @@ msgstr ""
237msgid "Search"
245msgid "Search"
238msgstr ""
246msgstr ""
239
247
240−#: plugins/Unity/scope.cpp:298
248+#: plugins/Unity/scope.cpp:317
241msgid "Sorry, there is nothing that matches your search."
249msgid "Sorry, there is nothing that matches your search."
242msgstr ""
250msgstr ""
243
251
244−#: Shell.qml:399
252+#: Shell.qml:429
245#, qt-format
253#, qt-format
246msgid "Please enter %1"
254msgid "Please enter %1"
247msgstr ""
255msgstr ""
tests/mocks/AccountsService/AccountsService.cppnew file+33
@@ -0,0 +1,33 @@
1+/*
2+ * Copyright (C) 2013 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+ * Author: Michael Terry <michael.terry@canonical.com>
17+ */
18+
19+#include "AccountsService.h"
20+
21+AccountsService::AccountsService(QObject* parent)
22+ : QObject(parent)
23+{
24+}
25+
26+QVariant AccountsService::getUserProperty(const QString &, const QString &)
27+{
28+ return QVariant(false);
29+}
30+
31+void AccountsService::setUserProperty(const QString &, const QString &, const QVariant &)
32+{
33+}
tests/mocks/AccountsService/AccountsService.hnew file+38
@@ -0,0 +1,38 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Gerry Boland <gerry.boland@canonical.com>
17+ * Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#ifndef UNITY_MOCK_ACCOUNTSSERVICE_H
21+#define UNITY_MOCK_ACCOUNTSSERVICE_H
22+
23+#include <QObject>
24+#include <QString>
25+#include <QVariant>
26+
27+class AccountsService: public QObject
28+{
29+ Q_OBJECT
30+
31+public:
32+ explicit AccountsService(QObject *parent = 0);
33+
34+ Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &property);
35+ Q_INVOKABLE void setUserProperty(const QString &user, const QString &property, const QVariant &value);
36+};
37+
38+#endif
tests/mocks/AccountsService/CMakeLists.txtnew file+19
@@ -0,0 +1,19 @@
1+add_library(MockAccountsService-qml MODULE
2+ AccountsService.cpp
3+ plugin.cpp
4+ )
5+
6+qt5_use_modules(MockAccountsService-qml DBus Qml)
7+
8+# copy files into build directory for shadow builds
9+file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/qmldir"
10+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
11+ )
12+
13+install(TARGETS MockAccountsService-qml
14+ DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/mocks/AccountsService
15+ )
16+
17+install(FILES qmldir
18+ DESTINATION ${SHELL_PRIVATE_LIBDIR}/qml/mocks/AccountsService
19+ )
tests/mocks/AccountsService/plugin.cppnew file+36
@@ -0,0 +1,36 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Gerry Boland <gerry.boland@canonical.com>
17+ * Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#include "plugin.h"
21+#include "AccountsService.h"
22+
23+#include <QtQml>
24+
25+static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
26+{
27+ Q_UNUSED(engine)
28+ Q_UNUSED(scriptEngine)
29+ return new AccountsService();
30+}
31+
32+void AccountsServicePlugin::registerTypes(const char *uri)
33+{
34+ Q_ASSERT(uri == QLatin1String("AccountsService"));
35+ qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
36+}
tests/mocks/AccountsService/plugin.hnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright (C) 2012,2013 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+ * Authors: Gerry Boland <gerry.boland@canonical.com>
17+ * Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#ifndef MOCK_ACCOUNTSSERVICE_PLUGIN_H
21+#define MOCK_ACCOUNTSSERVICE_PLUGIN_H
22+
23+#include <QQmlEngine>
24+#include <QQmlExtensionPlugin>
25+
26+class AccountsServicePlugin : public QQmlExtensionPlugin
27+{
28+ Q_OBJECT
29+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
30+
31+public:
32+ void registerTypes(const char *uri);
33+};
34+
35+#endif
tests/mocks/AccountsService/qmldirnew file+2
@@ -0,0 +1,2 @@
1+module AccountsService
2+plugin MockAccountsService-qml
tests/mocks/CMakeLists.txt+1
@@ -1,3 +1,4 @@
1+add_subdirectory(AccountsService)
1add_subdirectory(GSettings.1.0)
2add_subdirectory(GSettings.1.0)
2add_subdirectory(HudClient)
3add_subdirectory(HudClient)
3add_subdirectory(libusermetrics)
4add_subdirectory(libusermetrics)
tests/plugins/AccountsService/AccountsServer.cppnew file+35
@@ -0,0 +1,35 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#include "AccountsServer.h"
21+
22+AccountsServer::AccountsServer(QObject *parent)
23+ : QObject(parent)
24+{
25+}
26+
27+QDBusObjectPath AccountsServer::FindUserByName(const QString &user)
28+{
29+ if (user == "testuser") {
30+ return QDBusObjectPath("/user");
31+ } else {
32+ sendErrorReply(QDBusError::InvalidArgs, "Bad user");
33+ return QDBusObjectPath("/");
34+ }
35+}
tests/plugins/AccountsService/AccountsServer.hnew file+39
@@ -0,0 +1,39 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#ifndef UNITY_ACCOUNTSSERVER_H
21+#define UNITY_ACCOUNTSSERVER_H
22+
23+#include <QDBusContext>
24+#include <QDBusObjectPath>
25+#include <QObject>
26+#include <QString>
27+
28+class AccountsServer: public QObject, protected QDBusContext
29+{
30+ Q_OBJECT
31+
32+public:
33+ explicit AccountsServer(QObject *parent = 0);
34+
35+public Q_SLOTS:
36+ QDBusObjectPath FindUserByName(const QString &user);
37+};
38+
39+#endif
tests/plugins/AccountsService/CMakeLists.txtnew file+40
@@ -0,0 +1,40 @@
1+macro(make_dbus_class NAME INTERFACE)
2+ if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
3+ execute_process(COMMAND qdbusxml2cpp -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
4+ endif()
5+endmacro(make_dbus_class)
6+
7+make_dbus_class(Accounts org.freedesktop.Accounts)
8+make_dbus_class(Properties org.freedesktop.DBus.Properties)
9+
10+include_directories(
11+ ${CMAKE_CURRENT_BINARY_DIR}
12+ ${CMAKE_SOURCE_DIR}/plugins/AccountsService
13+ )
14+
15+add_definitions(-DSM_BUSNAME=sessionBus)
16+
17+add_executable(mock-server
18+ ${CMAKE_CURRENT_BINARY_DIR}/AccountsAdaptor.cpp
19+ ${CMAKE_CURRENT_BINARY_DIR}/PropertiesAdaptor.cpp
20+ server.cpp
21+ AccountsServer.cpp
22+ PropertiesServer.cpp
23+ )
24+qt5_use_modules(mock-server Core DBus)
25+
26+add_executable(test-accountsservice
27+ ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp
28+ client.cpp
29+ )
30+qt5_use_modules(test-accountsservice Core DBus Test)
31+
32+add_test(NAME test-accountsservice
33+ COMMAND dbus-test-runner
34+ --task ${CMAKE_CURRENT_BINARY_DIR}/mock-server
35+ --task-name server
36+ --ignore-return
37+ --task ${CMAKE_CURRENT_BINARY_DIR}/test-accountsservice
38+ --task-name client
39+ --wait-for org.freedesktop.Accounts
40+ )
tests/plugins/AccountsService/PropertiesServer.cppnew file+45
@@ -0,0 +1,45 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#include "PropertiesServer.h"
21+
22+PropertiesServer::PropertiesServer(QObject *parent)
23+ : QObject(parent),
24+ edge_demo(true)
25+{
26+}
27+
28+QDBusVariant PropertiesServer::Get(const QString &interface, const QString &property)
29+{
30+ if (interface == "com.canonical.unity.AccountsService" && property == "demo-edges") {
31+ return QDBusVariant(QVariant(edge_demo));
32+ } else {
33+ sendErrorReply(QDBusError::InvalidArgs, "Bad interface or property");
34+ return QDBusVariant(QVariant());
35+ }
36+}
37+
38+void PropertiesServer::Set(const QString &interface, const QString &property, const QDBusVariant &variant)
39+{
40+ if (interface == "com.canonical.unity.AccountsService" && property == "demo-edges") {
41+ edge_demo = variant.variant().toBool();
42+ } else {
43+ sendErrorReply(QDBusError::InvalidArgs, "Bad interface or property");
44+ }
45+}
tests/plugins/AccountsService/PropertiesServer.hnew file+44
@@ -0,0 +1,44 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#ifndef UNITY_PROPERTIESSERVER_H
21+#define UNITY_PROPERTIESSERVER_H
22+
23+#include "PropertiesServer.h"
24+#include <QDBusContext>
25+#include <QDBusVariant>
26+#include <QObject>
27+#include <QString>
28+
29+class PropertiesServer: public QObject, protected QDBusContext
30+{
31+ Q_OBJECT
32+
33+public:
34+ explicit PropertiesServer(QObject *parent = 0);
35+
36+public Q_SLOTS:
37+ QDBusVariant Get(const QString &interface, const QString &property);
38+ void Set(const QString &interface, const QString &property, const QDBusVariant &variant);
39+
40+private:
41+ bool edge_demo;
42+};
43+
44+#endif
tests/plugins/AccountsService/client.cppnew file+49
@@ -0,0 +1,49 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#include "AccountsService.h"
21+#include <QSignalSpy>
22+#include <QTest>
23+
24+class AccountsServiceTest : public QObject
25+{
26+ Q_OBJECT
27+
28+private Q_SLOTS:
29+
30+ void testInvalids()
31+ {
32+ // Test various invalid calls
33+ AccountsService session;
34+ QCOMPARE(session.getUserProperty("NOPE", "demo-edges"), QVariant());
35+ QCOMPARE(session.getUserProperty("testuser", "NOPE"), QVariant());
36+ }
37+
38+ void testGetSet()
39+ {
40+ AccountsService session;
41+ QCOMPARE(session.getUserProperty("testuser", "demo-edges"), QVariant(true));
42+ session.setUserProperty("testuser", "demo-edges", QVariant(false));
43+ QCOMPARE(session.getUserProperty("testuser", "demo-edges"), QVariant(false));
44+ }
45+};
46+
47+QTEST_MAIN(AccountsServiceTest)
48+
49+#include "client.moc"
tests/plugins/AccountsService/interfaces.xmlnew file+20
@@ -0,0 +1,20 @@
1+<node>
2+ <interface name="org.freedesktop.DBus.Properties">
3+ <method name="Get">
4+ <arg name="interface" type="s" direction="in" />
5+ <arg name="property" type="s" direction="in" />
6+ <arg name="value" type="v" direction="out" />
7+ </method>
8+ <method name="Set">
9+ <arg name="interface" type="s" direction="in" />
10+ <arg name="property" type="s" direction="in" />
11+ <arg name="value" type="v" direction="in" />
12+ </method>
13+ </interface>
14+ <interface name="org.freedesktop.Accounts">
15+ <method name="FindUserByName">
16+ <arg name="user" type="s" direction="in" />
17+ <arg name="path" type="o" direction="out" />
18+ </method>
19+ </interface>
20+</node>
tests/plugins/AccountsService/server.cppnew file+46
@@ -0,0 +1,46 @@
1+/*
2+ * Copyright 2013 Canonical Ltd.
3+ *
4+ * This program is free software: you can redistribute it and/or modify it
5+ * under the terms of the GNU General Public License version 3, as published
6+ * by the Free Software Foundation.
7+ *
8+ * This program is distributed in the hope that it will be useful, but
9+ * WITHOUT ANY WARRANTY; without even the implied warranties of
10+ * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11+ * PURPOSE. See the GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * version 3 along with this program. If not, see
15+ * <http://www.gnu.org/licenses/>
16+ *
17+ * Authored by: Michael Terry <michael.terry@canonical.com>
18+ */
19+
20+#include "AccountsAdaptor.h"
21+#include "AccountsServer.h"
22+#include "PropertiesAdaptor.h"
23+#include "PropertiesServer.h"
24+#include <QCoreApplication>
25+
26+int main(int argc, char *argv[])
27+{
28+ QCoreApplication a(argc, argv);
29+
30+ auto accounts = new AccountsServer();
31+ new AccountsAdaptor(accounts);
32+
33+ auto props = new PropertiesServer();
34+ new PropertiesAdaptor(props);
35+
36+ // We use the session bus for testing. The real plugin uses the system bus
37+ auto connection = QDBusConnection::sessionBus();
38+ if (!connection.registerObject("/org/freedesktop/Accounts", accounts))
39+ return 1;
40+ if (!connection.registerObject("/user", props))
41+ return 1;
42+ if (!connection.registerService("org.freedesktop.Accounts"))
43+ return 1;
44+
45+ return a.exec();
46+}
tests/plugins/CMakeLists.txt+3−2
@@ -1,4 +1,5 @@
1−add_subdirectory(Utils)
1+add_subdirectory(AccountsService)
2+add_subdirectory(ListViewWithPageHeader)
2add_subdirectory(Ubuntu)
3add_subdirectory(Ubuntu)
3add_subdirectory(Unity)
4add_subdirectory(Unity)
4−add_subdirectory(ListViewWithPageHeader)
5+add_subdirectory(Utils)
tests/qmltests/CMakeLists.txt+1
@@ -30,6 +30,7 @@ add_qml_test(. Shell IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${qmltest_DEFAULT_
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
30 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/tests/mocks/LightDM/single")
31add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
31add_manual_qml_test(Components DragHandle IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
32add_qml_test(Components DraggingArea)
32add_qml_test(Components DraggingArea)
33+add_qml_test(Components EdgeDemoOverlay)
33add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
34add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
34add_qml_test(Components ResponsiveFlowView)
35add_qml_test(Components ResponsiveFlowView)
35add_qml_test(Components ResponsiveGridView)
36add_qml_test(Components ResponsiveGridView)
tests/qmltests/Components/tst_EdgeDemoOverlay.qmlnew file+123
@@ -0,0 +1,123 @@
1+/*
2+ * Copyright 2013 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.0
18+import QtTest 1.0
19+import Unity.Test 0.1 as UT
20+import "../../../Components"
21+
22+Item {
23+ id: root
24+ width: boxWidth * 3
25+ height: boxHeight * 2
26+
27+ property int boxWidth: 250
28+ property int boxHeight: 250
29+
30+ EdgeDemoOverlay {
31+ id: top
32+ edge: "top"
33+ title: "Top"
34+ text: "Displayed on top left"
35+ anchors.left: parent.left
36+ anchors.top: parent.top
37+ width: boxWidth
38+ height: boxHeight
39+ }
40+
41+ EdgeDemoOverlay {
42+ id: right
43+ edge: "right"
44+ title: "Right"
45+ text: "Displayed on top right"
46+ anchors.right: parent.right
47+ anchors.top: parent.top
48+ width: boxWidth
49+ height: boxHeight
50+ }
51+
52+ EdgeDemoOverlay {
53+ id: left
54+ edge: "left"
55+ title: "Left"
56+ text: "Displayed on bottom right"
57+ anchors.right: parent.right
58+ anchors.bottom: parent.bottom
59+ width: boxWidth
60+ height: boxHeight
61+ available: false
62+ }
63+
64+ EdgeDemoOverlay {
65+ id: bottom
66+ edge: "bottom"
67+ title: "Bottom"
68+ text: "Displayed on bottom left"
69+ anchors.left: parent.left
70+ anchors.bottom: parent.bottom
71+ width: boxWidth
72+ height: boxHeight
73+ }
74+
75+ EdgeDemoOverlay {
76+ id: none
77+ edge: "none"
78+ title: "None"
79+ text: "Displayed on top middle"
80+ anchors.horizontalCenter: parent.horizontalCenter
81+ anchors.top: parent.top
82+ width: boxWidth
83+ height: boxHeight
84+ }
85+
86+ SignalSpy {
87+ id: signalSpy
88+ }
89+
90+ UT.UnityTestCase {
91+ name: "EdgeDemoOverlay"
92+ when: windowShown
93+
94+ function test_animations() {
95+ compare(right.running, true)
96+
97+ compare(left.running, false)
98+ left.available = true
99+ compare(left.running, true)
100+ }
101+
102+ function test_skip() {
103+ signalSpy.target = bottom
104+ signalSpy.signalName = "skip"
105+ signalSpy.clear()
106+ var bottomSkip = findChild(bottom, "skipLabel")
107+ mousePress(bottomSkip, 1, 1)
108+ mouseRelease(bottomSkip, 1, 1)
109+ signalSpy.wait()
110+ compare(bottom.available, false)
111+
112+ // Test that the 'none' edge skips anywhere
113+ signalSpy.target = none
114+ signalSpy.clear()
115+ var backgroundShade = findChild(none, "backgroundShade")
116+ tryCompare(none, "opacity", 1)
117+ mousePress(backgroundShade, 1, 1)
118+ mouseRelease(backgroundShade, 1, 1)
119+ signalSpy.wait()
120+ compare(none.available, false)
121+ }
122+ }
123+}