diff options
Diffstat (limited to 'src/plugins/bearer')
-rw-r--r-- | src/plugins/bearer/connman/qconnmanservice_linux.cpp | 1 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/corewlan.pro | 3 | ||||
-rw-r--r-- | src/plugins/bearer/corewlan/qcorewlanengine.mm | 4 | ||||
-rw-r--r-- | src/plugins/bearer/platformdefs_win.h | 5 | ||||
-rw-r--r-- | src/plugins/bearer/qbearerengine_impl.h | 7 | ||||
-rw-r--r-- | src/plugins/bearer/qnetworksession_impl.cpp | 67 | ||||
-rw-r--r-- | src/plugins/bearer/qnetworksession_impl.h | 23 |
7 files changed, 42 insertions, 68 deletions
diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index ac88a1c..02b5eb9 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -870,7 +870,6 @@ quint64 QConnmanCounterInterface::getTimeOnline() return 0; } - ///////////////////////////////////////// QConnmanDBusHelper::QConnmanDBusHelper(QObject * parent) : QObject(parent) diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 9cb3955..90078e9 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -16,9 +16,10 @@ HEADERS += qcorewlanengine.h \ ../qbearerengine_impl.h SOURCES += main.cpp \ - qcorewlanengine.mm \ ../qnetworksession_impl.cpp +OBJECTIVE_SOURCES += qcorewlanengine.mm + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer INSTALLS += target diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 533a7cd..07e74fe 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -864,7 +864,7 @@ quint64 QCoreWlanEngine::bytesReceived(const QString &id) return getBytes(interfaceStr,true); } -quint64 QCoreWlanEngine::startTime(const QString &id) +quint64 QCoreWlanEngine::startTime(const QString &identifier) { QMutexLocker locker(&mutex); NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init]; @@ -899,7 +899,7 @@ quint64 QCoreWlanEngine::startTime(const QString &id) for(int i = 0; i < dictSize; i++) { if([ssidStr isEqualToString:keys[i]]) { const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_NSStringToQString(objects[i]))); - if(ident == id) { + if(ident == identifier) { ok = true; } } diff --git a/src/plugins/bearer/platformdefs_win.h b/src/plugins/bearer/platformdefs_win.h index 89d3384..b102183 100644 --- a/src/plugins/bearer/platformdefs_win.h +++ b/src/plugins/bearer/platformdefs_win.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE #define NS_NLA 15 +#ifndef NLA_NAMESPACE_GUID enum NLA_BLOB_DATA_TYPE { NLA_RAW_DATA = 0, NLA_INTERFACE = 1, @@ -115,6 +116,8 @@ struct NLA_BLOB { } ICS; } data; }; +#endif // NLA_NAMESPACE_GUID + #endif enum NDIS_MEDIUM { @@ -135,4 +138,4 @@ enum NDIS_PHYSICAL_MEDIUM { QT_END_NAMESPACE -#endif +#endif // QPLATFORMDEFS_WIN_H diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 601143e..ac96207 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -60,8 +60,8 @@ public: DisconnectionError, }; - QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) { } - ~QBearerEngineImpl() { } + QBearerEngineImpl(QObject *parent = 0) : QBearerEngine(parent) {} + ~QBearerEngineImpl() {} virtual void connectToId(const QString &id) = 0; virtual void disconnectFromId(const QString &id) = 0; @@ -81,4 +81,5 @@ Q_SIGNALS: QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT -#endif + +#endif // QBEARERENGINE_IMPL_H diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 5c9e234..c41e3e0 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -45,9 +45,10 @@ #include <QtNetwork/qnetworksession.h> #include <QtNetwork/private/qnetworkconfigmanager_p.h> -#include <QtCore/qstringlist.h> +#include <QtCore/qdatetime.h> #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> +#include <QtCore/qstringlist.h> #ifndef QT_NO_BEARERMANAGEMENT @@ -71,10 +72,11 @@ class QNetworkSessionManagerPrivate : public QObject Q_OBJECT public: - QNetworkSessionManagerPrivate(QObject *parent = 0); - ~QNetworkSessionManagerPrivate(); + QNetworkSessionManagerPrivate(QObject *parent = 0) : QObject(parent) {} + ~QNetworkSessionManagerPrivate() {} - void forceSessionClose(const QNetworkConfiguration &config); + inline void forceSessionClose(const QNetworkConfiguration &config) + { emit forcedSessionClose(config); } Q_SIGNALS: void forcedSessionClose(const QNetworkConfiguration &config); @@ -84,20 +86,6 @@ Q_SIGNALS: Q_GLOBAL_STATIC(QNetworkSessionManagerPrivate, sessionManager); -QNetworkSessionManagerPrivate::QNetworkSessionManagerPrivate(QObject *parent) -: QObject(parent) -{ -} - -QNetworkSessionManagerPrivate::~QNetworkSessionManagerPrivate() -{ -} - -void QNetworkSessionManagerPrivate::forceSessionClose(const QNetworkConfiguration &config) -{ - emit forcedSessionClose(config); -} - void QNetworkSessionPrivateImpl::syncStateWithInterface() { connect(sessionManager(), SIGNAL(forcedSessionClose(QNetworkConfiguration)), @@ -108,8 +96,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() state = QNetworkSession::Invalid; lastError = QNetworkSession::UnknownSessionError; - qRegisterMetaType<QBearerEngineImpl::ConnectionError> - ("QBearerEngineImpl::ConnectionError"); + qRegisterMetaType<QBearerEngineImpl::ConnectionError>("QBearerEngineImpl::ConnectionError"); switch (publicConfig.type()) { case QNetworkConfiguration::InternetAccessPoint: @@ -145,9 +132,8 @@ void QNetworkSessionPrivateImpl::open() lastError = QNetworkSession::OperationNotSupportedError; emit QNetworkSessionPrivate::error(lastError); } else if (!isOpen) { - if ((activeConfig.state() & QNetworkConfiguration::Discovered) != - QNetworkConfiguration::Discovered) { - lastError =QNetworkSession::InvalidConfigurationError; + if ((activeConfig.state() & QNetworkConfiguration::Discovered) != QNetworkConfiguration::Discovered) { + lastError = QNetworkSession::InvalidConfigurationError; state = QNetworkSession::Invalid; emit stateChanged(state); emit QNetworkSessionPrivate::error(lastError); @@ -221,11 +207,10 @@ void QNetworkSessionPrivateImpl::reject() #ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { - if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) + if (!engine || state != QNetworkSession::Connected || !publicConfig.isValid()) return QNetworkInterface(); QString interface = engine->getInterfaceFromId(activeConfig.identifier()); - if (interface.isEmpty()) return QNetworkInterface(); return QNetworkInterface::interfaceFromName(interface); @@ -237,10 +222,7 @@ QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString &key) const if (key == QLatin1String("AutoCloseSessionTimeout")) { if (engine && engine->requiresPolling() && !(engine->capabilities() & QNetworkConfigurationManager::CanStartAndStopInterfaces)) { - if (sessionTimeout >= 0) - return sessionTimeout * 10000; - else - return -1; + return sessionTimeout >= 0 ? sessionTimeout * 10000 : -1; } } @@ -278,7 +260,8 @@ QString QNetworkSessionPrivateImpl::errorString() const return tr("The specified configuration cannot be used."); case QNetworkSession::RoamingError: return tr("Roaming was aborted or is not possible."); - + default: + break; } return QString(); @@ -293,24 +276,21 @@ quint64 QNetworkSessionPrivateImpl::bytesWritten() const { if (engine && state == QNetworkSession::Connected) return engine->bytesWritten(activeConfig.identifier()); - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::bytesReceived() const { if (engine && state == QNetworkSession::Connected) return engine->bytesReceived(activeConfig.identifier()); - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } quint64 QNetworkSessionPrivateImpl::activeTime() const { if (state == QNetworkSession::Connected && startTime != Q_UINT64_C(0)) return QDateTime::currentDateTime().toTime_t() - startTime; - else - return Q_UINT64_C(0); + return Q_UINT64_C(0); } void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() @@ -323,17 +303,15 @@ void QNetworkSessionPrivateImpl::updateStateFromServiceNetwork() if (activeConfig != config) { if (engine) { - disconnect(engine, - SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), - this, - SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); + disconnect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError))); } activeConfig = config; engine = getEngineFromId(activeConfig.identifier()); + if (engine) { - connect(engine, - SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), + connect(engine, SIGNAL(connectionError(QString,QBearerEngineImpl::ConnectionError)), this, SLOT(connectionError(QString,QBearerEngineImpl::ConnectionError)), Qt::QueuedConnection); } @@ -362,7 +340,6 @@ void QNetworkSessionPrivateImpl::updateStateFromActiveConfig() return; QNetworkSession::State oldState = state; - state = engine->sessionStateForId(activeConfig.identifier()); bool oldActive = isOpen; @@ -410,8 +387,7 @@ void QNetworkSessionPrivateImpl::forcedSessionClose(const QNetworkConfiguration } } -void QNetworkSessionPrivateImpl::connectionError(const QString &id, - QBearerEngineImpl::ConnectionError error) +void QNetworkSessionPrivateImpl::connectionError(const QString &id, QBearerEngineImpl::ConnectionError error) { if (activeConfig.identifier() == id) { networkConfigurationsChanged(); @@ -443,4 +419,3 @@ void QNetworkSessionPrivateImpl::decrementTimeout() QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT - diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index ab85869..644565a 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -58,8 +58,6 @@ #include <QtNetwork/private/qnetworkconfigmanager_p.h> #include <QtNetwork/private/qnetworksession_p.h> -#include <QtCore/qdatetime.h> - #ifndef QT_NO_BEARERMANAGEMENT QT_BEGIN_NAMESPACE @@ -69,15 +67,13 @@ class QBearerEngineImpl; class QNetworkSessionPrivateImpl : public QNetworkSessionPrivate { Q_OBJECT + public: QNetworkSessionPrivateImpl() - : startTime(0), sessionTimeout(-1) - { - } - + : startTime(0), sessionTimeout(-1) + {} ~QNetworkSessionPrivateImpl() - { - } + {} //called by QNetworkSession constructor and ensures //that the state is immediately updated (w/o actually opening @@ -106,10 +102,6 @@ public: quint64 bytesReceived() const; quint64 activeTime() const; -private: - void updateStateFromServiceNetwork(); - void updateStateFromActiveConfig(); - private Q_SLOTS: void networkConfigurationsChanged(); void configurationChanged(QNetworkConfigurationPrivatePointer config); @@ -118,6 +110,10 @@ private Q_SLOTS: void decrementTimeout(); private: + void updateStateFromServiceNetwork(); + void updateStateFromActiveConfig(); + +private: QBearerEngineImpl *engine; quint64 startTime; @@ -133,5 +129,4 @@ QT_END_NAMESPACE #endif // QT_NO_BEARERMANAGEMENT -#endif //QNETWORKSESSION_IMPL_H - +#endif // QNETWORKSESSION_IMPL_H |