on xenial help sign in
Merge wallpaper branch
commit9f3920f2f2207e1b17efcd89250efdef19e4d575 authorMichael Terry <michael.terry@canonical.com> dateWed 4 Sep 2013, 13:22 (13 years ago) parent58e3cb6a4cbac4
16 files changed+346−40
Components/EdgeDemo.qml+4−4 Greeter/GreeterContent.qml+19−2 Shell.qml+2 plugins/AccountsService/AccountsBindings.cpp+104 plugins/AccountsService/AccountsBindings.h+70 plugins/AccountsService/AccountsService.cpp+57−5 plugins/AccountsService/AccountsService.h+13−3 plugins/AccountsService/CMakeLists.txt+1 plugins/AccountsService/plugin.cpp+3−3 plugins/Unity/Launcher/backend/launcherbackend.cpp+2−2 tests/mocks/AccountsService/AccountsService.cpp → tests/mocks/AccountsService/AccountsBindings.cpp+21−5 tests/mocks/AccountsService/AccountsService.h → tests/mocks/AccountsService/AccountsBindings.h+25−6 tests/mocks/AccountsService/CMakeLists.txt+3−1 tests/mocks/AccountsService/plugin.cpp+3−3 tests/plugins/AccountsService/CMakeLists.txt+1 tests/plugins/AccountsService/client.cpp+18−6
Components/EdgeDemo.qml+4−4
@@ -44,13 +44,13 @@ Item {
4444
4545 function hideEdgeDemoInShell() {
4646 var user = LightDM.Users.data(greeter.currentIndex, LightDM.UserRoles.NameRole);
47− AccountsService.setUserProperty(user, "demo-edges", false);
47+ AccountsService.demoEdges = false;
4848 d.showEdgeDemo = false;
4949 stopDemo();
5050 }
5151
5252 function hideEdgeDemoInGreeter() {
53− // TODO: AccountsService.setUserProperty("lightdm", "demo-edges", false);
53+ // TODO: AccountsService.demoEdges = false as lightdm user
5454 d.showEdgeDemoInGreeter = false;
5555 }
5656
@@ -80,7 +80,7 @@ Item {
8080 property QtObject leftEdgeDemo
8181 property QtObject finalEdgeDemo
8282 property bool showEdgeDemo: false
83− property bool showEdgeDemoInGreeter: d.showEdgeDemo // TODO: AccountsService.getUserProperty("lightdm", "demo-edges")
83+ property bool showEdgeDemoInGreeter: d.showEdgeDemo // TODO: AccountsService.demoEdges as lightdm user
8484
8585 onShowEdgeDemoInGreeterChanged: {
8686 if (!d.overlay && d.showEdgeDemoInGreeter) {
@@ -126,7 +126,7 @@ Item {
126126
127127 onSelected: {
128128 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole)
129− d.showEdgeDemo = AccountsService.getUserProperty(user, "demo-edges")
129+ d.showEdgeDemo = AccountsService.demoEdges
130130 }
131131 }
132132
Greeter/GreeterContent.qml+19−2
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import AccountsService 0.1
1819import Ubuntu.Components 0.1
1920import LightDM 0.1 as LightDM
2021import "../Components"
@@ -39,14 +40,30 @@ MouseArea {
3940 color: "black"
4041 }
4142
43+ property url backgroundValue: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : shell.defaultBackground
44+ onBackgroundValueChanged: wallpaper.source = backgroundValue
45+
4246 CrossFadeImage {
4347 id: wallpaper
44−
45− source: shell.background
4648 anchors.fill: parent
4749 fadeInFirst: false
4850 }
4951
52+ // See Shell.qml's backgroundSettings treatment for why we need a separate
53+ // Image, but it boils down to avoiding binding loop detection.
54+ Image {
55+ source: wallpaper.source
56+ height: 0
57+ width: 0
58+ sourceSize.height: 0
59+ sourceSize.width: 0
60+ onStatusChanged: {
61+ if (status == Image.Error && source != shell.defaultBackground) {
62+ wallpaper.source = shell.defaultBackground
63+ }
64+ }
65+ }
66+
5067 Rectangle {
5168 anchors.fill: parent
5269 color: "black"
Shell.qml+2
@@ -15,6 +15,7 @@
1515 */
1616
1717import QtQuick 2.0
18+import AccountsService 0.1
1819import GSettings 1.0
1920import Ubuntu.Application 0.1
2021import Ubuntu.Components 0.1
@@ -469,6 +470,7 @@ FocusScope {
469470 onSelected: {
470471 // Update launcher items for new user
471472 var user = LightDM.Users.data(uid, LightDM.UserRoles.NameRole);
473+ AccountsService.user = user;
472474 LauncherModel.setUser(user);
473475 }
474476
plugins/AccountsService/AccountsBindings.cppnew file+104
@@ -0,0 +1,104 @@
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 "AccountsBindings.h"
20+#include "AccountsService.h"
21+
22+#include <QStringList>
23+
24+AccountsBindings::AccountsBindings(QObject* parent)
25+ : QObject(parent),
26+ m_service(new AccountsService(this)),
27+ m_user(qgetenv("USER"))
28+{
29+ connect(m_service, SIGNAL(propertiesChanged(const QString &, const QString &, const QStringList &)),
30+ this, SLOT(propertiesChanged(const QString &, const QString &, const QStringList &)));
31+ connect(m_service, SIGNAL(maybeChanged(const QString &)),
32+ this, SLOT(maybeChanged(const QString &)));
33+}
34+
35+QString AccountsBindings::getUser()
36+{
37+ return m_user;
38+}
39+
40+void AccountsBindings::setUser(const QString &user)
41+{
42+ m_user = user;
43+ Q_EMIT userChanged();
44+
45+ updateDemoEdges();
46+ updateBackgroundFile();
47+}
48+
49+bool AccountsBindings::getDemoEdges()
50+{
51+ return m_demoEdges;
52+}
53+
54+void AccountsBindings::setDemoEdges(bool demoEdges)
55+{
56+ m_demoEdges = demoEdges;
57+ m_service->setUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges", demoEdges);
58+}
59+
60+QString AccountsBindings::getBackgroundFile()
61+{
62+ return m_backgroundFile;
63+}
64+
65+void AccountsBindings::updateDemoEdges()
66+{
67+ auto demoEdges = m_service->getUserProperty(m_user, "com.canonical.unity.AccountsService", "demo-edges").toBool();
68+ if (m_demoEdges != demoEdges) {
69+ m_demoEdges = demoEdges;
70+ Q_EMIT demoEdgesChanged();
71+ }
72+}
73+
74+void AccountsBindings::updateBackgroundFile()
75+{
76+ auto backgroundFile = m_service->getUserProperty(m_user, "org.freedesktop.Accounts.User", "BackgroundFile").toString();
77+ if (m_backgroundFile != backgroundFile) {
78+ m_backgroundFile = backgroundFile;
79+ Q_EMIT backgroundFileChanged();
80+ }
81+}
82+
83+void AccountsBindings::propertiesChanged(const QString &user, const QString &interface, const QStringList &changed)
84+{
85+ if (m_user != user) {
86+ return;
87+ }
88+
89+ if (interface == "com.canonical.unity.AccountsService") {
90+ if (changed.contains("demo-edges")) {
91+ updateDemoEdges();
92+ }
93+ }
94+}
95+
96+void AccountsBindings::maybeChanged(const QString &user)
97+{
98+ if (m_user != user) {
99+ return;
100+ }
101+
102+ // Standard properties might have changed
103+ updateBackgroundFile();
104+}
plugins/AccountsService/AccountsBindings.hnew file+70
@@ -0,0 +1,70 @@
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_ACCOUNTSBINDINGS_H
20+#define UNITY_ACCOUNTSBINDINGS_H
21+
22+#include <QObject>
23+#include <QString>
24+
25+class AccountsService;
26+
27+class AccountsBindings: public QObject
28+{
29+ Q_OBJECT
30+ Q_PROPERTY (QString user
31+ READ getUser
32+ WRITE setUser
33+ NOTIFY userChanged)
34+ Q_PROPERTY (bool demoEdges
35+ READ getDemoEdges
36+ WRITE setDemoEdges
37+ NOTIFY demoEdgesChanged)
38+ Q_PROPERTY (QString backgroundFile
39+ READ getBackgroundFile
40+ NOTIFY backgroundFileChanged)
41+
42+public:
43+ explicit AccountsBindings(QObject *parent = 0);
44+
45+ QString getUser();
46+ void setUser(const QString &user);
47+ bool getDemoEdges();
48+ void setDemoEdges(bool demoEdges);
49+ QString getBackgroundFile();
50+
51+Q_SIGNALS:
52+ void userChanged();
53+ void demoEdgesChanged();
54+ void backgroundFileChanged();
55+
56+private Q_SLOTS:
57+ void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
58+ void maybeChanged(const QString &user);
59+
60+private:
61+ void updateDemoEdges();
62+ void updateBackgroundFile();
63+
64+ AccountsService *m_service;
65+ QString m_user;
66+ bool m_demoEdges;
67+ QString m_backgroundFile;
68+};
69+
70+#endif
plugins/AccountsService/AccountsService.cpp+57−5
@@ -36,11 +36,11 @@ AccountsService::AccountsService(QObject* parent)
3636 connection, this);
3737}
3838
39−QVariant AccountsService::getUserProperty(const QString &user, const QString &property)
39+QVariant AccountsService::getUserProperty(const QString &user, const QString &interface, const QString &property)
4040{
4141 auto iface = getUserInterface(user);
4242 if (iface != nullptr && iface->isValid()) {
43− auto answer = iface->call("Get", "com.canonical.unity.AccountsService", property);
43+ auto answer = iface->call("Get", interface, property);
4444 if (answer.type() == QDBusMessage::ReplyMessage) {
4545 return answer.arguments()[0].value<QDBusVariant>().variant();
4646 }
@@ -48,25 +48,77 @@ QVariant AccountsService::getUserProperty(const QString &user, const QString &pr
4848 return QVariant();
4949}
5050
51−void AccountsService::setUserProperty(const QString &user, const QString &property, const QVariant &value)
51+void AccountsService::setUserProperty(const QString &user, const QString &interface, const QString &property, const QVariant &value)
5252{
5353 auto iface = getUserInterface(user);
5454 if (iface != nullptr && iface->isValid()) {
5555 // The value needs to be carefully wrapped
56− iface->call("Set", "com.canonical.unity.AccountsService", property, QVariant::fromValue(QDBusVariant(value)));
56+ iface->call("Set", interface, property, QVariant::fromValue(QDBusVariant(value)));
5757 }
5858}
5959
60+void AccountsService::propertiesChangedSlot(const QString &interface, const QVariantMap &changed, const QStringList &invalid)
61+{
62+ // Merge changed and invalidated together
63+ QStringList combined;
64+ combined << invalid;
65+ combined << changed.keys();
66+ combined.removeDuplicates();
67+
68+ Q_EMIT propertiesChanged(getUserForPath(message().path()), interface, combined);
69+}
70+
71+void AccountsService::maybeChangedSlot()
72+{
73+ Q_EMIT maybeChanged(getUserForPath(message().path()));
74+}
75+
76+QString AccountsService::getUserForPath(const QString &path)
77+{
78+ QMap<QString, QDBusInterface *>::const_iterator i;
79+ for (i = users.constBegin(); i != users.constEnd(); ++i) {
80+ if (i.value()->path() == path) {
81+ return i.key();
82+ }
83+ }
84+ return QString();
85+}
86+
6087QDBusInterface *AccountsService::getUserInterface(const QString &user)
6188{
6289 auto iface = users.value(user);
6390 if (iface == nullptr && accounts_manager->isValid()) {
6491 auto answer = accounts_manager->call("FindUserByName", user);
6592 if (answer.type() == QDBusMessage::ReplyMessage) {
93+ auto path = answer.arguments()[0].value<QDBusObjectPath>().path();
94+
6695 iface = new QDBusInterface("org.freedesktop.Accounts",
67− answer.arguments()[0].value<QDBusObjectPath>().path(),
96+ path,
6897 "org.freedesktop.DBus.Properties",
6998 accounts_manager->connection(), this);
99+
100+ // With its own pre-defined properties, AccountsService is oddly
101+ // close-lipped. It won't send out proper DBus.Properties notices,
102+ // but it does have one catch-all Changed() signal. So let's
103+ // listen to that.
104+ iface->connection().connect(
105+ iface->service(),
106+ path,
107+ "org.freedesktop.Accounts.User",
108+ "Changed",
109+ this,
110+ SLOT(maybeChangedSlot()));
111+
112+ // But custom properties do send out the right notifications, so
113+ // let's still listen there.
114+ iface->connection().connect(
115+ iface->service(),
116+ path,
117+ "org.freedesktop.DBus.Properties",
118+ "PropertiesChanged",
119+ this,
120+ SLOT(propertiesChangedSlot(QString, QVariantMap, QStringList)));
121+
70122 users.insert(user, iface);
71123 }
72124 }
plugins/AccountsService/AccountsService.h+13−3
@@ -19,23 +19,33 @@
1919#ifndef UNITY_ACCOUNTSSERVICE_H
2020#define UNITY_ACCOUNTSSERVICE_H
2121
22+#include <QDBusContext>
2223#include <QDBusInterface>
2324#include <QMap>
2425#include <QObject>
2526#include <QString>
2627
27−class AccountsService: public QObject
28+class AccountsService: public QObject, public QDBusContext
2829{
2930 Q_OBJECT
3031
3132public:
3233 explicit AccountsService(QObject *parent = 0);
3334
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);
35+ Q_INVOKABLE QVariant getUserProperty(const QString &user, const QString &interface, const QString &property);
36+ Q_INVOKABLE void setUserProperty(const QString &user, const QString &interface, const QString &property, const QVariant &value);
37+
38+Q_SIGNALS:
39+ void propertiesChanged(const QString &user, const QString &interface, const QStringList &changed);
40+ void maybeChanged(const QString &user); // Standard properties might have changed
41+
42+private Q_SLOTS:
43+ void propertiesChangedSlot(const QString &interface, const QVariantMap &changed, const QStringList &invalid);
44+ void maybeChangedSlot();
3645
3746private:
3847 QDBusInterface *getUserInterface(const QString &user);
48+ QString getUserForPath(const QString &path);
3949
4050 QDBusInterface *accounts_manager;
4151 QMap<QString, QDBusInterface *> users;
plugins/AccountsService/CMakeLists.txt+1
@@ -3,6 +3,7 @@ include(Plugins)
33add_definitions(-DSM_BUSNAME=systemBus)
44
55add_library(AccountsService-qml MODULE
6+ AccountsBindings.cpp
67 AccountsService.cpp
78 plugin.cpp
89 )
plugins/AccountsService/plugin.cpp+3−3
@@ -17,7 +17,7 @@
1717 */
1818
1919#include "plugin.h"
20−#include "AccountsService.h"
20+#include "AccountsBindings.h"
2121
2222#include <QDBusMetaType>
2323#include <QtQml>
@@ -26,12 +26,12 @@ static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
2626{
2727 Q_UNUSED(engine)
2828 Q_UNUSED(scriptEngine)
29− return new AccountsService();
29+ return new AccountsBindings();
3030}
3131
3232void AccountsServicePlugin::registerTypes(const char *uri)
3333{
3434 Q_ASSERT(uri == QLatin1String("AccountsService"));
3535 qDBusRegisterMetaType<QList<QVariantMap>>();
36− qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
36+ qmlRegisterSingletonType<AccountsBindings>(uri, 0, 1, "AccountsService", service_provider);
3737}
plugins/Unity/Launcher/backend/launcherbackend.cpp+2−2
@@ -200,7 +200,7 @@ void LauncherBackend::syncFromAccounts()
200200 m_storedApps.clear();
201201
202202 if (m_accounts && m_user.isEmpty()) {
203− QVariant variant = m_accounts->getUserProperty(m_user, "launcher-items");
203+ QVariant variant = m_accounts->getUserProperty(m_user, "com.canonical.unity.AccountsService", "launcher-items");
204204 apps = qdbus_cast<QList<QVariantMap>>(variant.value<QDBusArgument>());
205205 defaults = isDefaultsItem(apps);
206206 }
@@ -239,7 +239,7 @@ void LauncherBackend::syncToAccounts()
239239 items << itemToVariant(appId);
240240 }
241241
242− m_accounts->setUserProperty(m_user, "launcher-items", QVariant::fromValue(items));
242+ m_accounts->setUserProperty(m_user, "com.canonical.unity.AccountsService", "launcher-items", QVariant::fromValue(items));
243243 }
244244}
245245
tests/mocks/AccountsService/AccountsService.cpp → tests/mocks/AccountsService/AccountsBindings.cpprenamed+21−5
@@ -16,18 +16,34 @@
1616 * Author: Michael Terry <michael.terry@canonical.com>
1717 */
1818
19−#include "AccountsService.h"
19+#include "AccountsBindings.h"
2020
21−AccountsService::AccountsService(QObject* parent)
21+AccountsBindings::AccountsBindings(QObject* parent)
2222 : QObject(parent)
2323{
2424}
2525
26−QVariant AccountsService::getUserProperty(const QString &, const QString &)
26+QString AccountsBindings::getUser()
2727{
28− return QVariant(false);
28+ return "testuser";
2929}
3030
31−void AccountsService::setUserProperty(const QString &, const QString &, const QVariant &)
31+void AccountsBindings::setUser(const QString &user)
3232{
33+ Q_UNUSED(user)
34+}
35+
36+bool AccountsBindings::getDemoEdges()
37+{
38+ return false;
39+}
40+
41+void AccountsBindings::setDemoEdges(bool demoEdges)
42+{
43+ Q_UNUSED(demoEdges)
44+}
45+
46+QString AccountsBindings::getBackgroundFile()
47+{
48+ return TOP_SRCDIR "/graphics/phone_background.jpg";
3349}
tests/mocks/AccountsService/AccountsService.h → tests/mocks/AccountsService/AccountsBindings.hrenamed+25−6
@@ -17,22 +17,41 @@
1717 * Michael Terry <michael.terry@canonical.com>
1818 */
1919
20−#ifndef UNITY_MOCK_ACCOUNTSSERVICE_H
21−#define UNITY_MOCK_ACCOUNTSSERVICE_H
20+#ifndef UNITY_MOCK_ACCOUNTSBINDINGS_H
21+#define UNITY_MOCK_ACCOUNTSBINDINGS_H
2222
2323#include <QObject>
2424#include <QString>
2525#include <QVariant>
2626
27−class AccountsService: public QObject
27+class AccountsBindings: public QObject
2828{
2929 Q_OBJECT
30+ Q_PROPERTY (QString user
31+ READ getUser
32+ WRITE setUser
33+ NOTIFY userChanged)
34+ Q_PROPERTY (bool demoEdges
35+ READ getDemoEdges
36+ WRITE setDemoEdges
37+ NOTIFY demoEdgesChanged)
38+ Q_PROPERTY (QString backgroundFile
39+ READ getBackgroundFile
40+ NOTIFY backgroundFileChanged)
3041
3142public:
32− explicit AccountsService(QObject *parent = 0);
43+ explicit AccountsBindings(QObject *parent = 0);
3344
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);
45+ QString getUser();
46+ void setUser(const QString &user);
47+ bool getDemoEdges();
48+ void setDemoEdges(bool demoEdges);
49+ QString getBackgroundFile();
50+
51+Q_SIGNALS:
52+ void userChanged();
53+ void demoEdgesChanged();
54+ void backgroundFileChanged();
3655};
3756
3857#endif
tests/mocks/AccountsService/CMakeLists.txt+3−1
@@ -1,5 +1,7 @@
1+add_definitions(-DTOP_SRCDIR="${CMAKE_SOURCE_DIR}")
2+
13add_library(MockAccountsService-qml MODULE
2− AccountsService.cpp
4+ AccountsBindings.cpp
35 plugin.cpp
46 )
57
tests/mocks/AccountsService/plugin.cpp+3−3
@@ -18,7 +18,7 @@
1818 */
1919
2020#include "plugin.h"
21−#include "AccountsService.h"
21+#include "AccountsBindings.h"
2222
2323#include <QtQml>
2424
@@ -26,11 +26,11 @@ static QObject *service_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
2626{
2727 Q_UNUSED(engine)
2828 Q_UNUSED(scriptEngine)
29− return new AccountsService();
29+ return new AccountsBindings();
3030}
3131
3232void AccountsServicePlugin::registerTypes(const char *uri)
3333{
3434 Q_ASSERT(uri == QLatin1String("AccountsService"));
35− qmlRegisterSingletonType<AccountsService>(uri, 0, 1, "AccountsService", service_provider);
35+ qmlRegisterSingletonType<AccountsBindings>(uri, 0, 1, "AccountsService", service_provider);
3636}
tests/plugins/AccountsService/CMakeLists.txt+1
@@ -25,6 +25,7 @@ qt5_use_modules(mock-server Core DBus)
2525
2626add_executable(test-accountsservice
2727 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp
28+ ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsBindings.cpp
2829 client.cpp
2930 )
3031qt5_use_modules(test-accountsservice Core DBus Test)
tests/plugins/AccountsService/client.cpp+18−6
@@ -17,6 +17,7 @@
1717 * Authored by: Michael Terry <michael.terry@canonical.com>
1818 */
1919
20+#include "AccountsBindings.h"
2021#include "AccountsService.h"
2122#include <QSignalSpy>
2223#include <QTest>
@@ -31,16 +32,27 @@ private Q_SLOTS:
3132 {
3233 // Test various invalid calls
3334 AccountsService session;
34− QCOMPARE(session.getUserProperty("NOPE", "demo-edges"), QVariant());
35− QCOMPARE(session.getUserProperty("testuser", "NOPE"), QVariant());
35+ QCOMPARE(session.getUserProperty("NOPE", "com.canonical.unity.AccountsService", "demo-edges"), QVariant());
36+ QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "NOPE"), QVariant());
3637 }
3738
38− void testGetSet()
39+ void testGetSetService()
3940 {
4041 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));
42+ session.setUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges", QVariant(true));
43+ QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges"), QVariant(true));
44+ session.setUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges", QVariant(false));
45+ QCOMPARE(session.getUserProperty("testuser", "com.canonical.unity.AccountsService", "demo-edges"), QVariant(false));
46+ }
47+
48+ void testGetSetBindings()
49+ {
50+ AccountsBindings bindings;
51+ bindings.setUser("testuser");
52+ bindings.setDemoEdges(true);
53+ QCOMPARE(bindings.getDemoEdges(), true);
54+ bindings.setDemoEdges(false);
55+ QCOMPARE(bindings.getDemoEdges(), false);
4456 }
4557};
4658