Merge lp:~diegosarmentero/ubuntu-system-settings/display-errors into lp:ubuntu-system-settings
- display-errors
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Ken VanDine |
Approved revision: | 1057 |
Merged at revision: | 1119 |
Proposed branch: | lp:~diegosarmentero/ubuntu-system-settings/display-errors |
Merge into: | lp:ubuntu-system-settings |
Diff against target: |
448 lines (+156/-88) 5 files modified
plugins/system-update/PageComponent.qml (+70/-3) plugins/system-update/network/network.cpp (+59/-69) plugins/system-update/network/network.h (+15/-4) plugins/system-update/update_manager.cpp (+9/-11) plugins/system-update/update_manager.h (+3/-1) |
To merge this branch: | bzr merge lp:~diegosarmentero/ubuntu-system-settings/display-errors |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ken VanDine | Approve | ||
Sebastien Bacher (community) | Needs Fixing | ||
Review via email: mp+235037@code.launchpad.net |
Commit message
- Improves in network backend.
- Detect network connection and show "Connect to the internet..." message or retry on netword detected.
Description of the change
This branch fix partially this issue:
https:/
(Next branch will fix the remaining problems)
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1048
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1049
http://
Executed test runs:
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1050. By Diego Sarmentero
-
retry on button press and connection state change
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1050
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
- 1051. By Diego Sarmentero
-
fix alignment
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1051
http://
Executed test runs:
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
Good work, some review comments though
* don't we have an api to check online status? it seems weird to have to query it from the indicator like that
*
> title: i18n.tr(
should be "failed" (lowercase) since we use sentence casing
The design on the wiki seems also use different strings, e.g "Sorry, the system update failed.", where did you find the one you are using?
* do we have a design for the strings used?
neither https:/
- 1052. By Diego Sarmentero
-
branch updated
Diego Sarmentero (diegosarmentero) wrote : | # |
> Good work, some review comments though
>
> * don't we have an api to check online status? it seems weird to have to query
> it from the indicator like that
>
>
> *
> > title: i18n.tr(
>
> should be "failed" (lowercase) since we use sentence casing
>
> The design on the wiki seems also use different strings, e.g "Sorry, the
> system update failed.", where did you find the one you are using?
>
>
> * do we have a design for the strings used?
> neither https:/
> https:/
> include "Update process failed." for example
Fixed
Sebastien Bacher (seb128) wrote : | # |
thanks, but "fixed" doesn't reply to some of the question, like the one about the api to check if the device is online...
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1052
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Diego Sarmentero (diegosarmentero) wrote : | # |
> thanks, but "fixed" doesn't reply to some of the question, like the one about
> the api to check if the device is online...
I'm using the same that is being used in the WiFi plugin of System Settings.
Sebastien Bacher (seb128) wrote : | # |
looks ok to me, would be nice to have another review from somebody knowing that code a bit better as well though ... Ken? ;-)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1052
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Sebastien Bacher (seb128) wrote : | # |
To check if the device is online you should be using the new bindings doing that
http://
(unity8 is starting using that as well)
- 1053. By Diego Sarmentero
-
using network status component
- 1054. By Diego Sarmentero
-
remove unused attribute signal
- 1055. By Diego Sarmentero
-
fix typo
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1054
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
I'm getting this error:
2014-10-07 13:00:37,246 - WARNING - file://
That's the NetworkingStatus component
Ken VanDine (ken-vandine) wrote : | # |
The error in the previous comment was from running the debs created by the account-detected branch which includes this branch. It looks like it does include the latest revision of this branch.
Sebastien Bacher (seb128) wrote : | # |
There is likely a missing depends on qml-module-
- 1056. By Diego Sarmentero
-
change usage of network status plugin
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1055
http://
Executed test runs:
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1056
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Ken VanDine (ken-vandine) wrote : | # |
When the updates page is loaded, there is a reference error if online status changes. See inline comment.
- 1057. By Diego Sarmentero
-
fix access to online attribute
Ken VanDine (ken-vandine) wrote : | # |
Looks good now, thanks!
- 1058. By Diego Sarmentero
-
[ jonas-drange ]
* [wifi/phone] dynamically chooses what SIM to use when there's only
one present. (LP: #1375832)
[ Iain Lane ]
* [storage/about] Use a QSharedPointer to manage freeing of the
counter which we use to display all of the collected sizes at once.
If the measuring process was cancelled, we were freeing it multiple
times - once for each outstanding size measurement. This led to a
crash. (LP: #1375988)
* [security-privacy] Link with gobject, uses symbols from this
library. Prevents "[…]libUbuntuSecurityPrivacyPa nel.so contains an
unresolvable reference to symbol
g_signal_handlers_ disconnect_ matched: it's probably a plugin"
warnings.
[ jonas-drange ]
* [cellular] react to application.state changes and update potential
out-of-date default SIM settings (LP: #1364103)
* [wifi] let removed networks update the previous network model so
that we can reuse the model (and not pop the pagestack twice,
causing this ux issue) (LP: #1370389)
[ Sebastien Bacher ]
* [location] use a flickable so the list can be scrolled (LP:
#1374017)
* [security] get localized application names from the trust-store (LP:
#1374018)
[ Ken VanDine ]
* Fixed handling of the Downloading/Installing label based on actual
state. . Forward updateProgress signals for system updates. Layout
fixes (LP: #1312587)
* Use new splash screen (LP: #1376242)
* Improved tracking download states
* Use new target_build_number from system-image-dbus to determine
visibility of the update notification (LP: #1355803)
[ CI bot ]
* Resync trunk
[ Sebastien Bacher ]
* [storage] use libclick rather than calling the command line (LP:
#1368967)
* [storage] tweaks to the disk informations, limit the free space to
the user available one (excluding the system partitions), don't list
the external mounts, that's described in the design and is going to
require work on the categories computation to give correct values
(LP: #1284247)
* [about] display the free space value next to the storage label (LP:
#1335144)
[ Albert Astals ]
* Add i18n.tr
[ jonas-drange ]
* [wifi] connect to hidden network is now a dialog (LP: #1366005)
[ Ken VanDine ]
* Provide more keywords to make search useful (LP: #1370219) (LP:
#1370219)
* [background] set sourceSize in the image preview to work around an
issue loading large images (LP: #1373462)
[ CI bot ]
* Resync trunk
[ Mathieu Trudel-Lapierre ]
* [bluetooth] Properly handle device types for connection and
disconnection. (LP: #1369964)
[ Michael Terry ]
* Add a translator comment for what HERE means. (LP: #1368838) (LP:
#1368838)
* Prevent a crash in unity8 when the wizard also crashes or stops
early. (LP: #1355892) (LP: #1355892)
[ Michael Terry ]
* Prevent the buttons of the wizard's password page from overlapping
its content when the OSK appears. (LP: #1368346) (LP: #1368346)
[ Ken VanDine ]
* Set the version information in the SystemUpdate constructor (LP:
#1371810) (LP: #1371810)
* [reset] Don't bail out on an isValid() check on the SystemImage
QDBusInterface, the docs say isValid() may not be reliable for
remote interfaces (LP: #1370815) (LP: #1370815)
* Fixed reference error for count on the various device models (LP:
#1362517) (LP: #1362517)
* [background] Use the ContentPeerPicker to select sources for
backgrounds (LP: #1356542) (LP: #1356542)
[ Iain Lane ]
* Don't check if the timedated interface is valid before calling
SetTime on it, it might have timed out and we should reactivate it
in that case.
* [about] Fix developerMode property to be QMLish - read & write
instead of separate "read" and "toggle" properties.
* [about] Don't display a frame for icons that can't be found,
improving the visual appearance. Also return the correct path for
click packages which use the icon theme.
[ Sebastien Bacher ]
* [storage] handle the scope click .ini and get the correct icons (LP:
#1368920)
[ Albert Astals ]
* make pot
[ Oliver Grawert ]
* fix LP: #1365903, add a watch to Developer Mode page so the page
gets refreshed when going back through the page stack, also fix the
page id and bounds (LP: #1365903)
* Some packaging fixes
- > is not a valid relationship. It should be >>
- Don't recommend suru-icon-theme since we also depend on it
- Bump S-V to 3.9.6 which for example allows the images we ship in
/usr/lib/
- Override binary-no-manpage lintian warnings. We're not going to get man
pages for u-s-s any time soon
[ Ken VanDine ]
* Make UpdateManager a singleton and refresh the availableUpdates
count when the model updates (LP: #1325629) (LP: #1325629)
[ Ken VanDine ]
* Include an icon instead of using the themed icon (LP: #1365408) (LP:
#1365408)
[ Mathieu Trudel-Lapierre ]
* [bluetooth] don't try to enable Discoverable if the device isn't
powered yet. (LP: #1355904)
[ Ken VanDine ]
* When activated by a url request for a specific panel, clear the
pageStack to maintain the natural navigation instead of pushing a
new page on top of a page from a the previous panel (LP: #1362025)
(LP: #1362025, #1359953)
[ Lars Uebernickel ]
* Use Icon instead of StatusIcon
[ CI bot ]
* Resync trunk
[ John R. Lenton ]
* Take the system settings push helper closer to implementing the spec
at https://wiki.ubuntu. com/SoftwareUpd ates#Prompting (LP: #1363972)
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1057
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'plugins/system-update/PageComponent.qml' |
2 | --- plugins/system-update/PageComponent.qml 2014-10-01 15:42:37 +0000 |
3 | +++ plugins/system-update/PageComponent.qml 2014-10-08 15:50:25 +0000 |
4 | @@ -28,6 +28,7 @@ |
5 | import Ubuntu.Components.Popups 0.1 |
6 | import Ubuntu.OnlineAccounts.Client 0.1 |
7 | import Ubuntu.SystemSettings.Update 1.0 |
8 | +import Ubuntu.Connectivity 1.0 |
9 | |
10 | |
11 | ItemPage { |
12 | @@ -45,6 +46,7 @@ |
13 | property bool batterySafeForUpdate: isCharging || chargeLevel > 25 |
14 | property var chargeLevel: indicatorPower.batteryLevel || 0 |
15 | property var notificationAction; |
16 | + property string errorDialogText: "" |
17 | |
18 | QDBusActionGroup { |
19 | id: indicatorPower |
20 | @@ -55,6 +57,21 @@ |
21 | Component.onCompleted: start() |
22 | } |
23 | |
24 | + Connections { |
25 | + id: networkingStatus |
26 | + target: NetworkingStatus |
27 | + onOnlineChanged: { |
28 | + if (NetworkingStatus.online) { |
29 | + activity.running = true; |
30 | + root.state = "SEARCHING"; |
31 | + UpdateManager.checkUpdates(); |
32 | + } else { |
33 | + activity.running = false; |
34 | + } |
35 | + } |
36 | + } |
37 | + |
38 | + |
39 | DeviceInfo { |
40 | id: deviceInfo |
41 | } |
42 | @@ -122,6 +139,23 @@ |
43 | } |
44 | } |
45 | |
46 | + Component { |
47 | + id: dialogErrorComponent |
48 | + Dialog { |
49 | + id: dialogueError |
50 | + title: i18n.tr("Installation failed") |
51 | + text: root.errorDialogText |
52 | + |
53 | + Button { |
54 | + text: i18n.tr("OK") |
55 | + color: UbuntuColors.orange |
56 | + onClicked: { |
57 | + PopupUtils.close(dialogueError); |
58 | + } |
59 | + } |
60 | + } |
61 | + } |
62 | + |
63 | //states |
64 | states: [ |
65 | State { |
66 | @@ -129,6 +163,7 @@ |
67 | PropertyChanges { target: installAllButton; visible: false} |
68 | PropertyChanges { target: checkForUpdatesArea; visible: true} |
69 | PropertyChanges { target: updateNotification; visible: false} |
70 | + PropertyChanges { target: activity; running: true} |
71 | }, |
72 | State { |
73 | name: "NOUPDATES" |
74 | @@ -191,10 +226,22 @@ |
75 | |
76 | onSystemUpdateFailed: { |
77 | root.state = "SYSTEMUPDATEFAILED"; |
78 | + root.errorDialogText = i18n.tr("Sorry, the system update failed."); |
79 | + PopupUtils.open(dialogErrorComponent); |
80 | } |
81 | |
82 | onUpdateProcessFailed: { |
83 | root.state = "SYSTEMUPDATEFAILED"; |
84 | + root.errorDialogText = i18n.tr("Sorry, the system update failed."); |
85 | + PopupUtils.open(dialogErrorComponent); |
86 | + } |
87 | + |
88 | + onServerError: { |
89 | + activity.running = false; |
90 | + } |
91 | + |
92 | + onNetworkError: { |
93 | + activity.running = false; |
94 | } |
95 | |
96 | onRebooting: { |
97 | @@ -237,22 +284,42 @@ |
98 | anchors { |
99 | left: parent.left |
100 | top: parent.top |
101 | - rightMargin: units.gu(2) |
102 | } |
103 | height: parent.height |
104 | } |
105 | |
106 | Label { |
107 | - text: i18n.tr("Checking for updates…") |
108 | + text: activity.running ? i18n.tr("Checking for updates…") : i18n.tr("Connect to the Internet to check for updates") |
109 | verticalAlignment: Text.AlignVCenter |
110 | elide: Text.ElideRight |
111 | anchors { |
112 | - left: activity.right |
113 | + left: activity.running ? activity.right : parent.left |
114 | top: parent.top |
115 | + right: btnRetry.left |
116 | + rightMargin: units.gu(2) |
117 | leftMargin: units.gu(2) |
118 | } |
119 | height: parent.height |
120 | } |
121 | + |
122 | + Button { |
123 | + id: btnRetry |
124 | + text: i18n.tr("Retry") |
125 | + color: UbuntuColors.orange |
126 | + anchors { |
127 | + right: parent.right |
128 | + top: parent.top |
129 | + bottom: parent.bottom |
130 | + margins: units.gu(1) |
131 | + } |
132 | + visible: !activity.visible |
133 | + |
134 | + onClicked: { |
135 | + activity.running = true; |
136 | + root.state = "SEARCHING"; |
137 | + UpdateManager.checkUpdates(); |
138 | + } |
139 | + } |
140 | } |
141 | |
142 | ListItem.SingleControl { |
143 | |
144 | === modified file 'plugins/system-update/network/network.cpp' |
145 | --- plugins/system-update/network/network.cpp 2014-07-23 13:53:48 +0000 |
146 | +++ plugins/system-update/network/network.cpp 2014-10-08 15:50:25 +0000 |
147 | @@ -26,7 +26,8 @@ |
148 | #include <QProcessEnvironment> |
149 | |
150 | #define URL_APPS "https://myapps.developer.ubuntu.com/dev/api/click-metadata/" |
151 | -#define URL_PACKAGE "https://search.apps.ubuntu.com/api/v1/package/" |
152 | + |
153 | +#define APPS_DATA "APPS_DATA" |
154 | |
155 | namespace UpdatePlugin { |
156 | |
157 | @@ -34,9 +35,6 @@ |
158 | QObject(parent), |
159 | m_nam(this) |
160 | { |
161 | - m_request.setHeader(QNetworkRequest::ContentTypeHeader, |
162 | - "application/json"); |
163 | - |
164 | QObject::connect(&m_nam, SIGNAL(finished(QNetworkReply*)), |
165 | this, SLOT(onReply(QNetworkReply*))); |
166 | } |
167 | @@ -57,12 +55,14 @@ |
168 | QByteArray content = doc.toJson(); |
169 | |
170 | QString urlApps = getUrlApps(); |
171 | - m_request.setUrl(QUrl(urlApps)); |
172 | - m_nam.post(m_request, content); |
173 | + QNetworkRequest request; |
174 | + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); |
175 | + request.setUrl(QUrl(urlApps)); |
176 | + RequestObject* reqObject = new RequestObject(QString(APPS_DATA)); |
177 | + request.setOriginatingObject(reqObject); |
178 | + m_nam.post(request, content); |
179 | } |
180 | |
181 | - |
182 | - |
183 | QString Network::getUrlApps() |
184 | { |
185 | QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
186 | @@ -70,85 +70,75 @@ |
187 | return command; |
188 | } |
189 | |
190 | -QString Network::getUrlPackage() |
191 | -{ |
192 | - QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); |
193 | - QString command = environment.value("URL_PACKAGE", QString(URL_PACKAGE)); |
194 | - return command; |
195 | -} |
196 | - |
197 | void Network::onReply(QNetworkReply *reply) |
198 | { |
199 | - QVariant statusAttr = reply->attribute( |
200 | - QNetworkRequest::HttpStatusCodeAttribute); |
201 | - if (!statusAttr.isValid()) { |
202 | - Q_EMIT errorOccurred(); |
203 | - return; |
204 | - } |
205 | - |
206 | - int httpStatus = statusAttr.toInt(); |
207 | - |
208 | - if (httpStatus == 200 || httpStatus == 201) { |
209 | - if (reply->hasRawHeader(X_CLICK_TOKEN)) { |
210 | - Update* app = qobject_cast<Update*>( |
211 | - reply->request().originatingObject()); |
212 | - if (app != nullptr) { |
213 | - QString header(reply->rawHeader(X_CLICK_TOKEN)); |
214 | - Q_EMIT clickTokenObtained(app, header); |
215 | - } |
216 | - reply->deleteLater(); |
217 | + if (reply->error() == QNetworkReply::NoError) { |
218 | + QVariant statusAttr = reply->attribute( |
219 | + QNetworkRequest::HttpStatusCodeAttribute); |
220 | + if (!statusAttr.isValid()) { |
221 | + Q_EMIT errorOccurred(); |
222 | return; |
223 | } |
224 | |
225 | - QByteArray payload = reply->readAll(); |
226 | - QJsonDocument document = QJsonDocument::fromJson(payload); |
227 | - |
228 | - if (document.isArray()) { |
229 | - QJsonArray array = document.array(); |
230 | - int i; |
231 | - bool updates = false; |
232 | - for (i = 0; i < array.size(); i++) { |
233 | - QJsonObject object = array.at(i).toObject(); |
234 | - QString name = object.value("name").toString(); |
235 | - QString version = object.value("version").toString(); |
236 | - QString icon_url = object.value("icon_url").toString(); |
237 | - int size = object.value("binary_filesize").toVariant().toInt(); |
238 | - if (m_apps.contains(name)) { |
239 | - m_apps[name]->setRemoteVersion(version); |
240 | - if (m_apps[name]->updateRequired()) { |
241 | - m_apps[name]->setIconUrl(icon_url); |
242 | - m_apps[name]->setBinaryFilesize(size); |
243 | - updates = true; |
244 | + int httpStatus = statusAttr.toInt(); |
245 | + |
246 | + if (httpStatus == 200 || httpStatus == 201) { |
247 | + if (reply->hasRawHeader(X_CLICK_TOKEN)) { |
248 | + Update* app = qobject_cast<Update*>( |
249 | + reply->request().originatingObject()); |
250 | + if (app != nullptr) { |
251 | + QString header(reply->rawHeader(X_CLICK_TOKEN)); |
252 | + Q_EMIT clickTokenObtained(app, header); |
253 | + } |
254 | + reply->deleteLater(); |
255 | + return; |
256 | + } |
257 | + |
258 | + QByteArray payload = reply->readAll(); |
259 | + QJsonDocument document = QJsonDocument::fromJson(payload); |
260 | + |
261 | + RequestObject* state = qobject_cast<RequestObject*>(reply->request().originatingObject()); |
262 | + if (state != nullptr && state->operation.contains(APPS_DATA) && document.isArray()) { |
263 | + QJsonArray array = document.array(); |
264 | + bool updates = false; |
265 | + for (int i = 0; i < array.size(); i++) { |
266 | + QJsonObject object = array.at(i).toObject(); |
267 | + QString name = object.value("name").toString(); |
268 | + QString version = object.value("version").toString(); |
269 | + QString icon_url = object.value("icon_url").toString(); |
270 | + QString url = object.value("download_url").toString(); |
271 | + int size = object.value("binary_filesize").toVariant().toInt(); |
272 | + if (m_apps.contains(name)) { |
273 | + m_apps[name]->setRemoteVersion(version); |
274 | + if (m_apps[name]->updateRequired()) { |
275 | + m_apps[name]->setIconUrl(icon_url); |
276 | + m_apps[name]->setDownloadUrl(url); |
277 | + m_apps[name]->setBinaryFilesize(size); |
278 | + updates = true; |
279 | + } |
280 | } |
281 | } |
282 | - } |
283 | - if (updates) { |
284 | - Q_EMIT updatesFound(); |
285 | + if (updates) { |
286 | + Q_EMIT updatesFound(); |
287 | + } else { |
288 | + Q_EMIT updatesNotFound(); |
289 | + } |
290 | } else { |
291 | - Q_EMIT updatesNotFound(); |
292 | + Q_EMIT errorOccurred(); |
293 | } |
294 | - } else if (document.isObject()) { |
295 | - QJsonObject object = document.object(); |
296 | - QString url = object.value("download_url").toString(); |
297 | - QString name = object.value("name").toString(); |
298 | - Q_EMIT downloadUrlFound(name, url); |
299 | } else { |
300 | Q_EMIT errorOccurred(); |
301 | } |
302 | + } else if (reply->error() == QNetworkReply::TemporaryNetworkFailureError || |
303 | + reply->error() == QNetworkReply::UnknownNetworkError) { |
304 | + Q_EMIT networkError(); |
305 | } else { |
306 | - Q_EMIT errorOccurred(); |
307 | + Q_EMIT serverError(); |
308 | } |
309 | |
310 | reply->deleteLater(); |
311 | } |
312 | |
313 | -void Network::getResourceUrl(const QString &packagename) |
314 | -{ |
315 | - QString urlPackage = getUrlPackage(); |
316 | - m_request.setUrl(QUrl(urlPackage + packagename)); |
317 | - m_nam.get(m_request); |
318 | -} |
319 | - |
320 | void Network::getClickToken(Update *app, const QString &url, |
321 | const QString &authHeader) |
322 | { |
323 | |
324 | === modified file 'plugins/system-update/network/network.h' |
325 | --- plugins/system-update/network/network.h 2014-02-25 20:27:51 +0000 |
326 | +++ plugins/system-update/network/network.h 2014-10-08 15:50:25 +0000 |
327 | @@ -29,6 +29,19 @@ |
328 | |
329 | namespace UpdatePlugin { |
330 | |
331 | +class RequestObject : public QObject |
332 | +{ |
333 | + Q_OBJECT |
334 | +public: |
335 | + explicit RequestObject(QString oper, QObject *parent = 0) : |
336 | + QObject(parent) |
337 | + { |
338 | + operation = oper; |
339 | + } |
340 | + |
341 | + QString operation; |
342 | +}; |
343 | + |
344 | class Network : public QObject |
345 | { |
346 | Q_OBJECT |
347 | @@ -36,7 +49,6 @@ |
348 | explicit Network(QObject *parent = 0); |
349 | |
350 | void checkForNewVersions(QHash<QString, Update*> &apps); |
351 | - void getResourceUrl(const QString &packagename); |
352 | void getClickToken(Update *app, const QString &url, |
353 | const QString &authHeader); |
354 | |
355 | @@ -44,7 +56,8 @@ |
356 | void updatesFound(); |
357 | void updatesNotFound(); |
358 | void errorOccurred(); |
359 | - void downloadUrlFound(const QString &packagename, const QString &url); |
360 | + void networkError(); |
361 | + void serverError(); |
362 | void clickTokenObtained(Update *app, const QString &clickToken); |
363 | |
364 | private Q_SLOTS: |
365 | @@ -52,11 +65,9 @@ |
366 | |
367 | private: |
368 | QNetworkAccessManager m_nam; |
369 | - QNetworkRequest m_request; |
370 | QHash<QString, Update*> m_apps; |
371 | |
372 | QString getUrlApps(); |
373 | - QString getUrlPackage(); |
374 | }; |
375 | |
376 | } |
377 | |
378 | === modified file 'plugins/system-update/update_manager.cpp' |
379 | --- plugins/system-update/update_manager.cpp 2014-09-19 04:26:10 +0000 |
380 | +++ plugins/system-update/update_manager.cpp 2014-10-08 15:50:25 +0000 |
381 | @@ -63,12 +63,13 @@ |
382 | this, SLOT(clickUpdateNotAvailable())); |
383 | QObject::connect(&m_network, SIGNAL(errorOccurred()), |
384 | this, SIGNAL(errorFound())); |
385 | + QObject::connect(&m_network, SIGNAL(networkError()), |
386 | + this, SIGNAL(networkError())); |
387 | + QObject::connect(&m_network, SIGNAL(serverError()), |
388 | + this, SIGNAL(serverError())); |
389 | QObject::connect(&m_network, |
390 | SIGNAL(clickTokenObtained(Update*, const QString&)), |
391 | this, SLOT(clickTokenReceived(Update*, const QString&))); |
392 | - QObject::connect(&m_network, |
393 | - SIGNAL(downloadUrlFound(const QString&, const QString&)), |
394 | - this, SLOT(downloadUrlObtained(const QString&, const QString&))); |
395 | // SYSTEM UPDATE |
396 | QObject::connect(&m_systemUpdate, SIGNAL(updateAvailable(const QString&, Update*)), |
397 | this, SLOT(registerSystemUpdate(const QString&, Update*))); |
398 | @@ -281,7 +282,7 @@ |
399 | if (m_apps[packagename]->systemUpdate()) { |
400 | m_systemUpdate.downloadUpdate(); |
401 | } else { |
402 | - m_network.getResourceUrl(packagename); |
403 | + downloadApp(m_apps[packagename]); |
404 | } |
405 | } |
406 | |
407 | @@ -305,16 +306,13 @@ |
408 | m_systemUpdate.pauseDownload(); |
409 | } |
410 | |
411 | -void UpdateManager::downloadUrlObtained(const QString &packagename, |
412 | - const QString &url) |
413 | +void UpdateManager::downloadApp(Update *app) |
414 | { |
415 | if (m_token.isValid()) { |
416 | - QString authHeader = m_token.signUrl(url, QStringLiteral("HEAD"), true); |
417 | - Update *app = m_apps[packagename]; |
418 | - app->setClickUrl(url); |
419 | - m_network.getClickToken(app, url, authHeader); |
420 | + QString authHeader = m_token.signUrl(app->downloadUrl(), QStringLiteral("HEAD"), true); |
421 | + app->setClickUrl(app->downloadUrl()); |
422 | + m_network.getClickToken(app, app->downloadUrl(), authHeader); |
423 | } else { |
424 | - Update *app = m_apps[packagename]; |
425 | app->setError("Invalid User Token"); |
426 | } |
427 | } |
428 | |
429 | === modified file 'plugins/system-update/update_manager.h' |
430 | --- plugins/system-update/update_manager.h 2014-09-18 19:57:03 +0000 |
431 | +++ plugins/system-update/update_manager.h 2014-10-08 15:50:25 +0000 |
432 | @@ -70,6 +70,8 @@ |
433 | void credentialsNotFound(); |
434 | void updateAvailableFound(bool downloading); |
435 | void errorFound(); |
436 | + void networkError(); |
437 | + void serverError(); |
438 | void downloadModeChanged(); |
439 | void systemUpdateDownloaded(); |
440 | void updateProcessFailed(QString message); |
441 | @@ -121,7 +123,7 @@ |
442 | void systemUpdateProgress(int value, double eta); |
443 | void processOutput(); |
444 | void processUpdates(); |
445 | - void downloadUrlObtained(const QString &packagename, const QString &url); |
446 | + void downloadApp(Update *app); |
447 | void handleCredentialsFound(Token token); |
448 | void clickTokenReceived(Update *app, const QString &clickToken); |
449 |
FAILED: Continuous integration, rev:1047 jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- ci/1498/ jenkins. qa.ubuntu. com/job/ generic- deb-autopilot- utopic- touch/4938/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- utopic/ 3602/console jenkins. qa.ubuntu. com/job/ ubuntu- system- settings- utopic- i386-ci/ 690/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- armhf/6190/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- utopic- amd64/3911/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/ubuntu- system- settings- ci/1498/ rebuild
http://