Merge lp:~mterry/unity8/set-real-name into lp:unity8

Proposed by Michael Terry
Status: Superseded
Proposed branch: lp:~mterry/unity8/set-real-name
Merge into: lp:unity8
Prerequisite: lp:~ci-train-bot/unity8/unity8-ubuntu-xenial-landing-041
Diff against target: 275 lines (+116/-22)
6 files modified
plugins/AccountsService/AccountsServiceDBusAdaptor.cpp (+12/-2)
tests/plugins/AccountsService/CMakeLists.txt (+2/-1)
tests/plugins/AccountsService/PropertiesServer.cpp (+36/-7)
tests/plugins/AccountsService/PropertiesServer.h (+7/-0)
tests/plugins/AccountsService/client.cpp (+46/-12)
tests/plugins/AccountsService/interfaces.xml (+13/-0)
To merge this branch: bzr merge lp:~mterry/unity8/set-real-name
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) code looks good, branch may need rework Approve
Unity8 CI Bot continuous-integration Needs Fixing
Review via email: mp+289284@code.launchpad.net

This proposal has been superseded by a proposal from 2016-03-23.

Commit message

Fix OOBE wizard not setting your name.

Description of the change

Fix how we set some standard properties of AccountsService (like Email and RealName).

AS does not let you set those properties directly. You must call SetEmail or SetRealName.

I've modified our DBus wrapper to notice such sets and use the right call. I've also updated our test suite to match and added a new test for SetRealName.

= To reproduce =

- Use tablet mode
- Go through the wizard, setting name

When done with wizard, your name should be above the greeter password field, instead of "Ubuntu"

= Checklist =

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 No (well, except silo 41)

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Yes

 * Did you make sure that your branch does not contain spurious tags?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 NA

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
lp:~mterry/unity8/set-real-name updated
2279. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2280. By Michael Zanetti

more fixes for the new theme palette Fixes: #1554616, #1557534
Approved by: Michael Zanetti

2281. By Lukáš Tinkl

Fix notifications with the new UITK color schemes Fixes: #1554616, #1556523
Approved by: Michael Terry

2282. By CI Train Bot Account

Releasing 8.11+16.04.20160318.1-0ubuntu1

2283. By CI Train Bot Account

Update translation template

Revision history for this message
Albert Astals Cid (aacid) wrote :

The diff looks weird, i guess launchpad got confused by the prereq? Maybe put this as Work in Progress until the prereq silo lands?

Revision history for this message
Michael Terry (mterry) wrote :
Revision history for this message
Albert Astals Cid (aacid) wrote :

The code from commit 2297 looks good but i'm afraid you will need to rework this branch since even if i download the current lp:~ci-train-bot/unity8/unity8-ubuntu-xenial-landing-041 and then merge this branch in, i get conflicts, i guess because lp:~ci-train-bot/unity8/unity8-ubuntu-xenial-landing-041 has been changing with time.

So half-approving

review: Approve (code looks good, branch may need rework)
Revision history for this message
Michael Terry (mterry) wrote :

OK good point, I'll mark this WIP until we land one of the silos we're waiting on.

lp:~mterry/unity8/set-real-name updated
2284. By CI Train Bot Account

Resync trunk.

2285. By Launchpad Translations on behalf of unity-team

Launchpad automatic translations update.

2286. By Michael Terry

New first-run wizard for the phone (part of the OOBE effort) Fixes: #1536617, #1536688, #1543790, #1555222
Approved by: Michael Zanetti

2287. By Michael Zanetti

Sidestage load/unload redesign Fixes: #1544479
Approved by: Michael Terry

2288. By Michael Zanetti

Add support for low shell chrome. Fixes: #1535397
Approved by: Gerry Boland

2289. By Michael Zanetti

Redesign the first-boot edge tutorial
Approved by: Michael Zanetti

2290. By Michael Terry

Stop the left edge tutorial from being shown when the bottom edge tutorial wants to be shown after receiving a call.
Approved by: Albert Astals Cid

2291. By Lukáš Tinkl

Keymap switching support Fixes: #1412492, #1491340, #1524400
Approved by: Unity8 CI Bot, Michael Terry

2292. By Michael Zanetti

disabling some tests that are flaky in adt but can't be made fail on our machines
Approved by: Michael Terry

2293. By Michael Terry

Fix setting OSK layout in OOBE wizard
Approved by: Lukáš Tinkl

2294. By Albert Astals Cid

Implement the API changes due to filters
Approved by: Andrea Cimitan, Michael Terry

2295. By Albert Astals Cid

New Dash Navigation UX
Approved by: Andrea Cimitan

2296. By Albert Astals Cid

Filter implementation with Option Selector filter as the only filter
Approved by: Andrea Cimitan

2297. By Albert Astals Cid

Match design visuals for the new dash navigation/page header popup
Approved by: Andrea Cimitan

2298. By Albert Astals Cid

Range Input filter
Approved by: Andrea Cimitan

2299. By Albert Astals Cid

Value slider filter
Approved by: Andrea Cimitan

2300. By Albert Astals Cid

Workaround SDK ListItem bug

Approved by: Michael Terry

2301. By Albert Astals Cid

Fix various tests

test_navigationShowFilterButton is gone since it was testing a feature that no longer exists
Approved by: Michael Zanetti

2302. By Albert Astals Cid

Get the engine from the parent context

Approved by: Michael Zanetti

2303. By Michael Zanetti

Change the behavior alond with the switch in indicator-display Fixes: #1538591
Approved by: Michael Terry

2304. By Michael Terry

Session indicator convergence Fixes: #1538591
Approved by: Michael Terry

2305. By CI Train Bot Account

Releasing 8.12+16.04.20160323.2-0ubuntu1

2306. By CI Train Bot Account

Update translation template

2307. By Michael Terry

Fix setting some AS properties

2308. By Michael Terry

Add missing file

2309. By Michael Terry

Fix integrated test

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/AccountsService/AccountsServiceDBusAdaptor.cpp'
2--- plugins/AccountsService/AccountsServiceDBusAdaptor.cpp 2016-02-16 14:12:58 +0000
3+++ plugins/AccountsService/AccountsServiceDBusAdaptor.cpp 2016-03-23 20:48:16 +0000
4@@ -57,8 +57,18 @@
5 {
6 QDBusInterface *iface = getUserInterface(user);
7 if (iface != nullptr && iface->isValid()) {
8- // The value needs to be carefully wrapped
9- return iface->asyncCall(QStringLiteral("Set"), interface, property, QVariant::fromValue(QDBusVariant(value)));
10+ if (interface == QStringLiteral("org.freedesktop.Accounts.User")) {
11+ // Standard AccountsService properties use special set methods.
12+ // It will not let you use the usual DBus property setters.
13+ QDBusInterface accountsIface(iface->service(),
14+ iface->path(),
15+ interface,
16+ iface->connection());
17+ return accountsIface.asyncCall(QStringLiteral("Set") + property, value);
18+ } else {
19+ // The value needs to be carefully wrapped
20+ return iface->asyncCall(QStringLiteral("Set"), interface, property, QVariant::fromValue(QDBusVariant(value)));
21+ }
22 }
23 return QDBusPendingCall::fromCompletedCall(QDBusMessage::createError(QDBusError::Other, QStringLiteral("Invalid Interface")));
24 }
25
26=== modified file 'tests/plugins/AccountsService/CMakeLists.txt'
27--- tests/plugins/AccountsService/CMakeLists.txt 2016-02-25 10:57:17 +0000
28+++ tests/plugins/AccountsService/CMakeLists.txt 2016-03-23 20:48:16 +0000
29@@ -5,7 +5,7 @@
30 endif()
31 macro(make_dbus_class NAME INTERFACE)
32 if(${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml IS_NEWER_THAN ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor.h)
33- execute_process(COMMAND ${QDBUSXML2CPP_EXECUTABLE} -c ${NAME}Adaptor -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
34+ execute_process(COMMAND ${QDBUSXML2CPP_EXECUTABLE} -c ${NAME}Adaptor -i types.h -a ${CMAKE_CURRENT_BINARY_DIR}/${NAME}Adaptor ${CMAKE_CURRENT_SOURCE_DIR}/interfaces.xml ${INTERFACE})
35 endif()
36 endmacro(make_dbus_class)
37
38@@ -20,6 +20,7 @@
39
40 include_directories(
41 ${CMAKE_CURRENT_BINARY_DIR}
42+ ${CMAKE_CURRENT_SOURCE_DIR}
43 ${CMAKE_SOURCE_DIR}/plugins/AccountsService
44 )
45
46
47=== modified file 'tests/plugins/AccountsService/PropertiesServer.cpp'
48--- tests/plugins/AccountsService/PropertiesServer.cpp 2016-03-23 09:50:10 +0000
49+++ tests/plugins/AccountsService/PropertiesServer.cpp 2016-03-23 20:48:16 +0000
50@@ -25,9 +25,7 @@
51 #include <QDBusMessage>
52 #include <QDBusMetaType>
53
54-using StringMap = QMap<QString,QString>;
55-using StringMapList = QList<StringMap>;
56-Q_DECLARE_METATYPE(StringMapList)
57+#define IFACE_ACCOUNTS_USER QStringLiteral("org.freedesktop.Accounts.User")
58
59 PropertiesServer::PropertiesServer(QObject *parent)
60 : QObject(parent)
61@@ -62,6 +60,38 @@
62 {
63 QVariant newValue = variant.variant();
64
65+ if (interface == IFACE_ACCOUNTS_USER) {
66+ sendErrorReply(QDBusError::InvalidArgs, QStringLiteral("Property is not writable"));
67+ return;
68+ }
69+
70+ internalSet(interface, property, newValue);
71+}
72+
73+void PropertiesServer::SetBackgroundFile(const QString &backgroundFile)
74+{
75+ internalSet(IFACE_ACCOUNTS_USER, QStringLiteral("BackgroundFile"), backgroundFile);
76+}
77+
78+void PropertiesServer::SetEmail(const QString &email)
79+{
80+ internalSet(IFACE_ACCOUNTS_USER, QStringLiteral("Email"), email);
81+}
82+
83+void PropertiesServer::SetInputSources(const StringMapList &inputSources)
84+{
85+ internalSet(IFACE_ACCOUNTS_USER, QStringLiteral("InputSources"), QVariant::fromValue(inputSources));
86+}
87+
88+void PropertiesServer::SetRealName(const QString &realName)
89+{
90+ internalSet(IFACE_ACCOUNTS_USER, QStringLiteral("RealName"), realName);
91+}
92+
93+void PropertiesServer::internalSet(const QString &interface, const QString &property, const QVariant &variant)
94+{
95+ QVariant newValue = variant;
96+
97 if (m_properties[interface].contains(property)) {
98 QVariant& oldValue = m_properties[interface][property];
99 if (oldValue != newValue) {
100@@ -69,14 +99,12 @@
101 if (interface == QStringLiteral("com.canonical.unity.AccountsService") &&
102 property == QStringLiteral("LauncherItems")) {
103 newValue = QVariant::fromValue(qdbus_cast<QList<QVariantMap>>(newValue.value<QDBusArgument>()));
104- } else if (interface == "org.freedesktop.Accounts.User" && property == "InputSources") {
105- newValue = QVariant::fromValue(qdbus_cast<StringMapList>(newValue.value<QDBusArgument>()));
106 }
107
108 oldValue = newValue;
109
110 // Special case for user properties.
111- if (interface == "org.freedesktop.Accounts.User") {
112+ if (interface == IFACE_ACCOUNTS_USER) {
113 Q_EMIT Changed();
114 } else {
115 QVariantMap propertyChanges;
116@@ -108,6 +136,7 @@
117 m_properties["com.ubuntu.location.providers.here.AccountsService"]["LicenseAccepted"] = false;
118 m_properties["com.ubuntu.location.providers.here.AccountsService"]["LicenseBasePath"] = "";
119 m_properties["org.freedesktop.Accounts.User"]["BackgroundFile"] = "";
120+ m_properties["org.freedesktop.Accounts.User"]["Email"] = "";
121+ m_properties["org.freedesktop.Accounts.User"]["InputSources"] = QVariant::fromValue(StringMapList());
122 m_properties["org.freedesktop.Accounts.User"]["RealName"] = "";
123- m_properties["org.freedesktop.Accounts.User"]["InputSources"] = QVariant::fromValue(StringMapList());
124 }
125
126=== modified file 'tests/plugins/AccountsService/PropertiesServer.h'
127--- tests/plugins/AccountsService/PropertiesServer.h 2016-03-11 12:54:58 +0000
128+++ tests/plugins/AccountsService/PropertiesServer.h 2016-03-23 20:48:16 +0000
129@@ -24,6 +24,7 @@
130 #include <QDBusVariant>
131 #include <QObject>
132 #include <QString>
133+#include "types.h"
134
135 class PropertiesServer: public QObject, protected QDBusContext
136 {
137@@ -36,6 +37,10 @@
138 QDBusVariant Get(const QString &interface, const QString &property) const;
139 QVariantMap GetAll(const QString &interface) const;
140 void Set(const QString &interface, const QString &property, const QDBusVariant &variant);
141+ void SetBackgroundFile(const QString &backgroundFile);
142+ void SetEmail(const QString &email);
143+ void SetInputSources(const StringMapList &inputSources);
144+ void SetRealName(const QString &realName);
145
146 // mock only.
147 void Reset();
148@@ -45,6 +50,8 @@
149 void Changed();
150
151 private:
152+ void internalSet(const QString &interface, const QString &property, const QVariant &variant);
153+
154 QHash<QString, QVariantMap> m_properties;
155 };
156
157
158=== modified file 'tests/plugins/AccountsService/client.cpp'
159--- tests/plugins/AccountsService/client.cpp 2016-03-23 09:50:10 +0000
160+++ tests/plugins/AccountsService/client.cpp 2016-03-23 20:48:16 +0000
161@@ -19,16 +19,13 @@
162
163 #include "AccountsService.h"
164 #include "AccountsServiceDBusAdaptor.h"
165+#include "types.h"
166 #include <QSignalSpy>
167 #include <QTest>
168 #include <QDebug>
169 #include <QDBusReply>
170 #include <QDBusMetaType>
171
172-using StringMap = QMap<QString,QString>;
173-using StringMapList = QList<StringMap>;
174-Q_DECLARE_METATYPE(StringMapList)
175-
176 template <class T>
177 QVariant dbusVariant(const T& value) { return QVariant::fromValue(QDBusVariant(value)); }
178
179@@ -263,10 +260,13 @@
180 AccountsService session(this, QTest::currentTestFunction());
181
182 QCOMPARE(session.backgroundFile(), QString());
183- ASSERT_DBUS_CALL(m_userInterface->asyncCall("Set",
184- "org.freedesktop.Accounts.User",
185- "BackgroundFile",
186- dbusVariant("/test/BackgroundFile")));
187+
188+ QDBusInterface accountsIface(m_userInterface->service(),
189+ m_userInterface->path(),
190+ "org.freedesktop.Accounts.User");
191+ ASSERT_DBUS_CALL(accountsIface.asyncCall("SetBackgroundFile",
192+ "/test/BackgroundFile"));
193+
194 QTRY_COMPARE(session.backgroundFile(), QString("/test/BackgroundFile"));
195 }
196
197@@ -311,6 +311,39 @@
198 QCOMPARE(arguments.at(0).toInt(), 0);
199 }
200
201+ void testSetRealName()
202+ {
203+ AccountsService session(this, QTest::currentTestFunction());
204+
205+ // Just confirm that we can't set normal way
206+ auto message = m_userInterface->call("Set",
207+ "org.freedesktop.Accounts.User",
208+ "RealName",
209+ dbusVariant("Stallman"));
210+ QCOMPARE(message.type(), QDBusMessage::ErrorMessage);
211+ QCOMPARE(message.errorName(), QStringLiteral("org.freedesktop.DBus.Error.InvalidArgs"));
212+
213+ message = m_userInterface->call("Get",
214+ "org.freedesktop.Accounts.User",
215+ "RealName");
216+ QCOMPARE(message.type(), QDBusMessage::ReplyMessage);
217+ auto response = message.arguments().first().value<QDBusVariant>().variant().toString();
218+ QCOMPARE(response, QStringLiteral(""));
219+
220+ // Now try it via our AS wrapper and confirm it did get through, unlike above
221+ session.setRealName("Stallman");
222+
223+ QCOMPARE(session.realName(), QStringLiteral("Stallman"));
224+
225+ message = m_userInterface->call("Get",
226+ "org.freedesktop.Accounts.User",
227+ "RealName");
228+ QCOMPARE(message.type(), QDBusMessage::ReplyMessage);
229+ response = message.arguments().first().value<QDBusVariant>().variant().toString();
230+ QCOMPARE(response, QStringLiteral("Stallman"));
231+
232+ }
233+
234 void testAsynchronousChangeForKeymaps()
235 {
236 AccountsService session(this, QTest::currentTestFunction());
237@@ -325,10 +358,11 @@
238 map2.insert("xkb", "fr");
239 inputSources.append(map2);
240
241- ASSERT_DBUS_CALL(m_userInterface->asyncCall("Set",
242- "org.freedesktop.Accounts.User",
243- "InputSources",
244- QVariant::fromValue(QDBusVariant(QVariant::fromValue(inputSources)))));
245+ QDBusInterface accountsIface(m_userInterface->service(),
246+ m_userInterface->path(),
247+ "org.freedesktop.Accounts.User");
248+ ASSERT_DBUS_CALL(accountsIface.asyncCall("SetInputSources",
249+ QVariant::fromValue(inputSources)));
250 QStringList result = {"cz+qwerty", "fr"};
251 QTRY_COMPARE(session.keymaps(), result);
252 }
253
254=== modified file 'tests/plugins/AccountsService/interfaces.xml'
255--- tests/plugins/AccountsService/interfaces.xml 2016-02-25 10:57:17 +0000
256+++ tests/plugins/AccountsService/interfaces.xml 2016-03-23 20:48:16 +0000
257@@ -42,6 +42,19 @@
258 <interface name="com.ubuntu.location.providers.here.AccountsService" />
259 <interface name="org.freedesktop.Accounts.User">
260 <signal name="Changed" />
261+ <method name="SetBackgroundFile">
262+ <arg name="backgroundFile" type="s" direction="in" />
263+ </method>
264+ <method name="SetEmail">
265+ <arg name="email" type="s" direction="in" />
266+ </method>
267+ <method name="SetInputSources">
268+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="StringMapList"/>
269+ <arg name="inputSources" type="aa{ss}" direction="in" />
270+ </method>
271+ <method name="SetRealName">
272+ <arg name="realName" type="s" direction="in" />
273+ </method>
274 </interface>
275 <interface name="com.canonical.unity.AccountsService.Private" />
276

Subscribers

People subscribed via source and target branches