diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-03-17 05:30:31 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-03-17 05:30:31 (GMT) |
commit | 611c2b7d3f4c2b6a05968c58c8da251bc054e74e (patch) | |
tree | 70cbd724dac9bb983bdef5532850e4ea4f5e4bd1 /src/plugins/bearer/corewlan | |
parent | 1a8eaa2087fde99366da6faa11ef8c14711a75ff (diff) | |
download | Qt-611c2b7d3f4c2b6a05968c58c8da251bc054e74e.zip Qt-611c2b7d3f4c2b6a05968c58c8da251bc054e74e.tar.gz Qt-611c2b7d3f4c2b6a05968c58c8da251bc054e74e.tar.bz2 |
use dynamicstore instead
Diffstat (limited to 'src/plugins/bearer/corewlan')
-rw-r--r-- | src/plugins/bearer/corewlan/qcorewlanengine.mm | 43 |
1 files changed, 14 insertions, 29 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 392e24c..67186a9 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -737,37 +737,22 @@ void QCoreWlanEngine::getUserConfigurations() CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]]; // add user configured system networks - NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist"; - NSDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:filePath]; - NSString *input = @"KnownNetworks"; - NSString *ssidStr = @"SSID_STR"; - - for (id key in plistDict) { - if ([input isEqualToString:key]) { - - NSDictionary *knownNetworksDict = [plistDict objectForKey:key]; - for (id networkKey in knownNetworksDict) { - - NSDictionary *itemDict = [knownNetworksDict objectForKey:networkKey]; - NSInteger dictSize = [itemDict count]; - id objects[dictSize]; - id keys[dictSize]; - - [itemDict getObjects:objects andKeys:keys]; - - for(int i = 0; i < dictSize; i++) { - if([ssidStr isEqualToString:keys[i]]) { - QString thisSsid = qt_mac_NSStringToQString(objects[i]); - if(!userProfiles.contains(thisSsid)) { - QMap <QString,QString> map; - map.insert(thisSsid, qt_mac_NSStringToQString([wifiInterface name])); - userProfiles.insert(thisSsid, map); - } - } - } - } + SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil); + CFDictionaryRef airportPlist = (const __CFDictionary*)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", [wifiInterface name]]); + CFRelease(dynRef); + + NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"]; + + NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; + for(NSString *ssidkey in thisSsidarray) { + QString thisSsid = qt_mac_NSStringToQString(ssidkey); + if(!userProfiles.contains(thisSsid)) { + QMap <QString,QString> map; + map.insert(thisSsid, qt_mac_NSStringToQString([wifiInterface name])); + userProfiles.insert(thisSsid, map); } } + CFRelease(airportPlist); // 802.1X user profiles QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist"; |