Merge lp:~ken-vandine/ubuntu-system-settings/lp1505663_abort into lp:ubuntu-system-settings

Proposed by Ken VanDine
Status: Merged
Approved by: Ken VanDine
Approved revision: 1550
Merged at revision: 1552
Proposed branch: lp:~ken-vandine/ubuntu-system-settings/lp1505663_abort
Merge into: lp:ubuntu-system-settings
Prerequisite: lp:~ken-vandine/ubuntu-system-settings/lp1505663
Diff against target: 51 lines (+13/-2)
2 files modified
plugins/system-update/network.cpp (+11/-2)
plugins/system-update/network.h (+2/-0)
To merge this branch: bzr merge lp:~ken-vandine/ubuntu-system-settings/lp1505663_abort
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+276317@code.launchpad.net

Commit message

[system-settings] Abort request when the onlineStatus changes to false

Description of the change

[system-settings] Abort request when the onlineStatus changes to false

To post a comment you must log in.
1550. By Ken VanDine

removed debug output and added warning when offline

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Jonas G. Drange (jonas-drange) wrote :

I like it. The lambda could reference used variables instead of copying, but that's up to you. Works well.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/system-update/network.cpp'
2--- plugins/system-update/network.cpp 2015-08-27 10:18:41 +0000
3+++ plugins/system-update/network.cpp 2015-10-30 20:51:14 +0000
4@@ -38,7 +38,8 @@
5
6 Network::Network(QObject *parent) :
7 QObject(parent),
8- m_nam(this)
9+ m_nam(this),
10+ m_ncm(new QNetworkConfigurationManager())
11 {
12 }
13
14@@ -166,9 +167,17 @@
15 connect(reply, &QNetworkReply::sslErrors, this, &Network::onReplySslErrors);
16 connect(reply, static_cast<void(QNetworkReply::*)
17 (QNetworkReply::NetworkError)>(&QNetworkReply::error),
18- this, &Network::onReplyError);
19+ this, &Network::onReplyError);
20+ connect(m_ncm, &QNetworkConfigurationManager::onlineStateChanged, [=](const bool &online) {
21+ if (!online) {
22+ qWarning() << "Offline, aborting check for updates";
23+ reply->abort();
24+ }
25+ });
26 }
27
28+
29+
30 QString Network::getUrlApps()
31 {
32 QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
33
34=== modified file 'plugins/system-update/network.h'
35--- plugins/system-update/network.h 2015-08-27 10:18:41 +0000
36+++ plugins/system-update/network.h 2015-10-30 20:51:14 +0000
37@@ -22,6 +22,7 @@
38 #include <token.h>
39 #include <QObject>
40 #include <QtNetwork/QNetworkAccessManager>
41+#include <QtNetwork/QNetworkConfigurationManager>
42 #include <QtNetwork/QNetworkReply>
43 #include <QHash>
44
45@@ -62,6 +63,7 @@
46
47 private:
48 QNetworkAccessManager m_nam;
49+ QNetworkConfigurationManager *m_ncm;
50 QHash<QString, Update*> m_apps;
51 UbuntuOne::Token m_token;
52

Subscribers

People subscribed via source and target branches