diff options
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 34 | ||||
-rw-r--r-- | src/network/bearer/qnetworksessionengine_p.h | 2 | ||||
-rw-r--r-- | src/plugins/bearer/generic/qgenericengine.cpp | 5 | ||||
-rw-r--r-- | src/plugins/bearer/generic/qgenericengine.h | 2 |
4 files changed, 17 insertions, 26 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c00d6d3..bc3cfbd 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -212,42 +212,24 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() } /*! - Returns the first active configuration found, if one exists; otherwise returns the first - discovered configuration found, if one exists; otherwise returns an empty configuration. + Returns the default configuration of the first plugin, if one exists; otherwise returns an + invalid configuration. \internal */ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration() { - QNetworkConfigurationPrivatePointer firstActive; - QNetworkConfigurationPrivatePointer firstDiscovered; - foreach (QNetworkSessionEngine *engine, sessionEngines) { - QHash<QString, QNetworkConfigurationPrivatePointer>::const_iterator i = - engine->accessPointConfigurations.constBegin(); - - while (i != engine->accessPointConfigurations.constEnd()) { - QNetworkConfigurationPrivatePointer priv = i.value(); - - if (!firstActive && priv->isValid && - (priv->state & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) - firstActive = priv; - if (!firstDiscovered && priv->isValid && - (priv->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) - firstDiscovered = priv; + QNetworkConfigurationPrivatePointer ptr = engine->defaultConfiguration(); - ++i; + if (ptr) { + QNetworkConfiguration config; + config.d = ptr; + return config; } } - QNetworkConfiguration item; - - if (firstActive) - item.d = firstActive; - else if (firstDiscovered) - item.d = firstDiscovered; - - return item; + return QNetworkConfiguration(); } void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate() diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h index 02772cb..029c2c5 100644 --- a/src/network/bearer/qnetworksessionengine_p.h +++ b/src/network/bearer/qnetworksessionengine_p.h @@ -99,6 +99,8 @@ public: virtual QNetworkSessionPrivate *createSessionBackend() = 0; + virtual QNetworkConfigurationPrivatePointer defaultConfiguration() = 0; + public: //this table contains an up to date list of all configs at any time. //it must be updated if configurations change, are added/removed or diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index e9770e1..55d1ae4 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -325,5 +325,10 @@ QNetworkSessionPrivate *QGenericEngine::createSessionBackend() return new QNetworkSessionPrivateImpl; } +QNetworkConfigurationPrivatePointer QGenericEngine::defaultConfiguration() +{ + return QNetworkConfigurationPrivatePointer(); +} + QT_END_NAMESPACE diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 04b845e..b44685b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -76,6 +76,8 @@ public: QNetworkSessionPrivate *createSessionBackend(); + QNetworkConfigurationPrivatePointer defaultConfiguration(); + private Q_SLOTS: void doRequestUpdate(); |