diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-07-29 06:39:05 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-08-02 00:09:06 (GMT) |
commit | d12f39e50e4144f3272424bb0bff18c857105654 (patch) | |
tree | ffde9a7863c78af2adabcb9c7e85c79d9f79cfc6 /src/network/bearer/qnetworkconfigmanager_p.cpp | |
parent | 613bc8eb31d8a80b43aa045ab2040b7cb7e0eadf (diff) | |
download | Qt-d12f39e50e4144f3272424bb0bff18c857105654.zip Qt-d12f39e50e4144f3272424bb0bff18c857105654.tar.gz Qt-d12f39e50e4144f3272424bb0bff18c857105654.tar.bz2 |
Use an enum to return the bearer type of a network configuration.
Task-number: QTBUG-12378
Reviewed-by: Alex
Diffstat (limited to 'src/network/bearer/qnetworkconfigmanager_p.cpp')
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 5d4274f..c4f7c00 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -150,25 +150,29 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( end = engine->accessPointConfigurations.end(); it != end; ++it) { QNetworkConfigurationPrivatePointer ptr = it.value(); - const QString bearerName = ptr->bearerName(); QMutexLocker configLocker(&ptr->mutex); + QNetworkConfiguration::BearerType bearerType = ptr->bearerType; if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { if (!defaultConfiguration) { defaultConfiguration = ptr; } else { + QMutexLocker defaultConfigLocker(&defaultConfiguration->mutex); + if (defaultConfiguration->state == ptr->state) { - if (defaultConfiguration->bearerName() == QLatin1String("Ethernet")) { + switch (defaultConfiguration->bearerType) { + case QNetworkConfiguration::BearerEthernet: // do nothing - } else if (defaultConfiguration->bearerName() == QLatin1String("WLAN")) { - // ethernet beats wlan - if (bearerName == QLatin1String("Ethernet")) - defaultConfiguration = ptr; - } else { - // ethernet and wlan beats other - if (bearerName == QLatin1String("Ethernet") || - bearerName == QLatin1String("WLAN")) { + break; + case QNetworkConfiguration::BearerWLAN: + // Ethernet beats WLAN + defaultConfiguration = ptr; + break; + default: + // Ethernet and WLAN beats other + if (bearerType == QNetworkConfiguration::BearerEthernet || + bearerType == QNetworkConfiguration::BearerWLAN) { defaultConfiguration = ptr; } } |