summaryrefslogtreecommitdiffstats
path: root/src/network/bearer
diff options
context:
space:
mode:
authorAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-24 23:53:12 (GMT)
committerAaron McCarthy <aaron.mccarthy@nokia.com>2010-01-26 23:36:04 (GMT)
commitd3b580fe8b2b0c185f0eadbf794156058496eff3 (patch)
tree5567ec5a433349ba8a7bfceb0e3c910745baa21d /src/network/bearer
parent084c9659719ac310630ac0c1a81d013176f9c350 (diff)
downloadQt-d3b580fe8b2b0c185f0eadbf794156058496eff3.zip
Qt-d3b580fe8b2b0c185f0eadbf794156058496eff3.tar.gz
Qt-d3b580fe8b2b0c185f0eadbf794156058496eff3.tar.bz2
Return default configuration from engines.
Diffstat (limited to 'src/network/bearer')
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp34
-rw-r--r--src/network/bearer/qnetworksessionengine_p.h2
2 files changed, 10 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