diff options
Diffstat (limited to 'src/network/bearer')
-rw-r--r-- | src/network/bearer/qbearerengine.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerengine_p.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerplugin.cpp | 4 | ||||
-rw-r--r-- | src/network/bearer/qbearerplugin_p.h | 5 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.cpp | 5 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.cpp | 20 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfigmanager_p.h | 15 | ||||
-rw-r--r-- | src/network/bearer/qnetworkconfiguration_p.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.cpp | 8 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession.h | 4 | ||||
-rw-r--r-- | src/network/bearer/qnetworksession_p.h | 8 |
12 files changed, 70 insertions, 15 deletions
diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index c42e2d2..2f8624a 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -41,6 +41,8 @@ #include "qbearerengine_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEngine::QBearerEngine(QObject *parent) @@ -110,4 +112,6 @@ bool QBearerEngine::configurationsInUse() const #include "moc_qbearerengine_p.cpp" +#endif // QT_NO_BEARERMANAGEMENT + QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h index fd4bf87..70aa5fa 100644 --- a/src/network/bearer/qbearerengine_p.h +++ b/src/network/bearer/qbearerengine_p.h @@ -65,6 +65,8 @@ #include <QtCore/qsharedpointer.h> #include <QtCore/qmutex.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfiguration; @@ -110,4 +112,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 4509fd0..a5e8918 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -43,6 +43,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) @@ -55,3 +57,5 @@ QBearerEnginePlugin::~QBearerEnginePlugin() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h index 36709c2..9652f14 100644 --- a/src/network/bearer/qbearerplugin_p.h +++ b/src/network/bearer/qbearerplugin_p.h @@ -58,6 +58,8 @@ #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -89,5 +91,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif +#endif // QT_NO_BEARERMANAGEMENT +#endif diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 1ba5dab..102b347 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -46,6 +46,8 @@ #include <QtCore/qstringlist.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); @@ -278,7 +280,7 @@ bool QNetworkConfigurationManager::isOnline() const */ QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const { - return connManager()->capFlags; + return connManager()->capabilities(); } /*! @@ -304,3 +306,4 @@ void QNetworkConfigurationManager::updateConfigurations() QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 79bb27c..3e44be1 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -49,6 +49,8 @@ #include <QtCore/qobject.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER @@ -111,5 +113,7 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGER_H diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c665fa2..a651dd1 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -50,13 +50,15 @@ #include <QtCore/qthread.h> #include <QtCore/private/qcoreapplication_p.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() -: capFlags(0), mutex(QMutex::Recursive), pollTimer(0), forcedPolling(0), firstUpdate(true) +: pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); @@ -265,6 +267,18 @@ bool QNetworkConfigurationManagerPrivate::isOnline() return !onlineConfigurations.isEmpty(); } +QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() +{ + QMutexLocker locker(&mutex); + + QNetworkConfigurationManager::Capabilities capFlags; + + foreach (QBearerEngine *engine, sessionEngines) + capFlags |= engine->capabilities(); + + return capFlags; +} + void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { QMutexLocker locker(&mutex); @@ -367,8 +381,6 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - capFlags |= engine->capabilities(); - QMetaObject::invokeMethod(engine, "requestUpdate"); } } @@ -493,3 +505,5 @@ void QNetworkConfigurationManagerPrivate::disablePolling() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index dba9d2c..0649031 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -59,6 +59,8 @@ #include <QtCore/qmutex.h> #include <QtCore/qset.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngine; @@ -78,7 +80,7 @@ public: bool isOnline(); - QNetworkConfigurationManager::Capabilities capFlags; + QNetworkConfigurationManager::Capabilities capabilities(); void performAsyncConfigurationUpdate(); @@ -102,19 +104,18 @@ Q_SIGNALS: void abort(); private: - QMutex mutex; - QTimer *pollTimer; + QMutex mutex; + QList<QBearerEngine *> sessionEngines; QSet<QString> onlineConfigurations; - QSet<int> updatingEngines; - bool updating; - QSet<int> pollingEngines; + QSet<int> updatingEngines; int forcedPolling; + bool updating; bool firstUpdate; @@ -130,4 +131,6 @@ Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManag QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index ccbe670..6e146e0 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -84,6 +84,8 @@ public: return bearer; } + QList<QNetworkConfigurationPrivatePointer> serviceNetworkMembers; + mutable QMutex mutex; QString bearer; @@ -94,8 +96,6 @@ public: QNetworkConfiguration::Type type; QNetworkConfiguration::Purpose purpose; - QList<QNetworkConfigurationPrivatePointer> serviceNetworkMembers; - bool isValid; bool roamingSupported; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 1bba56f..1ed6cbb 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -47,6 +47,8 @@ #include "qnetworkconfigmanager_p.h" #include "qnetworksession_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE /*! @@ -225,6 +227,10 @@ QT_BEGIN_NAMESPACE QNetworkSession::QNetworkSession(const QNetworkConfiguration& connectionConfig, QObject* parent) : QObject(parent), d(0) { + // invalid configuration + if (connectionConfig.identifier().isNull()) + return; + foreach (QBearerEngine *engine, qNetworkConfigurationManagerPrivate()->engines()) { if (engine->hasIdentifier(connectionConfig.identifier())) { d = engine->createSessionBackend(); @@ -702,3 +708,5 @@ void QNetworkSession::disconnectNotify(const char *signal) #include "moc_qnetworksession.cpp" QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 2911d0a..e7fffac 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -48,6 +48,8 @@ #include <QtCore/qvariant.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + #if defined(Q_OS_WIN) && defined(interface) #undef interface #endif @@ -149,4 +151,6 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSION_H diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a341eaf..c7b5718 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -56,6 +56,8 @@ #include "qnetworksession.h" #include "qnetworkconfiguration_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject @@ -126,6 +128,8 @@ Q_SIGNALS: void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); protected: + QNetworkSession *q; + // The config set on QNetworkSession. QNetworkConfiguration publicConfig; @@ -140,11 +144,11 @@ protected: QNetworkSession::State state; bool isOpen; - - QNetworkSession *q; }; QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSIONPRIVATE_H |