259 return configurationInterface.contains(id.toUInt()); |
269 return configurationInterface.contains(id.toUInt()); |
260 } |
270 } |
261 |
271 |
262 void QCoreWlanEngine::connectToId(const QString &id) |
272 void QCoreWlanEngine::connectToId(const QString &id) |
263 { |
273 { |
264 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
|
265 QString interfaceString = getInterfaceFromId(id); |
274 QString interfaceString = getInterfaceFromId(id); |
266 |
275 |
267 if(networkInterfaces.value(interfaceString) == "WLAN") { |
276 if(networkInterfaces.value(interfaceString) == "WLAN") { |
268 #if defined(MAC_SDK_10_6) |
277 #if defined(MAC_SDK_10_6) |
|
278 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
269 CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; |
279 CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceString)]; |
270 CWConfiguration *userConfig = [ wifiInterface configuration]; |
280 |
271 |
281 if([wifiInterface power]) { |
272 NSSet *remNets = [userConfig rememberedNetworks]; //CWWirelessProfile |
282 NSError *err = nil; |
273 |
283 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0]; |
274 NSEnumerator *enumerator = [remNets objectEnumerator]; |
284 |
275 CWWirelessProfile *wProfile; |
285 QString wantedSsid = 0; |
276 NSUInteger index=0; |
286 bool using8021X = false; |
277 |
287 |
278 NSDictionary *parametersDict; |
288 if(getNetworkNameFromSsid(id) != id) { |
279 NSArray* apArray; |
289 NSArray *array = [CW8021XProfile allUser8021XProfiles]; |
280 |
290 for (NSUInteger i=0; i<[array count]; ++i) { |
281 CW8021XProfile *user8021XProfile; |
291 |
282 NSError *err; |
292 if(id == nsstringToQString([[array objectAtIndex:i] userDefinedName]) |
283 NSMutableDictionary *params; |
293 || id == nsstringToQString([[array objectAtIndex:i] ssid]) ) { |
284 |
294 QString thisName = getSsidFromNetworkName(id); |
285 while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile |
295 if(thisName.isEmpty()) { |
286 |
296 wantedSsid = id; |
287 if(id == nsstringToQString([wProfile ssid])) { |
297 } else { |
288 user8021XProfile = nil; |
298 wantedSsid = thisName; |
289 user8021XProfile = [ wProfile user8021XProfile]; |
299 } |
290 |
300 [params setValue: [array objectAtIndex:i] forKey:kCWAssocKey8021XProfile]; |
291 err = nil; |
301 using8021X = true; |
292 params = [NSMutableDictionary dictionaryWithCapacity:0]; |
302 break; |
293 |
303 } |
294 if(user8021XProfile) { |
|
295 [params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile]; |
|
296 } else { |
|
297 [params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase]; |
|
298 } |
304 } |
299 |
305 } |
300 parametersDict = nil; |
306 |
301 apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; |
307 if(!using8021X) { |
302 |
308 QString wantedNetwork; |
303 if(!err) { |
309 QMapIterator<QString, QMap<QString,QString> > i(userProfiles); |
304 |
310 while (i.hasNext()) { |
305 for(uint row=0; row < [apArray count]; row++ ) { |
311 i.next(); |
306 CWNetwork *apNetwork = [apArray objectAtIndex:row]; |
312 wantedNetwork = i.key(); |
307 if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) { |
313 if(id == wantedNetwork) { |
308 |
314 wantedSsid = getSsidFromNetworkName(wantedNetwork); |
309 bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; |
315 break; |
310 |
316 } |
311 if(!result) { |
317 } |
312 emit connectionError(id, ConnectError); |
318 } |
|
319 |
|
320 NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys: |
|
321 [NSNumber numberWithBool:YES], kCWScanKeyMerge, |
|
322 [NSNumber numberWithInteger:100], kCWScanKeyRestTime, |
|
323 qstringToNSString(wantedSsid), kCWScanKeySSID, |
|
324 nil]; |
|
325 |
|
326 |
|
327 NSArray *scanArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]]; |
|
328 if(!err) { |
|
329 for(uint row=0; row < [scanArray count]; row++ ) { |
|
330 CWNetwork *apNetwork = [scanArray objectAtIndex:row]; |
|
331 if(wantedSsid == nsstringToQString([apNetwork ssid])) { |
|
332 |
|
333 if(!using8021X) { |
|
334 SecKeychainAttribute attributes[3]; |
|
335 |
|
336 NSString *account = [apNetwork ssid]; |
|
337 NSString *keyKind = @"AirPort network password"; |
|
338 NSString *keyName = account; |
|
339 |
|
340 attributes[0].tag = kSecAccountItemAttr; |
|
341 attributes[0].data = (void *)[account UTF8String]; |
|
342 attributes[0].length = [account length]; |
|
343 |
|
344 attributes[1].tag = kSecDescriptionItemAttr; |
|
345 attributes[1].data = (void *)[keyKind UTF8String]; |
|
346 attributes[1].length = [keyKind length]; |
|
347 |
|
348 attributes[2].tag = kSecLabelItemAttr; |
|
349 attributes[2].data = (void *)[keyName UTF8String]; |
|
350 attributes[2].length = [keyName length]; |
|
351 |
|
352 SecKeychainAttributeList attributeList = {3,attributes}; |
|
353 |
|
354 SecKeychainSearchRef searchRef; |
|
355 OSErr result = SecKeychainSearchCreateFromAttributes(NULL, kSecGenericPasswordItemClass, &attributeList, &searchRef); |
|
356 |
|
357 NSString *password = @""; |
|
358 SecKeychainItemRef searchItem; |
|
359 |
|
360 if (SecKeychainSearchCopyNext(searchRef, &searchItem) == noErr) { |
|
361 UInt32 realPasswordLength; |
|
362 SecKeychainAttribute attributesW[8]; |
|
363 attributesW[0].tag = kSecAccountItemAttr; |
|
364 SecKeychainAttributeList listW = {1,attributesW}; |
|
365 char *realPassword; |
|
366 OSStatus status = SecKeychainItemCopyContent(searchItem, NULL, &listW, &realPasswordLength,(void **)&realPassword); |
|
367 |
|
368 if (status == noErr) { |
|
369 if (realPassword != NULL) { |
|
370 |
|
371 QByteArray pBuf; |
|
372 pBuf.resize(realPasswordLength); |
|
373 pBuf.prepend(realPassword); |
|
374 pBuf.insert(realPasswordLength,'\0'); |
|
375 |
|
376 password = [NSString stringWithUTF8String:pBuf]; |
|
377 } |
|
378 } |
|
379 |
|
380 CFRelease(searchItem); |
|
381 SecKeychainItemFreeContent(&listW, realPassword); |
313 } else { |
382 } else { |
314 [autoreleasepool release]; |
383 qDebug() << "SecKeychainSearchCopyNext error"; |
315 return; |
|
316 } |
384 } |
|
385 [params setValue: password forKey: kCWAssocKeyPassphrase]; |
|
386 } // end using8021X |
|
387 |
|
388 bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err]; |
|
389 |
|
390 if(!result) { |
|
391 emit connectionError(id, ConnectError); |
|
392 } else { |
|
393 [autoreleasepool release]; |
|
394 return; |
317 } |
395 } |
318 } |
396 } |
319 } |
397 } |
320 } |
398 } else { |
321 index++; |
399 qDebug() <<"ERROR"<< nsstringToQString([err localizedDescription ]); |
322 } |
400 } |
323 |
401 |
324 emit connectionError(id, InterfaceLookupError); |
402 emit connectionError(id, InterfaceLookupError); |
325 #endif |
403 [autoreleasepool release]; |
326 } else { |
404 |
327 // not wifi |
405 } else { |
|
406 // not wifi |
|
407 } |
|
408 #endif |
328 } |
409 } |
329 emit connectionError(id, OperationNotSupported); |
410 emit connectionError(id, OperationNotSupported); |
330 [autoreleasepool release]; |
|
331 } |
411 } |
332 |
412 |
333 void QCoreWlanEngine::disconnectFromId(const QString &id) |
413 void QCoreWlanEngine::disconnectFromId(const QString &id) |
334 { |
414 { |
335 QString interfaceString = getInterfaceFromId(id); |
415 QString interfaceString = getInterfaceFromId(id); |
351 } |
431 } |
352 |
432 |
353 void QCoreWlanEngine::requestUpdate() |
433 void QCoreWlanEngine::requestUpdate() |
354 { |
434 { |
355 getAllScInterfaces(); |
435 getAllScInterfaces(); |
|
436 getUserConfigurations(); |
356 emit configurationsChanged(); |
437 emit configurationsChanged(); |
357 } |
438 } |
358 |
439 |
359 QCoreWlanEngine *QCoreWlanEngine::instance() |
440 QCoreWlanEngine *QCoreWlanEngine::instance() |
360 { |
441 { |
361 return coreWlanEngine(); |
442 return coreWlanEngine(); |
362 } |
443 } |
363 |
444 |
|
445 QString QCoreWlanEngine::getSsidFromNetworkName(const QString &name) |
|
446 { |
|
447 QMapIterator<QString, QMap<QString,QString> > i(userProfiles); |
|
448 while (i.hasNext()) { |
|
449 i.next(); |
|
450 QMap<QString,QString> map = i.value(); |
|
451 QMapIterator<QString, QString> ij(i.value()); |
|
452 while (ij.hasNext()) { |
|
453 ij.next(); |
|
454 if(name == i.key()) { |
|
455 return ij.key(); |
|
456 } |
|
457 } |
|
458 } |
|
459 return QString(); |
|
460 } |
|
461 |
|
462 QString QCoreWlanEngine::getNetworkNameFromSsid(const QString &ssid) |
|
463 { |
|
464 QMapIterator<QString, QMap<QString,QString> > i(userProfiles); |
|
465 while (i.hasNext()) { |
|
466 i.next(); |
|
467 QMap<QString,QString> map = i.value(); |
|
468 QMapIterator<QString, QString> ij(i.value()); |
|
469 while (ij.hasNext()) { |
|
470 ij.next(); |
|
471 if(ij.key() == ssid) { |
|
472 return i.key(); |
|
473 } |
|
474 } |
|
475 } |
|
476 return QString(); |
|
477 } |
|
478 |
364 QList<QNetworkConfigurationPrivate *> QCoreWlanEngine::scanForSsids(const QString &interfaceName) |
479 QList<QNetworkConfigurationPrivate *> QCoreWlanEngine::scanForSsids(const QString &interfaceName) |
365 { |
480 { |
366 QList<QNetworkConfigurationPrivate *> foundConfigs; |
481 QList<QNetworkConfigurationPrivate *> foundConfigs; |
|
482 if(!hasWifi) { |
|
483 return foundConfigs; |
|
484 } |
367 #if defined(MAC_SDK_10_6) |
485 #if defined(MAC_SDK_10_6) |
368 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
486 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
369 |
|
370 CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; |
487 CWInterface *currentInterface = [CWInterface interfaceWithName:qstringToNSString(interfaceName)]; |
|
488 QStringList addedConfigs; |
|
489 |
371 if([currentInterface power]) { |
490 if([currentInterface power]) { |
372 NSError *err = nil; |
491 NSError *err = nil; |
373 NSDictionary *parametersDict = nil; |
492 NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys: |
|
493 [NSNumber numberWithBool:YES], kCWScanKeyMerge, |
|
494 [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType, // get the networks in the scan cache |
|
495 [NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil]; |
374 NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; |
496 NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err]; |
375 |
|
376 CWNetwork *apNetwork; |
497 CWNetwork *apNetwork; |
377 if(!err) { |
498 if(!err) { |
378 for(uint row=0; row < [apArray count]; row++ ) { |
499 for(uint row=0; row < [apArray count]; row++ ) { |
379 NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init]; |
|
380 |
|
381 apNetwork = [apArray objectAtIndex:row]; |
500 apNetwork = [apArray objectAtIndex:row]; |
|
501 |
|
502 QString networkSsid = nsstringToQString([apNetwork ssid]); |
|
503 |
382 QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); |
504 QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); |
383 QString networkSsid = nsstringToQString([apNetwork ssid]); |
|
384 cpPriv->name = networkSsid; |
505 cpPriv->name = networkSsid; |
385 cpPriv->isValid = true; |
506 cpPriv->isValid = true; |
386 cpPriv->id = networkSsid; |
507 cpPriv->id = networkSsid; |
387 cpPriv->internet = true; |
508 cpPriv->internet = true; |
388 cpPriv->bearer = QLatin1String("WLAN"); |
509 cpPriv->bearer = QLatin1String("WLAN"); |
389 cpPriv->type = QNetworkConfiguration::InternetAccessPoint; |
510 cpPriv->type = QNetworkConfiguration::InternetAccessPoint; |
390 cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName); |
511 cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName); |
391 |
512 bool known = isKnownSsid(networkSsid); |
392 if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { |
513 if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { |
393 QString interfaceSsidString = nsstringToQString( [currentInterface ssid]); |
514 if( cpPriv->name == nsstringToQString( [currentInterface ssid])) { |
394 if( cpPriv->name == interfaceSsidString) { |
|
395 cpPriv->state |= QNetworkConfiguration::Active; |
515 cpPriv->state |= QNetworkConfiguration::Active; |
396 } |
516 } |
397 } |
517 } |
|
518 |
398 if(!cpPriv->state) { |
519 if(!cpPriv->state) { |
399 if(isKnownSsid(cpPriv->serviceInterface.name(), networkSsid)) { |
520 if(known) { |
400 cpPriv->state = QNetworkConfiguration::Discovered; |
521 cpPriv->state = QNetworkConfiguration::Discovered; |
401 } else { |
522 } else { |
402 cpPriv->state = QNetworkConfiguration::Defined; |
523 cpPriv->state = QNetworkConfiguration::Undefined; |
403 } |
524 } |
404 } |
|
405 if(!cpPriv->state) { |
|
406 cpPriv->state = QNetworkConfiguration::Undefined; |
|
407 } |
525 } |
408 if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) |
526 if([[apNetwork securityMode ] intValue]== kCWSecurityModeOpen) |
409 cpPriv->purpose = QNetworkConfiguration::PublicPurpose; |
527 cpPriv->purpose = QNetworkConfiguration::PublicPurpose; |
410 else |
528 else |
411 cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; |
529 cpPriv->purpose = QNetworkConfiguration::PrivatePurpose; |
|
530 |
412 foundConfigs.append(cpPriv); |
531 foundConfigs.append(cpPriv); |
413 [looppool release]; |
532 addedConfigs << networkSsid; |
414 } |
533 |
415 } |
534 } //end scanned row |
416 } |
535 } |
|
536 } //end power |
|
537 |
|
538 |
|
539 // add known configurations that are not around. |
|
540 QMapIterator<QString, QMap<QString,QString> > i(userProfiles); |
|
541 while (i.hasNext()) { |
|
542 i.next(); |
|
543 QString networkName = i.key(); |
|
544 |
|
545 if(!addedConfigs.contains(networkName)) { |
|
546 QString interfaceName; |
|
547 QMapIterator<QString, QString> ij(i.value()); |
|
548 while (ij.hasNext()) { |
|
549 ij.next(); |
|
550 interfaceName = ij.value(); |
|
551 } |
|
552 |
|
553 QNetworkConfigurationPrivate* cpPriv = new QNetworkConfigurationPrivate(); |
|
554 cpPriv->name = networkName; |
|
555 cpPriv->isValid = true; |
|
556 cpPriv->id = networkName; |
|
557 cpPriv->internet = true; |
|
558 cpPriv->bearer = QLatin1String("WLAN"); |
|
559 cpPriv->type = QNetworkConfiguration::InternetAccessPoint; |
|
560 cpPriv->serviceInterface = QNetworkInterface::interfaceFromName(interfaceName); |
|
561 QString ssid = getSsidFromNetworkName(networkName); |
|
562 if( [currentInterface.interfaceState intValue] == kCWInterfaceStateRunning) { |
|
563 if( ssid == nsstringToQString( [currentInterface ssid])) { |
|
564 cpPriv->state |= QNetworkConfiguration::Active; |
|
565 } |
|
566 } |
|
567 |
|
568 if( addedConfigs.contains(ssid)) { |
|
569 cpPriv->state |= QNetworkConfiguration::Discovered; |
|
570 } |
|
571 |
|
572 if(!cpPriv->state) { |
|
573 cpPriv->state = QNetworkConfiguration::Defined; |
|
574 } |
|
575 |
|
576 foundConfigs.append(cpPriv); |
|
577 } |
|
578 } |
|
579 |
417 [autoreleasepool drain]; |
580 [autoreleasepool drain]; |
418 #else |
581 #else |
419 Q_UNUSED(interfaceName); |
582 Q_UNUSED(interfaceName); |
420 #endif |
583 #endif |
421 return foundConfigs; |
584 return foundConfigs; |
422 } |
585 } |
423 |
586 |
424 bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) |
587 bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName) |
425 { |
588 { |
426 #if defined(MAC_SDK_10_6) |
589 #if defined(MAC_SDK_10_6) |
427 CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)]; |
590 if([[CWInterface supportedInterfaces] count] > 0 ) { |
428 if([defaultInterface power]) |
591 CWInterface *defaultInterface = [CWInterface interfaceWithName: qstringToNSString(wifiDeviceName)]; |
429 return true; |
592 if([defaultInterface power]) |
|
593 return true; |
|
594 } |
430 #else |
595 #else |
431 Q_UNUSED(wifiDeviceName); |
596 Q_UNUSED(wifiDeviceName); |
432 #endif |
597 #endif |
433 return false; |
598 return false; |
434 } |
599 } |
435 |
600 |
436 bool QCoreWlanEngine::isKnownSsid(const QString &interfaceName, const QString &ssid) |
601 bool QCoreWlanEngine::isKnownSsid( const QString &ssid) |
437 { |
602 { |
438 #if defined(MAC_SDK_10_6) |
603 #if defined(MAC_SDK_10_6) |
439 CWInterface *wifiInterface = [CWInterface interfaceWithName: qstringToNSString(interfaceName)]; |
604 QMapIterator<QString, QMap<QString,QString> > i(userProfiles); |
440 CWConfiguration *userConfig = [wifiInterface configuration]; |
605 while (i.hasNext()) { |
441 NSSet *remNets = [userConfig rememberedNetworks]; |
606 i.next(); |
442 for (CWWirelessProfile *wProfile in remNets) { |
607 QMap<QString,QString> map = i.value(); |
443 if(ssid == nsstringToQString([wProfile ssid])) |
608 if(map.keys().contains(ssid)) { |
444 return true; |
609 return true; |
|
610 } |
445 } |
611 } |
446 #else |
612 #else |
447 Q_UNUSED(interfaceName); |
|
448 Q_UNUSED(ssid); |
613 Q_UNUSED(ssid); |
449 #endif |
614 #endif |
450 return false; |
615 return false; |
451 } |
616 } |
452 |
617 |
542 |
707 |
543 CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, kCFRunLoopDefaultMode); |
708 CFRunLoopAddSource(CFRunLoopGetCurrent(), runloopSource, kCFRunLoopDefaultMode); |
544 return; |
709 return; |
545 } |
710 } |
546 |
711 |
|
712 void QCoreWlanEngine::getUserConfigurations() |
|
713 { |
|
714 #ifdef MAC_SDK_10_6 |
|
715 NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; |
|
716 userProfiles.clear(); |
|
717 |
|
718 NSArray *wifiInterfaces = [CWInterface supportedInterfaces]; |
|
719 for(uint row=0; row < [wifiInterfaces count]; row++ ) { |
|
720 |
|
721 CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]]; |
|
722 NSString *nsInterfaceName = [wifiInterface name]; |
|
723 // add user configured system networks |
|
724 SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil); |
|
725 NSDictionary *airportPlist = (NSDictionary *)SCDynamicStoreCopyValue(dynRef, (CFStringRef)[[NSString stringWithFormat:@"Setup:/Network/Interface/%@/AirPort", nsInterfaceName] autorelease]); |
|
726 CFRelease(dynRef); |
|
727 |
|
728 NSDictionary *prefNetDict = [airportPlist objectForKey:@"PreferredNetworks"]; |
|
729 |
|
730 NSArray *thisSsidarray = [prefNetDict valueForKey:@"SSID_STR"]; |
|
731 for(NSString *ssidkey in thisSsidarray) { |
|
732 QString thisSsid = nsstringToQString(ssidkey); |
|
733 if(!userProfiles.contains(thisSsid)) { |
|
734 QMap <QString,QString> map; |
|
735 map.insert(thisSsid, nsstringToQString(nsInterfaceName)); |
|
736 userProfiles.insert(thisSsid, map); |
|
737 } |
|
738 } |
|
739 CFRelease(airportPlist); |
|
740 |
|
741 // 802.1X user profiles |
|
742 QString userProfilePath = QDir::homePath() + "/Library/Preferences/com.apple.eap.profiles.plist"; |
|
743 NSDictionary* eapDict = [[NSDictionary alloc] initWithContentsOfFile:qstringToNSString(userProfilePath)]; |
|
744 NSString *profileStr= @"Profiles"; |
|
745 NSString *nameStr = @"UserDefinedName"; |
|
746 NSString *networkSsidStr = @"Wireless Network"; |
|
747 for (id profileKey in eapDict) { |
|
748 if ([profileStr isEqualToString:profileKey]) { |
|
749 NSDictionary *itemDict = [eapDict objectForKey:profileKey]; |
|
750 for (id itemKey in itemDict) { |
|
751 |
|
752 NSInteger dictSize = [itemKey count]; |
|
753 id objects[dictSize]; |
|
754 id keys[dictSize]; |
|
755 |
|
756 [itemKey getObjects:objects andKeys:keys]; |
|
757 QString networkName; |
|
758 QString ssid; |
|
759 for(int i = 0; i < dictSize; i++) { |
|
760 if([nameStr isEqualToString:keys[i]]) { |
|
761 networkName = nsstringToQString(objects[i]); |
|
762 } |
|
763 if([networkSsidStr isEqualToString:keys[i]]) { |
|
764 ssid = nsstringToQString(objects[i]); |
|
765 } |
|
766 if(!userProfiles.contains(networkName) |
|
767 && !ssid.isEmpty()) { |
|
768 QMap<QString,QString> map; |
|
769 map.insert(ssid, nsstringToQString(nsInterfaceName)); |
|
770 userProfiles.insert(networkName, map); |
|
771 } |
|
772 } |
|
773 } |
|
774 [itemDict release]; |
|
775 } |
|
776 } |
|
777 [eapDict release]; |
|
778 } |
|
779 [autoreleasepool release]; |
|
780 #endif |
|
781 |
|
782 } |
547 |
783 |
548 #include "moc_qcorewlanengine_mac_p.cpp" |
784 #include "moc_qcorewlanengine_mac_p.cpp" |
549 |
785 |
550 QTM_END_NAMESPACE |
786 QTM_END_NAMESPACE |
551 |
|