diff options
author | Lorn Potter <lorn.potter@nokia.com> | 2010-06-06 23:30:41 (GMT) |
---|---|---|
committer | Lorn Potter <lorn.potter@nokia.com> | 2010-06-06 23:30:41 (GMT) |
commit | fad226e8a6354d89fad3dbee5ab6dd07e80534bc (patch) | |
tree | e8e2f7d566d8103ad1e2c8751ca22a625cb279f0 | |
parent | caaf44f7a4f22189248d43a3074b4fba90df36a6 (diff) | |
download | Qt-fad226e8a6354d89fad3dbee5ab6dd07e80534bc.zip Qt-fad226e8a6354d89fad3dbee5ab6dd07e80534bc.tar.gz Qt-fad226e8a6354d89fad3dbee5ab6dd07e80534bc.tar.bz2 |
make corewlan more namespace friendly
-rw-r--r-- | src/plugins/bearer/corewlan/qcorewlanengine.mm | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index a9cb65b..6ba9504 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -70,9 +70,10 @@ #include <net/if.h> #include <ifaddrs.h> -@interface QNSListener : NSObject + +@interface QT_MANGLE_NAMESPACE(QNSListener) : NSObject { - NSNotificationCenter *center; + NSNotificationCenter *notificationCenter; CWInterface *currentInterface; QCoreWlanEngine *engine; NSLock *locker; @@ -86,16 +87,16 @@ @end -@implementation QNSListener +@implementation QT_MANGLE_NAMESPACE(QNSListener) @synthesize engine; - (id) init { [locker lock]; QMacCocoaAutoReleasePool pool; - center = [NSNotificationCenter defaultCenter]; + notificationCenter = [NSNotificationCenter defaultCenter]; currentInterface = [CWInterface interfaceWithName:nil]; - [center addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil]; + [notificationCenter addObserver:self selector:@selector(notificationHandler:) name:kCWPowerDidChangeNotification object:nil]; [locker unlock]; return self; } @@ -116,7 +117,7 @@ -(void)remove { [locker lock]; - [center removeObserver:self]; + [notificationCenter removeObserver:self]; [locker unlock]; } @@ -126,7 +127,7 @@ } @end -QNSListener *listener = 0; +QT_MANGLE_NAMESPACE(QNSListener) *listener = 0; QT_BEGIN_NAMESPACE @@ -296,6 +297,9 @@ void QScanThread::getUserConfigurations() for(uint row=0; row < [wifiInterfaces count]; row++ ) { CWInterface *wifiInterface = [CWInterface interfaceWithName: [wifiInterfaces objectAtIndex:row]]; + if ( ![wifiInterface power] ) + continue; + NSString *nsInterfaceName = [wifiInterface name]; // add user configured system networks SCDynamicStoreRef dynRef = SCDynamicStoreCreate(kCFAllocatorSystemDefault, (CFStringRef)@"Qt corewlan", nil, nil); @@ -430,7 +434,7 @@ void QCoreWlanEngine::initialize() QMacCocoaAutoReleasePool pool; if([[CWInterface supportedInterfaces] count] > 0 && !listener) { - listener = [[QNSListener alloc] init]; + listener = [[QT_MANGLE_NAMESPACE(QNSListener) alloc] init]; listener.engine = this; hasWifi = true; } else { @@ -785,6 +789,11 @@ void QCoreWlanEngine::networksChanged() changed = true; } + if (ptr->bearer != cpPriv->bearer) { + ptr->bearer = cpPriv->bearer; + changed = true; + } + if (ptr->state != cpPriv->state) { ptr->state = cpPriv->state; changed = true; |