summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-03-26 01:07:36 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-03-26 01:07:36 (GMT)
commit6f9eb6f97bdace74111180bc548f21f613e2674c (patch)
tree970dee9f6b24092cb2597ef2389137a9b10ac876
parent3343298448da3f2546b0708670effb798f762c5c (diff)
downloadQt-6f9eb6f97bdace74111180bc548f21f613e2674c.zip
Qt-6f9eb6f97bdace74111180bc548f21f613e2674c.tar.gz
Qt-6f9eb6f97bdace74111180bc548f21f613e2674c.tar.bz2
specify the configuration's purpose based on security mode of network.
open is public.
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm20
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp14
3 files changed, 29 insertions, 7 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 5e93193..11f5d96 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -102,7 +102,7 @@ protected:
void getUserConfigurations();
QString getNetworkNameFromSsid(const QString &ssid);
QString getSsidFromNetworkName(const QString &name);
- QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName);
+ QStringList foundNetwork(const QString &id, const QString &ssid, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose);
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index a366d00..b59ccee 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -271,7 +271,7 @@ void QCoreWlanEngine::connectToId(const QString &id)
SecKeychainAttributeList attributeList = {3,attributes};
SecKeychainSearchRef searchRef;
- OSErr result = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attributeList, &searchRef);
+ SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attributeList, &searchRef);
NSString *password = @"";
SecKeychainItemRef searchItem;
@@ -429,7 +429,14 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
state = QNetworkConfiguration::Undefined;
}
}
- found.append(foundNetwork(id, networkSsid, state, interfaceName));
+ QNetworkConfiguration::Purpose purpose = QNetworkConfiguration::UnknownPurpose;
+ if([[apNetwork securityMode] intValue] == kCWSecurityModeOpen) {
+ purpose = QNetworkConfiguration::PublicPurpose;
+ } else {
+ purpose = QNetworkConfiguration::PrivatePurpose;
+ }
+
+ found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
} //end row
} //end error
@@ -470,13 +477,13 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
state = QNetworkConfiguration::Defined;
}
- found.append(foundNetwork(id, networkName, state, interfaceName));
+ found.append(foundNetwork(id, networkName, state, interfaceName, QNetworkConfiguration::UnknownPurpose));
}
}
return found;
}
-QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName)
+QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
{
QStringList found;
QMutexLocker locker(&mutex);
@@ -507,6 +514,10 @@ QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name
changed = true;
}
+ if (ptr->purpose != purpose) {
+ ptr->purpose = purpose;
+ changed = true;
+ }
ptr->mutex.unlock();
if (changed) {
@@ -524,6 +535,7 @@ QStringList QCoreWlanEngine::foundNetwork(const QString &id, const QString &name
ptr->state = state;
ptr->type = QNetworkConfiguration::InternetAccessPoint;
ptr->bearer = QLatin1String("WLAN");
+ ptr->purpose = purpose;
accessPointConfigurations.insert(ptr->id, ptr);
configurationInterface.insert(ptr->id, interfaceName);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 28ee38e..72d6838 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -602,7 +602,11 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec
ptr->isValid = true;
ptr->id = QString::number(qHash(objectPath.path()));
ptr->type = QNetworkConfiguration::InternetAccessPoint;
- ptr->purpose = QNetworkConfiguration::PublicPurpose;
+ if(accessPoint->flags() == NM_802_11_AP_FLAGS_PRIVACY) {
+ ptr->purpose = QNetworkConfiguration::PrivatePurpose;
+ } else {
+ ptr->purpose = QNetworkConfiguration::PublicPurpose;
+ }
ptr->state = QNetworkConfiguration::Undefined;
ptr->bearer = QLatin1String("WLAN");
@@ -718,6 +722,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
if (connectionType == QLatin1String("802-3-ethernet")) {
cpPriv->bearer = QLatin1String("Ethernet");
+ cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path());
@@ -734,7 +739,12 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
cpPriv->bearer = QLatin1String("WLAN");
const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
-
+ const QString connectionSecurity = map.value("802-11-wireless").value("security").toString();
+ if(!connectionSecurity.isEmpty()) {
+ cpPriv->purpose = QNetworkConfiguration::PrivatePurpose;
+ } else {
+ cpPriv->purpose = QNetworkConfiguration::PublicPurpose;
+ }
for (int i = 0; i < accessPoints.count(); ++i) {
if (connectionSsid == accessPoints.at(i)->ssid()) {
cpPriv->state |= QNetworkConfiguration::Discovered;