summaryrefslogtreecommitdiffstats
path: root/src/plugins/bearer/corewlan
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/bearer/corewlan')
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h3
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm14
2 files changed, 8 insertions, 9 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 2fe8974..02766c5 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -95,11 +95,10 @@ private:
SCDynamicStoreRef storeSession;
CFRunLoopSourceRef runloopSource;
-
bool hasWifi;
protected:
- QMap<QString, QMap<QString,QString> > userProfiles;
+ QMap<QString, QMap<QString,QString> > userProfiles;
void startNetworkChangeLoop();
void getUserConfigurations();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index af57159..9c2cb0c 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -50,11 +50,13 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdebug.h>
+
#include <QDir>
#include <CoreWLAN/CoreWLAN.h>
#include <CoreWLAN/CWInterface.h>
#include <CoreWLAN/CWNetwork.h>
#include <CoreWLAN/CWNetwork.h>
+#include <CoreWLAN/CW8021XProfile.h>
#include <Foundation/NSEnumerator.h>
#include <Foundation/NSKeyValueObserving.h>
@@ -194,14 +196,14 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSString *wantedSsid = 0;
bool okToProceed = true;
+
if(getNetworkNameFromSsid(id) != id) {
NSArray *array = [CW8021XProfile allUser8021XProfiles];
for (NSUInteger i=0; i<[array count]; ++i) {
const QString idCheck = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] userDefinedName])));
const QString idCheck2 = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString([[array objectAtIndex:i] ssid])));
- if(id == idCheck
- || id == idCheck2) {
+ if (id == idCheck || id == idCheck2) {
QString thisName = getSsidFromNetworkName(id);
if(thisName.isEmpty()) {
wantedSsid = qt_mac_QStringToNSString(id);
@@ -263,6 +265,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
emit connectionError(id, InterfaceLookupError);
locker.relock();
}
+
+ locker.unlock();
emit connectionError(id, OperationNotSupported);
}
@@ -416,7 +420,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
if (!err) {
for(uint row=0; row < [apArray count]; row++ ) {
-
apNetwork = [apArray objectAtIndex:row];
const QString networkSsid = qt_mac_NSStringToQString([apNetwork ssid]);
@@ -456,7 +459,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
QString networkSsid = getSsidFromNetworkName(networkName);
const QString ssidId = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
QNetworkConfiguration::StateFlags state = QNetworkConfiguration::Undefined;
-
QString interfaceName;
QMapIterator<QString, QString> ij(i.value());
while (ij.hasNext()) {
@@ -693,7 +695,6 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
while (i.hasNext()) {
i.next();
-
QMap<QString,QString> map = i.value();
QMapIterator<QString, QString> ij(i.value());
while (ij.hasNext()) {
@@ -702,7 +703,7 @@ QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name)
if(name == i.key() || name == idCheck) {
return ij.key();
}
- }
+ }
}
return QString();
}
@@ -737,7 +738,6 @@ void QCoreWlanEngine::getUserConfigurations()
CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]];
NSString *nsInterfaceName = [wifiInterface name];
-
// add user configured system networks
SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil);
NSDictionary * airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName]);