~system-settings-touch/ubuntu-system-settings/trunk

« back to all changes in this revision

Viewing changes to plugins/system-update/network.cpp

  • Committer: CI Train Bot
  • Author(s): Ken VanDine
  • Date: 2015-11-03 16:26:21 UTC
  • mfrom: (1544.3.6 lp1505663)
  • Revision ID: ci-train-bot@canonical.com-20151103162621-binaxg3y6vs895h3
[system-settings] Abort request when the onlineStatus changes to false
 Fixes: #1505663
Approved by: Jonas G. Drange

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
Network::Network(QObject *parent) :
40
40
    QObject(parent),
41
 
    m_nam(this)
 
41
    m_nam(this),
 
42
    m_ncm(new QNetworkConfigurationManager())
42
43
{
43
44
}
44
45
 
166
167
    connect(reply, &QNetworkReply::sslErrors, this, &Network::onReplySslErrors);
167
168
    connect(reply, static_cast<void(QNetworkReply::*)
168
169
            (QNetworkReply::NetworkError)>(&QNetworkReply::error),
169
 
        this, &Network::onReplyError);
 
170
            this, &Network::onReplyError);
 
171
    connect(m_ncm, &QNetworkConfigurationManager::onlineStateChanged, [=](const bool &online) {
 
172
            if (!online) {
 
173
                qWarning() << "Offline, aborting check for updates";
 
174
                reply->abort();
 
175
            }
 
176
    });
170
177
}
171
178
 
 
179
 
 
180
 
172
181
QString Network::getUrlApps()
173
182
{
174
183
    QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();