diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-07-28 02:12:06 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-07-28 04:43:04 (GMT) |
commit | a259bd2841b3ce7e34bb18990332bd497f97cdd0 (patch) | |
tree | acd8e37cf2797bea362e03dabf87d7752657439b /src/plugins | |
parent | 6ca74af0121f6038a20bca363deaf5c3e2d760f9 (diff) | |
download | Qt-a259bd2841b3ce7e34bb18990332bd497f97cdd0.zip Qt-a259bd2841b3ce7e34bb18990332bd497f97cdd0.tar.gz Qt-a259bd2841b3ce7e34bb18990332bd497f97cdd0.tar.bz2 |
Cherry pick fix for MOBILITY-1194 from Qt Mobility.
f84bb604d745c512db8d53410c5fec835309f85e
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/bearer/symbian/qnetworksession_impl.cpp | 22 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/qnetworksession_impl.h | 3 | ||||
-rw-r--r-- | src/plugins/bearer/symbian/symbianengine.cpp | 67 |
3 files changed, 68 insertions, 24 deletions
diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 225161d..1de4c0f 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -146,6 +146,23 @@ void QNetworkSessionPrivateImpl::configurationRemoved(QNetworkConfigurationPriva } } +void QNetworkSessionPrivateImpl::configurationAdded(QNetworkConfigurationPrivatePointer config) +{ + Q_UNUSED(config); + // If session is based on service network, some other app may create new access points + // to the SNAP --> synchronize session's state with that of interface's. + if (!publicConfig.isValid() || publicConfig.type() != QNetworkConfiguration::ServiceNetwork) + return; + +#ifdef QT_BEARERMGMT_SYMBIAN_DEBUG + qDebug() << "QNS this : " << QString::number((uint)this) << " - " + << "configurationAdded IAP: " + << toSymbianConfig(privateConfiguration(config))->numericIdentifier(); +#endif + + syncStateWithInterface(); +} + // Function sets the state of the session to match the state // of the underlying interface (the configuration this session is based on) void QNetworkSessionPrivateImpl::syncStateWithInterface() @@ -160,6 +177,11 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() // this session is based on is removed, session knows to enter Invalid -state. QObject::connect(engine, SIGNAL(configurationRemoved(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer))); + // Connect to configuration additions, so that in case a configuration is added + // in a SNAP this session is based on, the session knows to synch its state with its + // interface. + QObject::connect(engine, SIGNAL(configurationAdded(QNetworkConfigurationPrivatePointer)), + this, SLOT(configurationAdded(QNetworkConfigurationPrivatePointer))); } // Start listening IAP state changes from QNetworkConfigurationManagerPrivate iHandleStateNotificationsFromManager = true; diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 73e6cab..aac9321 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -134,7 +134,8 @@ protected: // From CActive private Q_SLOTS: void configurationStateChanged(TUint32 accessPointId, TUint32 connMonId, QNetworkSession::State newState); void configurationRemoved(QNetworkConfigurationPrivatePointer config); - + void configurationAdded(QNetworkConfigurationPrivatePointer config); + private: TUint iapClientCount(TUint aIAPId) const; quint64 transferredData(TUint dataType) const; diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 664cb6e..f87ea3c 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -291,14 +291,17 @@ void SymbianEngine::updateConfigurationsL() if (error == KErrNone) { QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); - - mutex.unlock(); - // Emit configuration added. Connected slots may throw execptions - // which propagate here --> must be converted to leaves (standard - // std::exception would cause any TRAP trapping this function to terminate - // program). - QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); - mutex.lock(); + if (!iFirstUpdate) { + // Emit configuration added. Connected slots may throw execptions + // which propagate here --> must be converted to leaves (standard + // std::exception would cause any TRAP trapping this function to terminate + // program). + QT_TRYCATCH_LEAVING(updateActiveAccessPoints()); + updateStatesToSnaps(); + mutex.unlock(); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); + mutex.lock(); + } } } CleanupStack::PopAndDestroy(&connectionMethod); @@ -346,10 +349,13 @@ void SymbianEngine::updateConfigurationsL() QNetworkConfigurationPrivatePointer ptr(cpPriv); snapConfigurations.insert(ident, ptr); - - mutex.unlock(); - QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); - mutex.lock(); + if (!iFirstUpdate) { + QT_TRYCATCH_LEAVING(updateActiveAccessPoints()); + updateStatesToSnaps(); + mutex.unlock(); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); + mutex.lock(); + } } // Loop through all connection methods in this SNAP @@ -362,19 +368,23 @@ void SymbianEngine::updateConfigurationsL() QString iface = QT_BEARERMGMT_CONFIGURATION_IAP_PREFIX+QString::number(qHash(iapId)); // Check that IAP can be found from accessPointConfigurations list QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(iface); - if (ptr) { - knownConfigs.removeOne(iface); - } else { + if (!ptr) { SymbianNetworkConfigurationPrivate *cpPriv = NULL; TRAP(error, cpPriv = configFromConnectionMethodL(connectionMethod)); if (error == KErrNone) { ptr = QNetworkConfigurationPrivatePointer(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); - mutex.unlock(); - QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); - mutex.lock(); + if (!iFirstUpdate) { + QT_TRYCATCH_LEAVING(updateActiveAccessPoints()); + updateStatesToSnaps(); + mutex.unlock(); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); + mutex.lock(); + } } + } else { + knownConfigs.removeOne(iface); } if (ptr) { @@ -397,6 +407,9 @@ void SymbianEngine::updateConfigurationsL() privSNAP->roamingSupported = privSNAP->serviceNetworkMembers.count() > 1; snapConfigLocker.unlock(); + + updateStatesToSnaps(); + mutex.unlock(); QT_TRYCATCH_LEAVING(emit configurationChanged(privSNAP)); mutex.lock(); @@ -422,10 +435,13 @@ void SymbianEngine::updateConfigurationsL() if (readNetworkConfigurationValuesFromCommsDb(apId, cpPriv)) { QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ident, ptr); - - mutex.unlock(); - QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); - mutex.lock(); + if (!iFirstUpdate) { + QT_TRYCATCH_LEAVING(updateActiveAccessPoints()); + updateStatesToSnaps(); + mutex.unlock(); + QT_TRYCATCH_LEAVING(emit configurationAdded(ptr)); + mutex.lock(); + } } else { delete cpPriv; } @@ -478,6 +494,10 @@ void SymbianEngine::updateConfigurationsL() stopCommsDatabaseNotifications(); TRAP_IGNORE(defaultConfig = defaultConfigurationL()); startCommsDatabaseNotifications(); + +#ifdef SNAP_FUNCTIONALITY_AVAILABLE + updateStatesToSnaps(); +#endif } #ifdef SNAP_FUNCTIONALITY_AVAILABLE @@ -711,7 +731,8 @@ void SymbianEngine::updateActiveAccessPoints() #endif if (ptr) { iConnectionMonitor.GetIntAttribute(connectionId, subConnectionCount, KConnectionStatus, connectionStatus, status); - User::WaitForRequest(status); + User::WaitForRequest(status); + if (connectionStatus == KLinkLayerOpen) { online = true; inactiveConfigs.removeOne(ident); |