Merge lp:~alecu/unity-scope-click/launcher-integration into lp:unity-scope-click/devel
- launcher-integration
- Merge into devel
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 308 |
Merged at revision: | 297 |
Proposed branch: | lp:~alecu/unity-scope-click/launcher-integration |
Merge into: | lp:unity-scope-click/devel |
Diff against target: |
744 lines (+494/-50) 19 files modified
CMakeLists.txt (+1/-0) bin/CMakeLists.txt (+1/-0) bin/install-helper (+77/-0) debian/control (+1/-0) debian/unity-scope-click.install (+2/-1) libclickscope/click/CMakeLists.txt (+2/-0) libclickscope/click/dbus_constants.h (+37/-0) libclickscope/click/download-manager.cpp (+9/-18) libclickscope/click/download-manager.h (+1/-2) libclickscope/click/launcher.cpp (+26/-0) libclickscope/click/launcher.h (+56/-0) libclickscope/click/launcher.xml (+16/-0) libclickscope/click/preview.cpp (+15/-2) libclickscope/click/preview.h (+1/-1) libclickscope/tests/test_download_manager.cpp (+0/-26) scope/tests/CMakeLists.txt (+1/-0) scope/tests/fake_launcher/CMakeLists.txt (+14/-0) scope/tests/fake_launcher/fake_launcher.cpp (+118/-0) scope/tests/fake_launcher/fake_launcher.h (+116/-0) |
To merge this branch: | bzr merge lp:~alecu/unity-scope-click/launcher-integration |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+223461@code.launchpad.net |
Commit message
Send the dbus signals to the launcher, when a download is started and when it's completed.
Description of the change
To test this branch irl: start scope/tests/
PS Jenkins bot (ps-jenkins) wrote : | # |
- 296. By Alejandro J. Cura
-
Call installationStarted from the scope; use package_name instead of download_id
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:296
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 297. By Alejandro J. Cura
-
a skeleton for install_helper
- 298. By Alejandro J. Cura
-
merged with /devel
- 299. By Alejandro J. Cura
-
merged from /devel
- 300. By Alejandro J. Cura
-
remove skeleton of the install-helper
- 301. By Alejandro J. Cura
-
The install helper
- 302. By Alejandro J. Cura
-
Typo in helper
- 303. By Alejandro J. Cura
-
Use the install-helper instead of the hacky commandline
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:302
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:303
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 304. By Alejandro J. Cura
-
Use CMake to install and find the install-helper
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:304
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 305. By Alejandro J. Cura
-
Install the helper in the proper directory
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:305
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 306. By Alejandro J. Cura
-
Pass the right commandline, and return the proper errors
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:306
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 307. By Alejandro J. Cura
-
Fix the dbus command line to refresh the launcher
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:307
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
dobey (dobey) wrote : | # |
A few small issues. I'll let the lack of unit tests mocking the new dbus calls slide for now, as the fake_launcher is added as well. I also don't like having the generated code, and dbus XML (especially when the scope is the client, not the service) here, but I don't guess there is much we can do about that for the time being. We'll likely need to migrate away from using QDbus here though, and use dbus-cpp in the future. There's no particular need for us to use QDbus here AFAICT, as we're just the client, and not a service trying to provide magic introspected paths.
- 308. By Alejandro J. Cura
-
Fixes requested on review
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:308
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
dobey (dobey) : | # |
Preview Diff
1 | === modified file 'CMakeLists.txt' | |||
2 | --- CMakeLists.txt 2014-06-16 12:40:06 +0000 | |||
3 | +++ CMakeLists.txt 2014-06-20 20:01:57 +0000 | |||
4 | @@ -49,6 +49,7 @@ | |||
5 | 49 | 49 | ||
6 | 50 | # Add our own subdirectories. | 50 | # Add our own subdirectories. |
7 | 51 | add_subdirectory(autopilot) | 51 | add_subdirectory(autopilot) |
8 | 52 | add_subdirectory(bin) | ||
9 | 52 | add_subdirectory(libclickscope) | 53 | add_subdirectory(libclickscope) |
10 | 53 | add_subdirectory(scope) | 54 | add_subdirectory(scope) |
11 | 54 | add_subdirectory(data) | 55 | add_subdirectory(data) |
12 | 55 | 56 | ||
13 | === added directory 'bin' | |||
14 | === added file 'bin/CMakeLists.txt' | |||
15 | --- bin/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
16 | +++ bin/CMakeLists.txt 2014-06-20 20:01:57 +0000 | |||
17 | @@ -0,0 +1,1 @@ | |||
18 | 1 | install(PROGRAMS install-helper DESTINATION lib/unity-scope-click/) | ||
19 | 0 | 2 | ||
20 | === added file 'bin/install-helper' | |||
21 | --- bin/install-helper 1970-01-01 00:00:00 +0000 | |||
22 | +++ bin/install-helper 2014-06-20 20:01:57 +0000 | |||
23 | @@ -0,0 +1,77 @@ | |||
24 | 1 | #!/bin/bash | ||
25 | 2 | # | ||
26 | 3 | # Copyright (C) 2014 Canonical Ltd. | ||
27 | 4 | # | ||
28 | 5 | # This program is free software: you can redistribute it and/or modify it | ||
29 | 6 | # under the terms of the GNU General Public License version 3, as published | ||
30 | 7 | # by the Free Software Foundation. | ||
31 | 8 | # | ||
32 | 9 | # This program is distributed in the hope that it will be useful, but | ||
33 | 10 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
34 | 11 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
35 | 12 | # PURPOSE. See the GNU General Public License for more details. | ||
36 | 13 | # | ||
37 | 14 | # You should have received a copy of the GNU General Public License along | ||
38 | 15 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
39 | 16 | # | ||
40 | 17 | # In addition, as a special exception, the copyright holders give | ||
41 | 18 | # permission to link the code of portions of this program with the | ||
42 | 19 | # OpenSSL library under certain conditions as described in each | ||
43 | 20 | # individual source file, and distribute linked combinations | ||
44 | 21 | # including the two. | ||
45 | 22 | # You must obey the GNU General Public License in all respects | ||
46 | 23 | # for all of the code used other than OpenSSL. If you modify | ||
47 | 24 | # file(s) with this exception, you may extend this exception to your | ||
48 | 25 | # version of the file(s), but you are not obligated to do so. If you | ||
49 | 26 | # do not wish to do so, delete this exception statement from your | ||
50 | 27 | # version. If you delete this exception statement from all source | ||
51 | 28 | # files in the program, then also delete it here. | ||
52 | 29 | # | ||
53 | 30 | |||
54 | 31 | FILE_NAME="$1" | ||
55 | 32 | PACKAGE_NAME="$2" | ||
56 | 33 | |||
57 | 34 | SCOPES_OBJECTPATH=/com/canonical/unity/scopes | ||
58 | 35 | SCOPES_INTERFACE=com.canonical.unity.scopes | ||
59 | 36 | SCOPES_METHOD=InvalidateResults | ||
60 | 37 | |||
61 | 38 | LAUNCHER_BUS=com.ubuntu.unity.launcher | ||
62 | 39 | LAUNCHER_OBJECTPATH=/com/ubuntu/unity/launcher/installations | ||
63 | 40 | LAUNCHER_INTERFACE=com.ubuntu.unity.launcher.Installations | ||
64 | 41 | LAUNCHER_METHOD=completeInstallation | ||
65 | 42 | |||
66 | 43 | function invalidate-scope { | ||
67 | 44 | SCOPE_ID=$1 | ||
68 | 45 | dbus-send $SCOPES_OBJECTPATH $SCOPES_INTERFACE.$SCOPES_METHOD string:$SCOPE_ID | ||
69 | 46 | } | ||
70 | 47 | |||
71 | 48 | function install-package { | ||
72 | 49 | FILE_NAME="$1" | ||
73 | 50 | pkcon -p install-local "$FILE_NAME" | ||
74 | 51 | } | ||
75 | 52 | |||
76 | 53 | function app_id-from-package_name { | ||
77 | 54 | PACKAGE_NAME=$1 | ||
78 | 55 | IFS=_ | ||
79 | 56 | TRIPLET=($(ubuntu-app-triplet $PACKAGE_NAME)) | ||
80 | 57 | unset IFS | ||
81 | 58 | echo ${TRIPLET[0]}_${TRIPLET[1]}_current-user-version | ||
82 | 59 | } | ||
83 | 60 | |||
84 | 61 | function complete-installation { | ||
85 | 62 | PACKAGE_NAME=$1 | ||
86 | 63 | APP_ID=$2 | ||
87 | 64 | dbus-send --dest=$LAUNCHER_BUS --type=method_call $LAUNCHER_OBJECTPATH $LAUNCHER_INTERFACE.$LAUNCHER_METHOD string:$PACKAGE_NAME string:$APP_ID | ||
88 | 65 | } | ||
89 | 66 | |||
90 | 67 | if install-package "$FILE_NAME" ; then | ||
91 | 68 | invalidate-scope clickscope | ||
92 | 69 | invalidate-scope com.canonical.scopes.clickstore | ||
93 | 70 | APP_ID=$(app_id-from-package_name $PACKAGE_NAME) | ||
94 | 71 | complete-installation $PACKAGE_NAME $APP_ID | ||
95 | 72 | else | ||
96 | 73 | PKCON_STATUS=$? | ||
97 | 74 | NO_APP_ID="" | ||
98 | 75 | complete-installation $PACKAGE_NAME $NO_APP_ID | ||
99 | 76 | exit $PKCON_STATUS | ||
100 | 77 | fi | ||
101 | 0 | 78 | ||
102 | === modified file 'debian/control' | |||
103 | --- debian/control 2014-06-18 12:32:49 +0000 | |||
104 | +++ debian/control 2014-06-20 20:01:57 +0000 | |||
105 | @@ -26,6 +26,7 @@ | |||
106 | 26 | Architecture: armhf i386 amd64 | 26 | Architecture: armhf i386 amd64 |
107 | 27 | Depends: account-plugin-ubuntuone, | 27 | Depends: account-plugin-ubuntuone, |
108 | 28 | packagekit-tools, | 28 | packagekit-tools, |
109 | 29 | ubuntu-app-launch-tools, | ||
110 | 29 | ubuntu-download-manager, | 30 | ubuntu-download-manager, |
111 | 30 | ubuntu-sdk-libs, | 31 | ubuntu-sdk-libs, |
112 | 31 | ${misc:Depends}, | 32 | ${misc:Depends}, |
113 | 32 | 33 | ||
114 | === modified file 'debian/unity-scope-click.install' | |||
115 | --- debian/unity-scope-click.install 2014-05-06 21:28:13 +0000 | |||
116 | +++ debian/unity-scope-click.install 2014-06-20 20:01:57 +0000 | |||
117 | @@ -1,3 +1,4 @@ | |||
118 | 1 | usr/lib/*/unity-scopes/* | 1 | usr/lib/*/unity-scopes/* |
119 | 2 | usr/lib/unity-scope-click/* | ||
120 | 2 | usr/share/unity/scopes/* | 3 | usr/share/unity/scopes/* |
121 | 3 | usr/share/locale/*/LC_MESSAGES/unity-scope-click.mo | ||
122 | 4 | \ No newline at end of file | 4 | \ No newline at end of file |
123 | 5 | usr/share/locale/*/LC_MESSAGES/unity-scope-click.mo | ||
124 | 5 | 6 | ||
125 | === modified file 'libclickscope/click/CMakeLists.txt' | |||
126 | --- libclickscope/click/CMakeLists.txt 2014-06-13 15:21:16 +0000 | |||
127 | +++ libclickscope/click/CMakeLists.txt 2014-06-20 20:01:57 +0000 | |||
128 | @@ -6,6 +6,7 @@ | |||
129 | 6 | add_definitions( | 6 | add_definitions( |
130 | 7 | -DGETTEXT_PACKAGE=\"${PROJECT_NAME}\" | 7 | -DGETTEXT_PACKAGE=\"${PROJECT_NAME}\" |
131 | 8 | -DGETTEXT_LOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}\" | 8 | -DGETTEXT_LOCALEDIR=\"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LOCALEDIR}\" |
132 | 9 | -DCLICK_INSTALL_HELPER=\"${CMAKE_INSTALL_PREFIX}/lib/unity-scope-click/install-helper\" | ||
133 | 9 | ) | 10 | ) |
134 | 10 | 11 | ||
135 | 11 | add_library(${SCOPE_LIB_NAME} STATIC | 12 | add_library(${SCOPE_LIB_NAME} STATIC |
136 | @@ -14,6 +15,7 @@ | |||
137 | 14 | index.cpp | 15 | index.cpp |
138 | 15 | interface.cpp | 16 | interface.cpp |
139 | 16 | key_file_locator.cpp | 17 | key_file_locator.cpp |
140 | 18 | launcher.cpp | ||
141 | 17 | network_access_manager.cpp | 19 | network_access_manager.cpp |
142 | 18 | package.cpp | 20 | package.cpp |
143 | 19 | preview.cpp | 21 | preview.cpp |
144 | 20 | 22 | ||
145 | === added file 'libclickscope/click/dbus_constants.h' | |||
146 | --- libclickscope/click/dbus_constants.h 1970-01-01 00:00:00 +0000 | |||
147 | +++ libclickscope/click/dbus_constants.h 2014-06-20 20:01:57 +0000 | |||
148 | @@ -0,0 +1,37 @@ | |||
149 | 1 | /* | ||
150 | 2 | * Copyright (C) 2014 Canonical Ltd. | ||
151 | 3 | * | ||
152 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
153 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
154 | 6 | * by the Free Software Foundation. | ||
155 | 7 | * | ||
156 | 8 | * This program is distributed in the hope that it will be useful, but | ||
157 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
158 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
159 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
160 | 12 | * | ||
161 | 13 | * You should have received a copy of the GNU General Public License along | ||
162 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
163 | 15 | * | ||
164 | 16 | * In addition, as a special exception, the copyright holders give | ||
165 | 17 | * permission to link the code of portions of this program with the | ||
166 | 18 | * OpenSSL library under certain conditions as described in each | ||
167 | 19 | * individual source file, and distribute linked combinations | ||
168 | 20 | * including the two. | ||
169 | 21 | * You must obey the GNU General Public License in all respects | ||
170 | 22 | * for all of the code used other than OpenSSL. If you modify | ||
171 | 23 | * file(s) with this exception, you may extend this exception to your | ||
172 | 24 | * version of the file(s), but you are not obligated to do so. If you | ||
173 | 25 | * do not wish to do so, delete this exception statement from your | ||
174 | 26 | * version. If you delete this exception statement from all source | ||
175 | 27 | * files in the program, then also delete it here. | ||
176 | 28 | */ | ||
177 | 29 | |||
178 | 30 | #ifndef DBUS_CONSTANTS_H | ||
179 | 31 | #define DBUS_CONSTANTS_H | ||
180 | 32 | |||
181 | 33 | #define LAUNCHER_BUSNAME "com.ubuntu.unity.launcher" | ||
182 | 34 | #define LAUNCHER_OBJECT_PATH "/com/ubuntu/unity/launcher/installations" | ||
183 | 35 | #define LAUNCHER_INTERFACE "com.ubuntu.unity.launcher.Installations" | ||
184 | 36 | |||
185 | 37 | #endif // DBUS_CONSTANTS_H | ||
186 | 0 | 38 | ||
187 | === modified file 'libclickscope/click/download-manager.cpp' | |||
188 | --- libclickscope/click/download-manager.cpp 2014-05-26 14:02:45 +0000 | |||
189 | +++ libclickscope/click/download-manager.cpp 2014-06-20 20:01:57 +0000 | |||
190 | @@ -52,19 +52,7 @@ | |||
191 | 52 | static const QString DOWNLOAD_APP_ID_KEY = "app_id"; | 52 | static const QString DOWNLOAD_APP_ID_KEY = "app_id"; |
192 | 53 | static const QString DOWNLOAD_COMMAND_KEY = "post-download-command"; | 53 | static const QString DOWNLOAD_COMMAND_KEY = "post-download-command"; |
193 | 54 | 54 | ||
207 | 55 | // Pass two commands using sh -c because UDM expects a single | 55 | static const QString DOWNLOAD_COMMAND = CLICK_INSTALL_HELPER; |
195 | 56 | // executable. | ||
196 | 57 | // Use a single string for both commands because the | ||
197 | 58 | // list is eventually given to QProcess, which adds quotes around each | ||
198 | 59 | // argument, while -c expects a single quoted string. | ||
199 | 60 | // Then, use the $0 positional variable in the pkcon command to let us | ||
200 | 61 | // pass "$file" as a separate list element, which UDM requires for | ||
201 | 62 | // substitution. | ||
202 | 63 | |||
203 | 64 | static const QString DOWNLOAD_COMMAND = QStringLiteral("pkcon -p install-local ") % click::QUOTED_ARG0 % QStringLiteral(" && ") % click::DBUSSEND_COMMAND; | ||
204 | 65 | static const QVariant DOWNLOAD_CMDLINE = QVariant(QStringList() | ||
205 | 66 | << "/bin/sh" << "-c" << | ||
206 | 67 | DOWNLOAD_COMMAND << "$file"); | ||
208 | 68 | 56 | ||
209 | 69 | static const QString DOWNLOAD_MANAGER_DO_NOT_HASH = ""; | 57 | static const QString DOWNLOAD_MANAGER_DO_NOT_HASH = ""; |
210 | 70 | static const QString DOWNLOAD_MANAGER_IGNORE_HASH_ALGORITHM = ""; | 58 | static const QString DOWNLOAD_MANAGER_IGNORE_HASH_ALGORITHM = ""; |
211 | @@ -90,7 +78,7 @@ | |||
212 | 90 | QSharedPointer<udm::Manager> systemDownloadManager; | 78 | QSharedPointer<udm::Manager> systemDownloadManager; |
213 | 91 | QSharedPointer<click::network::Reply> reply; | 79 | QSharedPointer<click::network::Reply> reply; |
214 | 92 | QString downloadUrl; | 80 | QString downloadUrl; |
216 | 93 | QString appId; | 81 | QString package_name; |
217 | 94 | }; | 82 | }; |
218 | 95 | 83 | ||
219 | 96 | const QByteArray& click::CLICK_TOKEN_HEADER() | 84 | const QByteArray& click::CLICK_TOKEN_HEADER() |
220 | @@ -133,9 +121,9 @@ | |||
221 | 133 | click::DownloadManager::~DownloadManager(){ | 121 | click::DownloadManager::~DownloadManager(){ |
222 | 134 | } | 122 | } |
223 | 135 | 123 | ||
225 | 136 | void click::DownloadManager::startDownload(const QString& downloadUrl, const QString& appId) | 124 | void click::DownloadManager::startDownload(const QString& downloadUrl, const QString& package_name) |
226 | 137 | { | 125 | { |
228 | 138 | impl->appId = appId; | 126 | impl->package_name = package_name; |
229 | 139 | 127 | ||
230 | 140 | // NOTE: using SIGNAL/SLOT macros here because new-style | 128 | // NOTE: using SIGNAL/SLOT macros here because new-style |
231 | 141 | // connections are flaky on ARM. | 129 | // connections are flaky on ARM. |
232 | @@ -151,8 +139,11 @@ | |||
233 | 151 | void click::DownloadManager::handleClickTokenFetched(const QString& clickToken) | 139 | void click::DownloadManager::handleClickTokenFetched(const QString& clickToken) |
234 | 152 | { | 140 | { |
235 | 153 | QVariantMap metadata; | 141 | QVariantMap metadata; |
238 | 154 | metadata[DOWNLOAD_COMMAND_KEY] = DOWNLOAD_CMDLINE; | 142 | |
239 | 155 | metadata[DOWNLOAD_APP_ID_KEY] = impl->appId; | 143 | QVariant commandline = QVariant(QStringList() << DOWNLOAD_COMMAND << "$file" << impl->package_name); |
240 | 144 | metadata[DOWNLOAD_COMMAND_KEY] = commandline; | ||
241 | 145 | metadata[DOWNLOAD_APP_ID_KEY] = impl->package_name; | ||
242 | 146 | metadata["package_name"] = impl->package_name; | ||
243 | 156 | 147 | ||
244 | 157 | QMap<QString, QString> headers; | 148 | QMap<QString, QString> headers; |
245 | 158 | headers[CLICK_TOKEN_HEADER()] = clickToken; | 149 | headers[CLICK_TOKEN_HEADER()] = clickToken; |
246 | 159 | 150 | ||
247 | === modified file 'libclickscope/click/download-manager.h' | |||
248 | --- libclickscope/click/download-manager.h 2014-05-26 14:02:45 +0000 | |||
249 | +++ libclickscope/click/download-manager.h 2014-06-20 20:01:57 +0000 | |||
250 | @@ -49,7 +49,6 @@ | |||
251 | 49 | 49 | ||
252 | 50 | namespace click | 50 | namespace click |
253 | 51 | { | 51 | { |
254 | 52 | static const QString QUOTED_ARG0 = QStringLiteral("\"$0\""); | ||
255 | 53 | // The dbus-send command to refresh the search results in the dash. | 52 | // The dbus-send command to refresh the search results in the dash. |
256 | 54 | static const QString DBUSSEND_COMMAND = QStringLiteral("dbus-send /com/canonical/unity/scopes com.canonical.unity.scopes.InvalidateResults string:clickscope"); | 53 | static const QString DBUSSEND_COMMAND = QStringLiteral("dbus-send /com/canonical/unity/scopes com.canonical.unity.scopes.InvalidateResults string:clickscope"); |
257 | 55 | 54 | ||
258 | @@ -67,7 +66,7 @@ | |||
259 | 67 | virtual ~DownloadManager(); | 66 | virtual ~DownloadManager(); |
260 | 68 | 67 | ||
261 | 69 | public slots: | 68 | public slots: |
263 | 70 | virtual void startDownload(const QString& downloadUrl, const QString& appId); | 69 | virtual void startDownload(const QString& downloadUrl, const QString& package_name); |
264 | 71 | virtual void fetchClickToken(const QString& downloadUrl); | 70 | virtual void fetchClickToken(const QString& downloadUrl); |
265 | 72 | 71 | ||
266 | 73 | signals: | 72 | signals: |
267 | 74 | 73 | ||
268 | === added file 'libclickscope/click/launcher.cpp' | |||
269 | --- libclickscope/click/launcher.cpp 1970-01-01 00:00:00 +0000 | |||
270 | +++ libclickscope/click/launcher.cpp 2014-06-20 20:01:57 +0000 | |||
271 | @@ -0,0 +1,26 @@ | |||
272 | 1 | /* | ||
273 | 2 | * This file was generated by qdbusxml2cpp version 0.8 | ||
274 | 3 | * Command line was: qdbusxml2cpp launcher.xml -p launcher -c Launcher -N | ||
275 | 4 | * | ||
276 | 5 | * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | ||
277 | 6 | * | ||
278 | 7 | * This is an auto-generated file. | ||
279 | 8 | * This file may have been hand-edited. Look for HAND-EDIT comments | ||
280 | 9 | * before re-generating it. | ||
281 | 10 | */ | ||
282 | 11 | |||
283 | 12 | #include "launcher.h" | ||
284 | 13 | |||
285 | 14 | /* | ||
286 | 15 | * Implementation of interface class Launcher | ||
287 | 16 | */ | ||
288 | 17 | |||
289 | 18 | Launcher::Launcher(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent) | ||
290 | 19 | : QDBusAbstractInterface(service, path, staticInterfaceName(), connection, parent) | ||
291 | 20 | { | ||
292 | 21 | } | ||
293 | 22 | |||
294 | 23 | Launcher::~Launcher() | ||
295 | 24 | { | ||
296 | 25 | } | ||
297 | 26 | |||
298 | 0 | 27 | ||
299 | === added file 'libclickscope/click/launcher.h' | |||
300 | --- libclickscope/click/launcher.h 1970-01-01 00:00:00 +0000 | |||
301 | +++ libclickscope/click/launcher.h 2014-06-20 20:01:57 +0000 | |||
302 | @@ -0,0 +1,56 @@ | |||
303 | 1 | /* | ||
304 | 2 | * This file was generated by qdbusxml2cpp version 0.8 | ||
305 | 3 | * Command line was: qdbusxml2cpp launcher.xml -p launcher -c Launcher -N | ||
306 | 4 | * | ||
307 | 5 | * qdbusxml2cpp is Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | ||
308 | 6 | * | ||
309 | 7 | * This is an auto-generated file. | ||
310 | 8 | * Do not edit! All changes made to it will be lost. | ||
311 | 9 | */ | ||
312 | 10 | |||
313 | 11 | #ifndef LAUNCHER_H_1403062747 | ||
314 | 12 | #define LAUNCHER_H_1403062747 | ||
315 | 13 | |||
316 | 14 | #include <QtCore/QObject> | ||
317 | 15 | #include <QtCore/QByteArray> | ||
318 | 16 | #include <QtCore/QList> | ||
319 | 17 | #include <QtCore/QMap> | ||
320 | 18 | #include <QtCore/QString> | ||
321 | 19 | #include <QtCore/QStringList> | ||
322 | 20 | #include <QtCore/QVariant> | ||
323 | 21 | #include <QtDBus/QtDBus> | ||
324 | 22 | |||
325 | 23 | /* | ||
326 | 24 | * Proxy class for interface com.ubuntu.unity.launcher.Installations | ||
327 | 25 | */ | ||
328 | 26 | class Launcher: public QDBusAbstractInterface | ||
329 | 27 | { | ||
330 | 28 | Q_OBJECT | ||
331 | 29 | public: | ||
332 | 30 | static inline const char *staticInterfaceName() | ||
333 | 31 | { return "com.ubuntu.unity.launcher.Installations"; } | ||
334 | 32 | |||
335 | 33 | public: | ||
336 | 34 | Launcher(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent = 0); | ||
337 | 35 | |||
338 | 36 | ~Launcher(); | ||
339 | 37 | |||
340 | 38 | public Q_SLOTS: // METHODS | ||
341 | 39 | inline Q_NOREPLY void completeInstallation(const QString &package_name, const QString &app_id) | ||
342 | 40 | { | ||
343 | 41 | QList<QVariant> argumentList; | ||
344 | 42 | argumentList << QVariant::fromValue(package_name) << QVariant::fromValue(app_id); | ||
345 | 43 | callWithArgumentList(QDBus::NoBlock, QLatin1String("completeInstallation"), argumentList); | ||
346 | 44 | } | ||
347 | 45 | |||
348 | 46 | inline Q_NOREPLY void startInstallation(const QString &title, const QString &icon_url, const QString &package_name) | ||
349 | 47 | { | ||
350 | 48 | QList<QVariant> argumentList; | ||
351 | 49 | argumentList << QVariant::fromValue(title) << QVariant::fromValue(icon_url) << QVariant::fromValue(package_name); | ||
352 | 50 | callWithArgumentList(QDBus::NoBlock, QLatin1String("startInstallation"), argumentList); | ||
353 | 51 | } | ||
354 | 52 | |||
355 | 53 | Q_SIGNALS: // SIGNALS | ||
356 | 54 | }; | ||
357 | 55 | |||
358 | 56 | #endif | ||
359 | 0 | 57 | ||
360 | === added file 'libclickscope/click/launcher.xml' | |||
361 | --- libclickscope/click/launcher.xml 1970-01-01 00:00:00 +0000 | |||
362 | +++ libclickscope/click/launcher.xml 2014-06-20 20:01:57 +0000 | |||
363 | @@ -0,0 +1,16 @@ | |||
364 | 1 | <!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> | ||
365 | 2 | <node> | ||
366 | 3 | <interface name="com.ubuntu.unity.launcher.Installations"> | ||
367 | 4 | <method name="startInstallation"> | ||
368 | 5 | <arg name="title" type="s" direction="in"/> | ||
369 | 6 | <arg name="icon_url" type="s" direction="in"/> | ||
370 | 7 | <arg name="package_name" type="s" direction="in"/> | ||
371 | 8 | <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/> | ||
372 | 9 | </method> | ||
373 | 10 | <method name="completeInstallation"> | ||
374 | 11 | <arg name="package_name" type="s" direction="in"/> | ||
375 | 12 | <arg name="app_id" type="s" direction="in"/> | ||
376 | 13 | <annotation name="org.freedesktop.DBus.Method.NoReply" value="true"/> | ||
377 | 14 | </method> | ||
378 | 15 | </interface> | ||
379 | 16 | </node> | ||
380 | 0 | 17 | ||
381 | === modified file 'libclickscope/click/preview.cpp' | |||
382 | --- libclickscope/click/preview.cpp 2014-06-19 16:55:02 +0000 | |||
383 | +++ libclickscope/click/preview.cpp 2014-06-20 20:01:57 +0000 | |||
384 | @@ -32,6 +32,8 @@ | |||
385 | 32 | #include "preview.h" | 32 | #include "preview.h" |
386 | 33 | #include <click/qtbridge.h> | 33 | #include <click/qtbridge.h> |
387 | 34 | #include <click/download-manager.h> | 34 | #include <click/download-manager.h> |
388 | 35 | #include <click/launcher.h> | ||
389 | 36 | #include <click/dbus_constants.h> | ||
390 | 35 | 37 | ||
391 | 36 | #include <boost/algorithm/string/replace.hpp> | 38 | #include <boost/algorithm/string/replace.hpp> |
392 | 37 | 39 | ||
393 | @@ -354,6 +356,15 @@ | |||
394 | 354 | { | 356 | { |
395 | 355 | } | 357 | } |
396 | 356 | 358 | ||
397 | 359 | void InstallingPreview::startLauncherAnimation(const PackageDetails &details) | ||
398 | 360 | { | ||
399 | 361 | Launcher l(LAUNCHER_BUSNAME, LAUNCHER_OBJECT_PATH, QDBusConnection::sessionBus()); | ||
400 | 362 | l.startInstallation(QString::fromStdString(details.package.title), | ||
401 | 363 | QString::fromStdString(details.package.icon_url), | ||
402 | 364 | QString::fromStdString(details.package.name)); | ||
403 | 365 | |||
404 | 366 | } | ||
405 | 367 | |||
406 | 357 | void InstallingPreview::run(const unity::scopes::PreviewReplyProxy &reply) | 368 | void InstallingPreview::run(const unity::scopes::PreviewReplyProxy &reply) |
407 | 358 | { | 369 | { |
408 | 359 | downloader->startDownload(download_url, result["name"].get_string(), | 370 | downloader->startDownload(download_url, result["name"].get_string(), |
409 | @@ -370,11 +381,13 @@ | |||
410 | 370 | reply->push(downloadErrorWidgets()); | 381 | reply->push(downloadErrorWidgets()); |
411 | 371 | return; | 382 | return; |
412 | 372 | default: | 383 | default: |
413 | 384 | std::string object_path = rc.first; | ||
414 | 373 | qDebug() << "Successfully created UDM Download."; | 385 | qDebug() << "Successfully created UDM Download."; |
416 | 374 | populateDetails([this, reply, rc](const PackageDetails &details){ | 386 | populateDetails([this, reply, object_path](const PackageDetails &details){ |
417 | 375 | reply->push(headerWidgets(details)); | 387 | reply->push(headerWidgets(details)); |
419 | 376 | reply->push(progressBarWidget(rc.first)); | 388 | reply->push(progressBarWidget(object_path)); |
420 | 377 | reply->push(descriptionWidgets(details)); | 389 | reply->push(descriptionWidgets(details)); |
421 | 390 | startLauncherAnimation(details); | ||
422 | 378 | }, | 391 | }, |
423 | 379 | [this, reply](const ReviewList& reviewlist, | 392 | [this, reply](const ReviewList& reviewlist, |
424 | 380 | click::Reviews::Error error) { | 393 | click::Reviews::Error error) { |
425 | 381 | 394 | ||
426 | === modified file 'libclickscope/click/preview.h' | |||
427 | --- libclickscope/click/preview.h 2014-06-12 21:05:25 +0000 | |||
428 | +++ libclickscope/click/preview.h 2014-06-20 20:01:57 +0000 | |||
429 | @@ -150,7 +150,7 @@ | |||
430 | 150 | virtual scopes::PreviewWidgetList progressBarWidget(const std::string& object_path); | 150 | virtual scopes::PreviewWidgetList progressBarWidget(const std::string& object_path); |
431 | 151 | std::string download_url; | 151 | std::string download_url; |
432 | 152 | QSharedPointer<click::Downloader> downloader; | 152 | QSharedPointer<click::Downloader> downloader; |
434 | 153 | 153 | void startLauncherAnimation(const PackageDetails& details); | |
435 | 154 | }; | 154 | }; |
436 | 155 | 155 | ||
437 | 156 | class InstalledPreview : public PreviewStrategy | 156 | class InstalledPreview : public PreviewStrategy |
438 | 157 | 157 | ||
439 | === modified file 'libclickscope/tests/test_download_manager.cpp' | |||
440 | --- libclickscope/tests/test_download_manager.cpp 2014-05-26 14:27:31 +0000 | |||
441 | +++ libclickscope/tests/test_download_manager.cpp 2014-06-20 20:01:57 +0000 | |||
442 | @@ -482,29 +482,3 @@ | |||
443 | 482 | StartDownloadTestParameters(true, false, false), | 482 | StartDownloadTestParameters(true, false, false), |
444 | 483 | StartDownloadTestParameters(false, true, false) | 483 | StartDownloadTestParameters(false, true, false) |
445 | 484 | )); | 484 | )); |
446 | 485 | |||
447 | 486 | class ArgZeroTest : public ::testing::TestWithParam<QString> {}; | ||
448 | 487 | |||
449 | 488 | TEST_P(ArgZeroTest, testArgZero) | ||
450 | 489 | { | ||
451 | 490 | auto expected_arg = GetParam(); | ||
452 | 491 | auto fake_command = "for n in " % click::QUOTED_ARG0 % "; do echo $n; done"; | ||
453 | 492 | QStringList arguments; | ||
454 | 493 | arguments << "-c" << fake_command << expected_arg; | ||
455 | 494 | |||
456 | 495 | QProcess sh; | ||
457 | 496 | sh.start("/bin/sh", arguments); | ||
458 | 497 | |||
459 | 498 | EXPECT_TRUE(sh.waitForStarted()); | ||
460 | 499 | sh.closeWriteChannel(); | ||
461 | 500 | |||
462 | 501 | EXPECT_TRUE(sh.waitForFinished()); | ||
463 | 502 | QByteArray result = sh.readAll().trimmed(); | ||
464 | 503 | EXPECT_EQ(sh.exitCode(), 0); | ||
465 | 504 | |||
466 | 505 | ASSERT_EQ(expected_arg, QString(result)); | ||
467 | 506 | } | ||
468 | 507 | |||
469 | 508 | INSTANTIATE_TEST_CASE_P(TestSampleFilenames, | ||
470 | 509 | ArgZeroTest, | ||
471 | 510 | ::testing::Values("sample_filename.click", "spaced_filename (1).click")); | ||
472 | 511 | 485 | ||
473 | === modified file 'scope/tests/CMakeLists.txt' | |||
474 | --- scope/tests/CMakeLists.txt 2014-05-26 15:56:40 +0000 | |||
475 | +++ scope/tests/CMakeLists.txt 2014-06-20 20:01:57 +0000 | |||
476 | @@ -59,3 +59,4 @@ | |||
477 | 59 | add_subdirectory(integration) | 59 | add_subdirectory(integration) |
478 | 60 | add_subdirectory(download_manager_tool) | 60 | add_subdirectory(download_manager_tool) |
479 | 61 | add_subdirectory(click_interface_tool) | 61 | add_subdirectory(click_interface_tool) |
480 | 62 | add_subdirectory(fake_launcher) | ||
481 | 62 | 63 | ||
482 | === added directory 'scope/tests/fake_launcher' | |||
483 | === added file 'scope/tests/fake_launcher/CMakeLists.txt' | |||
484 | --- scope/tests/fake_launcher/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
485 | +++ scope/tests/fake_launcher/CMakeLists.txt 2014-06-20 20:01:57 +0000 | |||
486 | @@ -0,0 +1,14 @@ | |||
487 | 1 | set(FAKE_LAUNCHER_TARGET fake_launcher) | ||
488 | 2 | |||
489 | 3 | include_directories ( | ||
490 | 4 | ${CMAKE_SOURCE_DIR}/scope/click | ||
491 | 5 | ) | ||
492 | 6 | |||
493 | 7 | add_executable (${FAKE_LAUNCHER_TARGET} | ||
494 | 8 | fake_launcher.cpp | ||
495 | 9 | fake_launcher.h | ||
496 | 10 | ) | ||
497 | 11 | |||
498 | 12 | target_link_libraries (${FAKE_LAUNCHER_TARGET} | ||
499 | 13 | ${STORE_LIB_UNVERSIONED} | ||
500 | 14 | ) | ||
501 | 0 | 15 | ||
502 | === added file 'scope/tests/fake_launcher/fake_launcher.cpp' | |||
503 | --- scope/tests/fake_launcher/fake_launcher.cpp 1970-01-01 00:00:00 +0000 | |||
504 | +++ scope/tests/fake_launcher/fake_launcher.cpp 2014-06-20 20:01:57 +0000 | |||
505 | @@ -0,0 +1,118 @@ | |||
506 | 1 | /* | ||
507 | 2 | * Copyright (C) 2014 Canonical Ltd. | ||
508 | 3 | * | ||
509 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
510 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
511 | 6 | * by the Free Software Foundation. | ||
512 | 7 | * | ||
513 | 8 | * This program is distributed in the hope that it will be useful, but | ||
514 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
515 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
516 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
517 | 12 | * | ||
518 | 13 | * You should have received a copy of the GNU General Public License along | ||
519 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
520 | 15 | * | ||
521 | 16 | * In addition, as a special exception, the copyright holders give | ||
522 | 17 | * permission to link the code of portions of this program with the | ||
523 | 18 | * OpenSSL library under certain conditions as described in each | ||
524 | 19 | * individual source file, and distribute linked combinations | ||
525 | 20 | * including the two. | ||
526 | 21 | * You must obey the GNU General Public License in all respects | ||
527 | 22 | * for all of the code used other than OpenSSL. If you modify | ||
528 | 23 | * file(s) with this exception, you may extend this exception to your | ||
529 | 24 | * version of the file(s), but you are not obligated to do so. If you | ||
530 | 25 | * do not wish to do so, delete this exception statement from your | ||
531 | 26 | * version. If you delete this exception statement from all source | ||
532 | 27 | * files in the program, then also delete it here. | ||
533 | 28 | */ | ||
534 | 29 | |||
535 | 30 | #include <ubuntu/download_manager/download.h> | ||
536 | 31 | #include <ubuntu/download_manager/downloads_list.h> | ||
537 | 32 | #include <ubuntu/download_manager/error.h> | ||
538 | 33 | |||
539 | 34 | #include <QCoreApplication> | ||
540 | 35 | #include <QDBusConnection> | ||
541 | 36 | #include <QDebug> | ||
542 | 37 | #include <QString> | ||
543 | 38 | #include <QTimer> | ||
544 | 39 | #include <QTextStream> | ||
545 | 40 | |||
546 | 41 | #include <iostream> | ||
547 | 42 | |||
548 | 43 | #include <boost/optional.hpp> | ||
549 | 44 | |||
550 | 45 | #include <fake_launcher.h> | ||
551 | 46 | |||
552 | 47 | void FakeLauncher::startInstallation(QString title, QString icon_url, QString package_name) | ||
553 | 48 | { | ||
554 | 49 | qDebug() << "startInstallation" << title << icon_url << package_name; | ||
555 | 50 | installations.insert(package_name, new FakeIcon(title, icon_url, this)); | ||
556 | 51 | manager->getAllDownloadsWithMetadata("package_name", package_name); | ||
557 | 52 | } | ||
558 | 53 | |||
559 | 54 | void FakeLauncher::handleDownloadsFound(const QString& key, const QString& value, DownloadsList *download_list) | ||
560 | 55 | { | ||
561 | 56 | Q_UNUSED(key) | ||
562 | 57 | Q_UNUSED(value) | ||
563 | 58 | foreach (const QSharedPointer<Download> download, download_list->downloads()) { | ||
564 | 59 | QString package_name{download->metadata()["package_name"].toString()}; | ||
565 | 60 | qDebug() << "download found for" << package_name; | ||
566 | 61 | installations[package_name]->downloadFound(*download); | ||
567 | 62 | } | ||
568 | 63 | } | ||
569 | 64 | |||
570 | 65 | void FakeLauncher::completeInstallation(QString package_name, QString app_id) | ||
571 | 66 | { | ||
572 | 67 | qDebug() << "completeInstallation" << package_name << app_id; | ||
573 | 68 | installations[package_name]->complete(app_id); | ||
574 | 69 | } | ||
575 | 70 | |||
576 | 71 | void FakeIcon::downloadFound(Download& download) | ||
577 | 72 | { | ||
578 | 73 | connect(&download, SIGNAL(progress(qulonglong,qulonglong)), this, SLOT(handleProgress(qulonglong,qulonglong))); | ||
579 | 74 | connect(&download, SIGNAL(error(Error*)), this, SLOT(handleDownloadError(Error*))); | ||
580 | 75 | qDebug() << title << "starting installation"; | ||
581 | 76 | // TODO: add icon to the launcher | ||
582 | 77 | } | ||
583 | 78 | |||
584 | 79 | void FakeIcon::handleProgress(qulonglong transferred, qulonglong total) | ||
585 | 80 | { | ||
586 | 81 | qDebug() << title << "download progress" << double(transferred)/total*80; | ||
587 | 82 | // TODO: update progress bar | ||
588 | 83 | } | ||
589 | 84 | |||
590 | 85 | void FakeIcon::handleDownloadError(Error *error) | ||
591 | 86 | { | ||
592 | 87 | failure(error->errorString()); | ||
593 | 88 | } | ||
594 | 89 | |||
595 | 90 | void FakeIcon::failure(QString message) | ||
596 | 91 | { | ||
597 | 92 | qDebug() << title << "installation failed" << message; | ||
598 | 93 | // TODO: remove icon from the launcher | ||
599 | 94 | } | ||
600 | 95 | |||
601 | 96 | void FakeIcon::complete(QString app_id) | ||
602 | 97 | { | ||
603 | 98 | if (app_id.isEmpty()) { | ||
604 | 99 | failure("Failed to install"); | ||
605 | 100 | } else { | ||
606 | 101 | qDebug() << title << "installation completed" << app_id; | ||
607 | 102 | // TODO: update icon with proper app_id | ||
608 | 103 | } | ||
609 | 104 | } | ||
610 | 105 | |||
611 | 106 | int main(int argc, char *argv[]) | ||
612 | 107 | { | ||
613 | 108 | |||
614 | 109 | QCoreApplication app(argc, argv); | ||
615 | 110 | FakeLauncher launcher; | ||
616 | 111 | new FakeLauncherAdaptor(&launcher); | ||
617 | 112 | qDebug() << "starting"; | ||
618 | 113 | auto bus = QDBusConnection::sessionBus(); | ||
619 | 114 | bus.registerObject(LAUNCHER_OBJECT_PATH, &launcher); | ||
620 | 115 | bus.registerService(LAUNCHER_BUSNAME); | ||
621 | 116 | return app.exec(); | ||
622 | 117 | } | ||
623 | 118 | |||
624 | 0 | 119 | ||
625 | === added file 'scope/tests/fake_launcher/fake_launcher.h' | |||
626 | --- scope/tests/fake_launcher/fake_launcher.h 1970-01-01 00:00:00 +0000 | |||
627 | +++ scope/tests/fake_launcher/fake_launcher.h 2014-06-20 20:01:57 +0000 | |||
628 | @@ -0,0 +1,116 @@ | |||
629 | 1 | /* | ||
630 | 2 | * Copyright (C) 2014 Canonical Ltd. | ||
631 | 3 | * | ||
632 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
633 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
634 | 6 | * by the Free Software Foundation. | ||
635 | 7 | * | ||
636 | 8 | * This program is distributed in the hope that it will be useful, but | ||
637 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
638 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
639 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
640 | 12 | * | ||
641 | 13 | * You should have received a copy of the GNU General Public License along | ||
642 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
643 | 15 | * | ||
644 | 16 | * In addition, as a special exception, the copyright holders give | ||
645 | 17 | * permission to link the code of portions of this program with the | ||
646 | 18 | * OpenSSL library under certain conditions as described in each | ||
647 | 19 | * individual source file, and distribute linked combinations | ||
648 | 20 | * including the two. | ||
649 | 21 | * You must obey the GNU General Public License in all respects | ||
650 | 22 | * for all of the code used other than OpenSSL. If you modify | ||
651 | 23 | * file(s) with this exception, you may extend this exception to your | ||
652 | 24 | * version of the file(s), but you are not obligated to do so. If you | ||
653 | 25 | * do not wish to do so, delete this exception statement from your | ||
654 | 26 | * version. If you delete this exception statement from all source | ||
655 | 27 | * files in the program, then also delete it here. | ||
656 | 28 | */ | ||
657 | 29 | |||
658 | 30 | #ifndef _FAKE_LAUNCHER_H_ | ||
659 | 31 | #define _FAKE_LAUNCHER_H_ | ||
660 | 32 | |||
661 | 33 | #include <QObject> | ||
662 | 34 | #include <QDBusObjectPath> | ||
663 | 35 | #include <QDBusAbstractAdaptor> | ||
664 | 36 | |||
665 | 37 | #include <click/dbus_constants.h> | ||
666 | 38 | #include <ubuntu/download_manager/manager.h> | ||
667 | 39 | |||
668 | 40 | class FakeIcon : public QObject { | ||
669 | 41 | Q_OBJECT | ||
670 | 42 | |||
671 | 43 | public: | ||
672 | 44 | explicit FakeIcon(QString title, QString icon_url, QObject *parent=0) | ||
673 | 45 | : QObject(parent), title(title), icon_url(icon_url) | ||
674 | 46 | { | ||
675 | 47 | } | ||
676 | 48 | void downloadFound(Download& download); | ||
677 | 49 | void complete(QString app_id); | ||
678 | 50 | |||
679 | 51 | private slots: | ||
680 | 52 | void handleProgress(qulonglong transferred, qulonglong total); | ||
681 | 53 | void handleDownloadError(Error* error); | ||
682 | 54 | |||
683 | 55 | private: | ||
684 | 56 | Download* download; | ||
685 | 57 | QString title; | ||
686 | 58 | QString icon_url; | ||
687 | 59 | void failure(QString message); | ||
688 | 60 | }; | ||
689 | 61 | |||
690 | 62 | class FakeLauncher : public QObject { | ||
691 | 63 | Q_OBJECT | ||
692 | 64 | |||
693 | 65 | public: | ||
694 | 66 | explicit FakeLauncher(QObject *parent=0) : QObject(parent) | ||
695 | 67 | { | ||
696 | 68 | manager = Ubuntu::DownloadManager::Manager::createSessionManager(); | ||
697 | 69 | connect(manager, SIGNAL(downloadsWithMetadataFound(QString,QString,DownloadsList*)), | ||
698 | 70 | this, SLOT(handleDownloadsFound(QString,QString,DownloadsList*))); | ||
699 | 71 | } | ||
700 | 72 | |||
701 | 73 | public slots: | ||
702 | 74 | void startInstallation(QString title, QString icon_url, QString package_name); | ||
703 | 75 | void completeInstallation(QString package_name, QString app_id); | ||
704 | 76 | |||
705 | 77 | private slots: | ||
706 | 78 | void handleDownloadsFound(const QString& key, const QString& value, DownloadsList* downloads); | ||
707 | 79 | |||
708 | 80 | signals: | ||
709 | 81 | |||
710 | 82 | private: | ||
711 | 83 | Ubuntu::DownloadManager::Manager* manager; | ||
712 | 84 | QMap<QString, FakeIcon*> installations; | ||
713 | 85 | }; | ||
714 | 86 | |||
715 | 87 | |||
716 | 88 | class FakeLauncherAdaptor : public QDBusAbstractAdaptor | ||
717 | 89 | { | ||
718 | 90 | Q_OBJECT | ||
719 | 91 | Q_CLASSINFO("D-Bus Interface", LAUNCHER_INTERFACE) | ||
720 | 92 | |||
721 | 93 | private: | ||
722 | 94 | FakeLauncher *_launcher; | ||
723 | 95 | |||
724 | 96 | public: | ||
725 | 97 | FakeLauncherAdaptor(FakeLauncher *launcher) : QDBusAbstractAdaptor(launcher), _launcher(launcher) | ||
726 | 98 | { | ||
727 | 99 | } | ||
728 | 100 | |||
729 | 101 | public slots: | ||
730 | 102 | Q_NOREPLY void startInstallation(QString title, QString icon_url, QString package_name) | ||
731 | 103 | { | ||
732 | 104 | _launcher->startInstallation(title, icon_url, package_name); | ||
733 | 105 | } | ||
734 | 106 | |||
735 | 107 | Q_NOREPLY void completeInstallation(QString package_name, QString app_id) | ||
736 | 108 | { | ||
737 | 109 | _launcher->completeInstallation(package_name, app_id); | ||
738 | 110 | } | ||
739 | 111 | }; | ||
740 | 112 | |||
741 | 113 | |||
742 | 114 | #endif /* _FAKE_LAUNCHER_H_ */ | ||
743 | 115 | |||
744 | 116 |
FAILED: Continuous integration, rev:295 /code.launchpad .net/~alecu/ unity-scope- click/launcher- integration/ +merge/ 223461/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- ci/119/ jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- amd64-ci/ 94 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 93/console jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- i386-ci/ 93
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- team-unity- scope-click- devel-ci/ 119/rebuild
http://