Merge lp:~mterry/unity8/greeter-wallpaper into lp:unity8
- greeter-wallpaper
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Michael Terry | ||||
Approved revision: | 279 | ||||
Merged at revision: | 302 | ||||
Proposed branch: | lp:~mterry/unity8/greeter-wallpaper | ||||
Merge into: | lp:unity8 | ||||
Diff against target: |
727 lines (+361/-55) 17 files modified
Components/EdgeDemo.qml (+4/-4) Greeter/GreeterContent.qml (+19/-2) Shell.qml (+2/-0) plugins/AccountsService/AccountsService.cpp (+104/-0) plugins/AccountsService/AccountsService.h (+70/-0) plugins/AccountsService/AccountsServiceDBusAdaptor.cpp (+63/-11) plugins/AccountsService/AccountsServiceDBusAdaptor.h (+18/-8) plugins/AccountsService/CMakeLists.txt (+1/-0) plugins/Unity/Launcher/CMakeLists.txt (+1/-1) plugins/Unity/Launcher/backend/launcherbackend.cpp (+4/-4) plugins/Unity/Launcher/backend/launcherbackend.h (+2/-2) tests/mocks/AccountsService/AccountsService.cpp (+23/-7) tests/mocks/AccountsService/AccountsService.h (+22/-3) tests/mocks/AccountsService/CMakeLists.txt (+2/-0) tests/plugins/AccountsService/CMakeLists.txt (+1/-0) tests/plugins/AccountsService/client.cpp (+23/-11) tests/plugins/Unity/Launcher/CMakeLists.txt (+2/-2) |
||||
To merge this branch: | bzr merge lp:~mterry/unity8/greeter-wallpaper | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michael Zanetti (community) | Approve | ||
Review via email: mp+183018@code.launchpad.net |
Commit message
Have the greeter use AccountsService to determine its background.
Description of the change
Have the greeter use AccountsService to determine its background.
See the design: https:/
Note that the user can have separate backgrounds for the greeter and the session. The session uses gsettings, and the greeter uses AccountsService. This is also what the greeter uses on the desktop (although there, the session makes sure that the two values are in sync rather than allowing them to be different).
Along the way, I cleaned up the AccountsService plugin to be more Qml-like. Bindable properties with change notifications for the properties we care about.
PS Jenkins bot (ps-jenkins) wrote : | # |
Michael Zanetti (mzanetti) wrote : | # |
554 + Q_INVOKABLE void setUser(const QString &user);
Why not make this a property too?
Michael Terry (mterry) wrote : | # |
No reason. I was just thinking that since I only needed a set, not a get/notify, a method would do. And I don't (yet!) dream in Qml so it didn't feel weird to me. :)
I've made it a property in latest revision.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:275
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
None: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
518 +void AccountsBinding
519 +{
520 +}
527 +void AccountsBinding
528 +{
529 +}
Please use Q_UNUSED to get rid of the compiler warnings.
Michael Terry (mterry) wrote : | # |
> Please use Q_UNUSED to get rid of the compiler warnings.
Done
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:277
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) wrote : | # |
tbh I really don't like the naming of the classes...
imho AccountsBindings should still be AccountsService and the current AccountsService should be AccountsService
but maybe its just me... what do you think?
Michael Terry (mterry) wrote : | # |
Well, note that from Qml, it still is exposed as AccountsService.
But I figured the AccountsService class was more "accurate" to the DBus service. So it should get the name. While the class that bridged the gap between the service and Qml should be called Bindings.
But I don't care much. I'm happy to rename.
Michael Terry (mterry) wrote : | # |
Renamed!
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:279
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Michael Zanetti (mzanetti) : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Francis Ginther (fginther) wrote : | # |
Re-approving to get a clean run after today's jenkins issues.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
None: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
ABORTED: http://
FAILURE: http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'Components/EdgeDemo.qml' |
2 | --- Components/EdgeDemo.qml 2013-09-03 14:09:28 +0000 |
3 | +++ Components/EdgeDemo.qml 2013-09-05 18:10:06 +0000 |
4 | @@ -44,13 +44,13 @@ |
5 | |
6 | function hideEdgeDemoInShell() { |
7 | var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole); |
8 | - AccountsService.setUserProperty(user, "demo-edges", false); |
9 | + AccountsService.demoEdges = false; |
10 | d.showEdgeDemo = false; |
11 | stopDemo(); |
12 | } |
13 | |
14 | function hideEdgeDemoInGreeter() { |
15 | - // TODO: AccountsService.setUserProperty("lightdm", "demo-edges", false); |
16 | + // TODO: AccountsService.demoEdges = false as lightdm user |
17 | d.showEdgeDemoInGreeter = false; |
18 | } |
19 | |
20 | @@ -80,7 +80,7 @@ |
21 | property QtObject leftEdgeDemo |
22 | property QtObject finalEdgeDemo |
23 | property bool showEdgeDemo: false |
24 | - property bool showEdgeDemoInGreeter: d.showEdgeDemo // TODO: AccountsService.getUserProperty("lightdm", "demo-edges") |
25 | + property bool showEdgeDemoInGreeter: d.showEdgeDemo // TODO: AccountsService.demoEdges as lightdm user |
26 | |
27 | onShowEdgeDemoInGreeterChanged: { |
28 | if (!d.overlay && d.showEdgeDemoInGreeter) { |
29 | @@ -126,7 +126,7 @@ |
30 | |
31 | onSelected: { |
32 | var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole) |
33 | - d.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges") |
34 | + d.showEdgeDemo = AccountsService.demoEdges |
35 | } |
36 | } |
37 | |
38 | |
39 | === modified file 'Greeter/GreeterContent.qml' |
40 | --- Greeter/GreeterContent.qml 2013-08-28 20:50:37 +0000 |
41 | +++ Greeter/GreeterContent.qml 2013-09-05 18:10:06 +0000 |
42 | @@ -15,6 +15,7 @@ |
43 | */ |
44 | |
45 | import QtQuick 2.0 |
46 | +import AccountsService 0.1 |
47 | import Ubuntu.Components 0.1 |
48 | import LightDM 0.1 as LightDM |
49 | import "../Components" |
50 | @@ -39,14 +40,30 @@ |
51 | color: "black" |
52 | } |
53 | |
54 | + property url backgroundValue: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : shell.defaultBackground |
55 | + onBackgroundValueChanged: wallpaper.source = backgroundValue |
56 | + |
57 | CrossFadeImage { |
58 | id: wallpaper |
59 | - |
60 | - source: shell.background |
61 | anchors.fill: parent |
62 | fadeInFirst: false |
63 | } |
64 | |
65 | + // See Shell.qml's backgroundSettings treatment for why we need a separate |
66 | + // Image, but it boils down to avoiding binding loop detection. |
67 | + Image { |
68 | + source: wallpaper.source |
69 | + height: 0 |
70 | + width: 0 |
71 | + sourceSize.height: 0 |
72 | + sourceSize.width: 0 |
73 | + onStatusChanged: { |
74 | + if (status == Image.Error && source != shell.defaultBackground) { |
75 | + wallpaper.source = shell.defaultBackground |
76 | + } |
77 | + } |
78 | + } |
79 | + |
80 | Rectangle { |
81 | anchors.fill: parent |
82 | color: "black" |
83 | |
84 | === modified file 'Shell.qml' |
85 | --- Shell.qml 2013-09-04 20:40:11 +0000 |
86 | +++ Shell.qml 2013-09-05 18:10:06 +0000 |
87 | @@ -15,6 +15,7 @@ |
88 | */ |
89 | |
90 | import QtQuick 2.0 |
91 | +import AccountsService 0.1 |
92 | import GSettings 1.0 |
93 | import Ubuntu.Application 0.1 |
94 | import Ubuntu.Components 0.1 |
95 | @@ -478,6 +479,7 @@ |
96 | onSelected: { |
97 | // Update launcher items for new user |
98 | var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole); |
99 | + AccountsService.user = user; |
100 | LauncherModel.setUser(user); |
101 | } |
102 | |
103 | |
104 | === added file 'plugins/AccountsService/AccountsService.cpp' |
105 | --- plugins/AccountsService/AccountsService.cpp 1970-01-01 00:00:00 +0000 |
106 | +++ plugins/AccountsService/AccountsService.cpp 2013-09-05 18:10:06 +0000 |
107 | @@ -0,0 +1,104 @@ |
108 | +/* |
109 | + * Copyright (C) 2013 Canonical, Ltd. |
110 | + * |
111 | + * This program is free software; you can redistribute it and/or modify |
112 | + * it under the terms of the GNU General Public License as published by |
113 | + * the Free Software Foundation; version 3. |
114 | + * |
115 | + * This program is distributed in the hope that it will be useful, |
116 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
117 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
118 | + * GNU General Public License for more details. |
119 | + * |
120 | + * You should have received a copy of the GNU General Public License |
121 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
122 | + * |
123 | + * Author: Michael Terry <michael.terry@canonical.com> |
124 | + */ |
125 | + |
126 | +#include "AccountsService.h" |
127 | +#include "AccountsServiceDBusAdaptor.h" |
128 | + |
129 | +#include <QStringList> |
130 | + |
131 | +AccountsService::AccountsService(QObject* parent) |
132 | + : QObject(parent), |
133 | + m_service(new AccountsServiceDBusAdaptor(this)), |
134 | + m_user(qgetenv("USER")) |
135 | +{ |
136 | + connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)), |
137 | + this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &))); |
138 | + connect(m_service, SIGNAL(maybeChanged(const QString &)), |
139 | + this, SLOT(maybeChanged(const QString &))); |
140 | +} |
141 | + |
142 | +QString AccountsService::getUser() |
143 | +{ |
144 | + return m_user; |
145 | +} |
146 | + |
147 | +void AccountsService::setUser(const QString &user) |
148 | +{ |
149 | + m_user = user; |
150 | + Q_EMIT userChanged(); |
151 | + |
152 | + updateDemoEdges(); |
153 | + updateBackgroundFile(); |
154 | +} |
155 | + |
156 | +bool AccountsService::getDemoEdges() |
157 | +{ |
158 | + return m_demoEdges; |
159 | +} |
160 | + |
161 | +void AccountsService::setDemoEdges(bool demoEdges) |
162 | +{ |
163 | + m_demoEdges = demoEdges; |
164 | + m_service->setUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges", demoEdges); |
165 | +} |
166 | + |
167 | +QString AccountsService::getBackgroundFile() |
168 | +{ |
169 | + return m_backgroundFile; |
170 | +} |
171 | + |
172 | +void AccountsService::updateDemoEdges() |
173 | +{ |
174 | + auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool(); |
175 | + if (m_demoEdges != demoEdges) { |
176 | + m_demoEdges = demoEdges; |
177 | + Q_EMIT demoEdgesChanged(); |
178 | + } |
179 | +} |
180 | + |
181 | +void AccountsService::updateBackgroundFile() |
182 | +{ |
183 | + auto backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString(); |
184 | + if (m_backgroundFile != backgroundFile) { |
185 | + m_backgroundFile = backgroundFile; |
186 | + Q_EMIT backgroundFileChanged(); |
187 | + } |
188 | +} |
189 | + |
190 | +void AccountsService::propertiesChanged(const QString &user, const QString &interface, const QStringList &changed) |
191 | +{ |
192 | + if (m_user != user) { |
193 | + return; |
194 | + } |
195 | + |
196 | + if (interface == "com.canonical.unity.AccountsService") { |
197 | + if (changed.contains("demo-edges")) { |
198 | + updateDemoEdges(); |
199 | + } |
200 | + } |
201 | +} |
202 | + |
203 | +void AccountsService::maybeChanged(const QString &user) |
204 | +{ |
205 | + if (m_user != user) { |
206 | + return; |
207 | + } |
208 | + |
209 | + // Standard properties might have changed |
210 | + updateBackgroundFile(); |
211 | +} |
212 | |
213 | === added file 'plugins/AccountsService/AccountsService.h' |
214 | --- plugins/AccountsService/AccountsService.h 1970-01-01 00:00:00 +0000 |
215 | +++ plugins/AccountsService/AccountsService.h 2013-09-05 18:10:06 +0000 |
216 | @@ -0,0 +1,70 @@ |
217 | +/* |
218 | + * Copyright (C) 2013 Canonical, Ltd. |
219 | + * |
220 | + * This program is free software; you can redistribute it and/or modify |
221 | + * it under the terms of the GNU General Public License as published by |
222 | + * the Free Software Foundation; version 3. |
223 | + * |
224 | + * This program is distributed in the hope that it will be useful, |
225 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
226 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
227 | + * GNU General Public License for more details. |
228 | + * |
229 | + * You should have received a copy of the GNU General Public License |
230 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
231 | + * |
232 | + * Authors: Michael Terry <michael.terry@canonical.com> |
233 | + */ |
234 | + |
235 | +#ifndef UNITY_ACCOUNTSSERVICE_H |
236 | +#define UNITY_ACCOUNTSSERVICE_H |
237 | + |
238 | +#include <QObject> |
239 | +#include <QString> |
240 | + |
241 | +class AccountsServiceDBusAdaptor; |
242 | + |
243 | +class AccountsService: public QObject |
244 | +{ |
245 | + Q_OBJECT |
246 | + Q_PROPERTY (QString user |
247 | + READ getUser |
248 | + WRITE setUser |
249 | + NOTIFY userChanged) |
250 | + Q_PROPERTY (bool demoEdges |
251 | + READ getDemoEdges |
252 | + WRITE setDemoEdges |
253 | + NOTIFY demoEdgesChanged) |
254 | + Q_PROPERTY (QString backgroundFile |
255 | + READ getBackgroundFile |
256 | + NOTIFY backgroundFileChanged) |
257 | + |
258 | +public: |
259 | + explicit AccountsService(QObject *parent = 0); |
260 | + |
261 | + QString getUser(); |
262 | + void setUser(const QString &user); |
263 | + bool getDemoEdges(); |
264 | + void setDemoEdges(bool demoEdges); |
265 | + QString getBackgroundFile(); |
266 | + |
267 | +Q_SIGNALS: |
268 | + void userChanged(); |
269 | + void demoEdgesChanged(); |
270 | + void backgroundFileChanged(); |
271 | + |
272 | +private Q_SLOTS: |
273 | + void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed); |
274 | + void maybeChanged(const QString &user); |
275 | + |
276 | +private: |
277 | + void updateDemoEdges(); |
278 | + void updateBackgroundFile(); |
279 | + |
280 | + AccountsServiceDBusAdaptor *m_service; |
281 | + QString m_user; |
282 | + bool m_demoEdges; |
283 | + QString m_backgroundFile; |
284 | +}; |
285 | + |
286 | +#endif |
287 | |
288 | === renamed file 'plugins/AccountsService/AccountsService.cpp' => 'plugins/AccountsService/AccountsServiceDBusAdaptor.cpp' |
289 | --- plugins/AccountsService/AccountsService.cpp 2013-08-22 14:54:08 +0000 |
290 | +++ plugins/AccountsService/AccountsServiceDBusAdaptor.cpp 2013-09-05 18:10:06 +0000 |
291 | @@ -16,13 +16,13 @@ |
292 | * Author: Michael Terry <michael.terry@canonical.com> |
293 | */ |
294 | |
295 | -#include "AccountsService.h" |
296 | +#include "AccountsServiceDBusAdaptor.h" |
297 | #include <QDBusConnection> |
298 | #include <QDBusConnectionInterface> |
299 | #include <QDBusMessage> |
300 | #include <QDBusVariant> |
301 | |
302 | -AccountsService::AccountsService(QObject* parent) |
303 | +AccountsServiceDBusAdaptor::AccountsServiceDBusAdaptor(QObject* parent) |
304 | : QObject(parent), |
305 | accounts_manager(NULL), |
306 | users() |
307 | @@ -36,11 +36,11 @@ |
308 | connection, this); |
309 | } |
310 | |
311 | -QVariant AccountsService::getUserProperty(const QString &user, const QString &property) |
312 | +QVariant AccountsServiceDBusAdaptor::getUserProperty(const QString &user, const QString &interface, const QString &property) |
313 | { |
314 | auto iface = getUserInterface(user); |
315 | if (iface != nullptr && iface->isValid()) { |
316 | - auto answer = iface->call("Get", "com.canonical.unity.AccountsService", property); |
317 | + auto answer = iface->call("Get", interface, property); |
318 | if (answer.type() == QDBusMessage::ReplyMessage) { |
319 | return answer.arguments()[0].value<QDBusVariant>().variant(); |
320 | } |
321 | @@ -48,25 +48,77 @@ |
322 | return QVariant(); |
323 | } |
324 | |
325 | -void AccountsService::setUserProperty(const QString &user, const QString &property, const QVariant &value) |
326 | +void AccountsServiceDBusAdaptor::setUserProperty(const QString &user, const QString &interface, const QString &property, const QVariant &value) |
327 | { |
328 | auto iface = getUserInterface(user); |
329 | if (iface != nullptr && iface->isValid()) { |
330 | // The value needs to be carefully wrapped |
331 | - iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value))); |
332 | - } |
333 | -} |
334 | - |
335 | -QDBusInterface *AccountsService::getUserInterface(const QString &user) |
336 | + iface->call("Set", interface, property, QVariant::fromValue(QDBusVariant(value))); |
337 | + } |
338 | +} |
339 | + |
340 | +void AccountsServiceDBusAdaptor::propertiesChangedSlot(const QString &interface, const QVariantMap &changed, const QStringList &invalid) |
341 | +{ |
342 | + // Merge changed and invalidated together |
343 | + QStringList combined; |
344 | + combined << invalid; |
345 | + combined << changed.keys(); |
346 | + combined.removeDuplicates(); |
347 | + |
348 | + Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined); |
349 | +} |
350 | + |
351 | +void AccountsServiceDBusAdaptor::maybeChangedSlot() |
352 | +{ |
353 | + Q_EMIT maybeChanged(getUserForPath(message().path())); |
354 | +} |
355 | + |
356 | +QString AccountsServiceDBusAdaptor::getUserForPath(const QString &path) |
357 | +{ |
358 | + QMap<QString, QDBusInterface *>::const_iterator i; |
359 | + for (i = users.constBegin(); i != users.constEnd(); ++i) { |
360 | + if (i.value()->path() == path) { |
361 | + return i.key(); |
362 | + } |
363 | + } |
364 | + return QString(); |
365 | +} |
366 | + |
367 | +QDBusInterface *AccountsServiceDBusAdaptor::getUserInterface(const QString &user) |
368 | { |
369 | auto iface = users.value(user); |
370 | if (iface == nullptr && accounts_manager->isValid()) { |
371 | auto answer = accounts_manager->call("FindUserByName", user); |
372 | if (answer.type() == QDBusMessage::ReplyMessage) { |
373 | + auto path = answer.arguments()[0].value<QDBusObjectPath>().path(); |
374 | + |
375 | iface = new QDBusInterface("org.freedesktop.Accounts", |
376 | - answer.arguments()[0].value<QDBusObjectPath>().path(), |
377 | + path, |
378 | "org.freedesktop.DBus.Properties", |
379 | accounts_manager->connection(), this); |
380 | + |
381 | + // With its own pre-defined properties, AccountsService is oddly |
382 | + // close-lipped. It won't send out proper DBus.Properties notices, |
383 | + // but it does have one catch-all Changed() signal. So let's |
384 | + // listen to that. |
385 | + iface->connection().connect( |
386 | + iface->service(), |
387 | + path, |
388 | + "org.freedesktop.Accounts.User", |
389 | + "Changed", |
390 | + this, |
391 | + SLOT(maybeChangedSlot())); |
392 | + |
393 | + // But custom properties do send out the right notifications, so |
394 | + // let's still listen there. |
395 | + iface->connection().connect( |
396 | + iface->service(), |
397 | + path, |
398 | + "org.freedesktop.DBus.Properties", |
399 | + "PropertiesChanged", |
400 | + this, |
401 | + SLOT(propertiesChangedSlot(QString, QVariantMap, QStringList))); |
402 | + |
403 | users.insert(user, iface); |
404 | } |
405 | } |
406 | |
407 | === renamed file 'plugins/AccountsService/AccountsService.h' => 'plugins/AccountsService/AccountsServiceDBusAdaptor.h' |
408 | --- plugins/AccountsService/AccountsService.h 2013-08-27 17:29:16 +0000 |
409 | +++ plugins/AccountsService/AccountsServiceDBusAdaptor.h 2013-09-05 18:10:06 +0000 |
410 | @@ -1,5 +1,5 @@ |
411 | /* |
412 | - * Copyright (C) 2012,2013 Canonical, Ltd. |
413 | + * Copyright (C) 2013 Canonical, Ltd. |
414 | * |
415 | * This program is free software; you can redistribute it and/or modify |
416 | * it under the terms of the GNU General Public License as published by |
417 | @@ -16,26 +16,36 @@ |
418 | * Authors: Michael Terry <michael.terry@canonical.com> |
419 | */ |
420 | |
421 | -#ifndef UNITY_ACCOUNTSSERVICE_H |
422 | -#define UNITY_ACCOUNTSSERVICE_H |
423 | +#ifndef UNITY_ACCOUNTSSERVICEDBUSADAPTOR_H |
424 | +#define UNITY_ACCOUNTSSERVICEDBUSADAPTOR_H |
425 | |
426 | +#include <QDBusContext> |
427 | #include <QDBusInterface> |
428 | #include <QMap> |
429 | #include <QObject> |
430 | #include <QString> |
431 | |
432 | -class AccountsService: public QObject |
433 | +class AccountsServiceDBusAdaptor: public QObject, public QDBusContext |
434 | { |
435 | Q_OBJECT |
436 | |
437 | public: |
438 | - explicit AccountsService(QObject *parent = 0); |
439 | - |
440 | - Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &property); |
441 | - Q_INVOKABLE void setUserProperty(const QString &user, const QString &property, const QVariant &value); |
442 | + explicit AccountsServiceDBusAdaptor(QObject *parent = 0); |
443 | + |
444 | + Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &interface, const QString &property); |
445 | + Q_INVOKABLE void setUserProperty(const QString &user, const QString &interface, const QString &property, const QVariant &value); |
446 | + |
447 | +Q_SIGNALS: |
448 | + void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed); |
449 | + void maybeChanged(const QString &user); // Standard properties might have changed |
450 | + |
451 | +private Q_SLOTS: |
452 | + void propertiesChangedSlot(const QString &interface, const QVariantMap &changed, const QStringList &invalid); |
453 | + void maybeChangedSlot(); |
454 | |
455 | private: |
456 | QDBusInterface *getUserInterface(const QString &user); |
457 | + QString getUserForPath(const QString &path); |
458 | |
459 | QDBusInterface *accounts_manager; |
460 | QMap<QString, QDBusInterface *> users; |
461 | |
462 | === modified file 'plugins/AccountsService/CMakeLists.txt' |
463 | --- plugins/AccountsService/CMakeLists.txt 2013-08-22 20:16:41 +0000 |
464 | +++ plugins/AccountsService/CMakeLists.txt 2013-09-05 18:10:06 +0000 |
465 | @@ -4,6 +4,7 @@ |
466 | |
467 | add_library(AccountsService-qml MODULE |
468 | AccountsService.cpp |
469 | + AccountsServiceDBusAdaptor.cpp |
470 | plugin.cpp |
471 | ) |
472 | |
473 | |
474 | === modified file 'plugins/Unity/Launcher/CMakeLists.txt' |
475 | --- plugins/Unity/Launcher/CMakeLists.txt 2013-09-02 08:53:33 +0000 |
476 | +++ plugins/Unity/Launcher/CMakeLists.txt 2013-09-05 18:10:06 +0000 |
477 | @@ -17,7 +17,7 @@ |
478 | quicklistmodel.cpp |
479 | common/quicklistentry.cpp |
480 | backend/launcherbackend.cpp |
481 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp |
482 | + ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
483 | ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h |
484 | ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherModelInterface.h |
485 | ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/QuickListModelInterface.h |
486 | |
487 | === modified file 'plugins/Unity/Launcher/backend/launcherbackend.cpp' |
488 | --- plugins/Unity/Launcher/backend/launcherbackend.cpp 2013-09-05 16:01:00 +0000 |
489 | +++ plugins/Unity/Launcher/backend/launcherbackend.cpp 2013-09-05 18:10:06 +0000 |
490 | @@ -18,7 +18,7 @@ |
491 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
492 | */ |
493 | |
494 | -#include "AccountsService.h" |
495 | +#include "AccountsServiceDBusAdaptor.h" |
496 | #include "launcherbackend.h" |
497 | |
498 | #include <QDir> |
499 | @@ -43,7 +43,7 @@ |
500 | m_accounts(nullptr) |
501 | { |
502 | if (useStorage) { |
503 | - m_accounts = new AccountsService(this); |
504 | + m_accounts = new AccountsServiceDBusAdaptor(this); |
505 | } |
506 | m_user = qgetenv("USER"); |
507 | syncFromAccounts(); |
508 | @@ -214,7 +214,7 @@ |
509 | m_storedApps.clear(); |
510 | |
511 | if (m_accounts && !m_user.isEmpty()) { |
512 | - QVariant variant = m_accounts->getUserProperty(m_user, "launcher-items"); |
513 | + QVariant variant = m_accounts->getUserProperty(m_user, "com.canonical.unity.AccountsService", "launcher-items"); |
514 | apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>()); |
515 | defaults = isDefaultsItem(apps); |
516 | } |
517 | @@ -257,7 +257,7 @@ |
518 | items << itemToVariant(appId); |
519 | } |
520 | |
521 | - m_accounts->setUserProperty(m_user, "launcher-items", QVariant::fromValue(items)); |
522 | + m_accounts->setUserProperty(m_user, "com.canonical.unity.AccountsService", "launcher-items", QVariant::fromValue(items)); |
523 | } |
524 | } |
525 | |
526 | |
527 | === modified file 'plugins/Unity/Launcher/backend/launcherbackend.h' |
528 | --- plugins/Unity/Launcher/backend/launcherbackend.h 2013-09-02 08:53:33 +0000 |
529 | +++ plugins/Unity/Launcher/backend/launcherbackend.h 2013-09-05 18:10:06 +0000 |
530 | @@ -25,7 +25,7 @@ |
531 | #include <QSettings> |
532 | #include <QStringList> |
533 | |
534 | -class AccountsService; |
535 | +class AccountsServiceDBusAdaptor; |
536 | |
537 | /** |
538 | * @brief An interface that provides all the data needed by the launcher. |
539 | @@ -156,7 +156,7 @@ |
540 | QList<QString> m_storedApps; |
541 | mutable QHash<QString, LauncherBackendItem*> m_itemCache; |
542 | |
543 | - AccountsService *m_accounts; |
544 | + AccountsServiceDBusAdaptor *m_accounts; |
545 | QString m_user; |
546 | }; |
547 | |
548 | |
549 | === modified file 'tests/mocks/AccountsService/AccountsService.cpp' |
550 | --- tests/mocks/AccountsService/AccountsService.cpp 2013-08-02 20:03:16 +0000 |
551 | +++ tests/mocks/AccountsService/AccountsService.cpp 2013-09-05 18:10:06 +0000 |
552 | @@ -23,11 +23,27 @@ |
553 | { |
554 | } |
555 | |
556 | -QVariant AccountsService::getUserProperty(const QString &, const QString &) |
557 | -{ |
558 | - return QVariant(false); |
559 | -} |
560 | - |
561 | -void AccountsService::setUserProperty(const QString &, const QString &, const QVariant &) |
562 | -{ |
563 | +QString AccountsService::getUser() |
564 | +{ |
565 | + return "testuser"; |
566 | +} |
567 | + |
568 | +void AccountsService::setUser(const QString &user) |
569 | +{ |
570 | + Q_UNUSED(user) |
571 | +} |
572 | + |
573 | +bool AccountsService::getDemoEdges() |
574 | +{ |
575 | + return false; |
576 | +} |
577 | + |
578 | +void AccountsService::setDemoEdges(bool demoEdges) |
579 | +{ |
580 | + Q_UNUSED(demoEdges) |
581 | +} |
582 | + |
583 | +QString AccountsService::getBackgroundFile() |
584 | +{ |
585 | + return TOP_SRCDIR "/graphics/phone_background.jpg"; |
586 | } |
587 | |
588 | === modified file 'tests/mocks/AccountsService/AccountsService.h' |
589 | --- tests/mocks/AccountsService/AccountsService.h 2013-08-27 17:34:46 +0000 |
590 | +++ tests/mocks/AccountsService/AccountsService.h 2013-09-05 18:10:06 +0000 |
591 | @@ -1,5 +1,5 @@ |
592 | /* |
593 | - * Copyright (C) 2012,2013 Canonical, Ltd. |
594 | + * Copyright (C) 2013 Canonical, Ltd. |
595 | * |
596 | * This program is free software; you can redistribute it and/or modify |
597 | * it under the terms of the GNU General Public License as published by |
598 | @@ -27,12 +27,31 @@ |
599 | class AccountsService: public QObject |
600 | { |
601 | Q_OBJECT |
602 | + Q_PROPERTY (QString user |
603 | + READ getUser |
604 | + WRITE setUser |
605 | + NOTIFY userChanged) |
606 | + Q_PROPERTY (bool demoEdges |
607 | + READ getDemoEdges |
608 | + WRITE setDemoEdges |
609 | + NOTIFY demoEdgesChanged) |
610 | + Q_PROPERTY (QString backgroundFile |
611 | + READ getBackgroundFile |
612 | + NOTIFY backgroundFileChanged) |
613 | |
614 | public: |
615 | explicit AccountsService(QObject *parent = 0); |
616 | |
617 | - Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &property); |
618 | - Q_INVOKABLE void setUserProperty(const QString &user, const QString &property, const QVariant &value); |
619 | + QString getUser(); |
620 | + void setUser(const QString &user); |
621 | + bool getDemoEdges(); |
622 | + void setDemoEdges(bool demoEdges); |
623 | + QString getBackgroundFile(); |
624 | + |
625 | +Q_SIGNALS: |
626 | + void userChanged(); |
627 | + void demoEdgesChanged(); |
628 | + void backgroundFileChanged(); |
629 | }; |
630 | |
631 | #endif |
632 | |
633 | === modified file 'tests/mocks/AccountsService/CMakeLists.txt' |
634 | --- tests/mocks/AccountsService/CMakeLists.txt 2013-07-30 23:22:48 +0000 |
635 | +++ tests/mocks/AccountsService/CMakeLists.txt 2013-09-05 18:10:06 +0000 |
636 | @@ -1,3 +1,5 @@ |
637 | +add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}") |
638 | + |
639 | add_library(MockAccountsService-qml MODULE |
640 | AccountsService.cpp |
641 | plugin.cpp |
642 | |
643 | === modified file 'tests/plugins/AccountsService/CMakeLists.txt' |
644 | --- tests/plugins/AccountsService/CMakeLists.txt 2013-08-13 23:35:31 +0000 |
645 | +++ tests/plugins/AccountsService/CMakeLists.txt 2013-09-05 18:10:06 +0000 |
646 | @@ -25,6 +25,7 @@ |
647 | |
648 | add_executable(test-accountsservice |
649 | ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp |
650 | + ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
651 | client.cpp |
652 | ) |
653 | qt5_use_modules(test-accountsservice Core DBus Test) |
654 | |
655 | === modified file 'tests/plugins/AccountsService/client.cpp' |
656 | --- tests/plugins/AccountsService/client.cpp 2013-08-22 14:54:08 +0000 |
657 | +++ tests/plugins/AccountsService/client.cpp 2013-09-05 18:10:06 +0000 |
658 | @@ -18,6 +18,7 @@ |
659 | */ |
660 | |
661 | #include "AccountsService.h" |
662 | +#include "AccountsServiceDBusAdaptor.h" |
663 | #include <QSignalSpy> |
664 | #include <QTest> |
665 | |
666 | @@ -30,17 +31,28 @@ |
667 | void testInvalids() |
668 | { |
669 | // Test various invalid calls |
670 | - AccountsService session; |
671 | - QCOMPARE(session.getUserProperty("NOPE", "demo-edges"), QVariant()); |
672 | - QCOMPARE(session.getUserProperty("testuser", "NOPE"), QVariant()); |
673 | - } |
674 | - |
675 | - void testGetSet() |
676 | - { |
677 | - AccountsService session; |
678 | - QCOMPARE(session.getUserProperty("testuser", "demo-edges"), QVariant(true)); |
679 | - session.setUserProperty("testuser", "demo-edges", QVariant(false)); |
680 | - QCOMPARE(session.getUserProperty("testuser", "demo-edges"), QVariant(false)); |
681 | + AccountsServiceDBusAdaptor session; |
682 | + QCOMPARE(session.getUserProperty("NOPE", "com.canonical.unity.AccountsService", "demo-edges"), QVariant()); |
683 | + QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "NOPE"), QVariant()); |
684 | + } |
685 | + |
686 | + void testGetSetServiceDBusAdaptor() |
687 | + { |
688 | + AccountsServiceDBusAdaptor session; |
689 | + session.setUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges", QVariant(true)); |
690 | + QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges"), QVariant(true)); |
691 | + session.setUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges", QVariant(false)); |
692 | + QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges"), QVariant(false)); |
693 | + } |
694 | + |
695 | + void testGetSetService() |
696 | + { |
697 | + AccountsService session; |
698 | + session.setUser("testuser"); |
699 | + session.setDemoEdges(true); |
700 | + QCOMPARE(session.getDemoEdges(), true); |
701 | + session.setDemoEdges(false); |
702 | + QCOMPARE(session.getDemoEdges(), false); |
703 | } |
704 | }; |
705 | |
706 | |
707 | === modified file 'tests/plugins/Unity/Launcher/CMakeLists.txt' |
708 | --- tests/plugins/Unity/Launcher/CMakeLists.txt 2013-09-04 22:30:51 +0000 |
709 | +++ tests/plugins/Unity/Launcher/CMakeLists.txt 2013-09-05 18:10:06 +0000 |
710 | @@ -21,7 +21,7 @@ |
711 | add_custom_target(launcherbackendtest ${testBackendCommand}) |
712 | add_executable(launcherbackendtestExec |
713 | launcherbackendtest.cpp |
714 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp |
715 | + ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
716 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/backend/launcherbackend.cpp |
717 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/common/quicklistentry.cpp |
718 | ) |
719 | @@ -39,7 +39,7 @@ |
720 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/launchermodel.cpp |
721 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/launcheritem.cpp |
722 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/quicklistmodel.cpp |
723 | - ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp |
724 | + ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsServiceDBusAdaptor.cpp |
725 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/backend/launcherbackend.cpp |
726 | ${CMAKE_SOURCE_DIR}/plugins/Unity/Launcher/common/quicklistentry.cpp |
727 | ${LAUNCHER_API_INCLUDEDIR}/unity/shell/launcher/LauncherItemInterface.h |
PASSED: Continuous integration, rev:274 jenkins. qa.ubuntu. com/job/ unity8- ci/836/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/2809 jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/408 jenkins. qa.ubuntu. com/job/ unity-phablet- qmluitests- saucy/1437 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/837 jenkins. qa.ubuntu. com/job/ unity8- saucy-armhf- ci/837/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity8- saucy-i386- ci/836 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 2815 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 2815/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- saucy/2385 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 410 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 410/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- maguro/ 372 jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- mako/379
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ unity8- ci/836/ rebuild
http://