Merge lp:~michael-sheldon/content-hub/fix-content-item-name into lp:content-hub
- fix-content-item-name
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 115 |
Merged at revision: | 125 |
Proposed branch: | lp:~michael-sheldon/content-hub/fix-content-item-name |
Merge into: | lp:content-hub |
Diff against target: |
410 lines (+105/-32) 13 files modified
import/Ubuntu/Content/contentitem.cpp (+5/-3) import/Ubuntu/Content/contentitem.h (+0/-1) include/com/ubuntu/content/item.h (+15/-0) src/com/ubuntu/content/detail/com.ubuntu.content.Transfer.xml (+2/-2) src/com/ubuntu/content/detail/service.cpp (+5/-3) src/com/ubuntu/content/detail/transfer.cpp (+13/-10) src/com/ubuntu/content/detail/transfer.h (+2/-2) src/com/ubuntu/content/hub.cpp (+2/-0) src/com/ubuntu/content/item.cpp (+42/-2) src/com/ubuntu/content/service/main.cpp (+1/-0) src/com/ubuntu/content/transfer_p.h (+10/-8) tests/acceptance-tests/app_hub_communication_transfer.cpp (+6/-0) tests/qml-tests/tst_ContentHub.qml (+2/-1) |
To merge this branch: | bzr merge lp:~michael-sheldon/content-hub/fix-content-item-name |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Review via email: mp+226669@code.launchpad.net |
Commit message
Transfer entire content Item objects over dbus, instead of just their URL component. Adds name property to C++ backend and connects to existing QML property.
Description of the change
Transfers entire content Item objects over dbus, instead of just their URL component. Allowing for additional properties to be provided, such as the name property which this branch also adds to the C++ backend and connects to the existing QML name property.
Michael Sheldon (michael-sheldon) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:112
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
Looks good, but lets add the name to the items created in the transfer tests to be safe.
- 113. By Michael Sheldon
-
Include name in content item comparison
- 114. By Michael Sheldon
-
Update tests to set names on items
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:114
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
I see you register the dbus type for cuc::Item in the service's main.cpp, which works fine. Why not register it in the cucd::Service constructor for places where the service is instantiated outside of main.cpp? I think the test suite creates a cucd::Service.
- 115. By Michael Sheldon
-
Register Item with dbus in Service object constructor
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:115
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
Did you perform an exploratory manual test run of the code change and any related functionality on device or emulator?
* Yes
Did CI run pass? If not, please explain why.
* Yes
Have you checked that submitter has accurately filled out the submitter checklist and has taken no shortcut?
* Yes
Preview Diff
1 | === modified file 'import/Ubuntu/Content/contentitem.cpp' | |||
2 | --- import/Ubuntu/Content/contentitem.cpp 2014-07-10 18:03:55 +0000 | |||
3 | +++ import/Ubuntu/Content/contentitem.cpp 2014-07-15 14:31:29 +0000 | |||
4 | @@ -47,16 +47,16 @@ | |||
5 | 47 | const QString &ContentItem::name() const | 47 | const QString &ContentItem::name() const |
6 | 48 | { | 48 | { |
7 | 49 | TRACE() << Q_FUNC_INFO; | 49 | TRACE() << Q_FUNC_INFO; |
9 | 50 | return m_name; | 50 | return m_item.name(); |
10 | 51 | } | 51 | } |
11 | 52 | 52 | ||
12 | 53 | void ContentItem::setName(const QString &name) | 53 | void ContentItem::setName(const QString &name) |
13 | 54 | { | 54 | { |
14 | 55 | TRACE() << Q_FUNC_INFO; | 55 | TRACE() << Q_FUNC_INFO; |
16 | 56 | if (name == m_name) | 56 | if (name == m_item.name()) |
17 | 57 | return; | 57 | return; |
18 | 58 | 58 | ||
20 | 59 | m_name = name; | 59 | m_item.setName(name); |
21 | 60 | Q_EMIT nameChanged(); | 60 | Q_EMIT nameChanged(); |
22 | 61 | } | 61 | } |
23 | 62 | 62 | ||
24 | @@ -77,7 +77,9 @@ | |||
25 | 77 | if (url == this->url()) | 77 | if (url == this->url()) |
26 | 78 | return; | 78 | return; |
27 | 79 | 79 | ||
28 | 80 | QString oldName = m_item.name(); | ||
29 | 80 | m_item = cuc::Item(url); | 81 | m_item = cuc::Item(url); |
30 | 82 | m_item.setName(oldName); | ||
31 | 81 | Q_EMIT urlChanged(); | 83 | Q_EMIT urlChanged(); |
32 | 82 | } | 84 | } |
33 | 83 | 85 | ||
34 | 84 | 86 | ||
35 | === modified file 'import/Ubuntu/Content/contentitem.h' | |||
36 | --- import/Ubuntu/Content/contentitem.h 2014-07-10 18:03:55 +0000 | |||
37 | +++ import/Ubuntu/Content/contentitem.h 2014-07-15 14:31:29 +0000 | |||
38 | @@ -50,7 +50,6 @@ | |||
39 | 50 | void urlChanged(); | 50 | void urlChanged(); |
40 | 51 | 51 | ||
41 | 52 | private: | 52 | private: |
42 | 53 | QString m_name; | ||
43 | 54 | com::ubuntu::content::Item m_item; | 53 | com::ubuntu::content::Item m_item; |
44 | 55 | }; | 54 | }; |
45 | 56 | 55 | ||
46 | 57 | 56 | ||
47 | === modified file 'include/com/ubuntu/content/item.h' | |||
48 | --- include/com/ubuntu/content/item.h 2013-08-21 12:08:58 +0000 | |||
49 | +++ include/com/ubuntu/content/item.h 2014-07-15 14:31:29 +0000 | |||
50 | @@ -18,6 +18,7 @@ | |||
51 | 18 | #ifndef COM_UBUNTU_CONTENT_ITEM_H_ | 18 | #ifndef COM_UBUNTU_CONTENT_ITEM_H_ |
52 | 19 | #define COM_UBUNTU_CONTENT_ITEM_H_ | 19 | #define COM_UBUNTU_CONTENT_ITEM_H_ |
53 | 20 | 20 | ||
54 | 21 | #include <QtDBus> | ||
55 | 21 | #include <QObject> | 22 | #include <QObject> |
56 | 22 | #include <QSharedPointer> | 23 | #include <QSharedPointer> |
57 | 23 | #include <QUrl> | 24 | #include <QUrl> |
58 | @@ -33,6 +34,7 @@ | |||
59 | 33 | { | 34 | { |
60 | 34 | Q_OBJECT | 35 | Q_OBJECT |
61 | 35 | Q_PROPERTY(QUrl url READ url()) | 36 | Q_PROPERTY(QUrl url READ url()) |
62 | 37 | Q_PROPERTY(QString name READ name WRITE setName) | ||
63 | 36 | 38 | ||
64 | 37 | public: | 39 | public: |
65 | 38 | Item(const QUrl& = QUrl(), QObject* = nullptr); | 40 | Item(const QUrl& = QUrl(), QObject* = nullptr); |
66 | @@ -43,6 +45,8 @@ | |||
67 | 43 | bool operator==(const Item&) const; | 45 | bool operator==(const Item&) const; |
68 | 44 | 46 | ||
69 | 45 | Q_INVOKABLE const QUrl& url() const; | 47 | Q_INVOKABLE const QUrl& url() const; |
70 | 48 | Q_INVOKABLE const QString& name() const; | ||
71 | 49 | Q_INVOKABLE void setName(const QString &name) const; | ||
72 | 46 | 50 | ||
73 | 47 | private: | 51 | private: |
74 | 48 | struct Private; | 52 | struct Private; |
75 | @@ -53,4 +57,15 @@ | |||
76 | 53 | } | 57 | } |
77 | 54 | } | 58 | } |
78 | 55 | 59 | ||
79 | 60 | Q_DECL_EXPORT | ||
80 | 61 | QDBusArgument &operator<<(QDBusArgument &argument, | ||
81 | 62 | const com::ubuntu::content::Item &item); | ||
82 | 63 | |||
83 | 64 | Q_DECL_EXPORT | ||
84 | 65 | const QDBusArgument &operator>>(const QDBusArgument &argument, | ||
85 | 66 | com::ubuntu::content::Item &item); | ||
86 | 67 | |||
87 | 68 | Q_DECLARE_METATYPE(com::ubuntu::content::Item) | ||
88 | 69 | |||
89 | 70 | |||
90 | 56 | #endif // COM_UBUNTU_CONTENT_ITEM_H_ | 71 | #endif // COM_UBUNTU_CONTENT_ITEM_H_ |
91 | 57 | 72 | ||
92 | === modified file 'src/com/ubuntu/content/detail/com.ubuntu.content.Transfer.xml' | |||
93 | --- src/com/ubuntu/content/detail/com.ubuntu.content.Transfer.xml 2014-04-03 12:00:41 +0000 | |||
94 | +++ src/com/ubuntu/content/detail/com.ubuntu.content.Transfer.xml 2014-07-15 14:31:29 +0000 | |||
95 | @@ -20,10 +20,10 @@ | |||
96 | 20 | <method name="Download"> | 20 | <method name="Download"> |
97 | 21 | </method> | 21 | </method> |
98 | 22 | <method name="Charge"> | 22 | <method name="Charge"> |
100 | 23 | <arg name="items" type="as" direction="in" /> | 23 | <arg name="items" type="av" direction="in" /> |
101 | 24 | </method> | 24 | </method> |
102 | 25 | <method name="Collect"> | 25 | <method name="Collect"> |
104 | 26 | <arg name="items" type="as" direction="out" /> | 26 | <arg name="items" type="av" direction="out" /> |
105 | 27 | </method> | 27 | </method> |
106 | 28 | <method name="Store"> | 28 | <method name="Store"> |
107 | 29 | <arg name="uri" type="s" direction="out" /> | 29 | <arg name="uri" type="s" direction="out" /> |
108 | 30 | 30 | ||
109 | === modified file 'src/com/ubuntu/content/detail/service.cpp' | |||
110 | --- src/com/ubuntu/content/detail/service.cpp 2014-07-07 12:39:38 +0000 | |||
111 | +++ src/com/ubuntu/content/detail/service.cpp 2014-07-15 14:31:29 +0000 | |||
112 | @@ -32,6 +32,7 @@ | |||
113 | 32 | #include <unistd.h> | 32 | #include <unistd.h> |
114 | 33 | #include <libnotify/notify.h> | 33 | #include <libnotify/notify.h> |
115 | 34 | 34 | ||
116 | 35 | #include <com/ubuntu/content/item.h> | ||
117 | 35 | #include <com/ubuntu/content/peer.h> | 36 | #include <com/ubuntu/content/peer.h> |
118 | 36 | #include <com/ubuntu/content/type.h> | 37 | #include <com/ubuntu/content/type.h> |
119 | 37 | #include <com/ubuntu/content/transfer.h> | 38 | #include <com/ubuntu/content/transfer.h> |
120 | @@ -92,6 +93,7 @@ | |||
121 | 92 | assert(!peer_registry.isNull()); | 93 | assert(!peer_registry.isNull()); |
122 | 93 | 94 | ||
123 | 94 | qDBusRegisterMetaType<cuc::Peer>(); | 95 | qDBusRegisterMetaType<cuc::Peer>(); |
124 | 96 | qDBusRegisterMetaType<cuc::Item>(); | ||
125 | 95 | 97 | ||
126 | 96 | m_watcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); | 98 | m_watcher->setWatchMode(QDBusServiceWatcher::WatchForUnregistration); |
127 | 97 | m_watcher->setConnection(d->connection); | 99 | m_watcher->setConnection(d->connection); |
128 | @@ -202,7 +204,7 @@ | |||
129 | 202 | Q_UNUSED(action); | 204 | Q_UNUSED(action); |
130 | 203 | 205 | ||
131 | 204 | cucd::Transfer* t = (cucd::Transfer*)data; | 206 | cucd::Transfer* t = (cucd::Transfer*)data; |
133 | 205 | t->Charge(QStringList()); | 207 | t->Charge(QVariantList()); |
134 | 206 | } | 208 | } |
135 | 207 | 209 | ||
136 | 208 | void download_notify (cucd::Transfer* t) | 210 | void download_notify (cucd::Transfer* t) |
137 | @@ -571,7 +573,7 @@ | |||
138 | 571 | { | 573 | { |
139 | 572 | TRACE() << Q_FUNC_INFO << "Found downloaded import, charging"; | 574 | TRACE() << Q_FUNC_INFO << "Found downloaded import, charging"; |
140 | 573 | if (r->handler->isValid()) | 575 | if (r->handler->isValid()) |
142 | 574 | t->Charge(QStringList()); | 576 | t->Charge(QVariantList()); |
143 | 575 | } | 577 | } |
144 | 576 | } | 578 | } |
145 | 577 | } | 579 | } |
146 | @@ -588,7 +590,7 @@ | |||
147 | 588 | if (t->Direction() == cuc::Transfer::Export) | 590 | if (t->Direction() == cuc::Transfer::Export) |
148 | 589 | { | 591 | { |
149 | 590 | TRACE() << Q_FUNC_INFO << "Found downloaded import, charging"; | 592 | TRACE() << Q_FUNC_INFO << "Found downloaded import, charging"; |
151 | 591 | t->Charge(QStringList()); | 593 | t->Charge(QVariantList()); |
152 | 592 | } | 594 | } |
153 | 593 | } | 595 | } |
154 | 594 | } | 596 | } |
155 | 595 | 597 | ||
156 | === modified file 'src/com/ubuntu/content/detail/transfer.cpp' | |||
157 | --- src/com/ubuntu/content/detail/transfer.cpp 2014-05-28 10:09:29 +0000 | |||
158 | +++ src/com/ubuntu/content/detail/transfer.cpp 2014-07-15 14:31:29 +0000 | |||
159 | @@ -52,7 +52,7 @@ | |||
160 | 52 | int direction; | 52 | int direction; |
161 | 53 | QString store; | 53 | QString store; |
162 | 54 | int selection_type; | 54 | int selection_type; |
164 | 55 | QStringList items; | 55 | QVariantList items; |
165 | 56 | bool source_started_by_content_hub; | 56 | bool source_started_by_content_hub; |
166 | 57 | QString download_id; | 57 | QString download_id; |
167 | 58 | }; | 58 | }; |
168 | @@ -141,7 +141,7 @@ | |||
169 | 141 | Q_EMIT(StateChanged(d->state)); | 141 | Q_EMIT(StateChanged(d->state)); |
170 | 142 | } | 142 | } |
171 | 143 | 143 | ||
173 | 144 | void cucd::Transfer::Charge(const QStringList& items) | 144 | void cucd::Transfer::Charge(const QVariantList& items) |
174 | 145 | { | 145 | { |
175 | 146 | TRACE() << __PRETTY_FUNCTION__; | 146 | TRACE() << __PRETTY_FUNCTION__; |
176 | 147 | 147 | ||
177 | @@ -161,12 +161,14 @@ | |||
178 | 161 | return; | 161 | return; |
179 | 162 | } | 162 | } |
180 | 163 | 163 | ||
187 | 164 | QStringList ret; | 164 | QVariantList ret; |
188 | 165 | Q_FOREACH(QString i, items) | 165 | Q_FOREACH(QVariant iv, items) { |
189 | 166 | ret.append(copy_to_store(i, d->store)); | 166 | cuc::Item origItem = qdbus_cast<Item>(iv); |
190 | 167 | 167 | cuc::Item copiedItem = cuc::Item{QUrl(copy_to_store(origItem.url().toString(), d->store))}; | |
191 | 168 | Q_FOREACH(QString f, ret) | 168 | copiedItem.setName(origItem.name()); |
192 | 169 | TRACE() << Q_FUNC_INFO << "Item:" << f; | 169 | TRACE() << Q_FUNC_INFO << "Item:" << copiedItem.url(); |
193 | 170 | ret.append(QVariant::fromValue(copiedItem)); | ||
194 | 171 | } | ||
195 | 170 | 172 | ||
196 | 171 | if (ret.count() <= 0) | 173 | if (ret.count() <= 0) |
197 | 172 | { | 174 | { |
198 | @@ -211,7 +213,8 @@ | |||
199 | 211 | void cucd::Transfer::DownloadComplete(QString destFilePath) | 213 | void cucd::Transfer::DownloadComplete(QString destFilePath) |
200 | 212 | { | 214 | { |
201 | 213 | TRACE() << __PRETTY_FUNCTION__; | 215 | TRACE() << __PRETTY_FUNCTION__; |
203 | 214 | d->items.append(QUrl::fromLocalFile(destFilePath).toString()); | 216 | cuc::Item item = cuc::Item{QUrl::fromLocalFile(destFilePath).toString()}; |
204 | 217 | d->items.append(QVariant::fromValue(item)); | ||
205 | 215 | d->state = cuc::Transfer::downloaded; | 218 | d->state = cuc::Transfer::downloaded; |
206 | 216 | Q_EMIT(StateChanged(d->state)); | 219 | Q_EMIT(StateChanged(d->state)); |
207 | 217 | } | 220 | } |
208 | @@ -226,7 +229,7 @@ | |||
209 | 226 | Q_EMIT(StateChanged(d->state)); | 229 | Q_EMIT(StateChanged(d->state)); |
210 | 227 | } | 230 | } |
211 | 228 | 231 | ||
213 | 229 | QStringList cucd::Transfer::Collect() | 232 | QVariantList cucd::Transfer::Collect() |
214 | 230 | { | 233 | { |
215 | 231 | TRACE() << __PRETTY_FUNCTION__; | 234 | TRACE() << __PRETTY_FUNCTION__; |
216 | 232 | 235 | ||
217 | 233 | 236 | ||
218 | === modified file 'src/com/ubuntu/content/detail/transfer.h' | |||
219 | --- src/com/ubuntu/content/detail/transfer.h 2014-05-22 09:11:23 +0000 | |||
220 | +++ src/com/ubuntu/content/detail/transfer.h 2014-07-15 14:31:29 +0000 | |||
221 | @@ -63,8 +63,8 @@ | |||
222 | 63 | int State(); | 63 | int State(); |
223 | 64 | void Start(); | 64 | void Start(); |
224 | 65 | void Handled(); | 65 | void Handled(); |
227 | 66 | void Charge(const QStringList&); | 66 | void Charge(const QVariantList&); |
228 | 67 | QStringList Collect(); | 67 | QVariantList Collect(); |
229 | 68 | void Abort(); | 68 | void Abort(); |
230 | 69 | void Finalize(); | 69 | void Finalize(); |
231 | 70 | QString Store(); | 70 | QString Store(); |
232 | 71 | 71 | ||
233 | === modified file 'src/com/ubuntu/content/hub.cpp' | |||
234 | --- src/com/ubuntu/content/hub.cpp 2014-05-30 17:55:50 +0000 | |||
235 | +++ src/com/ubuntu/content/hub.cpp 2014-07-15 14:31:29 +0000 | |||
236 | @@ -63,6 +63,8 @@ | |||
237 | 63 | setLoggingLevel(value); | 63 | setLoggingLevel(value); |
238 | 64 | } | 64 | } |
239 | 65 | 65 | ||
240 | 66 | qDBusRegisterMetaType<cuc::Item>(); | ||
241 | 67 | |||
242 | 66 | if (qApp) | 68 | if (qApp) |
243 | 67 | qApp->installEventFilter(this); | 69 | qApp->installEventFilter(this); |
244 | 68 | } | 70 | } |
245 | 69 | 71 | ||
246 | === modified file 'src/com/ubuntu/content/item.cpp' | |||
247 | --- src/com/ubuntu/content/item.cpp 2013-07-16 11:04:48 +0000 | |||
248 | +++ src/com/ubuntu/content/item.cpp 2014-07-15 14:31:29 +0000 | |||
249 | @@ -16,21 +16,25 @@ | |||
250 | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> | 16 | * Authored by: Thomas Voß <thomas.voss@canonical.com> |
251 | 17 | */ | 17 | */ |
252 | 18 | 18 | ||
253 | 19 | #include <QDBusArgument> | ||
254 | 20 | |||
255 | 19 | #include <com/ubuntu/content/item.h> | 21 | #include <com/ubuntu/content/item.h> |
256 | 22 | #include "debug.h" | ||
257 | 20 | 23 | ||
258 | 21 | namespace cuc = com::ubuntu::content; | 24 | namespace cuc = com::ubuntu::content; |
259 | 22 | 25 | ||
260 | 23 | struct cuc::Item::Private | 26 | struct cuc::Item::Private |
261 | 24 | { | 27 | { |
262 | 25 | QUrl url; | 28 | QUrl url; |
263 | 29 | QString name; | ||
264 | 26 | 30 | ||
265 | 27 | bool operator==(const Private& rhs) const | 31 | bool operator==(const Private& rhs) const |
266 | 28 | { | 32 | { |
268 | 29 | return url == rhs.url; | 33 | return url == rhs.url && name == rhs.name; |
269 | 30 | } | 34 | } |
270 | 31 | }; | 35 | }; |
271 | 32 | 36 | ||
273 | 33 | cuc::Item::Item(const QUrl& url, QObject* parent) : QObject(parent), d{new cuc::Item::Private{url}} | 37 | cuc::Item::Item(const QUrl& url, QObject* parent) : QObject(parent), d{new cuc::Item::Private{url, QString()}} |
274 | 34 | { | 38 | { |
275 | 35 | } | 39 | } |
276 | 36 | 40 | ||
277 | @@ -60,3 +64,39 @@ | |||
278 | 60 | { | 64 | { |
279 | 61 | return d->url; | 65 | return d->url; |
280 | 62 | } | 66 | } |
281 | 67 | |||
282 | 68 | const QString& cuc::Item::name() const | ||
283 | 69 | { | ||
284 | 70 | return d->name; | ||
285 | 71 | } | ||
286 | 72 | |||
287 | 73 | void cuc::Item::setName(const QString& newName) const | ||
288 | 74 | { | ||
289 | 75 | if (newName != d->name) | ||
290 | 76 | d->name = newName; | ||
291 | 77 | } | ||
292 | 78 | |||
293 | 79 | QDBusArgument &operator<<(QDBusArgument &argument, const cuc::Item& item) | ||
294 | 80 | { | ||
295 | 81 | argument.beginStructure(); | ||
296 | 82 | argument << item.name() << item.url().toDisplayString(); | ||
297 | 83 | argument.endStructure(); | ||
298 | 84 | return argument; | ||
299 | 85 | } | ||
300 | 86 | |||
301 | 87 | const QDBusArgument &operator>>(const QDBusArgument &argument, cuc::Item &item) | ||
302 | 88 | { | ||
303 | 89 | TRACE() << Q_FUNC_INFO; | ||
304 | 90 | QString name; | ||
305 | 91 | QString urlString; | ||
306 | 92 | |||
307 | 93 | |||
308 | 94 | argument.beginStructure(); | ||
309 | 95 | argument >> name >> urlString; | ||
310 | 96 | argument.endStructure(); | ||
311 | 97 | |||
312 | 98 | item = cuc::Item{QUrl(urlString)}; | ||
313 | 99 | item.setName(name); | ||
314 | 100 | return argument; | ||
315 | 101 | } | ||
316 | 102 | |||
317 | 63 | 103 | ||
318 | === modified file 'src/com/ubuntu/content/service/main.cpp' | |||
319 | --- src/com/ubuntu/content/service/main.cpp 2014-05-01 17:03:40 +0000 | |||
320 | +++ src/com/ubuntu/content/service/main.cpp 2014-07-15 14:31:29 +0000 | |||
321 | @@ -19,6 +19,7 @@ | |||
322 | 19 | #include <QCoreApplication> | 19 | #include <QCoreApplication> |
323 | 20 | #include <QProcessEnvironment> | 20 | #include <QProcessEnvironment> |
324 | 21 | #include <csignal> | 21 | #include <csignal> |
325 | 22 | #include <com/ubuntu/content/item.h> | ||
326 | 22 | 23 | ||
327 | 23 | #include "detail/app_manager.h" | 24 | #include "detail/app_manager.h" |
328 | 24 | #include "debug.h" | 25 | #include "debug.h" |
329 | 25 | 26 | ||
330 | === modified file 'src/com/ubuntu/content/transfer_p.h' | |||
331 | --- src/com/ubuntu/content/transfer_p.h 2014-04-03 12:00:41 +0000 | |||
332 | +++ src/com/ubuntu/content/transfer_p.h 2014-07-15 14:31:29 +0000 | |||
333 | @@ -106,13 +106,12 @@ | |||
334 | 106 | 106 | ||
335 | 107 | bool charge(const QVector<Item>& items) | 107 | bool charge(const QVector<Item>& items) |
336 | 108 | { | 108 | { |
338 | 109 | QStringList l; | 109 | QVariantList itemVariants; |
339 | 110 | Q_FOREACH(const Item& item, items) | 110 | Q_FOREACH(const Item& item, items) |
342 | 111 | { | 111 | { |
343 | 112 | l << item.url().toDisplayString(); | 112 | itemVariants << QVariant::fromValue(item); |
344 | 113 | } | 113 | } |
347 | 114 | 114 | auto reply = remote_transfer->Charge(itemVariants); | |
346 | 115 | auto reply = remote_transfer->Charge(l); | ||
348 | 116 | reply.waitForFinished(); | 115 | reply.waitForFinished(); |
349 | 117 | 116 | ||
350 | 118 | return not reply.isError(); | 117 | return not reply.isError(); |
351 | @@ -128,10 +127,13 @@ | |||
352 | 128 | if (reply.isError()) | 127 | if (reply.isError()) |
353 | 129 | return result; | 128 | return result; |
354 | 130 | 129 | ||
358 | 131 | Q_FOREACH(const QString& url, reply.value()) | 130 | auto items = reply.value(); |
359 | 132 | { | 131 | |
360 | 133 | result << Item(QUrl(url)); | 132 | Q_FOREACH(const QVariant& itemVariant, items) |
361 | 133 | { | ||
362 | 134 | result << qdbus_cast<Item>(itemVariant); | ||
363 | 134 | } | 135 | } |
364 | 136 | |||
365 | 135 | return result; | 137 | return result; |
366 | 136 | } | 138 | } |
367 | 137 | 139 | ||
368 | 138 | 140 | ||
369 | === modified file 'tests/acceptance-tests/app_hub_communication_transfer.cpp' | |||
370 | --- tests/acceptance-tests/app_hub_communication_transfer.cpp 2014-02-21 02:30:11 +0000 | |||
371 | +++ tests/acceptance-tests/app_hub_communication_transfer.cpp 2014-07-15 14:31:29 +0000 | |||
372 | @@ -128,13 +128,19 @@ | |||
373 | 128 | { | 128 | { |
374 | 129 | QVector<cuc::Item> source_items; | 129 | QVector<cuc::Item> source_items; |
375 | 130 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file1").absoluteFilePath())); | 130 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file1").absoluteFilePath())); |
376 | 131 | source_items[0].setName("name1"); | ||
377 | 131 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file2").absoluteFilePath())); | 132 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file2").absoluteFilePath())); |
378 | 133 | source_items[1].setName("name2"); | ||
379 | 132 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file3").absoluteFilePath())); | 134 | source_items << cuc::Item(QUrl::fromLocalFile(QFileInfo("file3").absoluteFilePath())); |
380 | 135 | source_items[2].setName("name3"); | ||
381 | 133 | 136 | ||
382 | 134 | QVector<cuc::Item> expected_items; | 137 | QVector<cuc::Item> expected_items; |
383 | 135 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file1")); | 138 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file1")); |
384 | 139 | expected_items[0].setName("name1"); | ||
385 | 136 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file2")); | 140 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file2")); |
386 | 141 | expected_items[1].setName("name2"); | ||
387 | 137 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file3")); | 142 | expected_items << cuc::Item(QUrl("file:///tmp/Incoming/file3")); |
388 | 143 | expected_items[2].setName("name3"); | ||
389 | 138 | 144 | ||
390 | 139 | /** [Importing pictures] */ | 145 | /** [Importing pictures] */ |
391 | 140 | auto hub = cuc::Hub::Client::instance(); | 146 | auto hub = cuc::Hub::Client::instance(); |
392 | 141 | 147 | ||
393 | === modified file 'tests/qml-tests/tst_ContentHub.qml' | |||
394 | --- tests/qml-tests/tst_ContentHub.qml 2014-03-07 21:03:36 +0000 | |||
395 | +++ tests/qml-tests/tst_ContentHub.qml 2014-07-15 14:31:29 +0000 | |||
396 | @@ -34,12 +34,13 @@ | |||
397 | 34 | function test_export_request() { | 34 | function test_export_request() { |
398 | 35 | var filePath = "file:///foo/bar.png"; | 35 | var filePath = "file:///foo/bar.png"; |
399 | 36 | var transfer = destPeer.request(); | 36 | var transfer = destPeer.request(); |
401 | 37 | transfer.items = [ resultComponent.createObject(test, {"url": filePath}) ]; | 37 | transfer.items = [ resultComponent.createObject(test, {"url": filePath, "name": "test"}) ]; |
402 | 38 | transfer.state = ContentTransfer.Charged; | 38 | transfer.state = ContentTransfer.Charged; |
403 | 39 | // This shouldn't be necessary, but without it we compare the results to fast | 39 | // This shouldn't be necessary, but without it we compare the results to fast |
404 | 40 | ContentHub.exportRequested(transfer); | 40 | ContentHub.exportRequested(transfer); |
405 | 41 | compare(test.exportTransfer, transfer, "Transfer object not correcty set"); | 41 | compare(test.exportTransfer, transfer, "Transfer object not correcty set"); |
406 | 42 | compare(test.exportTransfer.items[0].url, filePath, "Transfer contents incorrect"); | 42 | compare(test.exportTransfer.items[0].url, filePath, "Transfer contents incorrect"); |
407 | 43 | compare(test.exportTransfer.items[0].name, "test", "Transfer name incorrect"); | ||
408 | 43 | } | 44 | } |
409 | 44 | 45 | ||
410 | 45 | Component { | 46 | Component { |
Are there any related MPs required for this MP to build/function as expected? Please list.
* No
Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
* Yes
Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?
* Yes
Did you successfully run all tests found in your component's Test Plan (https:/ /wiki.ubuntu. com/Process/ Merges/ TestPlan/ content- hub) on device or emulator?
* Yes
If you changed the UI, was the change specified/approved by design?
* No change
If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?
* No change