Merge lp:~michihenning/storage-framework/qml-improvements into lp:storage-framework/devel
- qml-improvements
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Michi Henning |
Approved revision: | 86 |
Merged at revision: | 88 |
Proposed branch: | lp:~michihenning/storage-framework/qml-improvements |
Merge into: | lp:storage-framework/devel |
Diff against target: |
665 lines (+167/-193) 14 files modified
demo/demo.qml (+3/-1) include/unity/storage/qt/Account.h (+9/-8) include/unity/storage/qt/AccountsJob.h (+3/-1) include/unity/storage/qt/Item.h (+22/-22) include/unity/storage/qt/MetadataKeys.h.THIS (+0/-37) include/unity/storage/qt/Runtime.h (+3/-3) include/unity/storage/qt/internal/AccountImpl.h (+12/-12) include/unity/storage/qt/internal/AccountsJobImpl.h (+1/-0) plugins/Ubuntu/StorageFramework/plugin.cpp (+1/-1) src/qt/Account.cpp (+13/-13) src/qt/AccountsJob.cpp (+7/-0) src/qt/internal/AccountImpl.cpp (+46/-46) src/qt/internal/AccountsJobImpl.cpp (+11/-1) tests/remote-client/remote-client_test.cpp (+36/-48) |
To merge this branch: | bzr merge lp:~michihenning/storage-framework/qml-improvements |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michi Henning (community) | Approve | ||
unity-api-1-bot | continuous-integration | Approve | |
James Henstridge | Approve | ||
Review via email: mp+309809@code.launchpad.net |
Commit message
Renamed Account accessors to reflect what we get from online accounts.
A few fixes for QML:
- accounts property is no tied to a method that returns a QVariantList
- Changed to fully-qualified type names for Q_INVOKABLE methods, so QML
doesn't complain about an unknown return type.
Description of the change
Renamed Account accessors to reflect what we get from online accounts.
A few fixes for QML:
- accounts property is no tied to a method that returns a QVariantList
- Changed to fully-qualified type names for Q_INVOKABLE methods, so QML
doesn't complain about an unknown return type.
unity-api-1-bot (unity-api-1-bot) wrote : | # |
James Henstridge (jamesh) wrote : | # |
This all looks a bit messed up.
In AccountImpl, we have:
static Account make_account(
Which is being invoked in AccountJobImpl as:
That is, it is setting id=a->serviceId(), service_id="", display_
This looks like it is a transposition of the 4th and 5th arguments relative to the v1 API. So before merging this, it'd be good to decide what information exactly we're actually trying expose here.
Michi Henning (michihenning) wrote : | # |
I fixed that after the hangout last night. Are you sure that you were looking at the correct branch? Looking through the diff, I'm seeing the correct call:
The change is around line 441 of the diff.
In terms of what to expose, the ID is not particularly useful, so we could drop that. The ID isn't stable anyway (for example, if I delete an account and then re-add it).
The service ID and display name we have to keep, I think.
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:83
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:84
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
James Henstridge (jamesh) wrote : | # |
There are a few small issues I've noted inline, but this is looking almost ready to merge.
Michi Henning (michihenning) wrote : | # |
Thanks for your eagle eye! Old habits die hard :-(
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Autolanding.
More details in the following jenkins job:
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
- 86. By Michi Henning
-
Merged devel and resolved conflict.
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:85
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:86
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Michi Henning (michihenning) wrote : | # |
Re-approving after fixing merge conflict.
Preview Diff
1 | === modified file 'demo/demo.qml' |
2 | --- demo/demo.qml 2016-09-29 12:34:18 +0000 |
3 | +++ demo/demo.qml 2016-11-03 07:36:55 +0000 |
4 | @@ -27,7 +27,9 @@ |
5 | var accounts = root.accountsjob.accounts; |
6 | console.log("Got accounts " + accounts); |
7 | for (var i = 0; i < accounts.length; i++) { |
8 | - console.log("Account " + i + " owner = " + accounts[i].owner); |
9 | + console.log("Account " + i + ": busName = " + accounts[i].busName()); |
10 | + console.log("Account " + i + ": objectPath = " + accounts[i].objectPath()); |
11 | + console.log("Account " + i + ": displayName = " + accounts[i].displayName); |
12 | } |
13 | } |
14 | } |
15 | |
16 | === modified file 'include/unity/storage/qt/Account.h' |
17 | --- include/unity/storage/qt/Account.h 2016-11-02 04:27:52 +0000 |
18 | +++ include/unity/storage/qt/Account.h 2016-11-03 07:36:55 +0000 |
19 | @@ -44,9 +44,9 @@ |
20 | { |
21 | Q_GADGET |
22 | Q_PROPERTY(bool isValid READ isValid FINAL) |
23 | - Q_PROPERTY(QString owner READ owner FINAL) |
24 | - Q_PROPERTY(QString ownerId READ ownerId FINAL) |
25 | - Q_PROPERTY(QString description READ description FINAL) |
26 | + Q_PROPERTY(QString busName READ busName FINAL) |
27 | + Q_PROPERTY(QString objectPath READ objectPath FINAL) |
28 | + Q_PROPERTY(QString displayName READ displayName FINAL) |
29 | |
30 | public: |
31 | Account(); |
32 | @@ -57,12 +57,13 @@ |
33 | Account& operator=(Account&&); |
34 | |
35 | bool isValid() const; |
36 | - QString owner() const; |
37 | - QString ownerId() const; |
38 | - QString description() const; |
39 | + QString busName() const; |
40 | + QString objectPath() const; |
41 | + QString displayName() const; |
42 | + // TODO: add more methods to retrieve additional info, such as description, icon ID, and service name. |
43 | |
44 | - Q_INVOKABLE ItemListJob* roots(QStringList const& keys = QStringList()) const; |
45 | - Q_INVOKABLE ItemJob* get(QString const& itemId, QStringList const& keys = QStringList()) const; |
46 | + Q_INVOKABLE unity::storage::qt::ItemListJob* roots(QStringList const& keys = QStringList()) const; |
47 | + Q_INVOKABLE unity::storage::qt::ItemJob* get(QString const& itemId, QStringList const& keys = QStringList()) const; |
48 | |
49 | bool operator==(Account const&) const; |
50 | bool operator!=(Account const&) const; |
51 | |
52 | === modified file 'include/unity/storage/qt/AccountsJob.h' |
53 | --- include/unity/storage/qt/AccountsJob.h 2016-10-10 04:07:07 +0000 |
54 | +++ include/unity/storage/qt/AccountsJob.h 2016-11-03 07:36:55 +0000 |
55 | @@ -48,7 +48,7 @@ |
56 | Q_PROPERTY(bool isValid READ isValid NOTIFY statusChanged FINAL) |
57 | Q_PROPERTY(unity::storage::qt::AccountsJob::Status status READ status NOTIFY statusChanged FINAL) |
58 | Q_PROPERTY(unity::storage::qt::StorageError error READ error NOTIFY statusChanged FINAL) |
59 | - Q_PROPERTY(QList<unity::storage::qt::Account> accounts READ accounts NOTIFY statusChanged FINAL) |
60 | + Q_PROPERTY(QVariantList accounts READ accountsAsVariantList NOTIFY statusChanged FINAL) |
61 | |
62 | public: |
63 | enum Status { Loading, Finished, Error }; |
64 | @@ -68,6 +68,8 @@ |
65 | AccountsJob(std::shared_ptr<internal::RuntimeImpl> const& runtime); |
66 | AccountsJob(StorageError const& error); |
67 | |
68 | + QVariantList accountsAsVariantList() const; |
69 | + |
70 | std::unique_ptr<internal::AccountsJobImpl> const p_; |
71 | |
72 | friend class internal::RuntimeImpl; |
73 | |
74 | === modified file 'include/unity/storage/qt/Item.h' |
75 | --- include/unity/storage/qt/Item.h 2016-11-03 03:41:24 +0000 |
76 | +++ include/unity/storage/qt/Item.h 2016-11-03 07:36:55 +0000 |
77 | @@ -98,28 +98,28 @@ |
78 | QDateTime lastModifiedTime() const; |
79 | QStringList parentIds() const; |
80 | |
81 | - Q_INVOKABLE ItemListJob* parents(QStringList const& keys = QStringList()) const; |
82 | - Q_INVOKABLE ItemJob* copy(Item const& newParent, |
83 | - QString const& newName, |
84 | - QStringList const& keys = QStringList()) const; |
85 | - Q_INVOKABLE ItemJob* move(Item const& newParent, |
86 | - QString const& newName, |
87 | - QStringList const& keys = QStringList()) const; |
88 | - Q_INVOKABLE VoidJob* deleteItem() const; |
89 | - |
90 | - Q_INVOKABLE Uploader* createUploader(ConflictPolicy policy, |
91 | - qint64 sizeInBytes, |
92 | - QStringList const& keys = QStringList()) const; |
93 | - Q_INVOKABLE Downloader* createDownloader(ConflictPolicy policy) const; |
94 | - |
95 | - Q_INVOKABLE ItemListJob* list(QStringList const& keys = QStringList()) const; |
96 | - Q_INVOKABLE ItemListJob* lookup(QString const& name, QStringList const& = QStringList()) const; |
97 | - Q_INVOKABLE ItemJob* createFolder(QString const& name, QStringList const& = QStringList()) const; |
98 | - Q_INVOKABLE Uploader* createFile(QString const& name, |
99 | - ConflictPolicy policy, |
100 | - qint64 sizeInBytes, |
101 | - QString const& contentType, |
102 | - QStringList const& keys = QStringList()) const; |
103 | + Q_INVOKABLE unity::storage::qt::ItemListJob* parents(QStringList const& keys = QStringList()) const; |
104 | + Q_INVOKABLE unity::storage::qt::ItemJob* copy(Item const& newParent, |
105 | + QString const& newName, |
106 | + QStringList const& keys = QStringList()) const; |
107 | + Q_INVOKABLE unity::storage::qt::ItemJob* move(Item const& newParent, |
108 | + QString const& newName, |
109 | + QStringList const& keys = QStringList()) const; |
110 | + Q_INVOKABLE unity::storage::qt::VoidJob* deleteItem() const; |
111 | + |
112 | + Q_INVOKABLE unity::storage::qt::Uploader* createUploader(ConflictPolicy policy, |
113 | + qint64 sizeInBytes, |
114 | + QStringList const& keys = QStringList()) const; |
115 | + Q_INVOKABLE unity::storage::qt::Downloader* createDownloader(ConflictPolicy policy) const; |
116 | + |
117 | + Q_INVOKABLE unity::storage::qt::ItemListJob* list(QStringList const& keys = QStringList()) const; |
118 | + Q_INVOKABLE unity::storage::qt::ItemListJob* lookup(QString const& name, QStringList const& = QStringList()) const; |
119 | + Q_INVOKABLE unity::storage::qt::ItemJob* createFolder(QString const& name, QStringList const& = QStringList()) const; |
120 | + Q_INVOKABLE unity::storage::qt::Uploader* createFile(QString const& name, |
121 | + ConflictPolicy policy, |
122 | + qint64 sizeInBytes, |
123 | + QString const& contentType, |
124 | + QStringList const& keys = QStringList()) const; |
125 | |
126 | bool operator==(Item const&) const; |
127 | bool operator!=(Item const&) const; |
128 | |
129 | === removed file 'include/unity/storage/qt/MetadataKeys.h.THIS' |
130 | --- include/unity/storage/qt/MetadataKeys.h.THIS 2016-11-02 03:27:23 +0000 |
131 | +++ include/unity/storage/qt/MetadataKeys.h.THIS 1970-01-01 00:00:00 +0000 |
132 | @@ -1,37 +0,0 @@ |
133 | -/* |
134 | - * Copyright (C) 2016 Canonical Ltd |
135 | - * |
136 | - * This program is free software: you can redistribute it and/or modify |
137 | - * it under the terms of the GNU Lesser General Public License version 3 as |
138 | - * published by the Free Software Foundation. |
139 | - * |
140 | - * This program is distributed in the hope that it will be useful, |
141 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
142 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
143 | - * GNU Lesser General Public License for more details. |
144 | - * |
145 | - * You should have received a copy of the GNU Lesser General Public License |
146 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
147 | - * |
148 | - * Authors: Michi Henning <michi.henning@canonical.com> |
149 | - */ |
150 | - |
151 | -#pragma once |
152 | - |
153 | -#include <unity/storage/common.h> |
154 | - |
155 | -#include <QList> |
156 | -#include <QString> |
157 | - |
158 | -namespace unity |
159 | -{ |
160 | -namespace storage |
161 | -{ |
162 | -namespace qt |
163 | -{ |
164 | - |
165 | -static QStringList const ALL_METADATA = { metadata::ALL }; |
166 | - |
167 | -} // namespace qt |
168 | -} // namespace storage |
169 | -} // namespace unity |
170 | |
171 | === modified file 'include/unity/storage/qt/Runtime.h' |
172 | --- include/unity/storage/qt/Runtime.h 2016-09-29 12:28:46 +0000 |
173 | +++ include/unity/storage/qt/Runtime.h 2016-11-03 07:36:55 +0000 |
174 | @@ -66,9 +66,9 @@ |
175 | |
176 | Account make_test_account(QString const& bus_name, |
177 | QString const& object_path, |
178 | - QString const& owner_id = "", |
179 | - QString const& owner = "", |
180 | - QString const& description = "") const; |
181 | + QString const& id = "", |
182 | + QString const& serviceId = "", |
183 | + QString const& displayName = "") const; |
184 | |
185 | private: |
186 | std::shared_ptr<internal::RuntimeImpl> p_; |
187 | |
188 | === modified file 'include/unity/storage/qt/internal/AccountImpl.h' |
189 | --- include/unity/storage/qt/internal/AccountImpl.h 2016-11-02 03:20:03 +0000 |
190 | +++ include/unity/storage/qt/internal/AccountImpl.h 2016-11-03 07:36:55 +0000 |
191 | @@ -47,9 +47,9 @@ |
192 | AccountImpl& operator=(AccountImpl const&) = default; |
193 | AccountImpl& operator=(AccountImpl&&) = default; |
194 | |
195 | - QString ownerId() const; |
196 | - QString owner() const; |
197 | - QString description() const; |
198 | + QString busName() const; |
199 | + QString objectPath() const; |
200 | + QString displayName() const; |
201 | |
202 | ItemListJob* roots(QStringList const& keys) const; |
203 | ItemJob* get(QString const& itemId, QStringList const& keys) const; |
204 | @@ -69,24 +69,24 @@ |
205 | static Account make_account(std::shared_ptr<RuntimeImpl> const& runtime_impl, |
206 | QString const& bus_name, |
207 | QString const& object_path, |
208 | - QString const& owner_id, |
209 | - QString const& owner, |
210 | - QString const& description); |
211 | + QString const& id, |
212 | + QString const& service_id, |
213 | + QString const& display_name); |
214 | |
215 | private: |
216 | AccountImpl(std::shared_ptr<RuntimeImpl> const& runtime_impl, |
217 | QString const& bus_name, |
218 | QString const& object_path, |
219 | - QString const& owner_id, |
220 | - QString const& owner, |
221 | - QString const& description); |
222 | + QString const& id, |
223 | + QString const& service_id, |
224 | + QString const& display_name); |
225 | |
226 | bool is_valid_; |
227 | QString bus_name_; |
228 | QString object_path_; |
229 | - QString owner_id_; |
230 | - QString owner_; |
231 | - QString description_; |
232 | + QString id_; |
233 | + QString service_id_; |
234 | + QString display_name_; |
235 | std::weak_ptr<RuntimeImpl> runtime_impl_; |
236 | std::shared_ptr<ProviderInterface> provider_; |
237 | |
238 | |
239 | === modified file 'include/unity/storage/qt/internal/AccountsJobImpl.h' |
240 | --- include/unity/storage/qt/internal/AccountsJobImpl.h 2016-10-12 05:25:20 +0000 |
241 | +++ include/unity/storage/qt/internal/AccountsJobImpl.h 2016-11-03 07:36:55 +0000 |
242 | @@ -43,6 +43,7 @@ |
243 | AccountsJob::Status status() const; |
244 | StorageError error() const; |
245 | QList<Account> accounts() const; |
246 | + QVariantList accountsAsVariantList() const; |
247 | |
248 | private Q_SLOTS: |
249 | void manager_ready(); |
250 | |
251 | === modified file 'plugins/Ubuntu/StorageFramework/plugin.cpp' |
252 | --- plugins/Ubuntu/StorageFramework/plugin.cpp 2016-09-29 12:28:46 +0000 |
253 | +++ plugins/Ubuntu/StorageFramework/plugin.cpp 2016-11-03 07:36:55 +0000 |
254 | @@ -36,8 +36,8 @@ |
255 | void StorageFrameworkPlugin::registerTypes(const char* uri) |
256 | { |
257 | qmlRegisterType<Runtime>(uri, 0, 1, "Runtime"); |
258 | + qmlRegisterUncreatableType<Account>(uri, 0, 1, "Account", ""); |
259 | qmlRegisterUncreatableType<AccountsJob>(uri, 0, 1, "AccountsJob", "Use Runtime to create AccountsJob"); |
260 | - qmlRegisterUncreatableType<Account>(uri, 0, 1, "Account", ""); |
261 | qmlRegisterUncreatableType<Item>(uri, 0, 1, "Item", ""); |
262 | qmlRegisterUncreatableType<ItemJob>(uri, 0, 1, "ItemJob", "Use Account or another item to access items"); |
263 | qmlRegisterUncreatableType<ItemListJob>(uri, 0, 1, "ItemListJob", "Use Account or another item to access items"); |
264 | |
265 | === modified file 'src/qt/Account.cpp' |
266 | --- src/qt/Account.cpp 2016-11-02 03:20:03 +0000 |
267 | +++ src/qt/Account.cpp 2016-11-03 07:36:55 +0000 |
268 | @@ -78,19 +78,19 @@ |
269 | return p_->is_valid_; |
270 | } |
271 | |
272 | -QString Account::owner() const |
273 | -{ |
274 | - return p_->owner(); |
275 | -} |
276 | - |
277 | -QString Account::ownerId() const |
278 | -{ |
279 | - return p_->ownerId(); |
280 | -} |
281 | - |
282 | -QString Account::description() const |
283 | -{ |
284 | - return p_->description(); |
285 | +QString Account::busName() const |
286 | +{ |
287 | + return p_->busName(); |
288 | +} |
289 | + |
290 | +QString Account::objectPath() const |
291 | +{ |
292 | + return p_->objectPath(); |
293 | +} |
294 | + |
295 | +QString Account::displayName() const |
296 | +{ |
297 | + return p_->displayName(); |
298 | } |
299 | |
300 | ItemListJob* Account::roots(QStringList const& keys) const |
301 | |
302 | === modified file 'src/qt/AccountsJob.cpp' |
303 | --- src/qt/AccountsJob.cpp 2016-09-16 06:25:08 +0000 |
304 | +++ src/qt/AccountsJob.cpp 2016-11-03 07:36:55 +0000 |
305 | @@ -21,6 +21,8 @@ |
306 | #include <unity/storage/qt/Account.h> |
307 | #include <unity/storage/qt/internal/AccountsJobImpl.h> |
308 | |
309 | +#include <QVariant> |
310 | + |
311 | using namespace unity::storage::qt; |
312 | using namespace std; |
313 | |
314 | @@ -63,6 +65,11 @@ |
315 | return p_->accounts(); |
316 | } |
317 | |
318 | +QVariantList AccountsJob::accountsAsVariantList() const |
319 | +{ |
320 | + return p_->accountsAsVariantList(); |
321 | +} |
322 | + |
323 | } // namespace qt |
324 | } // namespace storage |
325 | } // namespace unity |
326 | |
327 | === modified file 'src/qt/internal/AccountImpl.cpp' |
328 | --- src/qt/internal/AccountImpl.cpp 2016-11-02 03:20:03 +0000 |
329 | +++ src/qt/internal/AccountImpl.cpp 2016-11-03 07:36:55 +0000 |
330 | @@ -50,15 +50,15 @@ |
331 | AccountImpl::AccountImpl(shared_ptr<RuntimeImpl> const& runtime_impl, |
332 | QString const& bus_name, |
333 | QString const& object_path, |
334 | - QString const& owner_id, |
335 | - QString const& owner, |
336 | - QString const& description) |
337 | + QString const& id, |
338 | + QString const& service_id, |
339 | + QString const& display_name) |
340 | : is_valid_(true) |
341 | , bus_name_(bus_name) |
342 | , object_path_(object_path) |
343 | - , owner_id_(owner_id) |
344 | - , owner_(owner) |
345 | - , description_(description) |
346 | + , id_(id) |
347 | + , service_id_(service_id) |
348 | + , display_name_(display_name) |
349 | , runtime_impl_(runtime_impl) |
350 | , provider_(new ProviderInterface(bus_name, object_path, runtime_impl->connection())) |
351 | { |
352 | @@ -66,19 +66,19 @@ |
353 | assert(!object_path.isEmpty()); |
354 | } |
355 | |
356 | -QString AccountImpl::owner() const |
357 | -{ |
358 | - return is_valid_ ? owner_ : ""; |
359 | -} |
360 | - |
361 | -QString AccountImpl::ownerId() const |
362 | -{ |
363 | - return is_valid_ ? owner_id_ : ""; |
364 | -} |
365 | - |
366 | -QString AccountImpl::description() const |
367 | -{ |
368 | - return is_valid_ ? description_ : ""; |
369 | +QString AccountImpl::busName() const |
370 | +{ |
371 | + return is_valid_ ? bus_name_ : ""; |
372 | +} |
373 | + |
374 | +QString AccountImpl::objectPath() const |
375 | +{ |
376 | + return is_valid_ ? object_path_ : ""; |
377 | +} |
378 | + |
379 | +QString AccountImpl::displayName() const |
380 | +{ |
381 | + return is_valid_ ? display_name_ : ""; |
382 | } |
383 | |
384 | ItemListJob* AccountImpl::roots(QStringList const& keys) const |
385 | @@ -142,9 +142,9 @@ |
386 | if (is_valid_) |
387 | { |
388 | return other.is_valid_ |
389 | - && owner_ == other.owner_ |
390 | - && owner_id_ == other.owner_id_ |
391 | - && description_ == other.description_; |
392 | + && id_ == other.id_ |
393 | + && service_id_ == other.service_id_ |
394 | + && display_name_ == other.display_name_; |
395 | } |
396 | return !other.is_valid_; |
397 | } |
398 | @@ -165,23 +165,23 @@ |
399 | return false; |
400 | } |
401 | assert(is_valid_ && other.is_valid_); |
402 | - if (owner_id_ < other.owner_id_) |
403 | - { |
404 | - return true; |
405 | - } |
406 | - if (owner_id_ > other.owner_id_) |
407 | - { |
408 | - return false; |
409 | - } |
410 | - if (owner_ < other.owner_) |
411 | - { |
412 | - return true; |
413 | - } |
414 | - if (owner_ > other.owner_) |
415 | - { |
416 | - return false; |
417 | - } |
418 | - return description_ < other.description_; |
419 | + if (id_ < other.id_) |
420 | + { |
421 | + return true; |
422 | + } |
423 | + if (id_ > other.id_) |
424 | + { |
425 | + return false; |
426 | + } |
427 | + if (service_id_ < other.service_id_) |
428 | + { |
429 | + return true; |
430 | + } |
431 | + if (service_id_ > other.service_id_) |
432 | + { |
433 | + return false; |
434 | + } |
435 | + return display_name_ < other.display_name_; |
436 | } |
437 | |
438 | bool AccountImpl::operator<=(AccountImpl const& other) const |
439 | @@ -216,20 +216,20 @@ |
440 | return 0; |
441 | } |
442 | size_t hash = 0; |
443 | - boost::hash_combine(hash, qHash(owner_)); |
444 | - boost::hash_combine(hash, qHash(owner_id_)); |
445 | - boost::hash_combine(hash, qHash(description_)); |
446 | + boost::hash_combine(hash, qHash(service_id_)); |
447 | + boost::hash_combine(hash, qHash(id_)); |
448 | + boost::hash_combine(hash, qHash(display_name_)); |
449 | return hash; |
450 | } |
451 | |
452 | Account AccountImpl::make_account(shared_ptr<RuntimeImpl> const& runtime, |
453 | QString const& bus_name, |
454 | QString const& object_path, |
455 | - QString const& owner_id, |
456 | - QString const& owner, |
457 | - QString const& description) |
458 | + QString const& id, |
459 | + QString const& service_id, |
460 | + QString const& display_name) |
461 | { |
462 | - shared_ptr<AccountImpl> p(new AccountImpl(runtime, bus_name, object_path, owner_id, owner, description)); |
463 | + shared_ptr<AccountImpl> p(new AccountImpl(runtime, bus_name, object_path, id, service_id, display_name)); |
464 | return Account(p); |
465 | } |
466 | |
467 | |
468 | === modified file 'src/qt/internal/AccountsJobImpl.cpp' |
469 | --- src/qt/internal/AccountsJobImpl.cpp 2016-11-02 09:32:53 +0000 |
470 | +++ src/qt/internal/AccountsJobImpl.cpp 2016-11-03 07:36:55 +0000 |
471 | @@ -103,6 +103,16 @@ |
472 | return accounts_; |
473 | } |
474 | |
475 | +QVariantList AccountsJobImpl::accountsAsVariantList() const |
476 | +{ |
477 | + QVariantList account_list; |
478 | + for (auto const& a : accounts()) |
479 | + { |
480 | + account_list.append(QVariant::fromValue(a)); |
481 | + } |
482 | + return account_list; |
483 | +} |
484 | + |
485 | void AccountsJobImpl::manager_ready() |
486 | { |
487 | timer_.stop(); |
488 | @@ -171,8 +181,8 @@ |
489 | accounts_.append(AccountImpl::make_account(runtime, |
490 | bus_name, |
491 | object_path, |
492 | + QString::number(a->id()), |
493 | a->serviceId(), |
494 | - "", |
495 | a->displayName())); |
496 | } |
497 | } |
498 | |
499 | === modified file 'tests/remote-client/remote-client_test.cpp' |
500 | --- tests/remote-client/remote-client_test.cpp 2016-11-03 03:41:24 +0000 |
501 | +++ tests/remote-client/remote-client_test.cpp 2016-11-03 07:36:55 +0000 |
502 | @@ -114,84 +114,84 @@ |
503 | // Default constructor. |
504 | Account a; |
505 | EXPECT_FALSE(a.isValid()); |
506 | - EXPECT_EQ("", a.ownerId()); |
507 | - EXPECT_EQ("", a.owner()); |
508 | - EXPECT_EQ("", a.description()); |
509 | + EXPECT_EQ("", a.busName()); |
510 | + EXPECT_EQ("", a.objectPath()); |
511 | + EXPECT_EQ("", a.displayName()); |
512 | } |
513 | |
514 | { |
515 | auto acc = runtime_->make_test_account(service_connection_->baseService(), object_path(), |
516 | - "id", "owner", "description"); |
517 | + "id", "sid", "displayName"); |
518 | EXPECT_TRUE(acc.isValid()); |
519 | - EXPECT_EQ("id", acc.ownerId()); |
520 | - EXPECT_EQ("owner", acc.owner()); |
521 | - EXPECT_EQ("description", acc.description()); |
522 | + EXPECT_EQ(service_connection_->baseService(), acc.busName()); |
523 | + EXPECT_EQ(object_path(), acc.objectPath()); |
524 | + EXPECT_EQ("displayName", acc.displayName()); |
525 | |
526 | // Copy constructor |
527 | Account a2(acc); |
528 | EXPECT_TRUE(a2.isValid()); |
529 | - EXPECT_EQ("id", a2.ownerId()); |
530 | - EXPECT_EQ("owner", a2.owner()); |
531 | - EXPECT_EQ("description", a2.description()); |
532 | + EXPECT_EQ(service_connection_->baseService(), a2.busName()); |
533 | + EXPECT_EQ(object_path(), a2.objectPath()); |
534 | + EXPECT_EQ("displayName", a2.displayName()); |
535 | |
536 | // Move constructor |
537 | Account a3(move(a2)); |
538 | EXPECT_TRUE(a3.isValid()); |
539 | - EXPECT_EQ("id", a3.ownerId()); |
540 | - EXPECT_EQ("owner", a3.owner()); |
541 | - EXPECT_EQ("description", a3.description()); |
542 | + EXPECT_EQ(service_connection_->baseService(), a3.busName()); |
543 | + EXPECT_EQ(object_path(), a3.objectPath()); |
544 | + EXPECT_EQ("displayName", a3.displayName()); |
545 | |
546 | // Moved-from object must be invalid |
547 | EXPECT_FALSE(a2.isValid()); |
548 | |
549 | // Moved-from object must be assignable |
550 | auto a4 = runtime_->make_test_account(service_connection_->baseService(), object_path(), |
551 | - "id4", "owner4", "description4"); |
552 | + "id4", "sid4", "displayName4"); |
553 | a2 = a4; |
554 | EXPECT_TRUE(a2.isValid()); |
555 | - EXPECT_EQ("id4", a2.ownerId()); |
556 | - EXPECT_EQ("owner4", a2.owner()); |
557 | - EXPECT_EQ("description4", a2.description()); |
558 | + EXPECT_EQ(service_connection_->baseService(), a2.busName()); |
559 | + EXPECT_EQ(object_path(), a2.objectPath()); |
560 | + EXPECT_EQ("displayName4", a2.displayName()); |
561 | } |
562 | |
563 | { |
564 | - auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "id", "owner", "description"); |
565 | - auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "id2", "owner2", "description2"); |
566 | + auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "id", "sid", "dn"); |
567 | + auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "id2", "sid2", "dn2"); |
568 | |
569 | // Copy assignment |
570 | a1 = a2; |
571 | EXPECT_TRUE(a2.isValid()); |
572 | - EXPECT_EQ("id2", a1.ownerId()); |
573 | - EXPECT_EQ("owner2", a2.owner()); |
574 | - EXPECT_EQ("description2", a1.description()); |
575 | + EXPECT_EQ(service_connection_->baseService(), a1.busName()); |
576 | + EXPECT_EQ(object_path(), a1.objectPath()); |
577 | + EXPECT_EQ("dn2", a1.displayName()); |
578 | |
579 | // Self-assignment |
580 | a2 = a2; |
581 | EXPECT_TRUE(a2.isValid()); |
582 | - EXPECT_EQ("id2", a1.ownerId()); |
583 | - EXPECT_EQ("owner2", a2.owner()); |
584 | - EXPECT_EQ("description2", a1.description()); |
585 | + EXPECT_EQ(service_connection_->baseService(), a1.busName()); |
586 | + EXPECT_EQ(object_path(), a1.objectPath()); |
587 | + EXPECT_EQ("dn2", a1.displayName()); |
588 | |
589 | // Move assignment |
590 | auto a3 = runtime_->make_test_account(service_connection_->baseService(), object_path(), |
591 | - "id3", "owner3", "description3"); |
592 | + "id3", "sid3", "dn3"); |
593 | a1 = move(a3); |
594 | EXPECT_TRUE(a1.isValid()); |
595 | - EXPECT_EQ("id3", a1.ownerId()); |
596 | - EXPECT_EQ("owner3", a1.owner()); |
597 | - EXPECT_EQ("description3", a1.description()); |
598 | + EXPECT_EQ(service_connection_->baseService(), a1.busName()); |
599 | + EXPECT_EQ(object_path(), a1.objectPath()); |
600 | + EXPECT_EQ("dn3", a1.displayName()); |
601 | |
602 | // Moved-from object must be invalid |
603 | EXPECT_FALSE(a3.isValid()); |
604 | |
605 | // Moved-from object must be assignable |
606 | auto a4 = runtime_->make_test_account(service_connection_->baseService(), object_path(), |
607 | - "id4", "owner4", "description4"); |
608 | + "id4", "sid4", "dn4"); |
609 | a2 = a4; |
610 | EXPECT_TRUE(a2.isValid()); |
611 | - EXPECT_EQ("id4", a2.ownerId()); |
612 | - EXPECT_EQ("owner4", a2.owner()); |
613 | - EXPECT_EQ("description4", a2.description()); |
614 | + EXPECT_EQ(service_connection_->baseService(), a2.busName()); |
615 | + EXPECT_EQ(object_path(), a2.objectPath()); |
616 | + EXPECT_EQ("dn4", a2.displayName()); |
617 | } |
618 | } |
619 | |
620 | @@ -230,7 +230,7 @@ |
621 | } |
622 | |
623 | { |
624 | - // a1 < a2 for owner ID |
625 | + // a1 < a2 for ID |
626 | auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "x", "x"); |
627 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "b", "x", "x"); |
628 | |
629 | @@ -251,7 +251,7 @@ |
630 | } |
631 | |
632 | { |
633 | - // a1 < a2 for owner |
634 | + // a1 < a2 for service ID |
635 | auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "a", "x"); |
636 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "b", "x"); |
637 | |
638 | @@ -272,7 +272,7 @@ |
639 | } |
640 | |
641 | { |
642 | - // a1 < a2 for description |
643 | + // a1 < a2 for display name |
644 | auto a1 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "a", "a"); |
645 | auto a2 = runtime_->make_test_account(service_connection_->baseService(), object_path(), "a", "a", "b"); |
646 | |
647 | @@ -994,18 +994,6 @@ |
648 | EXPECT_EQ("Item::deleteItem(): cannot create job from invalid item", j->error().message()); |
649 | } |
650 | |
651 | -#if 0 |
652 | -// TODO: need to make internal symbols available for testing. |
653 | -TEST_F(ValidateTest, basic) |
654 | -{ |
655 | - using namespace unity::storage::qt::internal; |
656 | - |
657 | - unity::storage::internal::ItemMetadata md; |
658 | - |
659 | - validate("foo", md); |
660 | -} |
661 | -#endif |
662 | - |
663 | TEST_F(ItemTest, basic) |
664 | { |
665 | set_provider(unique_ptr<provider::ProviderBase>(new MockProvider())); |
PASSED: Continuous integration, rev:82 /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/166/ /jenkins. canonical. com/unity- api-1/job/ build/944 /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/951 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 754/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 754 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 754/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-storage- framework- ci/166/ rebuild
https:/