Merge lp:~mandel/ubuntu-download-manager/vivid-add-appid-metadata into lp:ubuntu-download-manager/vivid

Proposed by Manuel de la Peña on 2015-08-27
Status: Merged
Approved by: Manuel de la Peña on 2015-09-21
Approved revision: 347
Merged at revision: 339
Proposed branch: lp:~mandel/ubuntu-download-manager/vivid-add-appid-metadata
Merge into: lp:ubuntu-download-manager/vivid
Diff against target: 3238 lines (+1069/-303)
72 files modified
CMakeLists.txt (+2/-2)
debian/changelog (+19/-0)
debian/control (+24/-24)
debian/libubuntu-download-manager-client1.install (+1/-1)
debian/libubuntu-download-manager-client1.symbols (+18/-1)
debian/libubuntu-download-manager-common1.install (+1/-1)
debian/libubuntu-download-manager-common1.symbols (+1/-1)
debian/libubuntu-upload-manager-common1.install (+1/-1)
debian/libubuntu-upload-manager-common1.symbols (+1/-1)
debian/libudm-common-dev.install (+1/-0)
debian/libudm-common1.install (+1/-1)
debian/libudm-common1.symbols (+33/-17)
debian/libudm-priv-common1.install (+1/-1)
docs/dbus/com.canonical.applications.download.xml (+7/-0)
docs/dbus/com.canonical.applications.testing.download_manager.xml (+7/-0)
src/common/public/CMakeLists.txt (+2/-0)
src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp (+6/-5)
src/common/public/ubuntu/transfers/errors/auth_error_struct.h (+9/-12)
src/common/public/ubuntu/transfers/errors/hash_error_struct.cpp (+96/-0)
src/common/public/ubuntu/transfers/errors/hash_error_struct.h (+122/-0)
src/common/public/ubuntu/transfers/errors/http_error_struct.cpp (+2/-2)
src/common/public/ubuntu/transfers/errors/http_error_struct.h (+3/-5)
src/common/public/ubuntu/transfers/errors/network_error_struct.cpp (+2/-2)
src/common/public/ubuntu/transfers/errors/network_error_struct.h (+3/-6)
src/common/public/ubuntu/transfers/errors/process_error_struct.cpp (+7/-7)
src/common/public/ubuntu/transfers/errors/process_error_struct.h (+8/-11)
src/common/public/ubuntu/transfers/metadata.cpp (+33/-0)
src/common/public/ubuntu/transfers/metadata.h (+6/-4)
src/downloads/client/symbols.map (+6/-0)
src/downloads/client/ubuntu/download_manager/download.h (+18/-4)
src/downloads/client/ubuntu/download_manager/download_impl.cpp (+19/-1)
src/downloads/client/ubuntu/download_manager/download_impl.h (+4/-4)
src/downloads/client/ubuntu/download_manager/download_interface.cpp (+1/-1)
src/downloads/client/ubuntu/download_manager/download_interface.h (+23/-18)
src/downloads/client/ubuntu/download_manager/error.cpp (+88/-22)
src/downloads/client/ubuntu/download_manager/error.h (+71/-6)
src/downloads/client/ubuntu/download_manager/manager_impl.cpp (+3/-1)
src/downloads/common/ubuntu/download_manager/metatypes.h (+4/-4)
src/downloads/priv/ubuntu/downloads/download.h (+14/-3)
src/downloads/priv/ubuntu/downloads/download_adaptor.cpp (+7/-1)
src/downloads/priv/ubuntu/downloads/download_adaptor.h (+12/-3)
src/downloads/priv/ubuntu/downloads/file_download.cpp (+2/-1)
src/downloads/priv/ubuntu/downloads/file_download.h (+2/-1)
src/downloads/priv/ubuntu/downloads/manager.cpp (+20/-0)
src/downloads/priv/ubuntu/downloads/manager.h (+2/-4)
src/downloads/test-daemon/testing_daemon.cpp (+12/-1)
src/downloads/test-daemon/testing_daemon.h (+3/-4)
src/downloads/test-daemon/testing_file_download.cpp (+17/-1)
src/downloads/test-daemon/testing_file_download.h (+5/-4)
src/downloads/test-daemon/testing_interface.cpp (+1/-1)
src/downloads/test-daemon/testing_interface.h (+8/-1)
src/downloads/test-daemon/testing_manager.cpp (+12/-3)
src/downloads/test-daemon/testing_manager.h (+3/-4)
src/downloads/test-daemon/testing_manager_adaptor.cpp (+9/-1)
src/downloads/test-daemon/testing_manager_adaptor.h (+7/-1)
src/downloads/test-daemon/ubuntu-download-manager-test-daemon.pro.THIS (+0/-44)
tests/common/daemon_testcase.cpp (+26/-3)
tests/common/daemon_testcase.h (+3/-4)
tests/common/testing_interface.cpp (+1/-1)
tests/common/testing_interface.h (+8/-1)
tests/downloads/client/CMakeLists.txt (+7/-6)
tests/downloads/client/test_client_download.cpp (+37/-1)
tests/downloads/client/test_client_download.h (+4/-4)
tests/downloads/client/test_client_manager.cpp (+1/-1)
tests/downloads/client/test_group_manager_watch.h (+3/-5)
tests/downloads/daemon/CMakeLists.txt (+2/-1)
tests/downloads/daemon/test_download.cpp (+3/-1)
tests/downloads/daemon/test_download_manager.cpp (+54/-0)
tests/downloads/daemon/test_final_state.cpp (+0/-4)
tests/downloads/daemon/test_metadata.cpp (+90/-0)
tests/downloads/daemon/test_metadata.h (+10/-3)
tests/downloads/qml/CMakeLists.txt (+30/-24)
To merge this branch: bzr merge lp:~mandel/ubuntu-download-manager/vivid-add-appid-metadata
Reviewer Review Type Date Requested Status
Alfonso Sanchez-Beato (community) 2015-08-27 Approve on 2015-09-17
Review via email: mp+269340@code.launchpad.net

Commit message

The download object now carries the app id of the application that created the download.

Description of the change

The download object now carries the app id of the application that created the download. The client lib has been updated so that the applications do not need to set the app id. Unconfined apps will use the value in APP_ID, confined apps will use their apparmor profile.

To post a comment you must log in.
345. By Manuel de la Peña on 2015-08-27

Link bug.

review: Approve
346. By Manuel de la Peña on 2015-09-21

Update the changelog and version.

347. By Manuel de la Peña on 2015-09-21

Use the correct versions in the changelog.

348. By Manuel de la Peña on 2015-09-22

Rename from owner to destinationApp

349. By Manuel de la Peña on 2015-09-22

Correctly rename property.

350. By Manuel de la Peña on 2015-09-22

Update symbols.

351. By Manuel de la Peña on 2015-09-22

Update symbols.

352. By Manuel de la Peña on 2015-09-22

Update setters and getters.

I did not find a way to get the download file name? Show we have a property for that on download interface? Or I am missing something?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-11-17 23:07:13 +0000
3+++ CMakeLists.txt 2015-09-22 15:25:44 +0000
4@@ -30,8 +30,8 @@
5 OUTPUT_STRIP_TRAILING_WHITESPACE
6 )
7
8-set(UDM_VERSION_MAJOR 0)
9-set(UDM_VERSION_MINOR 9)
10+set(UDM_VERSION_MAJOR 1)
11+set(UDM_VERSION_MINOR 1)
12 set(UDM_VERSION_PATCH 0)
13
14 find_package(Gtest REQUIRED)
15
16=== modified file 'debian/changelog'
17--- debian/changelog 2015-02-03 09:29:42 +0000
18+++ debian/changelog 2015-09-22 15:25:44 +0000
19@@ -1,3 +1,22 @@
20+ubuntu-download-manager (1.1+15.04-0ubuntu1) UNRELEASED; urgency=medium
21+
22+ * Add new metadata property. This update changes ABI in the client lib.
23+
24+ -- Manuel de la Pena <mandel@mark-II> Mon, 21 Sep 2015 11:59:03 +0200
25+
26+ubuntu-download-manager (1.0+15.04-0ubuntu1) wily; urgency=medium
27+
28+ [ Manuel de la Pena ]
29+ * Bump version number due to the new ABI provided by the client lib.
30+
31+ [ CI Train Bot ]
32+ * debian/libubuntu-download-manager-client1.symbols: update to
33+ released version.
34+ * debian/libudm-common1.symbols: update to released version.
35+ * New rebuild forced.
36+
37+ -- CI Train Bot <ci-train-bot@canonical.com> Fri, 24 Jul 2015 16:44:28 +0000
38+
39 ubuntu-download-manager (0.9+15.04.20150203-0ubuntu1) vivid; urgency=medium
40
41 [ Manuel de la Pena ]
42
43=== modified file 'debian/control'
44--- debian/control 2014-11-26 12:21:53 +0000
45+++ debian/control 2015-09-22 15:25:44 +0000
46@@ -18,7 +18,7 @@
47 qtdeclarative5-dev,
48 qtdeclarative5-dev-tools,
49 qtdeclarative5-test-plugin,
50- network-manager
51+ network-manager,
52 Maintainer: Manuel de la Peña <manuel.delapena@canonical.com>
53 Standards-Version: 3.9.5
54 Homepage: https://launchpad.net/ubuntu-system-image
55@@ -27,7 +27,7 @@
56 # upstream branch
57 Vcs-Bzr: lp:ubuntu-download-manager
58
59-Package: libudm-common0
60+Package: libudm-common1
61 Section: libs
62 Architecture: any
63 Depends: ${misc:Depends},
64@@ -42,7 +42,7 @@
65 Package: libudm-common-dev
66 Section: libdevel
67 Architecture: any
68-Depends: libudm-common0 (= ${binary:Version}),
69+Depends: libudm-common1 (= ${binary:Version}),
70 qtbase5-dev,
71 ${shlibs:Depends},
72 ${misc:Depends}
73@@ -50,12 +50,12 @@
74 This package contains the common headers shared between the client library and
75 the daemon library.
76
77-Package: libudm-priv-common0
78+Package: libudm-priv-common1
79 Section: libs
80 Architecture: any
81 Depends: ${misc:Depends},
82 ${shlibs:Depends},
83- libudm-common0 (= ${binary:Version}),
84+ libudm-common1 (= ${binary:Version}),
85 Breaks: libubuntu-download-manager-priv1
86 Replaces: libubuntu-download-manager-priv1
87 Description: Upload Download Manager - shared private library
88@@ -63,10 +63,10 @@
89 .
90 This package includes the private shared library.
91
92-Package: libubuntu-download-manager-common0
93+Package: libubuntu-download-manager-common1
94 Section: libs
95 Architecture: any
96-Depends: libudm-common0 (= ${binary:Version}),
97+Depends: libudm-common1 (= ${binary:Version}),
98 ${misc:Depends},
99 ${shlibs:Depends},
100 Breaks: ubuntu-download-manager-common1
101@@ -81,7 +81,7 @@
102 Section: libdevel
103 Architecture: any
104 Depends: libudm-common-dev (= ${binary:Version}),
105- libubuntu-download-manager-common0 (= ${binary:Version}),
106+ libubuntu-download-manager-common1 (= ${binary:Version}),
107 qtbase5-dev,
108 ${shlibs:Depends},
109 ${misc:Depends}
110@@ -91,13 +91,13 @@
111 This package contains the common headers shared between the client library and
112 the daemon library.
113
114-Package: libubuntu-download-manager-client0
115+Package: libubuntu-download-manager-client1
116 Section: libs
117 Architecture: any
118 Depends: ${misc:Depends},
119 ${shlibs:Depends},
120- libudm-common0 (= ${binary:Version}),
121- libubuntu-download-manager-common0 (= ${binary:Version}),
122+ libudm-common1 (= ${binary:Version}),
123+ libubuntu-download-manager-common1 (= ${binary:Version}),
124 Breaks: ubuntu-download-manager-client1
125 Replaces: ubuntu-download-manager-client1
126 Description: Ubuntu Download Manager - shared public library
127@@ -110,7 +110,7 @@
128 Architecture: any
129 Depends: libudm-common-dev (= ${binary:Version}),
130 libubuntu-download-manager-common-dev (= ${binary:Version}),
131- libubuntu-download-manager-client0 (= ${binary:Version}),
132+ libubuntu-download-manager-client1 (= ${binary:Version}),
133 qtbase5-dev,
134 ${shlibs:Depends},
135 ${misc:Depends}
136@@ -128,10 +128,10 @@
137 Description: Documentation files for libcontent-hub-dev
138 Documentation files for the libcontent-hub development
139
140-Package: libubuntu-upload-manager-common0
141+Package: libubuntu-upload-manager-common1
142 Section: libs
143 Architecture: any
144-Depends: libudm-common0 (= ${binary:Version}),
145+Depends: libudm-common1 (= ${binary:Version}),
146 ${misc:Depends},
147 ${shlibs:Depends},
148 Description: Ubuntu Upload Manager - shared common library
149@@ -144,7 +144,7 @@
150 Section: libdevel
151 Architecture: any
152 Depends: libudm-common-dev (= ${binary:Version}),
153- libubuntu-download-manager-common0 (= ${binary:Version}),
154+ libubuntu-download-manager-common1 (= ${binary:Version}),
155 qtbase5-dev,
156 ${shlibs:Depends},
157 ${misc:Depends}
158@@ -157,9 +157,9 @@
159 Architecture: any
160 Depends: ${misc:Depends},
161 ${shlibs:Depends},
162- libudm-common0 (= ${binary:Version}),
163- libudm-priv-common0 (= ${binary:Version}),
164- libubuntu-download-manager-common0 (= ${binary:Version}),
165+ libudm-common1 (= ${binary:Version}),
166+ libudm-priv-common1 (= ${binary:Version}),
167+ libubuntu-download-manager-common1 (= ${binary:Version}),
168 unzip
169 Suggests: apparmor
170 Description: Ubuntu Download Manager - daemon
171@@ -172,9 +172,9 @@
172 Architecture: any
173 Depends: ${misc:Depends},
174 ${shlibs:Depends},
175- libudm-common0 (= ${binary:Version}),
176- libudm-priv-common0 (= ${binary:Version}),
177- libubuntu-upload-manager-common0 (= ${binary:Version}),
178+ libudm-common1 (= ${binary:Version}),
179+ libudm-priv-common1 (= ${binary:Version}),
180+ libubuntu-upload-manager-common1 (= ${binary:Version}),
181 Description: Ubuntu Upload Manager - daemon
182 Ubuntu Upload Manager performs uploads from a centralized location.
183 .
184@@ -185,9 +185,9 @@
185 Architecture: any
186 Depends: ${misc:Depends},
187 ${shlibs:Depends},
188- libudm-common0 (= ${binary:Version}),
189- libubuntu-download-manager-common0 (= ${binary:Version}),
190- libubuntu-download-manager-client0 (= ${binary:Version})
191+ libudm-common1 (= ${binary:Version}),
192+ libubuntu-download-manager-common1 (= ${binary:Version}),
193+ libubuntu-download-manager-client1 (= ${binary:Version})
194 Description: Ubuntu Download Manager Plugin
195 This package contains a QML Plugin to handle downloads from a pure QML
196 application, without the need to write any C++ code.
197
198=== renamed file 'debian/libubuntu-download-manager-client0.install' => 'debian/libubuntu-download-manager-client1.install'
199--- debian/libubuntu-download-manager-client0.install 2014-02-10 18:04:03 +0000
200+++ debian/libubuntu-download-manager-client1.install 2015-09-22 15:25:44 +0000
201@@ -1,1 +1,1 @@
202-usr/lib/*/libubuntu-download-manager-client.so.0*
203+usr/lib/*/libubuntu-download-manager-client.so.1*
204
205=== renamed file 'debian/libubuntu-download-manager-client0.symbols' => 'debian/libubuntu-download-manager-client1.symbols'
206--- debian/libubuntu-download-manager-client0.symbols 2014-10-14 16:08:07 +0000
207+++ debian/libubuntu-download-manager-client1.symbols 2015-09-22 15:25:44 +0000
208@@ -1,4 +1,4 @@
209-libubuntu-download-manager-client.so.0 libubuntu-download-manager-client0 #MINVER#
210+libubuntu-download-manager-client.so.1 libubuntu-download-manager-client1 #MINVER#
211 (c++)"Ubuntu::DownloadManager::NetworkError::errorString()@Base" 0.4+14.10.20140618
212 (c++)"Ubuntu::DownloadManager::NetworkError::qt_metacall(QMetaObject::Call, int, void**)@Base" 0.4+14.10.20140618
213 (c++)"Ubuntu::DownloadManager::NetworkError::qt_metacast(char const*)@Base" 0.4+14.10.20140618
214@@ -60,6 +60,7 @@
215 (c++)"Ubuntu::DownloadManager::Download::titleChanged()@Base" 0.9+14.10.20141014.1
216 (c++)"Ubuntu::DownloadManager::Download::clickPackagedChanged()@Base" 0.9+14.10.20141014.1
217 (c++)"Ubuntu::DownloadManager::Download::showInIndicatorChanged()@Base" 0.9+14.10.20141014.1
218+ (c++)"Ubuntu::DownloadManager::Download::destinationAppChanged()@Base" 0replaceme
219 (c++)"Ubuntu::DownloadManager::AuthError::errorString()@Base" 0.4+14.10.20140618
220 (c++)"Ubuntu::DownloadManager::AuthError::qt_metacall(QMetaObject::Call, int, void**)@Base" 0.4+14.10.20140618
221 (c++)"Ubuntu::DownloadManager::AuthError::qt_metacast(char const*)@Base" 0.4+14.10.20140618
222@@ -135,3 +136,19 @@
223 (c++)"vtable for Ubuntu::DownloadManager::AuthError@Base" 0.4+14.10.20140618
224 (c++)"vtable for Ubuntu::DownloadManager::DBusError@Base" 0.4+14.10.20140618
225 (c++)"vtable for Ubuntu::DownloadManager::HttpError@Base" 0.4+14.10.20140618
226+ (c++)"Ubuntu::DownloadManager::HashError::errorString()@Base" 1.0+15.10.20150724
227+ (c++)"Ubuntu::DownloadManager::HashError::qt_metacall(QMetaObject::Call, int, void**)@Base" 1.0+15.10.20150724
228+ (c++)"Ubuntu::DownloadManager::HashError::qt_metacast(char const*)@Base" 1.0+15.10.20150724
229+ (c++)"Ubuntu::DownloadManager::HashError::staticMetaObject@Base" 1.0+15.10.20150724
230+ (c++)"Ubuntu::DownloadManager::HashError::method()@Base" 1.0+15.10.20150724
231+ (c++)"Ubuntu::DownloadManager::HashError::checksum()@Base" 1.0+15.10.20150724
232+ (c++)"Ubuntu::DownloadManager::HashError::expected()@Base" 1.0+15.10.20150724
233+ (c++)"Ubuntu::DownloadManager::HashError::HashError(Ubuntu::Transfers::Errors::HashErrorStruct, QObject*)@Base" 1.0+15.10.20150724
234+ (c++)"Ubuntu::DownloadManager::HashError::HashError(Ubuntu::Transfers::Errors::HashErrorStruct, QObject*)@Base" 1.0+15.10.20150724
235+ (c++)"Ubuntu::DownloadManager::HashError::~HashError()@Base" 1.0+15.10.20150724
236+ (c++)"Ubuntu::DownloadManager::HashError::~HashError()@Base" 1.0+15.10.20150724
237+ (c++)"Ubuntu::DownloadManager::HashError::~HashError()@Base" 1.0+15.10.20150724
238+ (c++)"Ubuntu::DownloadManager::HashError::metaObject() const@Base" 1.0+15.10.20150724
239+ (c++)"typeinfo for Ubuntu::DownloadManager::HashError@Base" 1.0+15.10.20150724
240+ (c++)"typeinfo name for Ubuntu::DownloadManager::HashError@Base" 1.0+15.10.20150724
241+ (c++)"vtable for Ubuntu::DownloadManager::HashError@Base" 1.0+15.10.20150724
242
243=== renamed file 'debian/libubuntu-download-manager-common0.install' => 'debian/libubuntu-download-manager-common1.install'
244--- debian/libubuntu-download-manager-common0.install 2014-02-10 18:04:03 +0000
245+++ debian/libubuntu-download-manager-common1.install 2015-09-22 15:25:44 +0000
246@@ -1,1 +1,1 @@
247-usr/lib/*/libubuntu-download-manager-common.so.0*
248+usr/lib/*/libubuntu-download-manager-common.so.1*
249
250=== renamed file 'debian/libubuntu-download-manager-common0.symbols' => 'debian/libubuntu-download-manager-common1.symbols'
251--- debian/libubuntu-download-manager-common0.symbols 2014-06-18 14:49:04 +0000
252+++ debian/libubuntu-download-manager-common1.symbols 2015-09-22 15:25:44 +0000
253@@ -1,4 +1,4 @@
254-libubuntu-download-manager-common.so.0 libubuntu-download-manager-common0 #MINVER#
255+libubuntu-download-manager-common.so.1 libubuntu-download-manager-common1 #MINVER#
256 (c++)"Ubuntu::DownloadManager::DownloadStruct::getHeaders()@Base" 0.4+14.10.20140618
257 (c++)"Ubuntu::DownloadManager::DownloadStruct::getMetadata()@Base" 0.4+14.10.20140618
258 (c++)"Ubuntu::DownloadManager::DownloadStruct::getAlgorithm()@Base" 0.4+14.10.20140618
259
260=== renamed file 'debian/libubuntu-upload-manager-common0.install' => 'debian/libubuntu-upload-manager-common1.install'
261--- debian/libubuntu-upload-manager-common0.install 2014-02-25 15:21:34 +0000
262+++ debian/libubuntu-upload-manager-common1.install 2015-09-22 15:25:44 +0000
263@@ -1,1 +1,1 @@
264-usr/lib/*/libubuntu-upload-manager-common.so.0*
265+usr/lib/*/libubuntu-upload-manager-common.so.1*
266
267=== renamed file 'debian/libubuntu-upload-manager-common0.symbols' => 'debian/libubuntu-upload-manager-common1.symbols'
268--- debian/libubuntu-upload-manager-common0.symbols 2014-06-18 14:49:04 +0000
269+++ debian/libubuntu-upload-manager-common1.symbols 2015-09-22 15:25:44 +0000
270@@ -1,4 +1,4 @@
271-libubuntu-upload-manager-common.so.0 libubuntu-upload-manager-common0 #MINVER#
272+libubuntu-upload-manager-common.so.1 libubuntu-upload-manager-common1 #MINVER#
273 (c++)"Ubuntu::UploadManager::UploadStruct::getHeaders()@Base" 0.4+14.10.20140618
274 (c++)"Ubuntu::UploadManager::UploadStruct::getFilePath()@Base" 0.4+14.10.20140618
275 (c++)"Ubuntu::UploadManager::UploadStruct::getMetadata()@Base" 0.4+14.10.20140618
276
277=== modified file 'debian/libudm-common-dev.install'
278--- debian/libudm-common-dev.install 2014-06-06 10:05:15 +0000
279+++ debian/libudm-common-dev.install 2015-09-22 15:25:44 +0000
280@@ -1,6 +1,7 @@
281 usr/include/ubuntu/transfers/metadata.h
282 usr/include/ubuntu/transfers/visibility.h
283 usr/include/ubuntu/transfers/errors/auth_error_struct.h
284+usr/include/ubuntu/transfers/errors/hash_error_struct.h
285 usr/include/ubuntu/transfers/errors/http_error_struct.h
286 usr/include/ubuntu/transfers/errors/network_error_struct.h
287 usr/include/ubuntu/transfers/errors/process_error_struct.h
288
289=== renamed file 'debian/libudm-common0.install' => 'debian/libudm-common1.install'
290--- debian/libudm-common0.install 2014-02-25 15:21:34 +0000
291+++ debian/libudm-common1.install 2015-09-22 15:25:44 +0000
292@@ -1,1 +1,1 @@
293-usr/lib/*/libudm-common.so.0*
294+usr/lib/*/libudm-common.so.1*
295
296=== renamed file 'debian/libudm-common0.symbols' => 'debian/libudm-common1.symbols'
297--- debian/libudm-common0.symbols 2014-10-14 16:08:07 +0000
298+++ debian/libudm-common1.symbols 2015-09-22 15:25:44 +0000
299@@ -1,40 +1,24 @@
300-libudm-common.so.0 libudm-common0 #MINVER#
301- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::getType()@Base" 0.4+14.10.20140618
302- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::getPhrase()@Base" 0.4+14.10.20140618
303- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct::Type, QString)@Base" 0.4+14.10.20140618
304+libudm-common.so.1 libudm-common1 #MINVER#
305 (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct const&)@Base" 0.4+14.10.20140618
306- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(int, QString)@Base" 0.4+14.10.20140618
307 (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct()@Base" 0.4+14.10.20140618
308- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct::Type, QString)@Base" 0.4+14.10.20140618
309 (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct const&)@Base" 0.4+14.10.20140618
310- (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(int, QString)@Base" 0.4+14.10.20140618
311 (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct()@Base" 0.4+14.10.20140618
312 (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::operator=(Ubuntu::Transfers::Errors::AuthErrorStruct const&)@Base" 0.4+14.10.20140618
313 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(Ubuntu::Transfers::Errors::HttpErrorStruct const&)@Base" 0.4+14.10.20140618
314- (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(int, QString)@Base" 0.4+14.10.20140618
315 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct()@Base" 0.4+14.10.20140618
316 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(Ubuntu::Transfers::Errors::HttpErrorStruct const&)@Base" 0.4+14.10.20140618
317- (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(int, QString)@Base" 0.4+14.10.20140618
318 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct()@Base" 0.4+14.10.20140618
319 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::operator=(Ubuntu::Transfers::Errors::HttpErrorStruct const&)@Base" 0.4+14.10.20140618
320 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(Ubuntu::Transfers::Errors::NetworkErrorStruct const&)@Base" 0.4+14.10.20140618
321- (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int, QString)@Base" 0.4+14.10.20140618
322 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int)@Base" 0.4+14.10.20140618
323 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct()@Base" 0.4+14.10.20140618
324 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(Ubuntu::Transfers::Errors::NetworkErrorStruct const&)@Base" 0.4+14.10.20140618
325- (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int, QString)@Base" 0.4+14.10.20140618
326 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int)@Base" 0.4+14.10.20140618
327 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct()@Base" 0.4+14.10.20140618
328 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::operator=(Ubuntu::Transfers::Errors::NetworkErrorStruct const&)@Base" 0.4+14.10.20140618
329 (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(Ubuntu::Transfers::Errors::ProcessErrorStruct const&)@Base" 0.4+14.10.20140618
330- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString)@Base" 0.4+14.10.20140618
331- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString, int, QString, QString)@Base" 0.4+14.10.20140618
332- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, int, QString, QString)@Base" 0.4+14.10.20140618
333 (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct()@Base" 0.4+14.10.20140618
334 (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(Ubuntu::Transfers::Errors::ProcessErrorStruct const&)@Base" 0.4+14.10.20140618
335- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString)@Base" 0.4+14.10.20140618
336- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString, int, QString, QString)@Base" 0.4+14.10.20140618
337- (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, int, QString, QString)@Base" 0.4+14.10.20140618
338 (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct()@Base" 0.4+14.10.20140618
339 (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::operator=(Ubuntu::Transfers::Errors::ProcessErrorStruct const&)@Base" 0.4+14.10.20140618
340 (c++)"Ubuntu::Transfers::Errors::operator<<(QDBusArgument&, Ubuntu::Transfers::Errors::AuthErrorStruct const&)@Base" 0.4+14.10.20140618
341@@ -79,6 +63,34 @@
342 (c++)"Ubuntu::Transfers::System::Logger::~Logger()@Base" 0.4+14.10.20140618
343 (c++)"Ubuntu::Transfers::System::Logger::~Logger()@Base" 0.4+14.10.20140618
344 (c++)"Ubuntu::Transfers::System::Logger::~Logger()@Base" 0.4+14.10.20140618
345+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct::Type, QString const&)@Base" 1.0+15.10.20150724
346+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
347+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(Ubuntu::Transfers::Errors::AuthErrorStruct::Type, QString const&)@Base" 1.0+15.10.20150724
348+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::AuthErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
349+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct(QString const&, QString const&, QString const&)@Base" 1.0+15.10.20150724
350+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct(Ubuntu::Transfers::Errors::HashErrorStruct const&)@Base" 1.0+15.10.20150724
351+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct()@Base" 1.0+15.10.20150724
352+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct(QString const&, QString const&, QString const&)@Base" 1.0+15.10.20150724
353+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct(Ubuntu::Transfers::Errors::HashErrorStruct const&)@Base" 1.0+15.10.20150724
354+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::HashErrorStruct()@Base" 1.0+15.10.20150724
355+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::operator=(Ubuntu::Transfers::Errors::HashErrorStruct const&)@Base" 1.0+15.10.20150724
356+ (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
357+ (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::HttpErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
358+ (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
359+ (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::NetworkErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
360+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
361+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString const&, int, QString const&, QString const&)@Base" 1.0+15.10.20150724
362+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, int, QString const&, QString const&)@Base" 1.0+15.10.20150724
363+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString const&)@Base" 1.0+15.10.20150724
364+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, QString const&, int, QString const&, QString const&)@Base" 1.0+15.10.20150724
365+ (c++)"Ubuntu::Transfers::Errors::ProcessErrorStruct::ProcessErrorStruct(int, int, QString const&, QString const&)@Base" 1.0+15.10.20150724
366+ (c++)"Ubuntu::Transfers::Errors::operator<<(QDBusArgument&, Ubuntu::Transfers::Errors::HashErrorStruct const&)@Base" 1.0+15.10.20150724
367+ (c++)"Ubuntu::Transfers::Errors::operator>>(QDBusArgument const&, Ubuntu::Transfers::Errors::HashErrorStruct&)@Base" 1.0+15.10.20150724
368+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::getType() const@Base" 1.0+15.10.20150724
369+ (c++)"Ubuntu::Transfers::Errors::AuthErrorStruct::getPhrase() const@Base" 1.0+15.10.20150724
370+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::getChecksum() const@Base" 1.0+15.10.20150724
371+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::getExpected() const@Base" 1.0+15.10.20150724
372+ (c++)"Ubuntu::Transfers::Errors::HashErrorStruct::getMethod() const@Base" 1.0+15.10.20150724
373 (c++)"Ubuntu::Transfers::Metadata::Metadata()@Base" 0.9+14.10.20141014.1
374 (c++)"Ubuntu::Transfers::Metadata::Metadata(QMap<QString, QVariant>)@Base" 0.9+14.10.20141014.1
375 (c++)"Ubuntu::Transfers::Metadata::Metadata()@Base" 0.9+14.10.20141014.1
376@@ -109,6 +121,10 @@
377 (c++)"Ubuntu::Transfers::Metadata::EXTRACT_KEY@Base" 0.9+14.10.20141014.1
378 (c++)"Ubuntu::Transfers::Metadata::hasExtract() const@Base" 0.9+14.10.20141014.1
379 (c++)"Ubuntu::Transfers::Metadata::extract() const@Base" 0.9+14.10.20141014.1
380+ (c++)"Ubuntu::Transfers::Metadata::APP_ID@Base" 0replaceme
381+ (c++)"Ubuntu::Transfers::Metadata::setDestinationApp(QString const&)@Base" 0replaceme
382+ (c++)"Ubuntu::Transfers::Metadata::destinationApp() const@Base" 0replaceme
383+ (c++)"Ubuntu::Transfers::Metadata::hasDestinationApp() const@Base" 0replaceme
384 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::getCode() const@Base" 0.4+14.10.20140618
385 (c++)"Ubuntu::Transfers::Errors::HttpErrorStruct::getPhrase() const@Base" 0.4+14.10.20140618
386 (c++)"Ubuntu::Transfers::Errors::NetworkErrorStruct::getCode() const@Base" 0.4+14.10.20140618
387
388=== renamed file 'debian/libudm-priv-common0.install' => 'debian/libudm-priv-common1.install'
389--- debian/libudm-priv-common0.install 2014-04-29 09:52:30 +0000
390+++ debian/libudm-priv-common1.install 2015-09-22 15:25:44 +0000
391@@ -1,1 +1,1 @@
392-usr/lib/*/libudm-priv-common.so.0*
393+usr/lib/*/libudm-priv-common.so.1*
394
395=== modified file 'docs/dbus/com.canonical.applications.download.xml'
396--- docs/dbus/com.canonical.applications.download.xml 2014-09-05 15:11:35 +0000
397+++ docs/dbus/com.canonical.applications.download.xml 2015-09-22 15:25:44 +0000
398@@ -98,6 +98,11 @@
399 <arg name="error" type="(isiss)" direction="out"/>
400 </signal>
401
402+ <signal name="hashError">
403+ <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="HashErrorStruct"/>
404+ <arg name="error" type="(sss)" direction="out"/>
405+ </signal>
406+
407 <signal name="progress">
408 <arg name="received" type="t" direction="out"/>
409 <arg name="total" type="t" direction="out"/>
410@@ -113,5 +118,7 @@
411
412 <property access="read" type="s" name="ClickPackage" />
413
414+ <property access="read" type="s" name="DestinationApp" />
415+
416 </interface>
417 </node>
418
419=== modified file 'docs/dbus/com.canonical.applications.testing.download_manager.xml'
420--- docs/dbus/com.canonical.applications.testing.download_manager.xml 2014-04-30 14:47:38 +0000
421+++ docs/dbus/com.canonical.applications.testing.download_manager.xml 2015-09-22 15:25:44 +0000
422@@ -28,5 +28,12 @@
423 <arg name="download" type="s" direction="in"/>
424 <arg name="error" type="(is)" direction="in"/>
425 </method>
426+
427+ <method name="returnHashError">
428+ <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="HashErrorStruct"/>
429+ <arg name="download" type="s" direction="in"/>
430+ <arg name="error" type="(sss)" direction="in"/>
431+ </method>
432+
433 </interface>
434 </node>
435
436=== removed file 'src/common/priv/ubuntu/transfers/system/pending_reply.cpp'
437=== modified file 'src/common/public/CMakeLists.txt'
438--- src/common/public/CMakeLists.txt 2014-06-16 12:38:08 +0000
439+++ src/common/public/CMakeLists.txt 2015-09-22 15:25:44 +0000
440@@ -5,6 +5,7 @@
441 set(SOURCES
442 ubuntu/transfers/metadata.cpp
443 ubuntu/transfers/errors/auth_error_struct.cpp
444+ ubuntu/transfers/errors/hash_error_struct.cpp
445 ubuntu/transfers/errors/http_error_struct.cpp
446 ubuntu/transfers/errors/network_error_struct.cpp
447 ubuntu/transfers/errors/process_error_struct.cpp
448@@ -20,6 +21,7 @@
449
450 set(ERRORS_PUBLIC_HEADERS
451 ubuntu/transfers/errors/auth_error_struct.h
452+ ubuntu/transfers/errors/hash_error_struct.h
453 ubuntu/transfers/errors/http_error_struct.h
454 ubuntu/transfers/errors/network_error_struct.h
455 ubuntu/transfers/errors/process_error_struct.h
456
457=== modified file 'src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp'
458--- src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp 2014-02-26 19:54:31 +0000
459+++ src/common/public/ubuntu/transfers/errors/auth_error_struct.cpp 2015-09-22 15:25:44 +0000
460@@ -1,5 +1,5 @@
461 /*
462- * Copyright 2014 Canonical Ltd.
463+ * Copyright 2014-2015 Canonical Ltd.
464 *
465 * This library is free software; you can redistribute it and/or
466 * modify it under the terms of version 3 of the GNU Lesser General Public
467@@ -30,12 +30,12 @@
468 _phrase("") {
469 }
470
471-AuthErrorStruct::AuthErrorStruct(AuthErrorStruct::Type type, QString phrase)
472+AuthErrorStruct::AuthErrorStruct(AuthErrorStruct::Type type, const QString& phrase)
473 : _type(type),
474 _phrase(phrase) {
475 }
476
477-AuthErrorStruct::AuthErrorStruct(int type, QString phrase)
478+AuthErrorStruct::AuthErrorStruct(int type, const QString& phrase)
479 : _type(static_cast<AuthErrorStruct::Type>(type)),
480 _phrase(phrase) {
481 }
482@@ -80,16 +80,17 @@
483
484
485 AuthErrorStruct::Type
486-AuthErrorStruct::getType() {
487+AuthErrorStruct::getType() const {
488 return _type;
489 }
490
491 QString
492-AuthErrorStruct::getPhrase() {
493+AuthErrorStruct::getPhrase() const {
494 return _phrase;
495 }
496
497 } // Errors
498
499 } // Transfers
500+
501 } // Ubuntu
502
503=== modified file 'src/common/public/ubuntu/transfers/errors/auth_error_struct.h'
504--- src/common/public/ubuntu/transfers/errors/auth_error_struct.h 2014-03-28 15:46:56 +0000
505+++ src/common/public/ubuntu/transfers/errors/auth_error_struct.h 2015-09-22 15:25:44 +0000
506@@ -1,5 +1,5 @@
507 /*
508- * Copyright 2014 Canonical Ltd.
509+ * Copyright 2014-2015 Canonical Ltd.
510 *
511 * This library is free software; you can redistribute it and/or
512 * modify it under the terms of version 3 of the GNU Lesser General Public
513@@ -16,8 +16,7 @@
514 * Boston, MA 02110-1301, USA.
515 */
516
517-#ifndef DOWNLOADER_LIB_AUTH_ERROR_STRUCT_H
518-#define DOWNLOADER_LIB_AUTH_ERROR_STRUCT_H
519+#pragma once
520
521 class QDBusArgument;
522
523@@ -55,12 +54,12 @@
524 /*!
525 Creates a new structure with the given error types and message.
526 */
527- AuthErrorStruct(AuthErrorStruct::Type type, QString phrase);
528+ AuthErrorStruct(AuthErrorStruct::Type type, const QString& phrase);
529
530 /*!
531 Creates a new structure with the given error types and message.
532 */
533- AuthErrorStruct(int type, QString phrase);
534+ AuthErrorStruct(int type, const QString& phrase);
535
536 /*!
537 Copy constructor.
538@@ -87,18 +86,18 @@
539 // properties getters
540
541 /*!
542- \fn AuthErrorStruct::Type getType()
543+ \fn AuthErrorStruct::Type getType() const
544
545 Returns the type of the error.
546 */
547- AuthErrorStruct::Type getType();
548+ AuthErrorStruct::Type getType() const;
549
550 /*!
551- \fn QString getPhrase()
552+ \fn QString getPhrase() const
553
554 Returns the message of the error.
555 */
556- QString getPhrase();
557+ QString getPhrase() const;
558
559 private:
560
561@@ -110,7 +109,7 @@
562 /*!
563 \internal
564 */
565- QString _phrase;
566+ QString _phrase = QString::null;
567 };
568
569 } // Errors
570@@ -118,5 +117,3 @@
571 } // Transfers
572
573 } // Ubuntu
574-
575-#endif // AUTH_ERROR_STRUCT_H
576
577=== added file 'src/common/public/ubuntu/transfers/errors/hash_error_struct.cpp'
578--- src/common/public/ubuntu/transfers/errors/hash_error_struct.cpp 1970-01-01 00:00:00 +0000
579+++ src/common/public/ubuntu/transfers/errors/hash_error_struct.cpp 2015-09-22 15:25:44 +0000
580@@ -0,0 +1,96 @@
581+/*
582+ * Copyright 2015 Canonical Ltd.
583+ *
584+ * This library is free software; you can redistribute it and/or
585+ * modify it under the terms of version 3 of the GNU Lesser General Public
586+ * License as published by the Free Software Foundation.
587+ *
588+ * This program is distributed in the hope that it will be useful,
589+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
590+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
591+ * General Public License for more details.
592+ *
593+ * You should have received a copy of the GNU Lesser General Public
594+ * License along with this library; if not, write to the
595+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
596+ * Boston, MA 02110-1301, USA.
597+ */
598+
599+#include <QDBusArgument>
600+
601+#include "hash_error_struct.h"
602+
603+
604+namespace Ubuntu {
605+
606+namespace Transfers {
607+
608+namespace Errors {
609+
610+HashErrorStruct::HashErrorStruct() {
611+}
612+
613+HashErrorStruct::HashErrorStruct(const QString& method, const QString& expected, const QString& found)
614+ : _method(method),
615+ _expected(expected),
616+ _found(found) {
617+
618+}
619+
620+HashErrorStruct::HashErrorStruct(const HashErrorStruct& other)
621+ : _method(other._method),
622+ _expected(other._expected),
623+ _found(other._found) {
624+}
625+
626+HashErrorStruct&
627+HashErrorStruct::operator=(const HashErrorStruct& other) {
628+ _method = other._method;
629+ _expected = other._expected;
630+ _found = other._found;
631+
632+ return *this;
633+}
634+
635+QDBusArgument&
636+operator<<(QDBusArgument &argument, const HashErrorStruct& error) {
637+ argument.beginStructure();
638+ argument << error._method;
639+ argument << error._expected;
640+ argument << error._found;
641+ argument.endStructure();
642+
643+ return argument;
644+}
645+
646+const QDBusArgument&
647+operator>>(const QDBusArgument &argument, HashErrorStruct& error) {
648+ argument.beginStructure();
649+ argument >> error._method;
650+ argument >> error._expected;
651+ argument >> error._found;
652+ argument.endStructure();
653+
654+ return argument;
655+}
656+
657+QString
658+HashErrorStruct::getMethod() const {
659+ return _method;
660+}
661+
662+QString
663+HashErrorStruct::getExpected() const {
664+ return _expected;
665+}
666+
667+QString
668+HashErrorStruct::getChecksum() const {
669+ return _found;
670+}
671+
672+}
673+
674+}
675+
676+}
677
678=== added file 'src/common/public/ubuntu/transfers/errors/hash_error_struct.h'
679--- src/common/public/ubuntu/transfers/errors/hash_error_struct.h 1970-01-01 00:00:00 +0000
680+++ src/common/public/ubuntu/transfers/errors/hash_error_struct.h 2015-09-22 15:25:44 +0000
681@@ -0,0 +1,122 @@
682+/*
683+ * Copyright 2015 Canonical Ltd.
684+ *
685+ * This library is free software; you can redistribute it and/or
686+ * modify it under the terms of version 3 of the GNU Lesser General Public
687+ * License as published by the Free Software Foundation.
688+ *
689+ * This program is distributed in the hope that it will be useful,
690+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
691+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
692+ * General Public License for more details.
693+ *
694+ * You should have received a copy of the GNU Lesser General Public
695+ * License along with this library; if not, write to the
696+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
697+ * Boston, MA 02110-1301, USA.
698+ */
699+
700+#pragma once
701+
702+#include <QString>
703+
704+class QDBusArgument;
705+
706+namespace Ubuntu {
707+
708+namespace Transfers {
709+
710+namespace Errors {
711+
712+/*!
713+ \class HashErrorStruct
714+ \brief The HashErrorStruct represents the dbus structure that is used
715+ to communicate hash errors that happened in the download
716+ manager to the different clients.
717+ \since 0.9
718+*/
719+class HashErrorStruct {
720+ Q_PROPERTY(QString method READ getMethod)
721+ Q_PROPERTY(QString expected READ getExpected)
722+ Q_PROPERTY(QString checksum READ getChecksum)
723+
724+ public:
725+
726+ /*!
727+ Creates a new structure with the default values.
728+ */
729+ HashErrorStruct();
730+
731+ /*!
732+ Creates a new structure with the given method, expected result and found checksum.
733+ */
734+ HashErrorStruct(const QString& method, const QString& expected, const QString& found);
735+
736+ /*!
737+ Copy constructor.
738+ */
739+ HashErrorStruct(const HashErrorStruct& other);
740+
741+ /*!
742+ Assign operator.
743+ */
744+ HashErrorStruct& operator=(const HashErrorStruct& other);
745+
746+ /*!
747+ \internal
748+ */
749+ friend QDBusArgument &operator<<(QDBusArgument &argument,
750+ const HashErrorStruct& error);
751+
752+ /*!
753+ \internal
754+ */
755+ friend const QDBusArgument &operator>>(const QDBusArgument &argument,
756+ HashErrorStruct& error);
757+
758+ // properties getters
759+
760+ /*!
761+ \fn QString getMethod() const
762+
763+ Returns the method that was used to calculate the checksum.
764+ */
765+ QString getMethod() const;
766+
767+ /*!
768+ \fn QString getExpected() const
769+
770+ Returns the checksum that was expected.
771+ */
772+ QString getExpected() const;
773+
774+ /*!
775+ \fn QString getChecksum() const
776+
777+ Returns the checksum of the completed download.
778+ */
779+ QString getChecksum() const;
780+
781+ private:
782+
783+ /*!
784+ \internal
785+ */
786+ QString _method = QString::null;
787+
788+ /*!
789+ \internal
790+ */
791+ QString _expected = QString::null;
792+
793+ /*!
794+ \internal
795+ */
796+ QString _found = QString::null;
797+};
798+
799+}
800+
801+}
802+
803+}
804
805=== modified file 'src/common/public/ubuntu/transfers/errors/http_error_struct.cpp'
806--- src/common/public/ubuntu/transfers/errors/http_error_struct.cpp 2014-03-28 15:46:56 +0000
807+++ src/common/public/ubuntu/transfers/errors/http_error_struct.cpp 2015-09-22 15:25:44 +0000
808@@ -1,5 +1,5 @@
809 /*
810- * Copyright 2014 Canonical Ltd.
811+ * Copyright 2014-2015 Canonical Ltd.
812 *
813 * This library is free software; you can redistribute it and/or
814 * modify it under the terms of version 3 of the GNU Lesser General Public
815@@ -30,7 +30,7 @@
816 _phrase("OK"){
817 }
818
819-HttpErrorStruct::HttpErrorStruct(int code, QString phrase)
820+HttpErrorStruct::HttpErrorStruct(int code, const QString& phrase)
821 : _code(code),
822 _phrase(phrase) {
823 }
824
825=== modified file 'src/common/public/ubuntu/transfers/errors/http_error_struct.h'
826--- src/common/public/ubuntu/transfers/errors/http_error_struct.h 2014-03-28 15:46:56 +0000
827+++ src/common/public/ubuntu/transfers/errors/http_error_struct.h 2015-09-22 15:25:44 +0000
828@@ -1,5 +1,5 @@
829 /*
830- * Copyright 2014 Canonical Ltd.
831+ * Copyright 2014-2015 Canonical Ltd.
832 *
833 * This library is free software; you can redistribute it and/or
834 * modify it under the terms of version 3 of the GNU Lesser General Public
835@@ -16,8 +16,7 @@
836 * Boston, MA 02110-1301, USA.
837 */
838
839-#ifndef DOWNLOADER_LIB_HTTP_ERROR_STRUCT_H
840-#define DOWNLOADER_LIB_HTTP_ERROR_STRUCT_H
841+#pragma once
842
843 #include <QString>
844
845@@ -50,7 +49,7 @@
846 /*!
847 Creates a new structure with the given error types and message.
848 */
849- HttpErrorStruct(int code, QString phrase);
850+ HttpErrorStruct(int code, const QString& phrase);
851
852 /*!
853 Copy constructor.
854@@ -107,4 +106,3 @@
855 } // Transfers
856
857 } // Ubuntu
858-#endif // HTTP_ERROR_STRUCT_H
859
860=== modified file 'src/common/public/ubuntu/transfers/errors/network_error_struct.cpp'
861--- src/common/public/ubuntu/transfers/errors/network_error_struct.cpp 2014-03-28 15:46:56 +0000
862+++ src/common/public/ubuntu/transfers/errors/network_error_struct.cpp 2015-09-22 15:25:44 +0000
863@@ -1,5 +1,5 @@
864 /*
865- * Copyright 2014 Canonical Ltd.
866+ * Copyright 2014-2015 Canonical Ltd.
867 *
868 * This library is free software; you can redistribute it and/or
869 * modify it under the terms of version 3 of the GNU Lesser General Public
870@@ -115,7 +115,7 @@
871 }
872 }
873
874-NetworkErrorStruct::NetworkErrorStruct(int code, QString phrase)
875+NetworkErrorStruct::NetworkErrorStruct(int code, const QString& phrase)
876 : _code(code),
877 _phrase(phrase) {
878 }
879
880=== modified file 'src/common/public/ubuntu/transfers/errors/network_error_struct.h'
881--- src/common/public/ubuntu/transfers/errors/network_error_struct.h 2014-03-28 15:46:56 +0000
882+++ src/common/public/ubuntu/transfers/errors/network_error_struct.h 2015-09-22 15:25:44 +0000
883@@ -1,5 +1,5 @@
884 /*
885- * Copyright 2014 Canonical Ltd.
886+ * Copyright 2014-2015 Canonical Ltd.
887 *
888 * This library is free software; you can redistribute it and/or
889 * modify it under the terms of version 3 of the GNU Lesser General Public
890@@ -16,8 +16,7 @@
891 * Boston, MA 02110-1301, USA.
892 */
893
894-#ifndef DOWNLOADER_LIB_NETWORK_ERROR_STRUCT_H
895-#define DOWNLOADER_LIB_NETWORK_ERROR_STRUCT_H
896+#pragma once
897
898 #include <QString>
899
900@@ -56,7 +55,7 @@
901 Creates a network error with the given type and a human readable
902 message.
903 */
904- NetworkErrorStruct(int code, QString phrase);
905+ NetworkErrorStruct(int code, const QString& phrase);
906
907 /*!
908 Copy constructor.
909@@ -112,5 +111,3 @@
910 } // Transfers
911
912 } // Ubuntu
913-
914-#endif // NETWORK_ERROR_STRUCT_H
915
916=== modified file 'src/common/public/ubuntu/transfers/errors/process_error_struct.cpp'
917--- src/common/public/ubuntu/transfers/errors/process_error_struct.cpp 2014-03-28 15:46:56 +0000
918+++ src/common/public/ubuntu/transfers/errors/process_error_struct.cpp 2015-09-22 15:25:44 +0000
919@@ -1,5 +1,5 @@
920 /*
921- * Copyright 2014 Canonical Ltd.
922+ * Copyright 2014-2015 Canonical Ltd.
923 *
924 * This library is free software; you can redistribute it and/or
925 * modify it under the terms of version 3 of the GNU Lesser General Public
926@@ -34,7 +34,7 @@
927 _stderr("") {
928 }
929
930-ProcessErrorStruct::ProcessErrorStruct(int code, QString phrase)
931+ProcessErrorStruct::ProcessErrorStruct(int code, const QString& phrase)
932 : _code(code),
933 _exitCode(0),
934 _phrase(phrase),
935@@ -44,8 +44,8 @@
936
937 ProcessErrorStruct::ProcessErrorStruct(int code,
938 int exitCode,
939- QString standardOutput,
940- QString standardError)
941+ const QString& standardOutput,
942+ const QString& standardError)
943 : _code(code),
944 _exitCode(exitCode),
945 _stdout(standardOutput),
946@@ -73,10 +73,10 @@
947 }
948
949 ProcessErrorStruct::ProcessErrorStruct(int code,
950- QString phrase,
951+ const QString& phrase,
952 int exitCode,
953- QString standardOutput,
954- QString standardError)
955+ const QString& standardOutput,
956+ const QString& standardError)
957 : _code(code),
958 _exitCode(exitCode),
959 _phrase(phrase),
960
961=== modified file 'src/common/public/ubuntu/transfers/errors/process_error_struct.h'
962--- src/common/public/ubuntu/transfers/errors/process_error_struct.h 2014-03-28 15:46:56 +0000
963+++ src/common/public/ubuntu/transfers/errors/process_error_struct.h 2015-09-22 15:25:44 +0000
964@@ -1,5 +1,5 @@
965 /*
966- * Copyright 2014 Canonical Ltd.
967+ * Copyright 2014-2015 Canonical Ltd.
968 *
969 * This library is free software; you can redistribute it and/or
970 * modify it under the terms of version 3 of the GNU Lesser General Public
971@@ -16,8 +16,7 @@
972 * Boston, MA 02110-1301, USA.
973 */
974
975-#ifndef DOWNLOADER_LIB_PROCESS_ERROR_STRUCT_H
976-#define DOWNLOADER_LIB_PROCESS_ERROR_STRUCT_H
977+#pragma once
978
979 #include <QString>
980
981@@ -54,7 +53,7 @@
982 Create a new structure with the given error \a code and
983 a given human readable message.
984 */
985- ProcessErrorStruct(int code, QString phrase);
986+ ProcessErrorStruct(int code, const QString& phrase);
987
988 /*!
989 Creates a new structure with the given error \a code and with
990@@ -64,8 +63,8 @@
991 */
992 ProcessErrorStruct(int code,
993 int exitCode,
994- QString standardOutput,
995- QString standardError);
996+ const QString& standardOutput,
997+ const QString& standardError);
998
999 /*!
1000 Creates a new structure with the given error \a code , a human
1001@@ -74,10 +73,10 @@
1002 out via \a standardOut and standard error via \a standarError
1003 */
1004 ProcessErrorStruct(int code,
1005- QString phrase,
1006+ const QString& phrase,
1007 int exitCode,
1008- QString standardOutput,
1009- QString standardError);
1010+ const QString& standardOutput,
1011+ const QString& standardError);
1012
1013 /*!
1014 Copy constructor.
1015@@ -169,5 +168,3 @@
1016 } // Transfers
1017
1018 } // Ubuntu
1019-
1020-#endif // PROCESS_ERROR_STRUCT_H
1021
1022=== modified file 'src/common/public/ubuntu/transfers/metadata.cpp'
1023--- src/common/public/ubuntu/transfers/metadata.cpp 2014-10-09 09:52:34 +0000
1024+++ src/common/public/ubuntu/transfers/metadata.cpp 2015-09-22 15:25:44 +0000
1025@@ -16,6 +16,8 @@
1026 * Boston, MA 02110-1301, USA.
1027 */
1028
1029+#include <QProcessEnvironment>
1030+
1031 #include "metadata.h"
1032
1033 namespace Ubuntu {
1034@@ -31,12 +33,27 @@
1035 const QString Metadata::CLICK_PACKAGE_KEY = "click-package";
1036 const QString Metadata::DEFLATE_KEY = "deflate";
1037 const QString Metadata::EXTRACT_KEY = "extract";
1038+const QString Metadata::APP_ID = "app-id";
1039+
1040+namespace {
1041+ const QString APP_ID_ENV = "APP_ID";
1042+}
1043
1044 Metadata::Metadata() {
1045+ auto environment = QProcessEnvironment::systemEnvironment();
1046+ if (environment.contains(APP_ID_ENV)) {
1047+ setDestinationApp(environment.value(APP_ID_ENV));
1048+ }
1049 }
1050
1051 Metadata::Metadata(const QVariantMap map)
1052 : QVariantMap(map) {
1053+ // check if the app id is present, if not, do it
1054+ if (!hasDestinationApp()) {
1055+ auto environment = QProcessEnvironment::systemEnvironment();
1056+ environment.contains(APP_ID_ENV);
1057+ setDestinationApp(environment.value(APP_ID_ENV));
1058+ }
1059 }
1060
1061 QString
1062@@ -167,6 +184,22 @@
1063 return contains(Metadata::EXTRACT_KEY);
1064 }
1065
1066+QString
1067+Metadata::destinationApp() const {
1068+ return (contains(Metadata::APP_ID))?
1069+ value(Metadata::APP_ID).toString():"";
1070+}
1071+
1072+void
1073+Metadata::setDestinationApp(const QString &id) {
1074+ insert(Metadata::APP_ID, id);
1075+}
1076+
1077+bool
1078+Metadata::hasDestinationApp() const {
1079+ return contains(Metadata::APP_ID);
1080+}
1081+
1082 } // DownloadManager
1083
1084 } // Ubuntu
1085
1086=== modified file 'src/common/public/ubuntu/transfers/metadata.h'
1087--- src/common/public/ubuntu/transfers/metadata.h 2014-10-09 09:52:34 +0000
1088+++ src/common/public/ubuntu/transfers/metadata.h 2015-09-22 15:25:44 +0000
1089@@ -16,8 +16,7 @@
1090 * Boston, MA 02110-1301, USA.
1091 */
1092
1093-#ifndef DOWNLOADER_LIB_METADATA_H
1094-#define DOWNLOADER_LIB_METADATA_H
1095+#pragma once
1096
1097 #include <QMap>
1098 #include <QVariant>
1099@@ -41,6 +40,7 @@
1100 static const QString CLICK_PACKAGE_KEY;
1101 static const QString DEFLATE_KEY;
1102 static const QString EXTRACT_KEY;
1103+ static const QString APP_ID;
1104
1105 // accessors to simplify the use of the metadata
1106 QString command() const;
1107@@ -74,10 +74,12 @@
1108 bool extract() const;
1109 void setExtract(bool extract);
1110 bool hasExtract() const;
1111+
1112+ QString destinationApp() const;
1113+ void setDestinationApp(const QString &id);
1114+ bool hasDestinationApp() const;
1115 };
1116
1117 } // DownloadManager
1118
1119 } // Ubuntu
1120-
1121-#endif // METADATA_H
1122
1123=== modified file 'src/downloads/client/symbols.map'
1124--- src/downloads/client/symbols.map 2014-06-30 12:01:15 +0000
1125+++ src/downloads/client/symbols.map 2015-09-22 15:25:44 +0000
1126@@ -9,6 +9,7 @@
1127 Ubuntu::DownloadManager::HttpError::*;
1128 Ubuntu::DownloadManager::NetworkError::*;
1129 Ubuntu::DownloadManager::ProcessError::*;
1130+ Ubuntu::DownloadManager::HashError::*;
1131 Ubuntu::DownloadManager::GroupDownload::*;
1132 Ubuntu::DownloadManager::Manager::*;
1133 Ubuntu::DownloadManager::Logging::Logger::init*;
1134@@ -20,6 +21,7 @@
1135 typeinfo?for?Ubuntu::DownloadManager::HttpError;
1136 typeinfo?for?Ubuntu::DownloadManager::NetworkError;
1137 typeinfo?for?Ubuntu::DownloadManager::ProcessError;
1138+ typeinfo?for?Ubuntu::DownloadManager::HashError;
1139 typeinfo?for?Ubuntu::DownloadManager::GroupDownload;
1140 typeinfo?for?Ubuntu::DownloadManager::Manager;
1141 typeinfo?for?Ubuntu::DownloadManager::Logging::Logger;
1142@@ -31,6 +33,7 @@
1143 typeinfo?name?for?Ubuntu::DownloadManager::HttpError;
1144 typeinfo?name?for?Ubuntu::DownloadManager::NetworkError;
1145 typeinfo?name?for?Ubuntu::DownloadManager::ProcessError;
1146+ typeinfo?name?for?Ubuntu::DownloadManager::HashError;
1147 typeinfo?name?for?Ubuntu::DownloadManager::GroupDownload;
1148 typeinfo?name?for?Ubuntu::DownloadManager::Manager;
1149 typeinfo?name?for?Ubuntu::DownloadManager::Logging::Logger;
1150@@ -42,6 +45,7 @@
1151 VTT?for?Ubuntu::DownloadManager::HttpError;
1152 VTT?for?Ubuntu::DownloadManager::NetworkError;
1153 VTT?for?Ubuntu::DownloadManager::ProcessError;
1154+ VTT?for?Ubuntu::DownloadManager::HashError;
1155 VTT?for?Ubuntu::DownloadManager::GroupDownload;
1156 VTT?for?Ubuntu::DownloadManager::Manager;
1157 VTT?for?Ubuntu::DownloadManager::Logging::Logger;
1158@@ -53,6 +57,7 @@
1159 virtual?thunk?to?Ubuntu::DownloadManager::HttpError;
1160 virtual?thunk?to?Ubuntu::DownloadManager::NetworkError;
1161 virtual?thunk?to?Ubuntu::DownloadManager::ProcessError;
1162+ virtual?thunk?to?Ubuntu::DownloadManager::HashError;
1163 virtual?thunk?to?Ubuntu::DownloadManager::GroupDownload;
1164 virtual?thunk?to?Ubuntu::DownloadManager::Manager;
1165 virtual?thunk?to?Ubuntu::DownloadManager::Logging::Logger;
1166@@ -64,6 +69,7 @@
1167 vtable?for?Ubuntu::DownloadManager::HttpError;
1168 vtable?for?Ubuntu::DownloadManager::NetworkError;
1169 vtable?for?Ubuntu::DownloadManager::ProcessError;
1170+ vtable?for?Ubuntu::DownloadManager::HashError;
1171 vtable?for?Ubuntu::DownloadManager::GroupDownload;
1172 vtable?for?Ubuntu::DownloadManager::Manager;
1173 vtable?for?Ubuntu::DownloadManager::Logging::Logger;
1174
1175=== modified file 'src/downloads/client/ubuntu/download_manager/download.h'
1176--- src/downloads/client/ubuntu/download_manager/download.h 2014-09-24 09:10:39 +0000
1177+++ src/downloads/client/ubuntu/download_manager/download.h 2015-09-22 15:25:44 +0000
1178@@ -16,8 +16,7 @@
1179 * Boston, MA 02110-1301, USA.
1180 */
1181
1182-#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
1183-#define UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
1184+#pragma once
1185
1186 #include <QObject>
1187 #include <QVariantMap>
1188@@ -51,6 +50,7 @@
1189 Q_PROPERTY(QString ClickPackage READ clickPackage NOTIFY clickPackagedChanged)
1190 Q_PROPERTY(bool ShowInIndicator READ showInIndicator NOTIFY showInIndicatorChanged)
1191 Q_PROPERTY(QString Title READ title NOTIFY titleChanged)
1192+ Q_PROPERTY(QString DownloadOwner READ destinationApp NOTIFY destinationAppChanged)
1193
1194 public:
1195 explicit Download(QObject* parent = 0)
1196@@ -244,6 +244,14 @@
1197 */
1198 virtual QString title() const = 0;
1199
1200+ /*!
1201+ \fn QString destinationApp() const = 0;
1202+
1203+ Returns the value of the destinationApp property of the download. The owner of the
1204+ download is the application that created the download in the system.
1205+ */
1206+ virtual QString destinationApp() const = 0;
1207+
1208 signals:
1209
1210 /*!
1211@@ -346,10 +354,16 @@
1212 */
1213 void titleChanged();
1214
1215+ /*!
1216+ \fn void Download::destinationAppChanged();
1217+
1218+ This signal is emitted whenever the download owner property of the download
1219+ has been updated.
1220+ */
1221+ void destinationAppChanged();
1222+
1223 };
1224
1225 } // Ubuntu
1226
1227 } // DownloadManager
1228-
1229-#endif // UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_H
1230
1231=== modified file 'src/downloads/client/ubuntu/download_manager/download_impl.cpp'
1232--- src/downloads/client/ubuntu/download_manager/download_impl.cpp 2014-09-24 09:11:19 +0000
1233+++ src/downloads/client/ubuntu/download_manager/download_impl.cpp 2015-09-22 15:25:44 +0000
1234@@ -1,5 +1,5 @@
1235 /*
1236- * Copyright 2013-2014 Canonical Ltd.
1237+ * Copyright 2013-2015 Canonical Ltd.
1238 *
1239 * This library is free software; you can redistribute it and/or
1240 * modify it under the terms of version 3 of the GNU Lesser General Public
1241@@ -129,6 +129,13 @@
1242 "Could not connect to signal &DownloadInterface::authError");
1243 }
1244
1245+ connected = connect(_dbusInterface, &DownloadInterface::hashError,
1246+ this, &DownloadImpl::onHashError);
1247+ if (!connected) {
1248+ Logger::log(Logger::Critical,
1249+ "Could not connect to signal &DownloadInterface::authError");
1250+ }
1251+
1252 connected = connect(_propertiesInterface, &PropertiesInterface::PropertiesChanged,
1253 this, &DownloadImpl::onPropertiesChanged);
1254 if (!connected) {
1255@@ -418,6 +425,11 @@
1256 return _dbusInterface->title();
1257 }
1258
1259+QString
1260+DownloadImpl::destinationApp() const {
1261+ return _dbusInterface->destinationApp();
1262+}
1263+
1264 void
1265 DownloadImpl::onHttpError(HttpErrorStruct errStruct) {
1266 auto err = new HttpError(errStruct, this);
1267@@ -443,6 +455,12 @@
1268 }
1269
1270 void
1271+DownloadImpl::onHashError(HashErrorStruct errStruct) {
1272+ auto err = new HashError(errStruct, this);
1273+ setLastError(err);
1274+}
1275+
1276+void
1277 DownloadImpl::onPropertiesChanged(const QString& interfaceName,
1278 const QVariantMap& changedProperties,
1279 const QStringList& invalidatedProperties) {
1280
1281=== modified file 'src/downloads/client/ubuntu/download_manager/download_impl.h'
1282--- src/downloads/client/ubuntu/download_manager/download_impl.h 2014-09-08 11:33:57 +0000
1283+++ src/downloads/client/ubuntu/download_manager/download_impl.h 2015-09-22 15:25:44 +0000
1284@@ -1,5 +1,5 @@
1285 /*
1286- * Copyright 2013-2014 Canonical Ltd.
1287+ * Copyright 2013-2015 Canonical Ltd.
1288 *
1289 * This library is free software; you can redistribute it and/or
1290 * modify it under the terms of version 3 of the GNU Lesser General Public
1291@@ -16,8 +16,7 @@
1292 * Boston, MA 02110-1301, USA.
1293 */
1294
1295-#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_IMPL_H
1296-#define UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_IMPL_H
1297+#pragma once
1298
1299 #include <QDBusConnection>
1300 #include <QDBusObjectPath>
1301@@ -82,6 +81,7 @@
1302 QString clickPackage() const;
1303 bool showInIndicator() const;
1304 QString title() const;
1305+ QString destinationApp() const;
1306
1307 protected:
1308 DownloadImpl(const QDBusConnection& conn, Error* err, QObject* parent = 0);
1309@@ -97,6 +97,7 @@
1310 void onNetworkError(NetworkErrorStruct);
1311 void onProcessError(ProcessErrorStruct);
1312 void onAuthError(AuthErrorStruct);
1313+ void onHashError(HashErrorStruct);
1314 void onPropertiesChanged(const QString& interfaceName,
1315 const QVariantMap& changedProperties,
1316 const QStringList& invalidatedProperties);
1317@@ -116,4 +117,3 @@
1318
1319 } // DownloadManager
1320
1321-#endif // UBUNTU_DOWNLOADMANAGER_CLIENT_DOWNLOAD_IMPL_H
1322
1323=== modified file 'src/downloads/client/ubuntu/download_manager/download_interface.cpp'
1324--- src/downloads/client/ubuntu/download_manager/download_interface.cpp 2014-01-13 17:26:28 +0000
1325+++ src/downloads/client/ubuntu/download_manager/download_interface.cpp 2015-09-22 15:25:44 +0000
1326@@ -2,7 +2,7 @@
1327 * This file was generated by qdbusxml2cpp version 0.8
1328 * Command line was: qdbusxml2cpp com.canonical.applications.download.xml -i metatypes.h -p download_interface -c DownloadInterface
1329 *
1330- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
1331+ * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
1332 *
1333 * This is an auto-generated file.
1334 * This file may have been hand-edited. Look for HAND-EDIT comments
1335
1336=== modified file 'src/downloads/client/ubuntu/download_manager/download_interface.h'
1337--- src/downloads/client/ubuntu/download_manager/download_interface.h 2014-09-05 15:11:35 +0000
1338+++ src/downloads/client/ubuntu/download_manager/download_interface.h 2015-09-22 15:25:44 +0000
1339@@ -2,14 +2,14 @@
1340 * This file was generated by qdbusxml2cpp version 0.8
1341 * Command line was: qdbusxml2cpp com.canonical.applications.download.xml -i metatypes.h -p download_interface -c DownloadInterface
1342 *
1343- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
1344+ * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
1345 *
1346 * This is an auto-generated file.
1347 * Do not edit! All changes made to it will be lost.
1348 */
1349
1350-#ifndef DOWNLOAD_INTERFACE_H_1392136772
1351-#define DOWNLOAD_INTERFACE_H_1392136772
1352+#ifndef DOWNLOAD_INTERFACE_H_1442932929
1353+#define DOWNLOAD_INTERFACE_H_1442932929
1354
1355 #include <QtCore/QObject>
1356 #include <QtCore/QByteArray>
1357@@ -40,6 +40,10 @@
1358 inline QString clickPackage() const
1359 { return qvariant_cast< QString >(property("ClickPackage")); }
1360
1361+ Q_PROPERTY(QString DestinationApp READ destinationApp)
1362+ inline QString destinationApp() const
1363+ { return qvariant_cast< QString >(property("DestinationApp")); }
1364+
1365 Q_PROPERTY(bool ShowInIndicator READ showInIndicator)
1366 inline bool showInIndicator() const
1367 { return qvariant_cast< bool >(property("ShowInIndicator")); }
1368@@ -53,95 +57,95 @@
1369 {
1370 QList<QVariant> argumentList;
1371 argumentList << QVariant::fromValue(allowed);
1372- return asyncCallWithArgumentList(QLatin1String("allowGSMDownload"), argumentList);
1373+ return asyncCallWithArgumentList(QStringLiteral("allowGSMDownload"), argumentList);
1374 }
1375
1376 inline QDBusPendingReply<> cancel()
1377 {
1378 QList<QVariant> argumentList;
1379- return asyncCallWithArgumentList(QLatin1String("cancel"), argumentList);
1380+ return asyncCallWithArgumentList(QStringLiteral("cancel"), argumentList);
1381 }
1382
1383 inline QDBusPendingReply<StringMap> headers()
1384 {
1385 QList<QVariant> argumentList;
1386- return asyncCallWithArgumentList(QLatin1String("headers"), argumentList);
1387+ return asyncCallWithArgumentList(QStringLiteral("headers"), argumentList);
1388 }
1389
1390 inline QDBusPendingReply<bool> isGSMDownloadAllowed()
1391 {
1392 QList<QVariant> argumentList;
1393- return asyncCallWithArgumentList(QLatin1String("isGSMDownloadAllowed"), argumentList);
1394+ return asyncCallWithArgumentList(QStringLiteral("isGSMDownloadAllowed"), argumentList);
1395 }
1396
1397 inline QDBusPendingReply<QVariantMap> metadata()
1398 {
1399 QList<QVariant> argumentList;
1400- return asyncCallWithArgumentList(QLatin1String("metadata"), argumentList);
1401+ return asyncCallWithArgumentList(QStringLiteral("metadata"), argumentList);
1402 }
1403
1404 inline QDBusPendingReply<> pause()
1405 {
1406 QList<QVariant> argumentList;
1407- return asyncCallWithArgumentList(QLatin1String("pause"), argumentList);
1408+ return asyncCallWithArgumentList(QStringLiteral("pause"), argumentList);
1409 }
1410
1411 inline QDBusPendingReply<qulonglong> progress()
1412 {
1413 QList<QVariant> argumentList;
1414- return asyncCallWithArgumentList(QLatin1String("progress"), argumentList);
1415+ return asyncCallWithArgumentList(QStringLiteral("progress"), argumentList);
1416 }
1417
1418 inline QDBusPendingReply<> resume()
1419 {
1420 QList<QVariant> argumentList;
1421- return asyncCallWithArgumentList(QLatin1String("resume"), argumentList);
1422+ return asyncCallWithArgumentList(QStringLiteral("resume"), argumentList);
1423 }
1424
1425 inline QDBusPendingReply<> setDestinationDir(const QString &path)
1426 {
1427 QList<QVariant> argumentList;
1428 argumentList << QVariant::fromValue(path);
1429- return asyncCallWithArgumentList(QLatin1String("setDestinationDir"), argumentList);
1430+ return asyncCallWithArgumentList(QStringLiteral("setDestinationDir"), argumentList);
1431 }
1432
1433 inline QDBusPendingReply<> setHeaders(StringMap headers)
1434 {
1435 QList<QVariant> argumentList;
1436 argumentList << QVariant::fromValue(headers);
1437- return asyncCallWithArgumentList(QLatin1String("setHeaders"), argumentList);
1438+ return asyncCallWithArgumentList(QStringLiteral("setHeaders"), argumentList);
1439 }
1440
1441 inline QDBusPendingReply<> setMetadata(const QVariantMap &data)
1442 {
1443 QList<QVariant> argumentList;
1444 argumentList << QVariant::fromValue(data);
1445- return asyncCallWithArgumentList(QLatin1String("setMetadata"), argumentList);
1446+ return asyncCallWithArgumentList(QStringLiteral("setMetadata"), argumentList);
1447 }
1448
1449 inline QDBusPendingReply<> setThrottle(qulonglong speed)
1450 {
1451 QList<QVariant> argumentList;
1452 argumentList << QVariant::fromValue(speed);
1453- return asyncCallWithArgumentList(QLatin1String("setThrottle"), argumentList);
1454+ return asyncCallWithArgumentList(QStringLiteral("setThrottle"), argumentList);
1455 }
1456
1457 inline QDBusPendingReply<> start()
1458 {
1459 QList<QVariant> argumentList;
1460- return asyncCallWithArgumentList(QLatin1String("start"), argumentList);
1461+ return asyncCallWithArgumentList(QStringLiteral("start"), argumentList);
1462 }
1463
1464 inline QDBusPendingReply<qulonglong> throttle()
1465 {
1466 QList<QVariant> argumentList;
1467- return asyncCallWithArgumentList(QLatin1String("throttle"), argumentList);
1468+ return asyncCallWithArgumentList(QStringLiteral("throttle"), argumentList);
1469 }
1470
1471 inline QDBusPendingReply<qulonglong> totalSize()
1472 {
1473 QList<QVariant> argumentList;
1474- return asyncCallWithArgumentList(QLatin1String("totalSize"), argumentList);
1475+ return asyncCallWithArgumentList(QStringLiteral("totalSize"), argumentList);
1476 }
1477
1478 Q_SIGNALS: // SIGNALS
1479@@ -149,6 +153,7 @@
1480 void canceled(bool success);
1481 void error(const QString &error);
1482 void finished(const QString &path);
1483+ void hashError(HashErrorStruct error);
1484 void httpError(HttpErrorStruct error);
1485 void networkError(NetworkErrorStruct error);
1486 void paused(bool success);
1487
1488=== modified file 'src/downloads/client/ubuntu/download_manager/error.cpp'
1489--- src/downloads/client/ubuntu/download_manager/error.cpp 2014-02-26 19:54:31 +0000
1490+++ src/downloads/client/ubuntu/download_manager/error.cpp 2015-09-22 15:25:44 +0000
1491@@ -1,5 +1,5 @@
1492 /*
1493- * Copyright 2013-2014 Canonical Ltd.
1494+ * Copyright 2013-2015 Canonical Ltd.
1495 *
1496 * This library is free software; you can redistribute it and/or
1497 * modify it under the terms of version 3 of the GNU Lesser General Public
1498@@ -26,6 +26,7 @@
1499 const QString HTTP_ERROR_STRING = "HttpError: %1 - %2";
1500 const QString NETWORK_ERROR_STRING = "NetworkError: %1 - %2";
1501 const QString PROCESS_ERROR_STRING = "ProcessError: %1 - %2\nExit code: %3\nStdout: %4\nStderr:%5";
1502+ const QString HASH_ERROR_STRING = "Hash validation error using %1: Expected result is %2 but result was %3.";
1503 }
1504
1505 namespace Ubuntu {
1506@@ -45,11 +46,11 @@
1507 q_ptr(parent) {
1508 }
1509
1510- Error::Type type() {
1511+ Error::Type type() const {
1512 return _type;
1513 }
1514
1515- QString errorString() {
1516+ QString errorString() const {
1517 switch(_type) {
1518 case Error::DBus:
1519 return "DBusError";
1520@@ -59,6 +60,8 @@
1521 return "NetworkError";
1522 case Error::Process:
1523 return "ProcessError";
1524+ case Error::Hash:
1525+ return "HashError";
1526 default:
1527 return "";
1528 }
1529@@ -78,15 +81,15 @@
1530 q_ptr(parent) {
1531 }
1532
1533- inline QString message() {
1534+ inline QString message() const {
1535 return _err.message();
1536 }
1537
1538- inline QString name() {
1539+ inline QString name() const {
1540 return _err.name();
1541 }
1542
1543- inline QString errorString() {
1544+ inline QString errorString() const {
1545 return DBUS_ERROR_STRING.arg(_err.name(), _err.message());
1546 }
1547
1548@@ -104,7 +107,7 @@
1549 q_ptr(parent) {
1550 }
1551
1552- inline AuthError::Type type() {
1553+ inline AuthError::Type type() const {
1554 switch(_err.getType()) {
1555 case Transfers::Errors::AuthErrorStruct::Proxy:
1556 return AuthError::Proxy;
1557@@ -113,7 +116,7 @@
1558 }
1559 }
1560
1561- inline QString getTypeString() {
1562+ inline QString getTypeString() const {
1563 switch(_err.getType()) {
1564 case Transfers::Errors::AuthErrorStruct::Proxy:
1565 return "Proxy";
1566@@ -122,11 +125,11 @@
1567 }
1568 }
1569
1570- inline QString phrase() {
1571+ inline QString phrase() const {
1572 return _err.getPhrase();
1573 }
1574
1575- inline QString errorString() {
1576+ inline QString errorString() const {
1577 return AUTH_ERROR_STRING.arg(getTypeString(), _err.getPhrase());
1578 }
1579
1580@@ -144,15 +147,15 @@
1581 q_ptr(parent) {
1582 }
1583
1584- inline int code() {
1585+ inline int code() const {
1586 return _err.getCode();
1587 }
1588
1589- inline QString phrase() {
1590+ inline QString phrase() const {
1591 return _err.getPhrase();
1592 }
1593
1594- inline QString errorString() {
1595+ inline QString errorString() const {
1596 return HTTP_ERROR_STRING.arg(QString::number(_err.getCode()),
1597 _err.getPhrase());
1598 }
1599@@ -172,16 +175,16 @@
1600 q_ptr(parent) {
1601 }
1602
1603- inline NetworkError::ErrorCode code() {
1604+ inline NetworkError::ErrorCode code() const {
1605 auto intCode = static_cast<NetworkError::ErrorCode>(_err.getCode());
1606 return intCode;
1607 }
1608
1609- inline QString phrase() {
1610+ inline QString phrase() const {
1611 return _err.getPhrase();
1612 }
1613
1614- inline QString errorString() {
1615+ inline QString errorString() const {
1616 return NETWORK_ERROR_STRING.arg(QString::number(_err.getCode()),
1617 _err.getPhrase());
1618 }
1619@@ -201,28 +204,28 @@
1620 q_ptr(parent) {
1621 }
1622
1623- QProcess::ProcessError code() {
1624+ QProcess::ProcessError code() const {
1625 auto code = static_cast<QProcess::ProcessError>(_err.getCode());
1626 return code;
1627 }
1628
1629- QString phrase() {
1630+ QString phrase() const {
1631 return _err.getPhrase();
1632 }
1633
1634- inline int exitCode() {
1635+ inline int exitCode() const {
1636 return _err.getExitCode();
1637 }
1638
1639- inline QString standardOut() {
1640+ inline QString standardOut() const {
1641 return _err.getStandardOutput();
1642 }
1643
1644- inline QString standardError() {
1645+ inline QString standardError() const {
1646 return _err.getStandardError();
1647 }
1648
1649- inline QString errorString() {
1650+ inline QString errorString() const {
1651 return PROCESS_ERROR_STRING.arg(QString::number(_err.getCode()),
1652 _err.getPhrase(), QString::number(_err.getExitCode()),
1653 _err.getStandardOutput(), _err.getStandardError());
1654@@ -233,6 +236,36 @@
1655 ProcessError* q_ptr;
1656 };
1657
1658+class HashErrorPrivate {
1659+ Q_DECLARE_PUBLIC(HashError)
1660+
1661+ public:
1662+ HashErrorPrivate (Transfers::Errors::HashErrorStruct err, HashError* parent)
1663+ : _err(err),
1664+ q_ptr(parent) {
1665+ }
1666+
1667+ inline QString method() const {
1668+ return _err.getMethod();
1669+ }
1670+
1671+ inline QString expected() const {
1672+ return _err.getExpected();
1673+ }
1674+
1675+ inline QString checksum() const {
1676+ return _err.getChecksum();
1677+ }
1678+
1679+ inline QString errorString() const {
1680+ return HASH_ERROR_STRING.arg(_err.getMethod()).arg(_err.getExpected()).arg(_err.getChecksum());
1681+ }
1682+
1683+ private:
1684+ Transfers::Errors::HashErrorStruct _err;
1685+ HashError* q_ptr;
1686+};
1687+
1688 /*
1689 * PUBLIC IMPLEMENTATIONS
1690 */
1691@@ -413,6 +446,39 @@
1692 return d->errorString();
1693 }
1694
1695+HashError::HashError(Transfers::Errors::HashErrorStruct errStruct, QObject* parent)
1696+ : Error(Error::Hash, parent),
1697+ d_ptr(new HashErrorPrivate(errStruct, this)) {
1698+}
1699+
1700+HashError::~HashError() {
1701+ delete d_ptr;
1702+}
1703+
1704+QString
1705+HashError::method() {
1706+ Q_D(HashError);
1707+ return d->method();
1708+}
1709+
1710+QString
1711+HashError::expected() {
1712+ Q_D(HashError);
1713+ return d->expected();
1714+}
1715+
1716+QString
1717+HashError::checksum() {
1718+ Q_D(HashError);
1719+ return d->checksum();
1720+}
1721+
1722+QString
1723+HashError::errorString() {
1724+ Q_D(HashError);
1725+ return d->errorString();
1726+}
1727+
1728 } // DownloadManager
1729
1730 } // Ubuntu
1731
1732=== modified file 'src/downloads/client/ubuntu/download_manager/error.h'
1733--- src/downloads/client/ubuntu/download_manager/error.h 2014-06-06 10:05:15 +0000
1734+++ src/downloads/client/ubuntu/download_manager/error.h 2015-09-22 15:25:44 +0000
1735@@ -1,5 +1,5 @@
1736 /*
1737- * Copyright 2013-2014 Canonical Ltd.
1738+ * Copyright 2013-2015 Canonical Ltd.
1739 *
1740 * This library is free software; you can redistribute it and/or
1741 * modify it under the terms of version 3 of the GNU Lesser General Public
1742@@ -16,8 +16,7 @@
1743 * Boston, MA 02110-1301, USA.
1744 */
1745
1746-#ifndef UBUNTU_DOWNLOADMANAGER_CLIENT_ERROR_H
1747-#define UBUNTU_DOWNLOADMANAGER_CLIENT_ERROR_H
1748+#pragma once
1749
1750 #include <QObject>
1751 #include <QProcess>
1752@@ -33,6 +32,7 @@
1753 class HttpErrorStruct;
1754 class NetworkErrorStruct;
1755 class ProcessErrorStruct;
1756+ class HashErrorStruct;
1757 }
1758
1759 }
1760@@ -66,7 +66,8 @@
1761 DBus, /*! The error was due to some problem when communicating with the dbus API.*/
1762 Http, /*! The error was due to a http error, for example a 404.*/
1763 Network, /*! The error was due to network problems such as a missing network interface.*/
1764- Process /*! The error was due to a problem when executing the post download command.*/
1765+ Process, /*! The error was due to a problem when executing the post download command.*/
1766+ Hash /*! The error was due to a problem when verifying the checksum of the download.*/
1767 };
1768
1769 /*!
1770@@ -468,8 +469,72 @@
1771 ProcessErrorPrivate* d_ptr;
1772 };
1773
1774+class HashErrorPrivate;
1775+
1776+/*!
1777+ \class HashError
1778+ \brief The HashError represents an error that occurred during the
1779+ hash validation after the download.
1780+ \since 0.3
1781+*/
1782+class HashError : public Error {
1783+ Q_OBJECT
1784+ Q_DECLARE_PRIVATE(HashError)
1785+
1786+ friend class DownloadImpl;
1787+
1788+ public:
1789+
1790+ /*!
1791+ Disposes of this error and frees any resources associated with it.
1792+ */
1793+ virtual ~HashError();
1794+
1795+ /*!
1796+ /fn QString method()
1797+
1798+ Returns the method that was used to verify the checksum of the download.
1799+ */
1800+ QString method();
1801+
1802+ /*!
1803+ /fn QString expected()
1804+
1805+ Returns the checksum that passed to the download manager to check against once the download
1806+ was completed.
1807+ */
1808+ QString expected();
1809+
1810+ /*!
1811+ /fn QString checksum()
1812+
1813+ Returns the checksum of the download on disk after the download was completed.
1814+ */
1815+ QString checksum();
1816+
1817+ /*!
1818+ /fn QString errorString() override
1819+
1820+ Returns a string representation of the error.
1821+ */
1822+ QString errorString() override;
1823+
1824+ protected:
1825+
1826+ /*!
1827+ Creates a new error from the provided process error struct.
1828+ \internal
1829+ */
1830+ HashError(Transfers::Errors::HashErrorStruct err, QObject* parent);
1831+
1832+ private:
1833+ /*!
1834+ Use pimpl pattern so that users do not have to be recompiled
1835+ \internal
1836+ */
1837+ HashErrorPrivate* d_ptr;
1838+};
1839+
1840 } // DownloadManager
1841
1842 } // Ubuntu
1843-
1844-#endif // ERROR_H
1845
1846=== modified file 'src/downloads/client/ubuntu/download_manager/manager_impl.cpp'
1847--- src/downloads/client/ubuntu/download_manager/manager_impl.cpp 2014-06-29 12:45:29 +0000
1848+++ src/downloads/client/ubuntu/download_manager/manager_impl.cpp 2015-09-22 15:25:44 +0000
1849@@ -1,5 +1,5 @@
1850 /*
1851- * Copyright 2013-2014 Canonical Ltd.
1852+ * Copyright 2013-2015 Canonical Ltd.
1853 *
1854 * This library is free software; you can redistribute it and/or
1855 * modify it under the terms of version 3 of the GNU Lesser General Public
1856@@ -69,6 +69,7 @@
1857 qRegisterMetaType<HttpError*>("HttpError*");
1858 qRegisterMetaType<NetworkError*>("NetworkError*");
1859 qRegisterMetaType<AuthError*>("AuthError*");
1860+ qRegisterMetaType<HashError*>("HashError*");
1861 qRegisterMetaType<ProcessError*>("ProcessError*");
1862 qRegisterMetaType<DownloadsList*>("DownloadsList*");
1863 qDBusRegisterMetaType<StringMap>();
1864@@ -76,6 +77,7 @@
1865 qDBusRegisterMetaType<GroupDownloadStruct>();
1866 qDBusRegisterMetaType<StructList>();
1867 qDBusRegisterMetaType<AuthErrorStruct>();
1868+ qDBusRegisterMetaType<HashErrorStruct>();
1869 qDBusRegisterMetaType<HttpErrorStruct>();
1870 qDBusRegisterMetaType<NetworkErrorStruct>();
1871 qDBusRegisterMetaType<ProcessErrorStruct>();
1872
1873=== modified file 'src/downloads/common/ubuntu/download_manager/metatypes.h'
1874--- src/downloads/common/ubuntu/download_manager/metatypes.h 2014-02-26 19:54:31 +0000
1875+++ src/downloads/common/ubuntu/download_manager/metatypes.h 2015-09-22 15:25:44 +0000
1876@@ -1,5 +1,5 @@
1877 /*
1878- * Copyright 2013-2014 Canonical Ltd.
1879+ * Copyright 2013-2015 Canonical Ltd.
1880 *
1881 * This library is free software; you can redistribute it and/or
1882 * modify it under the terms of version 3 of the GNU Lesser General Public
1883@@ -16,12 +16,12 @@
1884 * Boston, MA 02110-1301, USA.
1885 */
1886
1887-#ifndef DOWNLOADER_LIB_APP_METATYPES_H
1888-#define DOWNLOADER_LIB_APP_METATYPES_H
1889+#pragma once
1890
1891 #include <QMap>
1892 #include <QList>
1893 #include <ubuntu/transfers/errors/auth_error_struct.h>
1894+#include <ubuntu/transfers/errors/hash_error_struct.h>
1895 #include <ubuntu/transfers/errors/http_error_struct.h>
1896 #include <ubuntu/transfers/errors/network_error_struct.h>
1897 #include <ubuntu/transfers/errors/process_error_struct.h>
1898@@ -35,6 +35,7 @@
1899 typedef QList<GroupDownloadStruct> StructList;
1900
1901 Q_DECLARE_METATYPE(AuthErrorStruct)
1902+Q_DECLARE_METATYPE(HashErrorStruct)
1903 Q_DECLARE_METATYPE(HttpErrorStruct)
1904 Q_DECLARE_METATYPE(NetworkErrorStruct)
1905 Q_DECLARE_METATYPE(ProcessErrorStruct)
1906@@ -42,4 +43,3 @@
1907 Q_DECLARE_METATYPE(StringMap)
1908 Q_DECLARE_METATYPE(StructList)
1909
1910-#endif // DOWNLOADER_LIB_APP_METATYPES_H
1911
1912=== modified file 'src/downloads/priv/ubuntu/downloads/download.h'
1913--- src/downloads/priv/ubuntu/downloads/download.h 2014-12-01 09:20:00 +0000
1914+++ src/downloads/priv/ubuntu/downloads/download.h 2015-09-22 15:25:44 +0000
1915@@ -16,8 +16,7 @@
1916 * Boston, MA 02110-1301, USA.
1917 */
1918
1919-#ifndef DOWNLOADER_LIB_DOWNLOAD_H
1920-#define DOWNLOADER_LIB_DOWNLOAD_H
1921+#pragma once
1922
1923 #include <QNetworkAccessManager>
1924 #include <QObject>
1925@@ -43,6 +42,7 @@
1926 Q_PROPERTY(QString ClickPackage READ clickPackage)
1927 Q_PROPERTY(bool ShowInIndicator READ showInIndicator)
1928 Q_PROPERTY(QString Title READ title)
1929+ Q_PROPERTY(QString DownloadOwner READ destinationApp)
1930
1931 public:
1932 Download(const QString& id,
1933@@ -77,12 +77,15 @@
1934 // rename the transfer method
1935 Transfer::allowGSMData(allowed);
1936 }
1937+
1938 virtual bool isGSMDownloadAllowed() {
1939 return Transfer::isGSMDataAllowed();
1940 }
1941+
1942 virtual StringMap headers() const {
1943 return _headers;
1944 }
1945+
1946 virtual void setHeaders(StringMap headers) {
1947 _headers = headers;
1948 }
1949@@ -91,6 +94,14 @@
1950 _metadata = data;
1951 }
1952
1953+ virtual QString destinationApp() {
1954+ return _destinationApp;
1955+ }
1956+
1957+ virtual void setDownloadOwner(const QString& owner) {
1958+ _destinationApp = owner;
1959+ }
1960+
1961 // slots to be implemented by the children
1962 virtual qulonglong progress() = 0;
1963 virtual qulonglong totalSize() = 0;
1964@@ -110,6 +121,7 @@
1965 QVariantMap _metadata;
1966
1967 private:
1968+ QString _destinationApp = QString::null;
1969 QMap<QString, QString> _headers;
1970 QMap<QString, QObject*> _adaptors;
1971 };
1972@@ -120,4 +132,3 @@
1973
1974 } // Ubuntu
1975
1976-#endif // DOWNLOADER_LIB_APP_DOWNLOAD_H
1977
1978=== modified file 'src/downloads/priv/ubuntu/downloads/download_adaptor.cpp'
1979--- src/downloads/priv/ubuntu/downloads/download_adaptor.cpp 2014-09-05 15:11:35 +0000
1980+++ src/downloads/priv/ubuntu/downloads/download_adaptor.cpp 2015-09-22 15:25:44 +0000
1981@@ -2,7 +2,7 @@
1982 * This file was generated by qdbusxml2cpp version 0.8
1983 * Command line was: qdbusxml2cpp -c DownloadAdaptor -a download_adaptor.h:download_adaptor.cpp com.canonical.applications.download.xml
1984 *
1985- * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
1986+ * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
1987 *
1988 * This is an auto-generated file.
1989 * Do not edit! All changes made to it will be lost.
1990@@ -39,6 +39,12 @@
1991 return qvariant_cast< QString >(parent()->property("ClickPackage"));
1992 }
1993
1994+QString DownloadAdaptor::destinationApp() const
1995+{
1996+ // get the value of property DownloadOwner
1997+ return qvariant_cast< QString >(parent()->property("DownloadOwner"));
1998+}
1999+
2000 bool DownloadAdaptor::showInIndicator() const
2001 {
2002 // get the value of property ShowInIndicator
2003
2004=== modified file 'src/downloads/priv/ubuntu/downloads/download_adaptor.h'
2005--- src/downloads/priv/ubuntu/downloads/download_adaptor.h 2014-09-05 15:11:35 +0000
2006+++ src/downloads/priv/ubuntu/downloads/download_adaptor.h 2015-09-22 15:25:44 +0000
2007@@ -2,15 +2,15 @@
2008 * This file was generated by qdbusxml2cpp version 0.8
2009 * Command line was: qdbusxml2cpp -c DownloadAdaptor -a download_adaptor.h:download_adaptor.cpp com.canonical.applications.download.xml
2010 *
2011- * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2012+ * qdbusxml2cpp is Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
2013 *
2014 * This is an auto-generated file.
2015 * This file may have been hand-edited. Look for HAND-EDIT comments
2016 * before re-generating it.
2017 */
2018
2019-#ifndef DOWNLOAD_ADAPTOR_H_1392117488
2020-#define DOWNLOAD_ADAPTOR_H_1392117488
2021+#ifndef DOWNLOAD_ADAPTOR_H_1440513488
2022+#define DOWNLOAD_ADAPTOR_H_1440513488
2023
2024 #include <QtCore/QObject>
2025 #include <QtDBus/QtDBus>
2026@@ -109,6 +109,10 @@
2027 " <annotation value=\"ProcessErrorStruct\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
2028 " <arg direction=\"out\" type=\"(isiss)\" name=\"error\"/>\n"
2029 " </signal>\n"
2030+" <signal name=\"hashError\">\n"
2031+" <annotation value=\"HashErrorStruct\" name=\"org.qtproject.QtDBus.QtTypeName.In0\"/>\n"
2032+" <arg direction=\"out\" type=\"(sss)\" name=\"error\"/>\n"
2033+" </signal>\n"
2034 " <signal name=\"progress\">\n"
2035 " <arg direction=\"out\" type=\"t\" name=\"received\"/>\n"
2036 " <arg direction=\"out\" type=\"t\" name=\"total\"/>\n"
2037@@ -119,6 +123,7 @@
2038 " <property access=\"read\" type=\"b\" name=\"ShowInIndicator\"/>\n"
2039 " <property access=\"read\" type=\"s\" name=\"Title\"/>\n"
2040 " <property access=\"read\" type=\"s\" name=\"ClickPackage\"/>\n"
2041+" <property access=\"read\" type=\"s\" name=\"DestinationApp\"/>\n"
2042 " </interface>\n"
2043 "")
2044 public:
2045@@ -129,6 +134,9 @@
2046 Q_PROPERTY(QString ClickPackage READ clickPackage)
2047 QString clickPackage() const;
2048
2049+ Q_PROPERTY(QString DestinationApp READ destinationApp)
2050+ QString destinationApp() const;
2051+
2052 Q_PROPERTY(bool ShowInIndicator READ showInIndicator)
2053 bool showInIndicator() const;
2054
2055@@ -156,6 +164,7 @@
2056 void canceled(bool success);
2057 void error(const QString &error);
2058 void finished(const QString &path);
2059+ void hashError(HashErrorStruct error);
2060 void httpError(HttpErrorStruct error);
2061 void networkError(NetworkErrorStruct error);
2062 void paused(bool success);
2063
2064=== modified file 'src/downloads/priv/ubuntu/downloads/file_download.cpp'
2065--- src/downloads/priv/ubuntu/downloads/file_download.cpp 2015-01-23 11:59:19 +0000
2066+++ src/downloads/priv/ubuntu/downloads/file_download.cpp 2015-09-22 15:25:44 +0000
2067@@ -1,5 +1,5 @@
2068 /*
2069- * Copyright 2013-2014 Canonical Ltd.
2070+ * Copyright 2013-2015 Canonical Ltd.
2071 *
2072 * This library is free software; you can redistribute it and/or
2073 * modify it under the terms of version 3 of the GNU Lesser General Public
2074@@ -931,6 +931,7 @@
2075 QString fileSig = QString(hash->result().toHex());
2076 if (fileSig != _hash) {
2077 DOWN_LOG(ERROR) << HASH_ERROR << fileSig << "!=" << _hash;
2078+ emit hashError(HashErrorStruct(HashAlgorithm::getHashAlgo(_algo), _hash, fileSig));
2079 return false;
2080 }
2081 }
2082
2083=== modified file 'src/downloads/priv/ubuntu/downloads/file_download.h'
2084--- src/downloads/priv/ubuntu/downloads/file_download.h 2015-01-22 22:08:41 +0000
2085+++ src/downloads/priv/ubuntu/downloads/file_download.h 2015-09-22 15:25:44 +0000
2086@@ -1,5 +1,5 @@
2087 /*
2088- * Copyright 2013-2014 Canonical Ltd.
2089+ * Copyright 2013-2015 Canonical Ltd.
2090 *
2091 * This library is free software; you can redistribute it and/or
2092 * modify it under the terms of version 3 of the GNU Lesser General Public
2093@@ -103,6 +103,7 @@
2094 void httpError(HttpErrorStruct error);
2095 void networkError(NetworkErrorStruct error);
2096 void processError(ProcessErrorStruct error);
2097+ void hashError(HashErrorStruct error);
2098 void propertiesChanged(const QVariantMap& changes);
2099
2100 protected:
2101
2102=== modified file 'src/downloads/priv/ubuntu/downloads/manager.cpp'
2103--- src/downloads/priv/ubuntu/downloads/manager.cpp 2014-10-22 23:32:28 +0000
2104+++ src/downloads/priv/ubuntu/downloads/manager.cpp 2015-09-22 15:25:44 +0000
2105@@ -78,6 +78,7 @@
2106 qDBusRegisterMetaType<StructList>();
2107 qDBusRegisterMetaType<AuthErrorStruct>();
2108 qDBusRegisterMetaType<HttpErrorStruct>();
2109+ qDBusRegisterMetaType<HashErrorStruct>();
2110 qDBusRegisterMetaType<NetworkErrorStruct>();
2111 qDBusRegisterMetaType<ProcessErrorStruct>();
2112
2113@@ -132,8 +133,27 @@
2114 return caller;
2115 }
2116
2117+QString
2118+DownloadManager::getDownloadOwner(const QVariantMap& metadata) {
2119+ QScopedPointer<System::AppArmor> appArmor(new System::AppArmor(_conn));
2120+ auto owner = getCaller();
2121+ auto appId = appArmor->appId(owner);
2122+ if(appArmor->isConfined(appId)) {
2123+ return appId;
2124+ } else {
2125+ if (metadata.contains(Metadata::APP_ID)){
2126+ return metadata[Metadata::APP_ID].toString();
2127+ } else {
2128+ return "";
2129+ }
2130+ }
2131+ return "";
2132+}
2133+
2134 QDBusObjectPath
2135 DownloadManager::registerDownload(Download* download) {
2136+ download->setDownloadOwner(getDownloadOwner(download->metadata()));
2137+
2138 download->setThrottle(_throttle);
2139 download->allowGSMDownload(_allowMobileData);
2140 if (!_db->store(download)) {
2141
2142=== modified file 'src/downloads/priv/ubuntu/downloads/manager.h'
2143--- src/downloads/priv/ubuntu/downloads/manager.h 2014-07-30 09:19:10 +0000
2144+++ src/downloads/priv/ubuntu/downloads/manager.h 2015-09-22 15:25:44 +0000
2145@@ -16,8 +16,7 @@
2146 * Boston, MA 02110-1301, USA.
2147 */
2148
2149-#ifndef DOWNLOADER_LIB_DOWNLOADER_H
2150-#define DOWNLOADER_LIB_DOWNLOADER_H
2151+#pragma once
2152
2153 #include <QObject>
2154 #include <QByteArray>
2155@@ -95,7 +94,6 @@
2156 virtual QDBusObjectPath registerDownload(Download* download);
2157
2158 private:
2159-
2160 typedef std::function<Download*(QString)> DownloadCreationFunc;
2161
2162 void init();
2163@@ -109,6 +107,7 @@
2164 StringMap headers);
2165 void onDownloadsChanged(QString);
2166 QString getCaller();
2167+ QString getDownloadOwner(const QVariantMap& metadata);
2168
2169 private:
2170 Application* _app = nullptr;
2171@@ -126,4 +125,3 @@
2172 } // DownloadManager
2173
2174 } // Manager
2175-#endif // DOWNLOADER_LIB_DOWNLOADER_H
2176
2177=== modified file 'src/downloads/test-daemon/testing_daemon.cpp'
2178--- src/downloads/test-daemon/testing_daemon.cpp 2014-03-12 12:59:51 +0000
2179+++ src/downloads/test-daemon/testing_daemon.cpp 2015-09-22 15:25:44 +0000
2180@@ -1,5 +1,5 @@
2181 /*
2182- * Copyright 2013-2014 Canonical Ltd.
2183+ * Copyright 2013-2015 Canonical Ltd.
2184 *
2185 * This library is free software; you can redistribute it and/or
2186 * modify it under the terms of version 3 of the GNU Lesser General Public
2187@@ -65,6 +65,17 @@
2188 }
2189
2190 void
2191+TestingDaemon::returnHashError(const QString &download,
2192+ HashErrorStruct error) {
2193+ qDebug() << "############################################";
2194+ qDebug() << "returnHashError from error";
2195+ qDebug() << "############################################";
2196+
2197+ auto man = qobject_cast<TestingManager*>(manager());
2198+ man->returnHashError(download, error);
2199+}
2200+
2201+void
2202 TestingDaemon::returnHttpError(const QString &download,
2203 HttpErrorStruct error) {
2204 auto man = qobject_cast<TestingManager*>(manager());
2205
2206=== modified file 'src/downloads/test-daemon/testing_daemon.h'
2207--- src/downloads/test-daemon/testing_daemon.h 2014-03-12 12:59:51 +0000
2208+++ src/downloads/test-daemon/testing_daemon.h 2015-09-22 15:25:44 +0000
2209@@ -1,5 +1,5 @@
2210 /*
2211- * Copyright 2013-2014 Canonical Ltd.
2212+ * Copyright 2013-2015 Canonical Ltd.
2213 *
2214 * This library is free software; you can redistribute it and/or
2215 * modify it under the terms of version 3 of the GNU Lesser General Public
2216@@ -16,8 +16,7 @@
2217 * Boston, MA 02110-1301, USA.
2218 */
2219
2220-#ifndef TESTING_DAEMON_H
2221-#define TESTING_DAEMON_H
2222+#pragma once
2223
2224 #include <QObject>
2225 #include <ubuntu/download_manager/metatypes.h>
2226@@ -36,6 +35,7 @@
2227 // let the client test to tell the manager to return dbus errors
2228 void returnDBusErrors(bool errors);
2229 void returnAuthError(const QString &download, AuthErrorStruct error);
2230+ void returnHashError(const QString &download, HashErrorStruct error);
2231 void returnHttpError(const QString &download, HttpErrorStruct error);
2232 void returnNetworkError(const QString &download, NetworkErrorStruct error);
2233 void returnProcessError(const QString &download, ProcessErrorStruct error);
2234@@ -52,4 +52,3 @@
2235
2236 };
2237
2238-#endif // TESTING_DAEMON_H
2239
2240=== modified file 'src/downloads/test-daemon/testing_file_download.cpp'
2241--- src/downloads/test-daemon/testing_file_download.cpp 2014-09-08 10:10:43 +0000
2242+++ src/downloads/test-daemon/testing_file_download.cpp 2015-09-22 15:25:44 +0000
2243@@ -1,5 +1,5 @@
2244 /*
2245- * Copyright 2014 Canonical Ltd.
2246+ * Copyright 2014-2015 Canonical Ltd.
2247 *
2248 * This library is free software; you can redistribute it and/or
2249 * modify it under the terms of version 3 of the GNU Lesser General Public
2250@@ -94,9 +94,20 @@
2251 _returnHttpError = false;
2252 _returnNetworkError = false;
2253 _returnProcessError = false;
2254+ _returnHashError = false;
2255 _authErr = error;
2256 }
2257
2258+void
2259+TestingFileDownload::returnHashError(HashErrorStruct error) {
2260+ _returnAuthError = false;
2261+ _returnHttpError = false;
2262+ _returnNetworkError = false;
2263+ _returnProcessError = false;
2264+ _returnHashError = true;
2265+ _hashErr = error;
2266+}
2267+
2268 qulonglong
2269 TestingFileDownload::progress() {
2270 if (calledFromDBus() && _returnErrors) {
2271@@ -246,6 +257,11 @@
2272 emitError("Forced processerror");
2273 }
2274
2275+ if (_returnHashError) {
2276+ emit hashError(_hashErr);
2277+ emitError("Forced hash error");
2278+ }
2279+
2280 }
2281
2282 void
2283
2284=== modified file 'src/downloads/test-daemon/testing_file_download.h'
2285--- src/downloads/test-daemon/testing_file_download.h 2014-09-08 10:10:43 +0000
2286+++ src/downloads/test-daemon/testing_file_download.h 2015-09-22 15:25:44 +0000
2287@@ -1,5 +1,5 @@
2288 /*
2289- * Copyright 2014 Canonical Ltd.
2290+ * Copyright 2014-2015 Canonical Ltd.
2291 *
2292 * This library is free software; you can redistribute it and/or
2293 * modify it under the terms of version 3 of the GNU Lesser General Public
2294@@ -16,8 +16,7 @@
2295 * Boston, MA 02110-1301, USA.
2296 */
2297
2298-#ifndef TESTING_FILE_DOWNLOAD_H
2299-#define TESTING_FILE_DOWNLOAD_H
2300+#pragma once
2301
2302 #include <QDBusContext>
2303 #include <QObject>
2304@@ -38,6 +37,7 @@
2305 void returnNetworkError(NetworkErrorStruct error);
2306 void returnProcessError(ProcessErrorStruct error);
2307 void returnAuthError(AuthErrorStruct error);
2308+ void returnHashError(HashErrorStruct error);
2309
2310 public slots: // NOLINT(whitespace/indent)
2311 qulonglong progress() override;
2312@@ -73,11 +73,12 @@
2313 bool _returnHttpError = false;
2314 bool _returnNetworkError = false;
2315 bool _returnProcessError = false;
2316+ bool _returnHashError = false;
2317 AuthErrorStruct _authErr;
2318 HttpErrorStruct _httpErr;
2319 NetworkErrorStruct _networkErr;
2320 ProcessErrorStruct _processErr;
2321+ HashErrorStruct _hashErr;
2322 FileDownload* _down = nullptr;
2323 };
2324
2325-#endif // TESTING_FILE_DOWNLOAD_H
2326
2327=== modified file 'src/downloads/test-daemon/testing_interface.cpp'
2328--- src/downloads/test-daemon/testing_interface.cpp 2014-03-12 12:59:51 +0000
2329+++ src/downloads/test-daemon/testing_interface.cpp 2015-09-22 15:25:44 +0000
2330@@ -2,7 +2,7 @@
2331 * This file was generated by qdbusxml2cpp version 0.8
2332 * Command line was: qdbusxml2cpp com.canonical.applications.testing.download_manager.xml -p testing_interface -c TestingInterface
2333 *
2334- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2335+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2336 *
2337 * This is an auto-generated file.
2338 * This file may have been hand-edited. Look for HAND-EDIT comments
2339
2340=== modified file 'src/downloads/test-daemon/testing_interface.h'
2341--- src/downloads/test-daemon/testing_interface.h 2014-03-12 12:59:51 +0000
2342+++ src/downloads/test-daemon/testing_interface.h 2015-09-22 15:25:44 +0000
2343@@ -2,7 +2,7 @@
2344 * This file was generated by qdbusxml2cpp version 0.8
2345 * Command line was: qdbusxml2cpp com.canonical.applications.testing.download_manager.xml -p testing_interface -c TestingInterface
2346 *
2347- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2348+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2349 *
2350 * This is an auto-generated file.
2351 * Do not edit! All changes made to it will be lost.
2352@@ -51,6 +51,13 @@
2353 return asyncCallWithArgumentList(QLatin1String("returnDBusErrors"), argumentList);
2354 }
2355
2356+ inline QDBusPendingReply<> returnHashError(const QString &download, HashErrorStruct error)
2357+ {
2358+ QList<QVariant> argumentList;
2359+ argumentList << QVariant::fromValue(download) << QVariant::fromValue(error);
2360+ return asyncCallWithArgumentList(QLatin1String("returnHashError"), argumentList);
2361+ }
2362+
2363 inline QDBusPendingReply<> returnHttpError(const QString &download, HttpErrorStruct error)
2364 {
2365 QList<QVariant> argumentList;
2366
2367=== modified file 'src/downloads/test-daemon/testing_manager.cpp'
2368--- src/downloads/test-daemon/testing_manager.cpp 2014-03-25 17:28:41 +0000
2369+++ src/downloads/test-daemon/testing_manager.cpp 2015-09-22 15:25:44 +0000
2370@@ -1,5 +1,5 @@
2371 /*
2372- * Copyright 2013 Canonical Ltd.
2373+ * Copyright 2013-2015 Canonical Ltd.
2374 *
2375 * This library is free software; you can redistribute it and/or
2376 * modify it under the terms of version 3 of the GNU Lesser General Public
2377@@ -86,12 +86,22 @@
2378 }
2379 }
2380
2381+void
2382+TestingManager::returnHashError(const QString &download, HashErrorStruct error) {
2383+ auto q = queue();
2384+ foreach(auto transfer, q->transfers().values()) {
2385+ auto testDown = qobject_cast<TestingFileDownload*>(transfer);
2386+ if (testDown != nullptr && testDown->url() == download) {
2387+ testDown->returnHashError(error);
2388+ }
2389+ }
2390+}
2391+
2392 QDBusObjectPath
2393 TestingManager::registerDownload(Download* download) {
2394 QDBusObjectPath path;
2395 auto fileDown = qobject_cast<FileDownload*>(download);
2396 if (fileDown != nullptr) {
2397- qDebug() << "Register testing file";
2398 auto testDown = new TestingFileDownload(fileDown);
2399 auto downAdaptor = new DownloadAdaptor(testDown);
2400 Q_UNUSED(downAdaptor);
2401@@ -101,7 +111,6 @@
2402 path = DownloadManager::registerDownload(download);
2403 }
2404 // create an adaptor so that we can be exposed to Dbus
2405- qDebug() << "Path" << path.path();
2406 return path;
2407 }
2408
2409
2410=== modified file 'src/downloads/test-daemon/testing_manager.h'
2411--- src/downloads/test-daemon/testing_manager.h 2014-03-25 17:28:41 +0000
2412+++ src/downloads/test-daemon/testing_manager.h 2015-09-22 15:25:44 +0000
2413@@ -1,5 +1,5 @@
2414 /*
2415- * Copyright 2013 Canonical Ltd.
2416+ * Copyright 2013-2015 Canonical Ltd.
2417 *
2418 * This library is free software; you can redistribute it and/or
2419 * modify it under the terms of version 3 of the GNU Lesser General Public
2420@@ -16,8 +16,7 @@
2421 * Boston, MA 02110-1301, USA.
2422 */
2423
2424-#ifndef TESTING_MANAGER_H
2425-#define TESTING_MANAGER_H
2426+#pragma once
2427
2428 #include <QObject>
2429 #include <ubuntu/download_manager/metatypes.h>
2430@@ -60,6 +59,7 @@
2431 void returnNetworkError(const QString &download, NetworkErrorStruct error);
2432 void returnProcessError(const QString &download, ProcessErrorStruct error);
2433 void returnAuthError(const QString &download, AuthErrorStruct error);
2434+ void returnHashError(const QString &download, HashErrorStruct error);
2435
2436 protected:
2437 QDBusObjectPath registerDownload(Download* download) override;
2438@@ -67,4 +67,3 @@
2439 bool _returnErrors = false;
2440 };
2441
2442-#endif // TESTING_MANAGER_H
2443
2444=== modified file 'src/downloads/test-daemon/testing_manager_adaptor.cpp'
2445--- src/downloads/test-daemon/testing_manager_adaptor.cpp 2014-03-12 12:59:51 +0000
2446+++ src/downloads/test-daemon/testing_manager_adaptor.cpp 2015-09-22 15:25:44 +0000
2447@@ -2,7 +2,7 @@
2448 * This file was generated by qdbusxml2cpp version 0.8
2449 * Command line was: qdbusxml2cpp -c TestingManagerAdaptor -a testing_manager_adaptor.h:testing_manager_adaptor.cpp com.canonical.applications.testing.download_manager.xml
2450 *
2451- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2452+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2453 *
2454 * This is an auto-generated file.
2455 * Do not edit! All changes made to it will be lost.
2456@@ -17,6 +17,8 @@
2457 #include <QtCore/QStringList>
2458 #include <QtCore/QVariant>
2459
2460+#include <QDebug>
2461+
2462 /*
2463 * Implementation of adaptor class TestingManagerAdaptor
2464 */
2465@@ -45,6 +47,12 @@
2466 QMetaObject::invokeMethod(parent(), "returnDBusErrors", Q_ARG(bool, returnErrors));
2467 }
2468
2469+void TestingManagerAdaptor::returnHashError(const QString &download, HashErrorStruct error)
2470+{
2471+ // handle method call com.canonical.applications.testing.DownloadManager.returnHashError
2472+ QMetaObject::invokeMethod(parent(), "returnHashError", Q_ARG(QString, download), Q_ARG(HashErrorStruct, error));
2473+}
2474+
2475 void TestingManagerAdaptor::returnHttpError(const QString &download, HttpErrorStruct error)
2476 {
2477 // handle method call com.canonical.applications.testing.DownloadManager.returnHttpError
2478
2479=== modified file 'src/downloads/test-daemon/testing_manager_adaptor.h'
2480--- src/downloads/test-daemon/testing_manager_adaptor.h 2014-03-12 12:59:51 +0000
2481+++ src/downloads/test-daemon/testing_manager_adaptor.h 2015-09-22 15:25:44 +0000
2482@@ -2,7 +2,7 @@
2483 * This file was generated by qdbusxml2cpp version 0.8
2484 * Command line was: qdbusxml2cpp -c TestingManagerAdaptor -a testing_manager_adaptor.h:testing_manager_adaptor.cpp com.canonical.applications.testing.download_manager.xml
2485 *
2486- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2487+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2488 *
2489 * This is an auto-generated file.
2490 * This file may have been hand-edited. Look for HAND-EDIT comments
2491@@ -57,6 +57,11 @@
2492 " <arg direction=\"in\" type=\"s\" name=\"download\"/>\n"
2493 " <arg direction=\"in\" type=\"(is)\" name=\"error\"/>\n"
2494 " </method>\n"
2495+" <method name=\"returnHashError\">\n"
2496+" <annotation value=\"HashErrorStruct\" name=\"org.qtproject.QtDBus.QtTypeName.In1\"/>\n"
2497+" <arg direction=\"in\" type=\"s\" name=\"download\"/>\n"
2498+" <arg direction=\"in\" type=\"(sss)\" name=\"error\"/>\n"
2499+" </method>\n"
2500 " </interface>\n"
2501 "")
2502 public:
2503@@ -67,6 +72,7 @@
2504 public Q_SLOTS: // METHODS
2505 void returnAuthError(const QString &download, AuthErrorStruct error);
2506 void returnDBusErrors(bool returnErrors);
2507+ void returnHashError(const QString &download, HashErrorStruct error);
2508 void returnHttpError(const QString &download, HttpErrorStruct error);
2509 void returnNetworkError(const QString &download, NetworkErrorStruct error);
2510 void returnProcessError(const QString &download, ProcessErrorStruct error);
2511
2512=== removed file 'src/downloads/test-daemon/ubuntu-download-manager-test-daemon.pro.THIS'
2513--- src/downloads/test-daemon/ubuntu-download-manager-test-daemon.pro.THIS 2014-03-07 15:39:14 +0000
2514+++ src/downloads/test-daemon/ubuntu-download-manager-test-daemon.pro.THIS 1970-01-01 00:00:00 +0000
2515@@ -1,44 +0,0 @@
2516-include( ../common-project-config.pri )
2517-include( ../common-vars.pri )
2518-
2519-QT += core systeminfo
2520-
2521-QT -= gui
2522-
2523-TARGET = ubuntu-download-manager-test-daemon
2524-CONFIG += console
2525-CONFIG -= app_bundle
2526-
2527-TEMPLATE = app
2528-
2529-SOURCES += main.cpp
2530-
2531-LIBS += -L$$OUT_PWD/../udm-common/ -ludm-common
2532-
2533-INCLUDEPATH += $$PWD/../udm-common
2534-DEPENDPATH += $$PWD/../udm-common
2535-
2536-LIBS += -L$$OUT_PWD/../udm-priv-common/ -ludm-priv-common
2537-
2538-INCLUDEPATH += $$PWD/../udm-priv-common
2539-DEPENDPATH += $$PWD/../udm-priv-common
2540-
2541-LIBS += -L$$OUT_PWD/../ubuntu-download-manager-common/ -lubuntu-download-manager-common
2542-
2543-INCLUDEPATH += $$PWD/../ubuntu-download-manager-common
2544-DEPENDPATH += $$PWD/../ubuntu-download-manager-common
2545-
2546-LIBS += -L$$OUT_PWD/../ubuntu-download-manager-priv/ -lubuntu-download-manager-priv
2547-
2548-INCLUDEPATH += $$PWD/../ubuntu-download-manager-priv
2549-DEPENDPATH += $$PWD/../ubuntu-download-manager-priv
2550-
2551-LIBS += -L$$OUT_PWD/../udm-testing/ -ludm-testing
2552-
2553-INCLUDEPATH += $$PWD/../udm-testing
2554-DEPENDPATH += $$PWD/../udm-testing
2555-
2556-LIBS += -L$$OUT_PWD/../ubuntu-download-manager-test-lib/ -lubuntu-download-manager-test-lib
2557-
2558-INCLUDEPATH += $$PWD/../ubuntu-download-manager-test-lib
2559-DEPENDPATH += $$PWD/../ubuntu-download-manager-test-lib
2560
2561=== modified file 'tests/common/daemon_testcase.cpp'
2562--- tests/common/daemon_testcase.cpp 2014-11-17 20:57:20 +0000
2563+++ tests/common/daemon_testcase.cpp 2015-09-22 15:25:44 +0000
2564@@ -1,5 +1,5 @@
2565 /*
2566- * Copyright 2013-2014 Canonical Ltd.
2567+ * Copyright 2013-2015 Canonical Ltd.
2568 *
2569 * This library is free software; you can redistribute it and/or
2570 * modify it under the terms of version 3 of the GNU Lesser General Public
2571@@ -21,8 +21,10 @@
2572 #include <QDBusMessage>
2573 #include <QFile>
2574 #include <QFileInfo>
2575+#include <QProcessEnvironment>
2576 #include <QScopedPointer>
2577-#include <QProcessEnvironment>
2578+#include <QThread>
2579+
2580 #include "testing_interface.h"
2581 #include "daemon_testcase.h"
2582 #define TEST_DAEMON "ubuntu-download-manager-test-daemon"
2583@@ -105,7 +107,7 @@
2584 QSKIP(msg.toUtf8(), SkipSingle);
2585 }
2586 } else {
2587- QFAIL("returnHttpError must be used after init has been executed.");
2588+ QFAIL("returnAuthError must be used after init has been executed.");
2589 }
2590 }
2591
2592@@ -175,6 +177,27 @@
2593 }
2594
2595 void
2596+DaemonTestCase::returnHashError(const QString &download, HashErrorStruct error) {
2597+ if (_daemonProcess != nullptr) {
2598+ auto conn = QDBusConnection::sessionBus();
2599+ QScopedPointer<TestingInterface> testingInterface(new TestingInterface(
2600+ _daemonPath, "/", conn));
2601+ QDBusPendingReply<> reply =
2602+ testingInterface->returnHashError(download, error);
2603+ reply.waitForFinished();
2604+
2605+ if (reply.isError()) {
2606+ auto error = reply.error();
2607+ QString msg = "Could not tell the daemon to return Hash errors: "
2608+ + error.name() + ":" + error.message();
2609+ QSKIP(msg.toUtf8(), SkipSingle);
2610+ }
2611+ } else {
2612+ QFAIL("returnHashError must be used after init has been executed.");
2613+ }
2614+}
2615+
2616+void
2617 DaemonTestCase::startUDMDaemon() {
2618 _daemonProcess = new QProcess();
2619
2620
2621=== modified file 'tests/common/daemon_testcase.h'
2622--- tests/common/daemon_testcase.h 2014-07-03 09:01:01 +0000
2623+++ tests/common/daemon_testcase.h 2015-09-22 15:25:44 +0000
2624@@ -1,5 +1,5 @@
2625 /*
2626- * Copyright 2013 Canonical Ltd.
2627+ * Copyright 2013-2015 Canonical Ltd.
2628 *
2629 * This library is free software; you can redistribute it and/or
2630 * modify it under the terms of version 3 of the GNU Lesser General Public
2631@@ -16,8 +16,7 @@
2632 * Boston, MA 02110-1301, USA.
2633 */
2634
2635-#ifndef DAEMON_TESTCASE_H
2636-#define DAEMON_TESTCASE_H
2637+#pragma once
2638
2639 #include <QDebug>
2640 #include <QObject>
2641@@ -46,6 +45,7 @@
2642 void returnHttpError(const QString &download, HttpErrorStruct error);
2643 void returnNetworkError(const QString &download, NetworkErrorStruct error);
2644 void returnProcessError(const QString &download, ProcessErrorStruct error);
2645+ void returnHashError(const QString &download, HashErrorStruct error);
2646
2647 private:
2648 void startUDMDaemon();
2649@@ -73,4 +73,3 @@
2650
2651 };
2652
2653-#endif // DAEMON_TESTCASE_H
2654
2655=== modified file 'tests/common/testing_interface.cpp'
2656--- tests/common/testing_interface.cpp 2014-07-03 09:01:01 +0000
2657+++ tests/common/testing_interface.cpp 2015-09-22 15:25:44 +0000
2658@@ -2,7 +2,7 @@
2659 * This file was generated by qdbusxml2cpp version 0.8
2660 * Command line was: qdbusxml2cpp com.canonical.applications.testing.download_manager.xml -p testing_interface -c TestingInterface
2661 *
2662- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2663+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2664 *
2665 * This is an auto-generated file.
2666 * This file may have been hand-edited. Look for HAND-EDIT comments
2667
2668=== modified file 'tests/common/testing_interface.h'
2669--- tests/common/testing_interface.h 2014-07-03 09:01:01 +0000
2670+++ tests/common/testing_interface.h 2015-09-22 15:25:44 +0000
2671@@ -2,7 +2,7 @@
2672 * This file was generated by qdbusxml2cpp version 0.8
2673 * Command line was: qdbusxml2cpp com.canonical.applications.testing.download_manager.xml -p testing_interface -c TestingInterface
2674 *
2675- * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
2676+ * qdbusxml2cpp is Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
2677 *
2678 * This is an auto-generated file.
2679 * Do not edit! All changes made to it will be lost.
2680@@ -51,6 +51,13 @@
2681 return asyncCallWithArgumentList(QLatin1String("returnDBusErrors"), argumentList);
2682 }
2683
2684+ inline QDBusPendingReply<> returnHashError(const QString &download, HashErrorStruct error)
2685+ {
2686+ QList<QVariant> argumentList;
2687+ argumentList << QVariant::fromValue(download) << QVariant::fromValue(error);
2688+ return asyncCallWithArgumentList(QLatin1String("returnHashError"), argumentList);
2689+ }
2690+
2691 inline QDBusPendingReply<> returnHttpError(const QString &download, HttpErrorStruct error)
2692 {
2693 QList<QVariant> argumentList;
2694
2695=== modified file 'tests/downloads/client/CMakeLists.txt'
2696--- tests/downloads/client/CMakeLists.txt 2014-11-17 23:07:13 +0000
2697+++ tests/downloads/client/CMakeLists.txt 2015-09-22 15:25:44 +0000
2698@@ -1,4 +1,4 @@
2699-# Copyright © 2014 Canonical Ltd.
2700+# Copyright © 2014-2015 Canonical Ltd.
2701 #
2702 # This program is free software: you can redistribute it and/or modify
2703 # it under the terms of the GNU General Public License version 3 as
2704@@ -17,9 +17,10 @@
2705
2706 set(CLIENT_TESTS
2707 test_client_download
2708- # test_download_manager_watch
2709- # test_download_watch
2710- # test_client_manager
2711+ test_download_manager_watch
2712+ test_download_watch
2713+ test_client_manager
2714+ test_group_manager_watch
2715 )
2716
2717 foreach(test ${CLIENT_TESTS})
2718@@ -59,14 +60,14 @@
2719 set(CLIENT_TESTS_LIBS
2720 ${NIH_DBUS_LIBRARIES}
2721 ${GLOG_LIBRARIES}
2722- ${Qt5Network_LIBRARIES}
2723+ ${Qt5Network_LIBRARIES}
2724 ${Qt5Test_LIBRARIES}
2725 udm-common
2726 udm-priv-common
2727 ubuntu-download-manager-common
2728 ubuntu-download-manager-client
2729 ubuntu-download-manager-priv
2730- ubuntu-download-manager-test-lib
2731+ ubuntu-download-manager-test-lib
2732 )
2733
2734 if(DBUS_RUNNER)
2735
2736=== modified file 'tests/downloads/client/test_client_download.cpp'
2737--- tests/downloads/client/test_client_download.cpp 2014-09-28 01:15:28 +0000
2738+++ tests/downloads/client/test_client_download.cpp 2015-09-22 15:25:44 +0000
2739@@ -1,5 +1,5 @@
2740 /*
2741- * Copyright 2014 Canonical Ltd.
2742+ * Copyright 2014-2015 Canonical Ltd.
2743 *
2744 * This library is free software; you can redistribute it and/or
2745 * modify it under the terms of version 3 of the GNU Lesser General Public
2746@@ -440,4 +440,40 @@
2747 QCOMPARE(Error::DBus, _down->error()->type());
2748 }
2749
2750+void
2751+TestDownload::testHashErrorRaised_data() {
2752+ QTest::addColumn<QString>("method");
2753+ QTest::addColumn<QString>("expected");
2754+ QTest::addColumn<QString>("found");
2755+
2756+ QTest::newRow("MD5") << "MD5" << "2323nlkmwe" << "sdscopw";
2757+ QTest::newRow("SHA524") << "Sha524" << "eww23sds" << "dscbnnt32";
2758+ QTest::newRow("Ransom") << "Sha245" << "ew23fv4t" << "2edbg92";
2759+}
2760+
2761+void
2762+TestDownload::testHashErrorRaised() {
2763+ QFETCH(QString, method);
2764+ QFETCH(QString, expected);
2765+ QFETCH(QString, found);
2766+
2767+ HashErrorStruct err(method, expected, found);
2768+ returnHashError(_url, err);
2769+
2770+ SignalBarrier spy(_down, SIGNAL(error(Error*)));
2771+ _down->start();
2772+
2773+ QVERIFY(spy.ensureSignalEmitted());
2774+ QTRY_COMPARE(1, spy.count());
2775+ auto error = spy.takeFirst().at(0).value<Error*>();
2776+ QVERIFY(_down->isError());
2777+ QVERIFY(_down->error() != nullptr);
2778+ QCOMPARE(Error::Hash, error->type());
2779+
2780+ auto hashError = qobject_cast<HashError*>(error);
2781+ QCOMPARE(method, hashError->method());
2782+ QCOMPARE(expected, hashError->expected());
2783+ QCOMPARE(found, hashError->checksum());
2784+}
2785+
2786 QTEST_MAIN(TestDownload)
2787
2788=== modified file 'tests/downloads/client/test_client_download.h'
2789--- tests/downloads/client/test_client_download.h 2014-09-08 10:10:43 +0000
2790+++ tests/downloads/client/test_client_download.h 2015-09-22 15:25:44 +0000
2791@@ -1,5 +1,5 @@
2792 /*
2793- * Copyright 2014 Canonical Ltd.
2794+ * Copyright 2014-2015 Canonical Ltd.
2795 *
2796 * This library is free software; you can redistribute it and/or
2797 * modify it under the terms of version 3 of the GNU Lesser General Public
2798@@ -16,8 +16,7 @@
2799 * Boston, MA 02110-1301, USA.
2800 */
2801
2802-#ifndef TEST_DOWNLOAD_H
2803-#define TEST_DOWNLOAD_H
2804+#pragma once
2805
2806 #include <QObject>
2807 #include <ubuntu/download_manager/manager.h>
2808@@ -61,6 +60,8 @@
2809 void testNetworkErroRaised();
2810 void testProcessErrorRaised_data();
2811 void testProcessErrorRaised();
2812+ void testHashErrorRaised_data();
2813+ void testHashErrorRaised();
2814
2815 // set local dir tests
2816 void testSetLocalDirectory();
2817@@ -77,4 +78,3 @@
2818 Download* _down = nullptr;
2819 };
2820
2821-#endif // TEST_DOWNLOAD_H
2822
2823=== modified file 'tests/downloads/client/test_client_manager.cpp'
2824--- tests/downloads/client/test_client_manager.cpp 2014-09-22 12:09:16 +0000
2825+++ tests/downloads/client/test_client_manager.cpp 2015-09-22 15:25:44 +0000
2826@@ -165,7 +165,7 @@
2827
2828 // ensure that all of the are created
2829 QVERIFY(managerSpy.ensureSignalEmitted());
2830- QTRY_COMPARE(count, managerSpy.count());
2831+ QTRY_COMPARE_WITH_TIMEOUT(count, managerSpy.count(), 20000);
2832 _man->getAllDownloads();
2833
2834 QVERIFY(listSpy.ensureSignalEmitted());
2835
2836=== modified file 'tests/downloads/client/test_group_manager_watch.h'
2837--- tests/downloads/client/test_group_manager_watch.h 2014-07-03 09:01:01 +0000
2838+++ tests/downloads/client/test_group_manager_watch.h 2015-09-22 15:25:44 +0000
2839@@ -1,5 +1,5 @@
2840 /*
2841- * Copyright 2013 Canonical Ltd.
2842+ * Copyright 2013-2015 Canonical Ltd.
2843 *
2844 * This library is free software; you can redistribute it and/or
2845 * modify it under the terms of version 3 of the GNU Lesser General Public
2846@@ -16,15 +16,14 @@
2847 * Boston, MA 02110-1301, USA.
2848 */
2849
2850-#ifndef TEST_GROUP_WATCH_H
2851-#define TEST_GROUP_WATCH_H
2852+#pragma once
2853
2854 #include <functional>
2855 #include <ubuntu/download_manager/group_download.h>
2856 #include <ubuntu/download_manager/error.h>
2857 #include <ubuntu/download_manager/manager.h>
2858+
2859 #include <QObject>
2860-#include <ubuntu/transfers/tests/test_runner.h>
2861 #include "local_tree_testcase.h"
2862
2863 using namespace Ubuntu::DownloadManager;
2864@@ -55,4 +54,3 @@
2865 Manager* _manager = nullptr;
2866 };
2867
2868-#endif // TEST_GROUP_WATCH_H
2869
2870=== modified file 'tests/downloads/daemon/CMakeLists.txt'
2871--- tests/downloads/daemon/CMakeLists.txt 2015-01-22 16:25:08 +0000
2872+++ tests/downloads/daemon/CMakeLists.txt 2015-09-22 15:25:44 +0000
2873@@ -1,4 +1,4 @@
2874-# Copyright © 2014 Canonical Ltd.
2875+# Copyright © 2014-2015 Canonical Ltd.
2876 #
2877 # This program is free software: you can redistribute it and/or modify
2878 # it under the terms of the GNU General Public License version 3 as
2879@@ -53,6 +53,7 @@
2880 download.h
2881 factory.h
2882 filename_mutex.h
2883+ group_download.h
2884 manager.h
2885 pending_reply.h
2886 queue.h
2887
2888=== modified file 'tests/downloads/daemon/test_download.cpp'
2889--- tests/downloads/daemon/test_download.cpp 2015-02-02 11:05:15 +0000
2890+++ tests/downloads/daemon/test_download.cpp 2015-09-22 15:25:44 +0000
2891@@ -1,5 +1,5 @@
2892 /*
2893- * Copyright 2013-2014 Canonical Ltd.
2894+ * Copyright 2013-2015 Canonical Ltd.
2895 *
2896 * This library is free software; you can redistribute it and/or
2897 * modify it under the terms of version 3 of the GNU Lesser General Public
2898@@ -1374,6 +1374,7 @@
2899 _isConfined, _rootPath, _url, "imposible-hash-is-not-hex",
2900 _algo, _metadata, _headers);
2901
2902+ SignalBarrier hashSpy(download, SIGNAL(hashError(HashErrorStruct)));
2903 SignalBarrier errorSpy(download, SIGNAL(error(QString)));
2904 SignalBarrier startedSpy(download, SIGNAL(started(bool)));
2905 SignalBarrier processingSpy(download, SIGNAL(processing(QString)));
2906@@ -1386,6 +1387,7 @@
2907
2908 // the has is a random string so we should get an error signal
2909
2910+ QVERIFY(hashSpy.ensureSignalEmitted());
2911 QVERIFY(errorSpy.ensureSignalEmitted());
2912 QTRY_COMPARE(errorSpy.count(), 1);
2913 QTRY_COMPARE(processingSpy.count(), 1);
2914
2915=== modified file 'tests/downloads/daemon/test_download_manager.cpp'
2916--- tests/downloads/daemon/test_download_manager.cpp 2014-12-01 09:20:00 +0000
2917+++ tests/downloads/daemon/test_download_manager.cpp 2015-09-22 15:25:44 +0000
2918@@ -145,6 +145,27 @@
2919 SignalBarrier spy(_man, SIGNAL(downloadCreated(QDBusObjectPath)));
2920 DownloadStruct downStruct(url, metadata, headers);
2921
2922+ auto dbusProxy = new MockDBusProxy();
2923+ auto reply = new MockPendingReply<QString>();
2924+ EXPECT_CALL(*_dbusProxyFactory, createDBusProxy(_conn, _))
2925+ .Times(1)
2926+ .WillOnce(Return(dbusProxy));
2927+
2928+ EXPECT_CALL(*dbusProxy, GetConnectionAppArmorSecurityContext(_))
2929+ .Times(1)
2930+ .WillOnce(Return(reply));
2931+
2932+ EXPECT_CALL(*reply, waitForFinished())
2933+ .Times(1);
2934+
2935+ EXPECT_CALL(*reply, isError())
2936+ .Times(1)
2937+ .WillOnce(Return(false));
2938+
2939+ EXPECT_CALL(*reply, value())
2940+ .Times(1)
2941+ .WillOnce(Return("TEST_APP_ID"));
2942+
2943 // set the expectations of the factory since is the one that
2944 // creates the downloads. The matchers will ensure that the
2945 // correct value is used.
2946@@ -157,10 +178,18 @@
2947 EXPECT_CALL(*down.data(), setThrottle(_man->defaultThrottle()))
2948 .Times(1);
2949
2950+ EXPECT_CALL(*down.data(), allowGSMDownload(_))
2951+ .Times(1);
2952+
2953+
2954 EXPECT_CALL(*down.data(), path())
2955 .Times(1)
2956 .WillRepeatedly(Return(dbusPath));
2957
2958+ EXPECT_CALL(*down.data(), metadata())
2959+ .Times(1)
2960+ .WillRepeatedly(Return(QVariantMap()));
2961+
2962 // expected actions performed by the db
2963 EXPECT_CALL(*_database, store(down.data()))
2964 .Times(1)
2965@@ -248,6 +277,27 @@
2966 .Times(1)
2967 .WillRepeatedly(Return(down.data()));
2968
2969+ auto dbusProxy = new MockDBusProxy();
2970+ auto reply = new MockPendingReply<QString>();
2971+ EXPECT_CALL(*_dbusProxyFactory, createDBusProxy(_conn, _))
2972+ .Times(1)
2973+ .WillOnce(Return(dbusProxy));
2974+
2975+ EXPECT_CALL(*dbusProxy, GetConnectionAppArmorSecurityContext(_))
2976+ .Times(1)
2977+ .WillOnce(Return(reply));
2978+
2979+ EXPECT_CALL(*reply, waitForFinished())
2980+ .Times(1);
2981+
2982+ EXPECT_CALL(*reply, isError())
2983+ .Times(1)
2984+ .WillOnce(Return(false));
2985+
2986+ EXPECT_CALL(*reply, value())
2987+ .Times(1)
2988+ .WillOnce(Return("TEST_APP_ID"));
2989+
2990 // expected actions to be performed on the download
2991 EXPECT_CALL(*down.data(), setThrottle(_man->defaultThrottle()))
2992 .Times(1);
2993@@ -259,6 +309,10 @@
2994 .Times(1)
2995 .WillRepeatedly(Return(dbusPath));
2996
2997+ EXPECT_CALL(*down.data(), metadata())
2998+ .Times(1)
2999+ .WillRepeatedly(Return(QVariantMap()));
3000+
3001 // expected actions performed by the db
3002 EXPECT_CALL(*_database, store(down.data()))
3003 .Times(1)
3004
3005=== modified file 'tests/downloads/daemon/test_final_state.cpp'
3006--- tests/downloads/daemon/test_final_state.cpp 2014-07-03 09:01:01 +0000
3007+++ tests/downloads/daemon/test_final_state.cpp 2015-09-22 15:25:44 +0000
3008@@ -43,10 +43,6 @@
3009 BaseTestCase::cleanup();
3010 _stateMachine.removeState(_s1);
3011 _stateMachine.removeState(_s2);
3012- delete _obj;
3013- delete _transition;
3014- delete _s1;
3015- delete _s2;
3016 }
3017
3018 void
3019
3020=== modified file 'tests/downloads/daemon/test_metadata.cpp'
3021--- tests/downloads/daemon/test_metadata.cpp 2014-09-22 23:24:34 +0000
3022+++ tests/downloads/daemon/test_metadata.cpp 2015-09-22 15:25:44 +0000
3023@@ -16,6 +16,10 @@
3024 * Boston, MA 02110-1301, USA.
3025 */
3026
3027+#include <stdlib.h>
3028+
3029+#include <QProcessEnvironment>
3030+
3031 #include "test_metadata.h"
3032
3033 using namespace Ubuntu::Transfers;
3034@@ -348,5 +352,91 @@
3035 QVERIFY(!metadata.hasDeflate());
3036 }
3037
3038+void
3039+TestMetadata::testDestinationApp_data() {
3040+ QTest::addColumn<QString>("owner");
3041+
3042+ QTest::newRow("First app") << "First app";
3043+ QTest::newRow("Browser") << "Browser";
3044+ QTest::newRow("Test") << "Test";
3045+}
3046+
3047+void
3048+TestMetadata::testDestinationApp() {
3049+ QFETCH(QString, owner);
3050+
3051+ Metadata metadata;
3052+ metadata[Metadata::APP_ID] = owner;
3053+ QCOMPARE(owner, metadata.destinationApp());
3054+}
3055+
3056+void
3057+TestMetadata::testSetDownloadDestinationApp_data() {
3058+ QTest::addColumn<QString>("owner");
3059+
3060+ QTest::newRow("First app") << "First app";
3061+ QTest::newRow("Browser") << "Browser";
3062+ QTest::newRow("Test") << "Test";
3063+}
3064+
3065+void
3066+TestMetadata::testSetDownloadDestinationApp() {
3067+ QFETCH(QString, owner);
3068+
3069+ Metadata metadata;
3070+ metadata.setDestinationApp(owner);
3071+ QCOMPARE(metadata[Metadata::APP_ID].toString(), owner);
3072+}
3073+
3074+void
3075+TestMetadata::testHasDownloadDestinationAppTrue() {
3076+ Metadata metadata;
3077+ metadata.setDestinationApp("pedro");
3078+
3079+ QVERIFY(metadata.hasDestinationApp());
3080+}
3081+
3082+void
3083+TestMetadata::testHasDownloadDestinationAppFalse() {
3084+ Metadata metadata;
3085+ metadata.clear();
3086+
3087+ QVERIFY(!metadata.hasDestinationApp());
3088+}
3089+
3090+void
3091+TestMetadata::testDestinationAppIsPickedFromEnv_data() {
3092+ QTest::addColumn<QString>("appid");
3093+
3094+ QTest::newRow("First app") << "Chanco";
3095+ QTest::newRow("Browser") << "Browser";
3096+ QTest::newRow("Test") << "Test";
3097+}
3098+
3099+
3100+void
3101+TestMetadata::testDestinationAppIsPickedFromEnv() {
3102+ QFETCH(QString, appid);
3103+
3104+ // set the used envar
3105+ setenv("APP_ID", appid.toStdString().c_str(), 1);
3106+
3107+ Metadata metadata;
3108+ QVERIFY(metadata.hasDestinationApp());
3109+ QCOMPARE(metadata.destinationApp(), appid);
3110+}
3111+
3112+void
3113+TestMetadata::testDestinationAppIsAlreadyPresent() {
3114+ QString appid("Test");
3115+ QVariantMap map;
3116+
3117+ // set the used envar
3118+ setenv("APP_ID", appid.toStdString().c_str(), 1);
3119+ Metadata metadata(map);
3120+ QVERIFY(metadata.hasDestinationApp());
3121+ QCOMPARE(metadata.destinationApp(), appid);
3122+}
3123+
3124 QTEST_MAIN(TestMetadata)
3125 #include "moc_test_metadata.cpp"
3126
3127=== modified file 'tests/downloads/daemon/test_metadata.h'
3128--- tests/downloads/daemon/test_metadata.h 2014-09-22 23:24:34 +0000
3129+++ tests/downloads/daemon/test_metadata.h 2015-09-22 15:25:44 +0000
3130@@ -16,8 +16,7 @@
3131 * Boston, MA 02110-1301, USA.
3132 */
3133
3134-#ifndef TEST_METADATA_H
3135-#define TEST_METADATA_H
3136+#pragma once
3137
3138 #include <QObject>
3139 #include <ubuntu/transfers/metadata.h>
3140@@ -71,6 +70,14 @@
3141 void testSetDeflate();
3142 void testHasDeflateTrue();
3143 void testHasDeflateFalse();
3144+ void testDestinationApp_data();
3145+ void testDestinationApp();
3146+ void testSetDownloadDestinationApp_data();
3147+ void testSetDownloadDestinationApp();
3148+ void testHasDownloadDestinationAppTrue();
3149+ void testHasDownloadDestinationAppFalse();
3150+ void testDestinationAppIsPickedFromEnv_data();
3151+ void testDestinationAppIsPickedFromEnv();
3152+ void testDestinationAppIsAlreadyPresent();
3153 };
3154
3155-#endif // TEST_METADATA_H
3156
3157=== modified file 'tests/downloads/qml/CMakeLists.txt'
3158--- tests/downloads/qml/CMakeLists.txt 2014-11-17 23:07:13 +0000
3159+++ tests/downloads/qml/CMakeLists.txt 2015-09-22 15:25:44 +0000
3160@@ -20,18 +20,18 @@
3161 )
3162
3163 foreach(test ${QML_TESTS})
3164- # set the sources per test
3165- set(${test}_QML_SOURCES
3166- ${test}.cpp
3167- )
3168+ # set the sources per test
3169+ set(${test}_QML_SOURCES
3170+ ${test}.cpp
3171+ )
3172
3173- set(${test}_QML_HEADERS
3174- download.h
3175- error.h
3176- manager.h
3177- testable_single_download.h
3178- ${test}.h
3179- )
3180+ set(${test}_QML_HEADERS
3181+ wnload.h
3182+ error.h
3183+ manager.h
3184+ testable_single_download.h
3185+ ${test}.h
3186+ )
3187
3188 endforeach(test)
3189
3190@@ -57,30 +57,36 @@
3191 set(QML_TESTS_LIBS
3192 ${NIH_DBUS_LIBRARIES}
3193 ${GLOG_LIBRARIES}
3194- ${Qt5Core_LIBRARIES}
3195- ${Qt5Sql_LIBRARIES}
3196- ${Qt5DBus_LIBRARIES}
3197+ ${Qt5Core_LIBRARIES}
3198+ ${Qt5Sql_LIBRARIES}
3199+ ${Qt5DBus_LIBRARIES}
3200 ${Qt5Test_LIBRARIES}
3201- ${GMOCK_LIBRARY}
3202- ${GTEST_BOTH_LIBRARIES}
3203+ ${GMOCK_LIBRARY}
3204+ ${GTEST_BOTH_LIBRARIES}
3205 udm-common
3206 ubuntu-download-manager-common
3207- ubuntu-download-manager-test-lib
3208- UbuntuDownloadManager
3209+ ubuntu-download-manager-test-lib
3210+ UbuntuDownloadManager
3211 )
3212
3213-foreach(test ${QML_TESTS})
3214+find_program(XVFB xvfb)
3215+
3216+if(XVFB)
3217+ foreach(test ${QML_TESTS})
3218 # set targets, linked libs and test
3219 add_executable(${test}_qml
3220- ${${test}_QML_SOURCES}
3221- ${${test}_QML_HEADERS}
3222+ ${${test}_QML_SOURCES}
3223+ ${${test}_QML_HEADERS}
3224 )
3225
3226 target_link_libraries(${test}_qml
3227- ${QML_TESTS_LIBS}
3228+ ${QML_TESTS_LIBS}
3229 )
3230
3231
3232- ADD_TEST(NAME qml_${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test}_qml)
3233-endforeach(test)
3234+ ADD_TEST(NAME qml_${test} COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${test}_qml)
3235+ endforeach(test)
3236+else(XVFB)
3237+ message(WARNING "dbus-test-runner binary not found tests will be disabled")
3238+endif(XVFB)
3239

Subscribers

People subscribed via source and target branches