diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-25 00:56:37 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-03-25 05:53:00 (GMT) |
commit | 3ccbfc46ef2647421608522aa38c12958e4ea3c3 (patch) | |
tree | 874721600ffa38985ee99a98b6ce5043eae122a3 | |
parent | af5501d2bef7242d3949d639e2bab7e326654bb2 (diff) | |
download | Qt-3ccbfc46ef2647421608522aa38c12958e4ea3c3.zip Qt-3ccbfc46ef2647421608522aa38c12958e4ea3c3.tar.gz Qt-3ccbfc46ef2647421608522aa38c12958e4ea3c3.tar.bz2 |
Compile with QT_NO_NETWORKINTERFACE defined.
20 files changed, 67 insertions, 24 deletions
diff --git a/examples/network/bearercloud/bearercloud.h b/examples/network/bearercloud/bearercloud.h index f09cb53..09de4c6 100644 --- a/examples/network/bearercloud/bearercloud.h +++ b/examples/network/bearercloud/bearercloud.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include <qnetworkconfigmanager.h> +#include <QNetworkConfigurationManager> #include <QGraphicsScene> #include <QMap> diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 81e13a6..d041034 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -253,10 +253,12 @@ void Cloud::stateChanged(QNetworkSession::State state) else tooltip += tr("<b>%1</b><br>").arg(configuration.name()); +#ifndef QT_NO_NETWORKINTERFACE const QNetworkInterface interface = session->interface(); if (interface.isValid()) tooltip += tr("<br>Interface: %1").arg(interface.humanReadableName()); tooltip += tr("<br>Id: %1").arg(configuration.identifier()); +#endif const QString bearerName = configuration.bearerName(); if (!bearerName.isEmpty()) diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h index 5d4e52a..9e25fb6 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include <qnetworkconfiguration.h> -#include <qnetworksession.h> +#include <QNetworkConfiguration> +#include <QNetworkSession> #include <QGraphicsItem> QT_USE_NAMESPACE diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 46ffb20..655c1ac 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -47,6 +47,13 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren { setupUi(this); +#ifdef QT_NO_NETWORKINTERFACE + interfaceName->setVisible(false); + interfaceNameLabel->setVisible(false); + interfaceGuid->setVisible(false); + interfaceGuidLabel->setVisible(false); +#endif + session = new QNetworkSession(config, this); connect(session, SIGNAL(stateChanged(QNetworkSession::State)), @@ -102,8 +109,10 @@ void SessionWidget::updateSession() bearer->setText(c.bearerName()); } +#ifndef QT_NO_NETWORKINTERFACE interfaceName->setText(session->interface().humanReadableName()); interfaceGuid->setText(session->interface().name()); +#endif } void SessionWidget::openSession() diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index 8ec8152..dba9d2c 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -57,6 +57,7 @@ #include "qnetworkconfiguration_p.h" #include <QtCore/qmutex.h> +#include <QtCore/qset.h> QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 07b472e..ccbe670 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -57,7 +57,6 @@ #include <QtCore/qshareddata.h> #include <QtCore/qmutex.h> -#include <QtNetwork/QNetworkInterface> QT_BEGIN_NAMESPACE diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index ca21dcd..1bba56f 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -370,6 +370,7 @@ QNetworkConfiguration QNetworkSession::configuration() const return d ? d->publicConfig : QNetworkConfiguration(); } +#ifndef QT_NO_NETWORKINTERFACE /*! Returns the network interface that is used by this session. @@ -386,6 +387,7 @@ QNetworkInterface QNetworkSession::interface() const { return d ? d->currentInterface() : QNetworkInterface(); } +#endif /*! Returns true if this session is open. If the number of all open sessions is greater than diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 1f25088..596f527 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -86,7 +86,9 @@ public: bool isOpen() const; QNetworkConfiguration configuration() const; +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface interface() const; +#endif State state() const; SessionError error() const; diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index 76691b3..a341eaf 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -56,8 +56,6 @@ #include "qnetworksession.h" #include "qnetworkconfiguration_p.h" -#include <QNetworkInterface> - QT_BEGIN_NAMESPACE class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject @@ -82,7 +80,9 @@ public: //notification hooks to discover future state changes. virtual void syncStateWithInterface() = 0; +#ifndef QT_NO_NETWORKINTERFACE virtual QNetworkInterface currentInterface() const = 0; +#endif virtual QVariant sessionProperty(const QString& key) const = 0; virtual void setSessionProperty(const QString& key, const QVariant& value) = 0; diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index b2d1b1f..d65025b 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -66,6 +66,7 @@ QT_BEGIN_NAMESPACE +#ifndef QT_NO_NETWORKINTERFACE static QString qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WIN32 @@ -139,6 +140,7 @@ static QString qGetInterfaceType(const QString &interface) return QLatin1String("Unknown"); } +#endif QGenericEngine::QGenericEngine(QObject *parent) : QBearerEngineImpl(parent) @@ -180,6 +182,7 @@ void QGenericEngine::requestUpdate() void QGenericEngine::doRequestUpdate() { +#ifndef QT_NO_NETWORKINTERFACE QMutexLocker locker(&mutex); // Immediately after connecting with a wireless access point @@ -290,6 +293,8 @@ void QGenericEngine::doRequestUpdate() } locker.unlock(); +#endif + emit updateCompleted(); } diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 06e0529..5bf95dc 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -1110,7 +1110,7 @@ void QNetworkSessionPrivateImpl::reject() { } - +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { if (!publicConfig.isValid() || state != QNetworkSession::Connected) @@ -1121,7 +1121,7 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const return QNetworkInterface::interfaceFromName(currentNetworkInterface); } - +#endif void QNetworkSessionPrivateImpl::setSessionProperty(const QString& key, const QVariant& value) { diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index 587e6dc..c02faac 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -56,11 +56,6 @@ #include <QtNetwork/private/qnetworksession_p.h> #include <QtNetwork/qnetworkconfigmanager.h> -//#include "qnetworkconfigmanager_maemo_p.h" -//#include "qnetworksession.h" - -//#include <qnetworksession.h> -//#include <QNetworkInterface> #include <QtCore/qdatetime.h> #include <icd/dbus_api.h> @@ -90,7 +85,9 @@ public: //notification hooks to discover future state changes. void syncStateWithInterface(); +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface currentInterface() const; +#endif QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 2b2df07..28ee38e 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -151,7 +151,7 @@ QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) continue; QNetworkManagerInterfaceDevice device(devices.at(0).path()); - return device.networkInterface().name(); + return device.networkInterface(); } } diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index d23bb0d..a20370b 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -353,9 +353,9 @@ QString QNetworkManagerInterfaceDevice::udi() const return d->connectionInterface->property("Udi").toString(); } -QNetworkInterface QNetworkManagerInterfaceDevice::networkInterface() const +QString QNetworkManagerInterfaceDevice::networkInterface() const { - return QNetworkInterface::interfaceFromName(d->connectionInterface->property("Interface").toString()); + return d->connectionInterface->property("Interface").toString(); } quint32 QNetworkManagerInterfaceDevice::ip4Address() const diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h index ecca537..95f5b4a 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h @@ -59,8 +59,6 @@ #include <QtDBus/QDBusInterface> #include <QtDBus/QDBusMessage> #include <QtDBus/QDBusReply> -#include <QNetworkInterface> - #include <QtDBus/QDBusPendingCallWatcher> #include <QtDBus/QDBusObjectPath> @@ -252,7 +250,7 @@ public: ~QNetworkManagerInterfaceDevice(); QString udi() const; - QNetworkInterface networkInterface() const; + QString networkInterface() const; QDBusInterface *connectionInterface() const; quint32 ip4Address() const; quint32 state() const; diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index db1759c..33cce69 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -49,8 +49,6 @@ #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> -#include <QtNetwork/qnetworkinterface.h> - QT_BEGIN_NAMESPACE static QBearerEngineImpl *getEngineFromId(const QString &id) @@ -218,6 +216,7 @@ void QNetworkSessionPrivateImpl::reject() { } +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { if (!publicConfig.isValid() || !engine || state != QNetworkSession::Connected) @@ -229,6 +228,7 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const return QNetworkInterface(); return QNetworkInterface::interfaceFromName(interface); } +#endif QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString &key) const { diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index c644174..3becbf0 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -83,7 +83,9 @@ public: //notification hooks to discover future state changes. void syncStateWithInterface(); +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface currentInterface() const; +#endif QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 8910efe..512ea51 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -152,6 +152,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() } } +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const { QString interfaceName; @@ -189,7 +190,9 @@ QNetworkInterface QNetworkSessionPrivateImpl::interface(TUint iapId) const return QNetworkInterface::interfaceFromName(interfaceName); } +#endif +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const { if (!publicConfig.isValid() || state != QNetworkSession::Connected) { @@ -198,6 +201,7 @@ QNetworkInterface QNetworkSessionPrivateImpl::currentInterface() const return activeInterface; } +#endif QVariant QNetworkSessionPrivateImpl::sessionProperty(const QString& /*key*/) const { @@ -309,7 +313,9 @@ void QNetworkSessionPrivateImpl::open() if (connInfo().iIapId == symbianConfig->numericId) { if (iConnection.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) { activeConfig = publicConfig; +#ifndef QT_NO_NETWORKINTERFACE activeInterface = interface(symbianConfig->numericId); +#endif connected = ETrue; startTime = QDateTime::currentDateTime(); if (iDynamicSetdefaultif) { @@ -878,7 +884,9 @@ void QNetworkSessionPrivateImpl::RunL() toSymbianConfig(privateConfiguration(activeConfig)); symbianConfig->mutex.lock(); +#ifndef QT_NO_NETWORKINTERFACE activeInterface = interface(symbianConfig->numericId); +#endif if (publicConfig.type() == QNetworkConfiguration::UserChoice) { serviceConfig = QNetworkConfigurationManager() .configurationFromIdentifier(symbianConfig->serviceNetworkPtr->id); @@ -936,9 +944,11 @@ bool QNetworkSessionPrivateImpl::newState(QNetworkSession::State newState, TUint SymbianNetworkConfigurationPrivate *symbianConfig = toSymbianConfig(privateConfiguration(activeConfig)); +#ifndef QT_NO_NETWORKINTERFACE symbianConfig->mutex.lock(); activeInterface = interface(symbianConfig->numericId); symbianConfig->mutex.unlock(); +#endif #ifdef SNAP_FUNCTIONALITY_AVAILABLE if (iDynamicSetdefaultif) { diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.h b/src/plugins/bearer/symbian/qnetworksession_impl.h index 35e2c58..9a57eae 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.h +++ b/src/plugins/bearer/symbian/qnetworksession_impl.h @@ -89,7 +89,9 @@ public: //notification hooks to discover future state changes. void syncStateWithInterface(); +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface currentInterface() const; +#endif QVariant sessionProperty(const QString& key) const; void setSessionProperty(const QString& key, const QVariant& value); @@ -137,12 +139,16 @@ private: void handleSymbianConnectionStatusChange(TInt aConnectionStatus, TInt aError, TUint accessPointId = 0); QNetworkConfiguration bestConfigFromSNAP(const QNetworkConfiguration& snapConfig) const; QNetworkConfiguration activeConfiguration(TUint32 iapId = 0) const; +#ifndef QT_NO_NETWORKINTERFACE QNetworkInterface interface(TUint iapId) const; +#endif private: // data SymbianEngine *engine; +#ifndef QT_NO_NETWORKINTERFACE mutable QNetworkInterface activeInterface; +#endif QDateTime startTime; diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index c08120c..58b0576 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -355,11 +355,13 @@ void tst_QNetworkSession::sessionProperties() // QNetworkSession::interface() should return an invalid interface unless // session is in the connected state. qDebug() << "Session state:" << session.state(); +#ifndef QT_NO_NETWORKINTERFACE qDebug() << "Session iface:" << session.interface().isValid() << session.interface().name(); #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QCOMPARE(session.state() == QNetworkSession::Connected, session.interface().isValid()); #endif +#endif if (!configuration.isValid()) { QVERIFY(configuration.state() == QNetworkConfiguration::Undefined && @@ -694,10 +696,12 @@ void tst_QNetworkSession::userChoiceSession() QTRY_VERIFY(!stateChangedSpy.isEmpty()); QVERIFY(session.state() == QNetworkSession::Connected); +#ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif +#endif const QString userChoiceIdentifier = session.sessionProperty("UserChoiceConfiguration").toString(); @@ -839,10 +843,12 @@ void tst_QNetworkSession::sessionOpenCloseStop() } QVERIFY(session.state() == QNetworkSession::Connected); +#ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif +#endif } else { QFAIL("Timeout waiting for session to open."); } @@ -875,12 +881,14 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); +#endif } sessionOpenedSpy2.clear(); @@ -1051,12 +1059,14 @@ void tst_QNetworkSession::sessionOpenCloseStop() QVERIFY(!session2.isOpen()); QVERIFY(session.state() == QNetworkSession::Connected); QVERIFY(session2.state() == QNetworkSession::Connected); +#ifndef QT_NO_NETWORKINTERFACE #if !(defined(Q_OS_SYMBIAN) && defined(__WINS__)) // On Symbian emulator, the support for data bearers is limited QVERIFY(session.interface().isValid()); #endif QCOMPARE(session.interface().hardwareAddress(), session2.interface().hardwareAddress()); QCOMPARE(session.interface().index(), session2.interface().index()); +#endif } sessionClosedSpy2.clear(); |