diff options
author | Takumi ASAKI <asaki@sra.co.jp> | 2016-07-04 13:57:09 +0900 |
---|---|---|
committer | Takumi ASAKI <takumi.asaki@gmail.com> | 2016-07-20 07:24:45 +0000 |
commit | b2029e9ca6c1645e85cbada1b09ba63fd1ee31ed (patch) | |
tree | f91a61ced036fe3dd66c88c0569af0551e726582 /src/plugins/bearer/connman | |
parent | cc119dee73c6cc46abf8d779a91f0ccad3ce1bd7 (diff) |
Bearer/Connman: emit missing updateCompleted()
emit missing updateCompleted() in some conditions after
QNetworkConfigurationManager::updateConfigurations() is called.
* There is no wifi devices.
* The wifi device returns error when scan is called.
Change-Id: I2668644249a0584bf43efea95348424aa64ab4a6
Reviewed-by: Lorn Potter <lorn.potter@canonical.com>
Diffstat (limited to 'src/plugins/bearer/connman')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.cpp | 10 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanengine.h | 2 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 13 | ||||
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux_p.h | 6 |
4 files changed, 21 insertions, 10 deletions
diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index b7cc5f949c..fdedaa46dc 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -85,7 +85,7 @@ void QConnmanEngine::initialize() this, SLOT(updateServices(ConnmanMapList,QList<QDBusObjectPath>))); connect(connmanManager,SIGNAL(servicesReady(QStringList)),this,SLOT(servicesReady(QStringList))); - connect(connmanManager,SIGNAL(scanFinished()),this,SLOT(finishedScan())); + connect(connmanManager,SIGNAL(scanFinished(bool)),this,SLOT(finishedScan(bool))); foreach (const QString &servPath, connmanManager->getServices()) { addServiceConfiguration(servPath); @@ -197,11 +197,15 @@ void QConnmanEngine::requestUpdate() void QConnmanEngine::doRequestUpdate() { - connmanManager->requestScan("wifi"); + bool scanned = connmanManager->requestScan("wifi"); + if (!scanned) + Q_EMIT updateCompleted(); } -void QConnmanEngine::finishedScan() +void QConnmanEngine::finishedScan(bool error) { + if (error) + Q_EMIT updateCompleted(); } void QConnmanEngine::updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed) diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 8c79b22bf9..c499886261 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -94,7 +94,7 @@ private Q_SLOTS: void updateServices(const ConnmanMapList &changed, const QList<QDBusObjectPath> &removed); void servicesReady(const QStringList &); - void finishedScan(); + void finishedScan(bool error); void changedModem(); void serviceStateChanged(const QString &state); void configurationChange(QConnmanServiceInterface * service); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index 10d8285a4a..40bab4fda6 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -243,13 +243,16 @@ QStringList QConnmanManagerInterface::getServices() return servicesList; } -void QConnmanManagerInterface::requestScan(const QString &type) +bool QConnmanManagerInterface::requestScan(const QString &type) { + bool scanned = false; Q_FOREACH (QConnmanTechnologyInterface *tech, technologiesMap) { if (tech->type() == type) { tech->scan(); + scanned = true; } } + return scanned; } void QConnmanManagerInterface::technologyAdded(const QDBusObjectPath &path, const QVariantMap &) @@ -259,7 +262,7 @@ void QConnmanManagerInterface::technologyAdded(const QDBusObjectPath &path, cons QConnmanTechnologyInterface *tech; tech = new QConnmanTechnologyInterface(path.path(),this); technologiesMap.insert(path.path(),tech); - connect(tech,SIGNAL(scanFinished()),this,SIGNAL(scanFinished())); + connect(tech,SIGNAL(scanFinished(bool)),this,SIGNAL(scanFinished(bool))); } } @@ -495,7 +498,11 @@ void QConnmanTechnologyInterface::scan() void QConnmanTechnologyInterface::scanReply(QDBusPendingCallWatcher *call) { - Q_EMIT scanFinished(); + QDBusPendingReply<QVariantMap> props_reply = *call; + if (props_reply.isError()) { + qDebug() << props_reply.error().message(); + } + Q_EMIT scanFinished(props_reply.isError()); call->deleteLater(); } diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 7292736e2e..b199a17af3 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -108,7 +108,7 @@ public: bool getOfflineMode(); QStringList getTechnologies(); QStringList getServices(); - void requestScan(const QString &type); + bool requestScan(const QString &type); QHash<QString, QConnmanTechnologyInterface *> technologiesMap; @@ -119,7 +119,7 @@ Q_SIGNALS: void servicesChanged(const ConnmanMapList&, const QList<QDBusObjectPath> &); void servicesReady(const QStringList &); - void scanFinished(); + void scanFinished(bool error); protected: void connectNotify(const QMetaMethod &signal); @@ -204,7 +204,7 @@ public: Q_SIGNALS: void propertyChanged(const QString &, const QDBusVariant &value); void propertyChangedContext(const QString &,const QString &,const QDBusVariant &); - void scanFinished(); + void scanFinished(bool error); protected: void connectNotify(const QMetaMethod &signal); QVariant getProperty(const QString &); |