diff options
-rw-r--r-- | src/network/bearer/qnetworkconfiguration_p.h | 11 | ||||
-rw-r--r-- | src/plugins/bearer/blackberry/qbbengine.cpp | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index cdeec36..b69ce87 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -59,6 +59,10 @@ #include <QtCore/qmutex.h> #include <QtCore/qmap.h> +#ifdef Q_OS_BLACKBERRY +#include <bps/netstatus.h> +#endif + QT_BEGIN_NAMESPACE typedef QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> QNetworkConfigurationPrivatePointer; @@ -70,6 +74,9 @@ public: type(QNetworkConfiguration::Invalid), purpose(QNetworkConfiguration::UnknownPurpose), bearerType(QNetworkConfiguration::BearerUnknown), +#ifdef Q_OS_BLACKBERRY + oldIpStatus(NETSTATUS_IP_STATUS_ERROR_UNKNOWN), +#endif isValid(false), roamingSupported(false) {} virtual ~QNetworkConfigurationPrivate() @@ -95,6 +102,10 @@ public: QNetworkConfiguration::Purpose purpose; QNetworkConfiguration::BearerType bearerType; +#ifdef Q_OS_BLACKBERRY + netstatus_ip_status_t oldIpStatus; +#endif + bool isValid; bool roamingSupported; diff --git a/src/plugins/bearer/blackberry/qbbengine.cpp b/src/plugins/bearer/blackberry/qbbengine.cpp index 908fecc..7233dfa 100644 --- a/src/plugins/bearer/blackberry/qbbengine.cpp +++ b/src/plugins/bearer/blackberry/qbbengine.cpp @@ -45,6 +45,7 @@ #include <QDebug> #include <QThreadStorage> #include <QStringList> +#include <QTimer> #include <bps/netstatus.h> @@ -369,6 +370,9 @@ void QBBEngine::updateConfiguration(const char *interface) changed = true; } + const netstatus_ip_status_t oldIpStatus = ptr->oldIpStatus; + ptr->oldIpStatus = ipStatus; + ptrLocker.unlock(); locker.unlock(); @@ -378,7 +382,17 @@ void QBBEngine::updateConfiguration(const char *interface) Q_EMIT configurationChanged(ptr); } else { + // maybe Wifi has changed but gateway not yet ready etc. qBearerDebug() << Q_FUNC_INFO << "configuration has not changed."; + if (oldIpStatus != ipStatus) { // if IP status changed + if (ipStatus != NETSTATUS_IP_STATUS_OK + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_UP + && ipStatus != NETSTATUS_IP_STATUS_ERROR_NOT_CONFIGURED) { + // work around race condition in netstatus API by just checking + // again in 300 ms + QTimer::singleShot(300, this, SLOT(doRequestUpdate())); + } + } } return; |