summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.tests/mac/corelwan/corewlan.pro4
-rw-r--r--config.tests/mac/corelwan/corewlantest.mm49
-rw-r--r--examples/network/bearercloud/bearercloud.pro4
-rw-r--r--examples/network/bearercloud/cloud.cpp12
-rw-r--r--examples/network/bearercloud/cloud.h2
-rw-r--r--examples/network/bearermonitor/bearermonitor.pro4
-rw-r--r--examples/network/bearermonitor/sessionwidget.cpp15
-rw-r--r--src/network/bearer/qnetworkconfigmanager_s60_p.h3
-rw-r--r--src/network/bearer/qnetworkconfiguration.cpp56
-rw-r--r--src/network/bearer/qnetworkconfiguration.h1
-rw-r--r--src/network/bearer/qnetworkconfiguration_maemo_p.h13
-rw-r--r--src/network/bearer/qnetworkconfiguration_p.h6
-rw-r--r--src/network/bearer/qnetworkconfiguration_s60_p.cpp16
-rw-r--r--src/network/bearer/qnetworkconfiguration_s60_p.h1
-rw-r--r--src/network/bearer/qnetworksession.cpp146
-rw-r--r--src/network/bearer/qnetworksession.h3
-rw-r--r--src/network/bearer/qnetworksession_maemo.cpp47
-rw-r--r--src/network/bearer/qnetworksession_maemo_p.h6
-rw-r--r--src/network/bearer/qnetworksession_p.cpp34
-rw-r--r--src/network/bearer/qnetworksession_p.h4
-rw-r--r--src/network/bearer/qnetworksession_s60_p.cpp76
-rw-r--r--src/network/bearer/qnetworksession_s60_p.h3
-rw-r--r--src/network/bearer/qnetworksessionengine_p.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h2
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm61
-rw-r--r--src/plugins/bearer/generic/qgenericengine.cpp36
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp5
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp9
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp45
-rw-r--r--src/plugins/bearer/nla/qnlaengine.cpp10
-rw-r--r--tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro4
-rw-r--r--tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp8
-rw-r--r--tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro4
-rw-r--r--tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp8
-rw-r--r--tests/auto/qnetworksession/lackey/main.cpp2
-rw-r--r--tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp86
-rw-r--r--tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro4
-rw-r--r--tests/manual/bearerex/bearerex.cpp37
-rw-r--r--tests/manual/bearerex/bearerex.h3
-rw-r--r--tests/manual/bearerex/bearerex.pro2
-rw-r--r--tests/manual/networkmanager/nmview.cpp2
-rw-r--r--tests/manual/networkmanager/nmview.h2
43 files changed, 477 insertions, 362 deletions
diff --git a/config.tests/mac/corelwan/corewlan.pro b/config.tests/mac/corelwan/corewlan.pro
deleted file mode 100644
index 54a6c36..0000000
--- a/config.tests/mac/corelwan/corewlan.pro
+++ /dev/null
@@ -1,4 +0,0 @@
-SOURCES=corewlantest.mm
-TARGET=corewlan
-LIBS += -framework CoreWLAN -framework Foundation
-CONFIG-=app_bundle
diff --git a/config.tests/mac/corelwan/corewlantest.mm b/config.tests/mac/corelwan/corewlantest.mm
deleted file mode 100644
index 3a29d84..0000000
--- a/config.tests/mac/corelwan/corewlantest.mm
+++ /dev/null
@@ -1,49 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the config.tests of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <CoreWLAN/CoreWLAN.h>
-#include <CoreWLAN/CWInterface.h>
-
-int main()
-{
- [CWInterface interfaceWithName:@"en2"];
- return 0;
-}
diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro
index c45d62a..b82857d 100644
--- a/examples/network/bearercloud/bearercloud.pro
+++ b/examples/network/bearercloud/bearercloud.pro
@@ -10,3 +10,7 @@ RESOURCES = icons.qrc
TARGET = bearercloud
QT = core gui network svg
+
+CONFIG += console
+
+symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp
index dcb7caf..81e13a6 100644
--- a/examples/network/bearercloud/cloud.cpp
+++ b/examples/network/bearercloud/cloud.cpp
@@ -226,7 +226,7 @@ QVariant Cloud::itemChange(GraphicsItemChange change, const QVariant &value)
void Cloud::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- if (session->isActive())
+ if (session->isOpen())
session->close();
else
session->open();
@@ -258,7 +258,7 @@ void Cloud::stateChanged(QNetworkSession::State state)
tooltip += tr("<br>Interface: %1").arg(interface.humanReadableName());
tooltip += tr("<br>Id: %1").arg(configuration.identifier());
- const QString bearerName = session->bearerName();
+ const QString bearerName = configuration.bearerName();
if (!bearerName.isEmpty())
tooltip += tr("<br>Bearer: %1").arg(bearerName);
@@ -289,10 +289,10 @@ void Cloud::stateChanged(QNetworkSession::State state)
s = s.arg(tr("Unknown"));
}
- if (session->isActive())
- s = s.arg(tr("Active"));
+ if (session->isOpen())
+ s = s.arg(tr("Open"));
else
- s = s.arg(tr("Inactive"));
+ s = s.arg(tr("Closed"));
tooltip += s;
@@ -307,7 +307,7 @@ void Cloud::stateChanged(QNetworkSession::State state)
//! [1]
void Cloud::newConfigurationActivated()
{
- const QString bearerName = session->bearerName();
+ const QString bearerName = configuration.bearerName();
if (!svgCache.contains(bearerName)) {
if (bearerName == QLatin1String("WLAN"))
svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg")));
diff --git a/examples/network/bearercloud/cloud.h b/examples/network/bearercloud/cloud.h
index 7a45ff2..38f8aff 100644
--- a/examples/network/bearercloud/cloud.h
+++ b/examples/network/bearercloud/cloud.h
@@ -45,8 +45,10 @@
#include <QGraphicsItem>
QT_USE_NAMESPACE
+QT_BEGIN_NAMESPACE
class QGraphicsTextItem;
class QGraphicsSvgItem;
+QT_END_NAMESPACE
class Cloud : public QObject, public QGraphicsItem
{
diff --git a/examples/network/bearermonitor/bearermonitor.pro b/examples/network/bearermonitor/bearermonitor.pro
index a854b55..db1727b 100644
--- a/examples/network/bearermonitor/bearermonitor.pro
+++ b/examples/network/bearermonitor/bearermonitor.pro
@@ -20,3 +20,7 @@ win32 {
LIBS += -lWs2
}
}
+
+CONFIG += console
+
+symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp
index 1e59935..d03c5bf 100644
--- a/examples/network/bearermonitor/sessionwidget.cpp
+++ b/examples/network/bearermonitor/sessionwidget.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "sessionwidget.h"
+#include "qnetworkconfigmanager.h"
SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *parent)
: QWidget(parent)
@@ -79,7 +80,13 @@ void SessionWidget::updateSession()
updateSessionState(session->state());
updateSessionError(session->error());
- bearer->setText(session->bearerName());
+ if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint)
+ bearer->setText(session->configuration().bearerName());
+ else {
+ QNetworkConfigurationManager mgr;
+ QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString());
+ bearer->setText(c.bearerName());
+ }
interfaceName->setText(session->interface().humanReadableName());
interfaceGuid->setText(session->interface().name());
@@ -140,10 +147,10 @@ void SessionWidget::updateSessionState(QNetworkSession::State state)
s = s.arg(tr("Unknown"));
}
- if (session->isActive())
- s = s.arg(tr("Active"));
+ if (session->isOpen())
+ s = s.arg(tr("Open"));
else
- s = s.arg(tr("Inactive"));
+ s = s.arg(tr("Closed"));
sessionState->setText(s);
}
diff --git a/src/network/bearer/qnetworkconfigmanager_s60_p.h b/src/network/bearer/qnetworkconfigmanager_s60_p.h
index c4d4e30..568803d 100644
--- a/src/network/bearer/qnetworkconfigmanager_s60_p.h
+++ b/src/network/bearer/qnetworkconfigmanager_s60_p.h
@@ -63,7 +63,10 @@
#endif
class CCommsDatabase;
+
+QT_BEGIN_NAMESPACE
class QTimer;
+QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp
index c105dfb..e1b2828 100644
--- a/src/network/bearer/qnetworkconfiguration.cpp
+++ b/src/network/bearer/qnetworkconfiguration.cpp
@@ -164,9 +164,9 @@ QT_BEGIN_NAMESPACE
QNetworkConfiguration::Defined. If the configuration is a service network
this flag is set if at least one of the underlying access points
configurations has the Discovered state.
- \value Active The configuration is currently used by an open/active network session
- (see \l QNetworkSession::isActive()). However this does not mean that the
- current process is the entity that created the active session. It merely
+ \value Active The configuration is currently used by an open network session
+ (see \l QNetworkSession::isOpen()). However this does not mean that the
+ current process is the entity that created the open session. It merely
indicates that if a new QNetworkSession were to be constructed based on
this configuration \l QNetworkSession::state() would return
\l QNetworkSession::Connected. This state implies the
@@ -344,6 +344,56 @@ QList<QNetworkConfiguration> QNetworkConfiguration::children() const
return results;
}
+/*!
+ Returns the type of bearer. The string is not translated and
+ therefore can not be shown to the user. The subsequent table presents the currently known
+ bearer types:
+
+ \table
+ \header
+ \o Value
+ \o Description
+ \row
+ \o Unknown
+ \o The session is based on an unknown or unspecified bearer type.
+ \row
+ \o Ethernet
+ \o The session is based on Ethernet.
+ \row
+ \o WLAN
+ \o The session is based on Wireless LAN.
+ \row
+ \o 2G
+ \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne.
+ \row
+ \o CDMA2000
+ \o The session uses CDMA.
+ \row
+ \o WCDMA
+ \o The session uses W-CDMA/UMTS.
+ \row
+ \o HSPA
+ \o The session uses High Speed Packet Access.
+ \row
+ \o Bluetooth
+ \o The session uses Bluetooth.
+ \row
+ \o WiMAX
+ \o The session uses WiMAX.
+ \endtable
+
+ This function returns an empty string if this is an invalid configuration,
+ a network configuration of type \l QNetworkConfiguration::ServiceNetwork or
+ \l QNetworkConfiguration::UserChoice.
+*/
+QString QNetworkConfiguration::bearerName() const
+{
+ if (!isValid())
+ return QString();
+
+ return d->bearerName();
+}
+
QT_END_NAMESPACE
diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h
index 63c37e5..dede2b1 100644
--- a/src/network/bearer/qnetworkconfiguration.h
+++ b/src/network/bearer/qnetworkconfiguration.h
@@ -90,6 +90,7 @@ public:
StateFlags state() const;
Type type() const;
Purpose purpose() const;
+ QString bearerName() const;
QString identifier() const;
bool isRoamingAvailable() const;
QList<QNetworkConfiguration> children() const;
diff --git a/src/network/bearer/qnetworkconfiguration_maemo_p.h b/src/network/bearer/qnetworkconfiguration_maemo_p.h
index 0ae6ea6..3b43312 100644
--- a/src/network/bearer/qnetworkconfiguration_maemo_p.h
+++ b/src/network/bearer/qnetworkconfiguration_maemo_p.h
@@ -89,6 +89,19 @@ public:
/* In Maemo the id field (defined above) is the IAP id (which typically is UUID) */
QByteArray network_id; /* typically WLAN ssid or similar */
QString iap_type; /* is this one WLAN or GPRS */
+ QString bearerName() const
+ {
+ if (iap_type == "WLAN_INFRA" ||
+ iap_type == "WLAN_ADHOC")
+ return QString("WLAN");
+ else if (iap_type == "GPRS")
+ return QString("HSPA");
+
+ //return whatever it is
+ //this may have to be split up later on
+ return iap_type;
+ }
+
uint32_t network_attrs; /* network attributes for this IAP, this is the value returned by icd and passed to it when connecting */
QString service_type;
diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h
index 365ec95..68d6ba4 100644
--- a/src/network/bearer/qnetworkconfiguration_p.h
+++ b/src/network/bearer/qnetworkconfiguration_p.h
@@ -76,6 +76,12 @@ public:
}
QString name;
+ QString bearer;
+ inline QString bearerName() const
+ {
+ return bearer;
+ }
+
bool isValid;
QString id;
QNetworkConfiguration::StateFlags state;
diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.cpp b/src/network/bearer/qnetworkconfiguration_s60_p.cpp
index 978c62c..3064840 100644
--- a/src/network/bearer/qnetworkconfiguration_s60_p.cpp
+++ b/src/network/bearer/qnetworkconfiguration_s60_p.cpp
@@ -57,4 +57,20 @@ QNetworkConfigurationPrivate::~QNetworkConfigurationPrivate()
serviceNetworkMembers.clear();
}
+QString QNetworkConfigurationPrivate::bearerName() const
+{
+ switch (bearer) {
+ case QNetworkConfigurationPrivate::BearerEthernet: return QLatin1String("Ethernet");
+ case QNetworkConfigurationPrivate::BearerWLAN: return QLatin1String("WLAN");
+ case QNetworkConfigurationPrivate::Bearer2G: return QLatin1String("2G");
+ case QNetworkConfigurationPrivate::BearerCDMA2000: return QLatin1String("CDMA2000");
+ case QNetworkConfigurationPrivate::BearerWCDMA: return QLatin1String("WCDMA");
+ case QNetworkConfigurationPrivate::BearerHSPA: return QLatin1String("HSPA");
+ case QNetworkConfigurationPrivate::BearerBluetooth: return QLatin1String("Bluetooth");
+ case QNetworkConfigurationPrivate::BearerWiMAX: return QLatin1String("WiMAX");
+ default: return QLatin1String("Unknown");
+ }
+}
+
+
QT_END_NAMESPACE
diff --git a/src/network/bearer/qnetworkconfiguration_s60_p.h b/src/network/bearer/qnetworkconfiguration_s60_p.h
index faacd64..0973152 100644
--- a/src/network/bearer/qnetworkconfiguration_s60_p.h
+++ b/src/network/bearer/qnetworkconfiguration_s60_p.h
@@ -87,6 +87,7 @@ public:
QList<QExplicitlySharedDataPointer<QNetworkConfigurationPrivate> > serviceNetworkMembers;
QNetworkConfigurationPrivate::Bearer bearer;
+ QString bearerName() const;
TUint32 numericId;
TUint connectionId;
diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp
index dbea087..74b9787 100644
--- a/src/network/bearer/qnetworksession.cpp
+++ b/src/network/bearer/qnetworksession.cpp
@@ -46,7 +46,7 @@
#ifdef Q_OS_SYMBIAN
#include "qnetworksession_s60_p.h"
-#elif MAEMO
+#elif Q_WS_MAEMO_6
#include "qnetworksession_maemo_p.h"
#else
#include "qnetworksession_p.h"
@@ -72,34 +72,41 @@ QT_BEGIN_NAMESPACE
QNetworkSession supports session management within the same process and depending on the platform's
capabilities may support out-of-process sessions. If the same
- network configuration is used by multiple active sessions the underlying network interface is only terminated once
+ network configuration is used by multiple open sessions the underlying network interface is only terminated once
the last session has been closed.
\section1 Roaming
Applications may connect to the preferredConfigurationChanged() signal in order to
receive notifications when a more suitable access point becomes available.
- In response to this signal the application may initiate the roaming via migrate()
- or may ignore() the new access point. Once the session has roamed the
+ In response to this signal the application must either initiate the roaming via migrate()
+ or ignore() the new access point. Once the session has roamed the
newConfigurationActivated() signal is emitted. The application may now test the
- carrier and can accept() or reject() it. The session will return to the previous
- access point if the roaming was rejected.
+ carrier and must either accept() or reject() it. The session will return to the previous
+ access point if the roaming was rejected. The subsequent state diagram depicts the required
+ state transitions.
+
+ \image roaming-states.png
- Some platforms may support the notion of forced roaming and application level roaming (ALR).
+ Some platforms may distinguish forced roaming and application level roaming (ALR).
ALR implies that the application controls (via migrate(), ignore(), accept() and reject())
- whether a network session can roam from one network configuration to the next. Such control is useful
+ whether a network session can roam from one access point to the next. Such control is useful
if the application maintains stateful socket connections and wants to control the transition from
- one interface to the next.
-
- Forced roaming implies that the system automatically roams to the next network without
+ one interface to the next. Forced roaming implies that the system automatically roams to the next network without
consulting the application. This has the advantage that the application can make use of roaming features
without actually being aware of it. It is expected that the application detects that the underlying
socket is broken and automatically reconnects via the new network link.
- If the platform supports both modes of roaming an application indicates its preference
+ If the platform supports both modes of roaming, an application indicates its preference
by connecting to the preferredConfigurationChanged() signal. Connecting to this signal means that
the application wants to take control over the roaming behavior and therefore implies application
- level roaming.
+ level roaming. If the client does not connect to the preferredConfigurationChanged(), forced roaming
+ is used. If forced roaming is not supported the network session will not roam by default.
+
+ Some applications may want to suppress any form of roaming altogether. Possible use cases may be
+ high priority downloads or remote services which cannot handle a roaming enabled client. Clients
+ can suppress roaming by connecting to the preferredConfigurationChanged() signal and answer each
+ signal emission with ignore().
\sa QNetworkConfiguration, QNetworkConfigurationManager
*/
@@ -119,7 +126,7 @@ QT_BEGIN_NAMESPACE
\value Connecting The network session is being established.
\value Connected The network session is connected. If the current process wishes to use this session
it has to register its interest by calling open(). A network session
- is considered to be ready for socket operations if it isActive() and connected.
+ is considered to be ready for socket operations if it isOpen() and connected.
\value Closing The network session is in the process of being shut down.
\value Disconnected The network session is not connected. The associated QNetworkConfiguration
has the state QNetworkConfiguration::Discovered.
@@ -167,9 +174,8 @@ QT_BEGIN_NAMESPACE
details such as proxy settings and \a isSeamless indicates whether roaming will
break the sessions IP address.
- As a consequence to this signal the application may start the roaming process
- by calling migrate() or may chose to ignore() the new access point. If the application
- doesn't call either of the two functions the session ignores the migration opportunity.
+ As a consequence to this signal the application must either start the roaming process
+ by calling migrate() or choose to ignore() the new access point.
If the roaming process is non-seamless the IP address will change which means that
a socket becomes invalid. However seamless mobility can ensure that the local IP address
@@ -194,7 +200,7 @@ QT_BEGIN_NAMESPACE
This signal is emitted once the session has roamed to the new access point.
The application may reopen its socket and test the suitability of the new network link.
- Subsequently it may accept() or reject() the new access point.
+ Subsequently it must either accept() or reject() the new access point.
\sa accept(), reject()
*/
@@ -239,13 +245,13 @@ QNetworkSession::~QNetworkSession()
}
/*!
- Creates an active/open session which increases the session counter on the underlying network interface.
+ Creates an open session which increases the session counter on the underlying network interface.
The system will not terminate a network interface until the session reference counter reaches zero.
- Therefore an active session allows an application to register its use of the interface.
+ Therefore an open session allows an application to register its use of the interface.
- The interface is started if it is not active yet. Some platforms may not provide support
- for out-of-process sessions. On such platforms the session counter ignores any sessions
- held by another process. The platform capabilities can be
+ As a result of calling open() the interface will be started if it is not connected/up yet.
+ Some platforms may not provide support for out-of-process sessions. On such platforms the session
+ counter ignores any sessions held by another process. The platform capabilities can be
detected via QNetworkConfigurationManager::capabilities().
Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired
@@ -253,7 +259,7 @@ QNetworkSession::~QNetworkSession()
It is not a requirement to open a session in order to monitor the underlying network interface.
- \sa close(), stop(), isActive()
+ \sa close(), stop(), isOpen()
*/
void QNetworkSession::open()
{
@@ -279,7 +285,7 @@ void QNetworkSession::open()
*/
bool QNetworkSession::waitForOpened(int msecs)
{
- if (d->isActive)
+ if (d->isOpen)
return true;
if (d->state != Connecting)
@@ -297,13 +303,13 @@ bool QNetworkSession::waitForOpened(int msecs)
loop->disconnect();
loop->deleteLater();
- return d->isActive;
+ return d->isOpen;
}
/*!
Decreases the session counter on the associated network configuration. If the session counter reaches zero
the active network interface is shut down. This also means that state() will only change from \l Connected to
- \l Disconnected if this was the last active session.
+ \l Disconnected if the current session was the last open session.
If the platform does not support out-of-process sessions calling this function does not stop the
interface. In this case \l{stop()} has to be used to force a shut down.
@@ -312,7 +318,7 @@ bool QNetworkSession::waitForOpened(int msecs)
Note that this call is asynchronous. Depending on the outcome of this call the results can be enquired
by connecting to the stateChanged(), opened() or error() signals.
- \sa open(), stop(), isActive()
+ \sa open(), stop(), isOpen()
*/
void QNetworkSession::close()
{
@@ -320,7 +326,7 @@ void QNetworkSession::close()
}
/*!
- Invalidates all active sessions against the network interface and therefore stops the
+ Invalidates all open sessions against the network interface and therefore stops the
underlying network interface. This function always changes the session's state() flag to
\l Disconnected.
@@ -341,15 +347,19 @@ QNetworkConfiguration QNetworkSession::configuration() const
return d->publicConfig;
}
-/*!
- Returns the type of bearer currently used by this session. The string is not translated and therefore can
- not be shown to the user. The subsequent table presents the currently known bearer types:
+/*
+ Returns the type of bearer currently used by this session. The string is not translated and
+ therefore can not be shown to the user. The subsequent table presents the currently known
+ bearer types:
\table
\header
\o Value
\o Description
\row
+ \o Unknown
+ \o The session is based on an unknown or unspecified bearer type.
+ \row
\o Ethernet
\o The session is based on Ethernet.
\row
@@ -380,12 +390,14 @@ QNetworkConfiguration QNetworkSession::configuration() const
active configuration is returned. Therefore the bearer type may change
over time.
- This function returns an empty string if this session is based on an invalid configuration.
+ This function returns an empty string if this session is based on an invalid configuration, or
+ a network configuration of type \l QNetworkConfiguration::ServiceNetwork with no
+ \l {QNetworkConfiguration::children()}{children}.
*/
-QString QNetworkSession::bearerName() const
+/*QString QNetworkSession::bearerName() const
{
return d->bearerName();
-}
+}*/
/*!
Returns the network interface that is used by this session.
@@ -402,25 +414,29 @@ QNetworkInterface QNetworkSession::interface() const
}
/*!
- Returns true if this object holds an active session on the underlying network interface.
+ Returns true if this session is open. If the number of all open sessions is greater than
+ zero the underlying network interface will remain connected/up.
+
The session can be controlled via open() and close().
*/
-bool QNetworkSession::isActive() const
+bool QNetworkSession::isOpen() const
{
- return d->isActive;
+ return d->isOpen;
}
/*!
- Returns the state of the session. If the session is based on a
- single access point configuration the state of the session is the same as the state of the
- associated network interface. Therefore a network session object can be used to monitor
- network interfaces.
+ Returns the state of the session.
+
+ If the session is based on a single access point configuration the state of the
+ session is the same as the state of the associated network interface. Therefore
+ a network session object can be used to monitor network interfaces.
A \l QNetworkConfiguration::ServiceNetwork based session summarizes the state of all its children
- and therefore returns the \l Connected state if at least one of its sub configurations is connected.
+ and therefore returns the \l Connected state if at least one of the service network's
+ \l {QNetworkConfiguration::children()}{children()} configurations is active.
- Note that it is not required to hold an active session in order to obtain the network interface state.
- A connected but inactive session may be used to monitor network interfaces whereas an active and connected
+ Note that it is not required to hold an open session in order to obtain the network interface state.
+ A connected but closed session may be used to monitor network interfaces whereas an open and connected
session object may prevent the network interface from being shut down.
\sa error(), stateChanged()
@@ -463,8 +479,8 @@ QString QNetworkSession::errorString() const
\header
\o Key \o Description
\row
- \o ActiveConfigurationIdentifier
- \o If the session \l isActive() this property returns the identifier of the
+ \o ActiveConfiguration
+ \o If the session \l isOpen() this property returns the identifier of the
QNetworkConfiguration that is used by this session; otherwise an empty string.
The main purpose of this key is to determine which Internet access point is used
@@ -476,7 +492,7 @@ QString QNetworkSession::errorString() const
QNetworkSession* session = new QNetworkSession(ap);
... //code activates session
- QString ident = session->sessionProperty("ActiveConfigurationIdentifier").toString();
+ QString ident = session->sessionProperty("ActiveConfiguration").toString();
if ( ap.type() == QNetworkConfiguration::ServiceNetwork ) {
Q_ASSERT( ap.identifier() != ident );
Q_ASSERT( ap.children().contains( mgr.configurationFromIdentifier(ident) ) );
@@ -485,17 +501,17 @@ QString QNetworkSession::errorString() const
}
\endcode
\row
- \o UserChoiceConfigurationIdentifier
- \o If the session \l isActive() and is bound to a QNetworkConfiguration of type
+ \o UserChoiceConfiguration
+ \o If the session \l isOpen() and is bound to a QNetworkConfiguration of type
UserChoice, this property returns the identifier of the QNetworkConfiguration that the
configuration resolved to when \l open() was called; otherwise an empty string.
The purpose of this key is to determine the real QNetworkConfiguration that the
- session is using. This key is different to \i ActiveConfigurationIdentifier in that
+ session is using. This key is different to \i ActiveConfiguration in that
this key may return an identifier for either a
\l {QNetworkConfiguration::ServiceNetwork}{service network} or a
\l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations
- whereas \i ActiveConfigurationIdentifier always returns identifiers for
+ whereas \i ActiveConfiguration always returns identifiers to
\l {QNetworkConfiguration::InternetAccessPoint}{Internet access points} configurations.
\row
\o ConnectInBackground
@@ -509,15 +525,15 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const
if (!d->publicConfig.isValid())
return QVariant();
- if (key == QLatin1String("ActiveConfigurationIdentifier")) {
- if (!d->isActive)
+ if (key == QLatin1String("ActiveConfiguration")) {
+ if (!d->isOpen)
return QString();
else
return d->activeConfig.identifier();
}
- if (key == QLatin1String("UserChoiceConfigurationIdentifier")) {
- if (!d->isActive || d->publicConfig.type() != QNetworkConfiguration::UserChoice)
+ if (key == QLatin1String("UserChoiceConfiguration")) {
+ if (!d->isOpen || d->publicConfig.type() != QNetworkConfiguration::UserChoice)
return QString();
if (d->serviceConfig.isValid())
@@ -534,13 +550,13 @@ QVariant QNetworkSession::sessionProperty(const QString& key) const
\a key. Removing an already set property can be achieved by passing an
invalid QVariant.
- Note that the \i UserChoiceConfigurationIdentifier and \i ActiveConfigurationIdentifier
+ Note that the \i UserChoiceConfiguration and \i ActiveConfiguration
properties are read only and cannot be changed using this method.
*/
void QNetworkSession::setSessionProperty(const QString& key, const QVariant& value)
{
- if (key == QLatin1String("ActiveConfigurationIdentifier") ||
- key == QLatin1String("UserChoiceConfigurationIdentifier")) {
+ if (key == QLatin1String("ActiveConfiguration") ||
+ key == QLatin1String("UserChoiceConfiguration")) {
return;
}
@@ -561,16 +577,14 @@ void QNetworkSession::migrate()
}
/*!
- This function indicates that the application does not wish to roam the session. This
- is the default behavior if an application doesn't call migrate() in response to a
- preferredConfigurationChanged() signal.
+ This function indicates that the application does not wish to roam the session.
\sa migrate()
*/
void QNetworkSession::ignore()
{
- //TODO Do we really need this function if we consider that this is
- // the default behavior if nobody calls migrate()?
+ // Needed on at least Symbian platform: the roaming must be explicitly
+ // ignore()'d or migrate()'d
d->ignore();
}
@@ -603,7 +617,7 @@ void QNetworkSession::reject()
/*!
Returns the amount of data sent in bytes; otherwise 0.
- This field value includes the usage across all active network
+ This field value includes the usage across all open network
sessions which use the same network interface.
If the session is based on a service network configuration the number of
@@ -620,7 +634,7 @@ quint64 QNetworkSession::bytesWritten() const
/*!
Returns the amount of data received in bytes; otherwise 0.
- This field value includes the usage across all active network
+ This field value includes the usage across all open network
sessions which use the same network interface.
If the session is based on a service network configuration the number of
diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h
index 0573c70..6138166 100644
--- a/src/network/bearer/qnetworksession.h
+++ b/src/network/bearer/qnetworksession.h
@@ -80,9 +80,8 @@ public:
QNetworkSession(const QNetworkConfiguration& connConfig, QObject* parent =0);
virtual ~QNetworkSession();
- bool isActive() const;
+ bool isOpen() const;
QNetworkConfiguration configuration() const;
- QString bearerName() const;
QNetworkInterface interface() const;
State state() const;
diff --git a/src/network/bearer/qnetworksession_maemo.cpp b/src/network/bearer/qnetworksession_maemo.cpp
index a35d8cb..6fb4453 100644
--- a/src/network/bearer/qnetworksession_maemo.cpp
+++ b/src/network/bearer/qnetworksession_maemo.cpp
@@ -305,14 +305,14 @@ void QNetworkSessionPrivate::updateState(QNetworkSession::State newState)
state = newState;
if (state == QNetworkSession::Disconnected) {
- isActive = false;
+ isOpen = false;
currentNetworkInterface.clear();
if (publicConfig.type() == QNetworkConfiguration::UserChoice)
activeConfig.d->state = QNetworkConfiguration::Defined;
publicConfig.d->state = QNetworkConfiguration::Defined;
} else if (state == QNetworkSession::Connected) {
- isActive = true;
+ isOpen = true;
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
activeConfig.d->state = QNetworkConfiguration::Active;
activeConfig.d->type = QNetworkConfiguration::InternetAccessPoint;
@@ -436,7 +436,7 @@ void QNetworkSessionPrivate::syncStateWithInterface()
/* Initially we are not active although the configuration might be in
* connected state.
*/
- isActive = false;
+ isOpen = false;
opened = false;
QObject::connect(&manager, SIGNAL(updateCompleted()), this, SLOT(networkConfigurationsChanged()));
@@ -684,13 +684,13 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig()
clearConfiguration(activeConfig);
}
- bool oldActive = isActive;
- isActive = newActive;
+ bool oldActive = isOpen;
+ isOpen = newActive;
- if (!oldActive && isActive)
+ if (!oldActive && isOpen)
emit quitPendingWaitsForOpened();
- if (oldActive && !isActive)
+ if (oldActive && !isOpen)
emit q->closed();
if (oldState != state) {
@@ -776,7 +776,7 @@ void QNetworkSessionPrivate::open()
if (serviceConfig.isValid()) {
lastError = QNetworkSession::OperationNotSupportedError;
emit q->error(lastError);
- } else if (!isActive) {
+ } else if (!isOpen) {
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
/* Caller is trying to connect to default IAP.
@@ -810,8 +810,8 @@ void QNetworkSessionPrivate::open()
return;
}
- isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
- if (isActive)
+ isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
+ if (isOpen)
emit quitPendingWaitsForOpened();
} else {
/* We seem to be active so inform caller */
@@ -826,7 +826,6 @@ void QNetworkSessionPrivate::do_open()
bool st;
QString result;
QString iap = publicConfig.identifier();
- QString bearer_name;
if (state == QNetworkSession::Connected) {
#ifdef BEARER_MANAGEMENT_DEBUG
@@ -922,14 +921,7 @@ void QNetworkSessionPrivate::do_open()
if (!name.isEmpty())
config.d->name = name;
- bearer_name = connect_result.connect.network_type;
- if (bearer_name == "WLAN_INFRA" ||
- bearer_name == "WLAN_ADHOC")
- currentBearerName = "WLAN";
- else if (bearer_name == "GPRS")
- currentBearerName = "HSPA";
- else
- currentBearerName = bearer_name;
+ config.d->iap_type = connect_result.connect.network_type;
config.d->isValid = true;
config.d->state = QNetworkConfiguration::Active;
@@ -1032,9 +1024,9 @@ void QNetworkSessionPrivate::close()
if (serviceConfig.isValid()) {
lastError = QNetworkSession::OperationNotSupportedError;
emit q->error(lastError);
- } else if (isActive) {
+ } else if (isOpen) {
opened = false;
- isActive = false;
+ isOpen = false;
emit q->closed();
}
}
@@ -1067,11 +1059,11 @@ void QNetworkSessionPrivate::stop()
mgr->configurationChanged((QNetworkConfigurationPrivate*)activeConfig.d.data());
opened = false;
- isActive = false;
+ isOpen = false;
} else {
opened = false;
- isActive = false;
+ isOpen = false;
emit q->closed();
}
}
@@ -1142,15 +1134,6 @@ QVariant QNetworkSessionPrivate::sessionProperty(const QString& key) const
}
-QString QNetworkSessionPrivate::bearerName() const
-{
- if (!publicConfig.isValid())
- return QString();
-
- return currentBearerName;
-}
-
-
QString QNetworkSessionPrivate::errorString() const
{
QString errorStr;
diff --git a/src/network/bearer/qnetworksession_maemo_p.h b/src/network/bearer/qnetworksession_maemo_p.h
index c5483a9..6febce4 100644
--- a/src/network/bearer/qnetworksession_maemo_p.h
+++ b/src/network/bearer/qnetworksession_maemo_p.h
@@ -69,7 +69,7 @@ class QNetworkSessionPrivate : public QObject
Q_OBJECT
public:
QNetworkSessionPrivate() :
- tx_data(0), rx_data(0), m_activeTime(0), isActive(false),
+ tx_data(0), rx_data(0), m_activeTime(0), isOpen(false),
connectFlags(ICD_CONNECTION_FLAG_USER_EVENT)
{
}
@@ -88,7 +88,6 @@ public:
QNetworkInterface currentInterface() const;
QVariant sessionProperty(const QString& key) const;
void setSessionProperty(const QString& key, const QVariant& value);
- QString bearerName() const;
void open();
void close();
@@ -142,7 +141,7 @@ private:
void cleanupAnyConfiguration();
QNetworkSession::State state;
- bool isActive;
+ bool isOpen;
bool opened;
icd_connection_flags connectFlags;
@@ -152,7 +151,6 @@ private:
friend class QNetworkSession;
QDateTime startTime;
- QString currentBearerName;
QString currentNetworkInterface;
friend class IcdListener;
void updateState(QNetworkSession::State);
diff --git a/src/network/bearer/qnetworksession_p.cpp b/src/network/bearer/qnetworksession_p.cpp
index 8421fbc..b615797 100644
--- a/src/network/bearer/qnetworksession_p.cpp
+++ b/src/network/bearer/qnetworksession_p.cpp
@@ -105,7 +105,7 @@ void QNetworkSessionPrivate::syncStateWithInterface()
this, SLOT(forcedSessionClose(QNetworkConfiguration)));
opened = false;
- isActive = false;
+ isOpen = false;
state = QNetworkSession::Invalid;
lastError = QNetworkSession::UnknownSessionError;
@@ -141,7 +141,7 @@ void QNetworkSessionPrivate::open()
if (serviceConfig.isValid()) {
lastError = QNetworkSession::OperationNotSupportedError;
emit q->error(lastError);
- } else if (!isActive) {
+ } else if (!isOpen) {
if ((activeConfig.state() & QNetworkConfiguration::Discovered) !=
QNetworkConfiguration::Discovered) {
lastError =QNetworkSession::InvalidConfigurationError;
@@ -158,8 +158,8 @@ void QNetworkSessionPrivate::open()
engine->connectToId(activeConfig.identifier());
}
- isActive = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
- if (isActive)
+ isOpen = (activeConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
+ if (isOpen)
emit quitPendingWaitsForOpened();
}
}
@@ -169,9 +169,9 @@ void QNetworkSessionPrivate::close()
if (serviceConfig.isValid()) {
lastError = QNetworkSession::OperationNotSupportedError;
emit q->error(lastError);
- } else if (isActive) {
+ } else if (isOpen) {
opened = false;
- isActive = false;
+ isOpen = false;
emit q->closed();
}
}
@@ -192,7 +192,7 @@ void QNetworkSessionPrivate::stop()
}
opened = false;
- isActive = false;
+ isOpen = false;
emit q->closed();
}
}
@@ -238,13 +238,13 @@ void QNetworkSessionPrivate::setSessionProperty(const QString& /*key*/, const QV
{
}
-QString QNetworkSessionPrivate::bearerName() const
+/*QString QNetworkSessionPrivate::bearerName() const
{
if (!publicConfig.isValid() || !engine)
return QString();
return engine->bearerName(activeConfig.identifier());
-}
+}*/
QString QNetworkSessionPrivate::errorString() const
{
@@ -273,7 +273,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const
quint64 QNetworkSessionPrivate::bytesWritten() const
{
#if defined(BACKEND_NM) && 0
- if( state == QNetworkSession::Connected ) {
+ if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) {
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
foreach (const QNetworkConfiguration &config, publicConfig.children()) {
if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
@@ -291,7 +291,7 @@ quint64 QNetworkSessionPrivate::bytesWritten() const
quint64 QNetworkSessionPrivate::bytesReceived() const
{
#if defined(BACKEND_NM) && 0
- if( state == QNetworkSession::Connected ) {
+ if( NetworkManagerAvailable() && state == QNetworkSession::Connected ) {
if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
foreach (const QNetworkConfiguration &config, publicConfig.children()) {
if ((config.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) {
@@ -369,12 +369,12 @@ void QNetworkSessionPrivate::updateStateFromActiveConfig()
state = engine->sessionStateForId(activeConfig.identifier());
- bool oldActive = isActive;
- isActive = (state == QNetworkSession::Connected) ? opened : false;
+ bool oldActive = isOpen;
+ isOpen = (state == QNetworkSession::Connected) ? opened : false;
- if (!oldActive && isActive)
+ if (!oldActive && isOpen)
emit quitPendingWaitsForOpened();
- if (oldActive && !isActive)
+ if (oldActive && !isOpen)
emit q->closed();
if (oldState != state)
@@ -404,7 +404,7 @@ void QNetworkSessionPrivate::forcedSessionClose(const QNetworkConfiguration &con
{
if (activeConfig == config) {
opened = false;
- isActive = false;
+ isOpen = false;
emit q->closed();
@@ -474,7 +474,7 @@ if(serviceName.isEmpty())
QNetworkManagerSettingsConnection *sysIface;
sysIface = new QNetworkManagerSettingsConnection(serviceName, path.path());
startTime = QDateTime::fromTime_t(sysIface->getTimestamp());
- // isActive = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
+ // isOpen = (publicConfig.state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active;
}
if(startTime.isNull())
startTime = QDateTime::currentDateTime();
diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h
index 0a45c92..cd73c9a 100644
--- a/src/network/bearer/qnetworksession_p.h
+++ b/src/network/bearer/qnetworksession_p.h
@@ -70,7 +70,7 @@ class QNetworkSessionPrivate : public QObject
Q_OBJECT
public:
QNetworkSessionPrivate() :
- tx_data(0), rx_data(0), m_activeTime(0), isActive(false)
+ tx_data(0), rx_data(0), m_activeTime(0), isOpen(false)
{
}
@@ -138,7 +138,7 @@ private:
QNetworkConfiguration activeConfig;
QNetworkSession::State state;
- bool isActive;
+ bool isOpen;
bool opened;
diff --git a/src/network/bearer/qnetworksession_s60_p.cpp b/src/network/bearer/qnetworksession_s60_p.cpp
index ed5269e..4d427c8 100644
--- a/src/network/bearer/qnetworksession_s60_p.cpp
+++ b/src/network/bearer/qnetworksession_s60_p.cpp
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
QNetworkSessionPrivate::QNetworkSessionPrivate()
: CActive(CActive::EPriorityStandard), state(QNetworkSession::Invalid),
- isActive(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError),
+ isOpen(false), ipConnectionNotifier(0), iError(QNetworkSession::UnknownSessionError),
iALREnabled(0)
{
CActiveScheduler::Add(this);
@@ -69,7 +69,7 @@ QNetworkSessionPrivate::QNetworkSessionPrivate()
QNetworkSessionPrivate::~QNetworkSessionPrivate()
{
- isActive = false;
+ isOpen = false;
// Cancel Connection Progress Notifications first.
// Note: ConnectionNotifier must be destroyed before Canceling RConnection::Start()
@@ -233,7 +233,7 @@ QNetworkSession::SessionError QNetworkSessionPrivate::error() const
void QNetworkSessionPrivate::open()
{
- if (isActive || !publicConfig.d || (state == QNetworkSession::Connecting)) {
+ if (isOpen || !publicConfig.d || (state == QNetworkSession::Connecting)) {
return;
}
@@ -296,7 +296,7 @@ void QNetworkSessionPrivate::open()
error = iDynamicSetdefaultif(&ifr);
}
- isActive = true;
+ isOpen = true;
// Make sure that state will be Connected
newState(QNetworkSession::Connected);
emit quitPendingWaitsForOpened();
@@ -333,7 +333,7 @@ void QNetworkSessionPrivate::open()
}
if (error != KErrNone) {
- isActive = false;
+ isOpen = false;
iError = QNetworkSession::UnknownSessionError;
emit q->error(iError);
if (ipConnectionNotifier) {
@@ -372,12 +372,12 @@ TUint QNetworkSessionPrivate::iapClientCount(TUint aIAPId) const
void QNetworkSessionPrivate::close(bool allowSignals)
{
- if (!isActive) {
+ if (!isOpen) {
return;
}
TUint activeIap = activeConfig.d.data()->numericId;
- isActive = false;
+ isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
@@ -419,13 +419,13 @@ void QNetworkSessionPrivate::close(bool allowSignals)
void QNetworkSessionPrivate::stop()
{
- if (!isActive) {
+ if (!isOpen) {
return;
}
- isActive = false;
+ isOpen = false;
newState(QNetworkSession::Closing);
iConnection.Stop(RConnection::EStopAuthoritative);
- isActive = true;
+ isOpen = true;
close(false);
emit q->closed();
}
@@ -510,8 +510,8 @@ void QNetworkSessionPrivate::NewCarrierActive(TAccessPointInfo /*aNewAPInfo*/, T
void QNetworkSessionPrivate::Error(TInt /*aError*/)
{
- if (isActive) {
- isActive = false;
+ if (isOpen) {
+ isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::RoamingError;
@@ -558,40 +558,6 @@ QNetworkConfiguration QNetworkSessionPrivate::bestConfigFromSNAP(const QNetworkC
return config;
}
-QString QNetworkSessionPrivate::bearerName() const
-{
- QNetworkConfiguration config;
- if (publicConfig.type() == QNetworkConfiguration::InternetAccessPoint) {
- config = publicConfig;
- } else if (publicConfig.type() == QNetworkConfiguration::ServiceNetwork) {
- if (activeConfig.isValid()) {
- config = activeConfig;
- } else {
- config = bestConfigFromSNAP(publicConfig);
- }
- } else if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
- if (activeConfig.isValid()) {
- config = activeConfig;
- }
- }
-
- if (!config.isValid()) {
- return QString();
- }
-
- switch (config.d.data()->bearer) {
- case QNetworkConfigurationPrivate::BearerEthernet: return QString("Ethernet");
- case QNetworkConfigurationPrivate::BearerWLAN: return QString("WLAN");
- case QNetworkConfigurationPrivate::Bearer2G: return QString("2G");
- case QNetworkConfigurationPrivate::BearerCDMA2000: return QString("CDMA2000");
- case QNetworkConfigurationPrivate::BearerWCDMA: return QString("WCDMA");
- case QNetworkConfigurationPrivate::BearerHSPA: return QString("HSPA");
- case QNetworkConfigurationPrivate::BearerBluetooth: return QString("Bluetooth");
- case QNetworkConfigurationPrivate::BearerWiMAX: return QString("WiMAX");
- default: return QString();
- }
-}
-
quint64 QNetworkSessionPrivate::bytesWritten() const
{
return transferredData(KUplinkData);
@@ -673,7 +639,7 @@ quint64 QNetworkSessionPrivate::transferredData(TUint dataType) const
quint64 QNetworkSessionPrivate::activeTime() const
{
- if (!isActive || startTime.isNull()) {
+ if (!isOpen || startTime.isNull()) {
return 0;
}
return startTime.secsTo(QDateTime::currentDateTime());
@@ -785,7 +751,7 @@ void QNetworkSessionPrivate::RunL()
}
if (error != KErrNone) {
- isActive = false;
+ isOpen = false;
iError = QNetworkSession::UnknownSessionError;
emit q->error(iError);
Cancel();
@@ -802,7 +768,7 @@ void QNetworkSessionPrivate::RunL()
iMobility = CActiveCommsMobilityApiExt::NewL(iConnection, *this);
}
#endif
- isActive = true;
+ isOpen = true;
activeConfig = newActiveConfig;
activeInterface = interface(activeConfig.d.data()->numericId);
if (publicConfig.type() == QNetworkConfiguration::UserChoice) {
@@ -818,7 +784,7 @@ void QNetworkSessionPrivate::RunL()
}
break;
case KErrNotFound: // Connection failed
- isActive = false;
+ isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::InvalidConfigurationError;
@@ -832,7 +798,7 @@ void QNetworkSessionPrivate::RunL()
case KErrCancel: // Connection attempt cancelled
case KErrAlreadyExists: // Connection already exists
default:
- isActive = false;
+ isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::UnknownSessionError;
@@ -855,7 +821,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc
{
// Make sure that activeConfig is always updated when SNAP is signaled to be
// connected.
- if (isActive && publicConfig.type() == QNetworkConfiguration::ServiceNetwork &&
+ if (isOpen && publicConfig.type() == QNetworkConfiguration::ServiceNetwork &&
newState == QNetworkSession::Connected) {
activeConfig = activeConfiguration(accessPointId);
activeInterface = interface(activeConfig.d.data()->numericId);
@@ -872,12 +838,12 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc
}
bool emitSessionClosed = false;
- if (isActive && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) {
+ if (isOpen && state == QNetworkSession::Connected && newState == QNetworkSession::Disconnected) {
// Active & Connected state should change directly to Disconnected state
// only when something forces connection to close (eg. when another
// application or session stops connection or when network drops
// unexpectedly).
- isActive = false;
+ isOpen = false;
activeConfig = QNetworkConfiguration();
serviceConfig = QNetworkConfiguration();
iError = QNetworkSession::SessionAbortedError;
@@ -903,7 +869,7 @@ bool QNetworkSessionPrivate::newState(QNetworkSession::State newState, TUint acc
emit q->stateChanged(state);
retVal = true;
}
- } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isActive) {
+ } else if (publicConfig.type() == QNetworkConfiguration::UserChoice && isOpen) {
if (activeConfig.d.data()->numericId == accessPointId) {
state = newState;
emit q->stateChanged(state);
diff --git a/src/network/bearer/qnetworksession_s60_p.h b/src/network/bearer/qnetworksession_s60_p.h
index 9aaedb7..9ac5ed8 100644
--- a/src/network/bearer/qnetworksession_s60_p.h
+++ b/src/network/bearer/qnetworksession_s60_p.h
@@ -92,7 +92,6 @@ public:
QNetworkInterface currentInterface() const;
QVariant sessionProperty(const QString& key) const;
void setSessionProperty(const QString& key, const QVariant& value);
- QString bearerName() const;
void setALREnabled(bool enabled);
@@ -158,7 +157,7 @@ private: // data
mutable QNetworkInterface activeInterface;
QNetworkSession::State state;
- bool isActive;
+ bool isOpen;
QNetworkSession* q;
QDateTime startTime;
diff --git a/src/network/bearer/qnetworksessionengine_p.h b/src/network/bearer/qnetworksessionengine_p.h
index a698c40..202a7dc 100644
--- a/src/network/bearer/qnetworksessionengine_p.h
+++ b/src/network/bearer/qnetworksessionengine_p.h
@@ -85,7 +85,7 @@ public:
virtual QString getInterfaceFromId(const QString &id) = 0;
virtual bool hasIdentifier(const QString &id) = 0;
- virtual QString bearerName(const QString &id) = 0;
+ //virtual QString bearerName(const QString &id) = 0;
virtual void connectToId(const QString &id) = 0;
virtual void disconnectFromId(const QString &id) = 0;
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 237680a..57906ca 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -85,6 +85,8 @@ private:
QList<QNetworkConfigurationPrivate *> getWlanProfiles(const QString &interfaceName);
bool isKnownSsid(const QString &interfaceName, const QString &ssid);
+ QList<QNetworkConfigurationPrivate *> foundConfigurations;
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 6625443..e07d7b4 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -101,7 +101,7 @@ inline QStringList nsarrayToQStringList(void *nsarray)
static QString qGetInterfaceType(const QString &interfaceString)
{
- return networkInterfaces.value(interfaceString);
+ return networkInterfaces.value(interfaceString, QLatin1String("Unknown"));
}
QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
@@ -114,6 +114,8 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent)
QCoreWlanEngine::~QCoreWlanEngine()
{
+ while (!foundConfigurations.isEmpty())
+ delete foundConfigurations.takeFirst();
}
QString QCoreWlanEngine::getInterfaceFromId(const QString &id)
@@ -126,16 +128,6 @@ bool QCoreWlanEngine::hasIdentifier(const QString &id)
return configurationInterface.contains(id);
}
-QString QCoreWlanEngine::bearerName(const QString &id)
-{
- QString interface = getInterfaceFromId(id);
-
- if (interface.isEmpty())
- return QString();
-
- return qGetInterfaceType(interface);
-}
-
void QCoreWlanEngine::connectToId(const QString &id)
{
NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
@@ -151,14 +143,22 @@ void QCoreWlanEngine::connectToId(const QString &id)
NSEnumerator *enumerator = [remNets objectEnumerator];
CWWirelessProfile *wProfile;
NSUInteger index=0;
+ CWNetwork *apNetwork;
+ NSDictionary *parametersDict;
+ NSArray* apArray;
+
+ CW8021XProfile *user8021XProfile;
+ NSError *err;
+ NSMutableDictionary *params;
+
while ((wProfile = [enumerator nextObject])) { //CWWirelessProfile
if(id == nsstringToQString([wProfile ssid])) {
- CW8021XProfile *user8021XProfile = nil;
+ user8021XProfile = nil;
user8021XProfile = [ wProfile user8021XProfile];
- NSError *err = nil;
- NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:0];
+ err = nil;
+ params = [NSMutableDictionary dictionaryWithCapacity:0];
if(user8021XProfile) {
[params setValue: user8021XProfile forKey:kCWAssocKey8021XProfile];
@@ -166,17 +166,22 @@ void QCoreWlanEngine::connectToId(const QString &id)
[params setValue: [wProfile passphrase] forKey: kCWAssocKeyPassphrase];
}
- NSDictionary *parametersDict = nil;
- NSArray* apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]];
+ parametersDict = nil;
+ apArray = [NSMutableArray arrayWithArray:[wifiInterface scanForNetworksWithParameters:parametersDict error:&err]];
+
if(!err) {
+
for(uint row=0; row < [apArray count]; row++ ) {
- CWNetwork *apNetwork = [apArray objectAtIndex:row];
+ apNetwork = [apArray objectAtIndex:row];
if([[apNetwork ssid] compare:[wProfile ssid]] == NSOrderedSame) {
+
bool result = [wifiInterface associateToNetwork: apNetwork parameters:[NSDictionary dictionaryWithDictionary:params] error:&err];
+
if(!result) {
qWarning() <<"ERROR"<< nsstringToQString([err localizedDescription ]);
emit connectionError(id, ConnectError);
} else {
+ [apNetwork release];
[autoreleasepool release];
return;
}
@@ -186,6 +191,8 @@ void QCoreWlanEngine::connectToId(const QString &id)
}
index++;
}
+ [apNetwork release];
+
emit connectionError(id, InterfaceLookupError);
#endif
} else {
@@ -331,11 +338,12 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
NSDictionary *parametersDict = nil;
NSArray* apArray = [NSMutableArray arrayWithArray:[currentInterface scanForNetworksWithParameters:parametersDict error:&err]];
+ CWNetwork *apNetwork;
if (!err) {
for(uint row=0; row < [apArray count]; row++ ) {
- CWNetwork *apNetwork = [apArray objectAtIndex:row];
+ NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
- const QString networkSsid = nsstringToQString([apNetwork ssid]);
+ apNetwork = [apArray objectAtIndex:row];
const QString id = QString::number(qHash(QLatin1String("corewlan:") + networkSsid));
found.append(id);
@@ -352,12 +360,6 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
state = QNetworkConfiguration::Defined;
}
- CWWirelessProfile *networkProfile = apNetwork.wirelessProfile;
- CW8021XProfile *userNetworkProfile = networkProfile.user8021XProfile;
- if (userNetworkProfile) {
- qWarning() <<"Has profile!" ;
- }
-
if (accessPointConfigurations.contains(id)) {
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
@@ -393,18 +395,21 @@ QStringList QCoreWlanEngine::scanForSsids(const QString &interfaceName)
ptr->id = id;
ptr->state = state;
ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
accessPointConfigurations.insert(id, ptr);
configurationInterface.insert(id, interfaceName);
emit configurationAdded(ptr);
}
+ [looppool release];
}
} else {
qWarning() << "ERROR scanning for ssids" << nsstringToQString([err localizedDescription])
<<nsstringToQString([err domain]);
}
- [autoreleasepool release];
+
+ [autoreleasepool drain];
#else
Q_UNUSED(interfaceName);
#endif
@@ -463,6 +468,7 @@ bool QCoreWlanEngine::getAllScInterfaces()
CFIndex interfaceIndex;
interfaceCount = CFArrayGetCount(interfaces);
for (interfaceIndex = 0; interfaceIndex < interfaceCount; interfaceIndex++) {
+ NSAutoreleasePool *looppool = [[NSAutoreleasePool alloc] init];
CFStringRef bsdName;
CFTypeRef thisInterface = CFArrayGetValueAtIndex(interfaces, interfaceIndex);
@@ -482,11 +488,12 @@ bool QCoreWlanEngine::getAllScInterfaces()
if(!networkInterfaces.contains(interfaceName) && !typeStr.isEmpty()) {
networkInterfaces.insert(interfaceName,typeStr);
}
+ [looppool release];
}
}
CFRelease(interfaces);
- [autoreleasepool release];
+ [autoreleasepool drain];
return true;
}
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp
index 0d9a958..9294fad 100644
--- a/src/plugins/bearer/generic/qgenericengine.cpp
+++ b/src/plugins/bearer/generic/qgenericengine.cpp
@@ -54,7 +54,13 @@
#include "../platformdefs_win.h"
#endif
-QT_BEGIN_NAMESPACE
+#ifdef Q_OS_LINUX
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <net/if_arp.h>
+#endif
+
static QString qGetInterfaceType(const QString &interface)
{
@@ -68,7 +74,7 @@ static QString qGetInterfaceType(const QString &interface)
HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0,
FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (handle == INVALID_HANDLE_VALUE)
- return QString();
+ return QLatin1String("Unknown");
oid = OID_GEN_MEDIA_SUPPORTED;
bytesWritten = 0;
@@ -76,7 +82,7 @@ static QString qGetInterfaceType(const QString &interface)
&medium, sizeof(medium), &bytesWritten, 0);
if (!result) {
CloseHandle(handle);
- return QString();
+ return QLatin1String("Unknown");
}
oid = OID_GEN_PHYSICAL_MEDIUM;
@@ -89,7 +95,7 @@ static QString qGetInterfaceType(const QString &interface)
if (medium == NdisMedium802_3)
return QLatin1String("Ethernet");
else
- return QString();
+ return QLatin1String("Unknown");
}
CloseHandle(handle);
@@ -113,11 +119,24 @@ static QString qGetInterfaceType(const QString &interface)
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug() << medium << physicalMedium;
#endif
+#elif defined(Q_OS_LINUX)
+ int sock = socket(AF_INET, SOCK_DGRAM, 0);
+
+ ifreq request;
+ strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
+ if (ioctl(sock, SIOCGIFHWADDR, &request) >= 0) {
+ switch (request.ifr_hwaddr.sa_family) {
+ case ARPHRD_ETHER:
+ return QLatin1String("Ethernet");
+ }
+ }
+
+ close(sock);
#else
Q_UNUSED(interface);
#endif
- return QString();
+ return QLatin1String("Unknown");
}
QGenericEngine::QGenericEngine(QObject *parent)
@@ -142,15 +161,15 @@ bool QGenericEngine::hasIdentifier(const QString &id)
return configurationInterface.contains(id);
}
-QString QGenericEngine::bearerName(const QString &id)
+/*QString QGenericEngine::bearerName(const QString &id)
{
QString interface = getInterfaceFromId(id);
if (interface.isEmpty())
- return QString();
+ return QLatin1String("Unknown");
return qGetInterfaceType(interface);
-}
+}*/
void QGenericEngine::connectToId(const QString &id)
{
@@ -249,6 +268,7 @@ void QGenericEngine::doRequestUpdate()
ptr->id = id;
ptr->state = state;
ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = qGetInterfaceType(interface.name());
accessPointConfigurations.insert(id, ptr);
configurationInterface.insert(id, interface.name());
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index e65eeea..0050770 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -199,6 +199,7 @@ void QNativeWifiEngine::scanComplete()
ptr->id = id;
ptr->state = state;
ptr->type = QNetworkConfiguration::InternetAccessPoint;
+ ptr->bearer = QLatin1String("WLAN");
accessPointConfigurations.insert(id, ptr);
@@ -321,10 +322,10 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id)
return false;
}
-QString QNativeWifiEngine::bearerName(const QString &)
+/*QString QNativeWifiEngine::bearerName(const QString &)
{
return QLatin1String("WLAN");
-}
+}*/
void QNativeWifiEngine::connectToId(const QString &id)
{
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 5d6af40..511a6a4 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -73,7 +73,7 @@ public:
QString getInterfaceFromId(const QString &id);
bool hasIdentifier(const QString &id);
- QString bearerName(const QString &id);
+ //QString bearerName(const QString &id);
void connectToId(const QString &id);
void disconnectFromId(const QString &id);
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 0af3675..20dee1f 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -515,6 +515,7 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec
ptr->type = QNetworkConfiguration::InternetAccessPoint;
ptr->purpose = QNetworkConfiguration::PublicPurpose;
ptr->state = QNetworkConfiguration::Undefined;
+ ptr->bearer = QLatin1String("WLAN");
accessPointConfigurations.insert(ptr->id, ptr);
emit configurationAdded(ptr);
@@ -570,6 +571,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
const QString connectionType = map.value("connection").value("type").toString();
if (connectionType == QLatin1String("802-3-ethernet")) {
+ cpPriv->bearer = QLatin1String("Ethernet");
+
foreach (const QDBusObjectPath &devicePath, interface->getDevices()) {
QNetworkManagerInterfaceDevice device(devicePath.path());
if (device.deviceType() == DEVICE_TYPE_802_3_ETHERNET) {
@@ -582,6 +585,8 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
}
}
} else if (connectionType == QLatin1String("802-11-wireless")) {
+ cpPriv->bearer = QLatin1String("WLAN");
+
const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString();
for (int i = 0; i < accessPoints.count(); ++i) {
@@ -599,6 +604,10 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri
break;
}
}
+ } else if (connectionType == "gsm") {
+ cpPriv->bearer = QLatin1String("2G");
+ } else if (connectionType == "cdma") {
+ cpPriv->bearer = QLatin1String("CDMA2000");
}
return cpPriv;
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index 9376324..3843f27 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -70,7 +70,7 @@ public:
};
QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
- : QObject(parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerInterfacePrivate();
d->connectionInterface = new QDBusInterface(NM_DBUS_SERVICE,
@@ -93,9 +93,10 @@ QNetworkManagerInterface::QNetworkManagerInterface(QObject *parent)
QNetworkManagerInterface::~QNetworkManagerInterface()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
- delete nmDBusHelper;
}
bool QNetworkManagerInterface::isValid()
@@ -196,7 +197,7 @@ public:
};
QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const QString &dbusPathName, QObject *parent)
- : QObject(parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerInterfaceAccessPointPrivate();
d->path = dbusPathName;
@@ -215,6 +216,8 @@ QNetworkManagerInterfaceAccessPoint::QNetworkManagerInterfaceAccessPoint(const Q
QNetworkManagerInterfaceAccessPoint::~QNetworkManagerInterfaceAccessPoint()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -230,6 +233,9 @@ bool QNetworkManagerInterfaceAccessPoint::setConnections()
return false;
bool allOk = false;
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -305,7 +311,7 @@ public:
};
QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &deviceObjectPath, QObject *parent)
- : QObject(parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerInterfaceDevicePrivate();
d->path = deviceObjectPath;
@@ -323,6 +329,8 @@ QNetworkManagerInterfaceDevice::QNetworkManagerInterfaceDevice(const QString &de
QNetworkManagerInterfaceDevice::~QNetworkManagerInterfaceDevice()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -338,6 +346,9 @@ bool QNetworkManagerInterfaceDevice::setConnections()
return false;
bool allOk = false;
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper,SIGNAL(pathForStateChanged(const QString &, quint32)),
this, SIGNAL(stateChanged(const QString&, quint32)));
@@ -397,6 +408,7 @@ public:
};
QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const QString &ifaceDevicePath, QObject *parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerInterfaceDeviceWiredPrivate();
d->path = ifaceDevicePath;
@@ -414,6 +426,8 @@ QNetworkManagerInterfaceDeviceWired::QNetworkManagerInterfaceDeviceWired(const Q
QNetworkManagerInterfaceDeviceWired::~QNetworkManagerInterfaceDeviceWired()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -431,6 +445,9 @@ bool QNetworkManagerInterfaceDeviceWired::setConnections()
bool allOk = false;
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -474,6 +491,7 @@ public:
};
QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(const QString &ifaceDevicePath, QObject *parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerInterfaceDeviceWirelessPrivate();
d->path = ifaceDevicePath;
@@ -491,6 +509,8 @@ QNetworkManagerInterfaceDeviceWireless::QNetworkManagerInterfaceDeviceWireless(c
QNetworkManagerInterfaceDeviceWireless::~QNetworkManagerInterfaceDeviceWireless()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -506,6 +526,9 @@ bool QNetworkManagerInterfaceDeviceWireless::setConnections()
return false;
bool allOk = false;
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -593,7 +616,6 @@ public:
QNetworkManagerSettings::QNetworkManagerSettings(const QString &settingsService, QObject *parent)
: QObject(parent)
{
-// qWarning() << __PRETTY_FUNCTION__;
d = new QNetworkManagerSettingsPrivate();
d->path = settingsService;
d->connectionInterface = new QDBusInterface(settingsService,
@@ -656,6 +678,7 @@ public:
};
QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QString &settingsService, const QString &connectionObjectPath, QObject *parent)
+ : QObject(parent), nmDBusHelper(0)
{
qDBusRegisterMetaType<QNmSettingsMap>();
d = new QNetworkManagerSettingsConnectionPrivate();
@@ -677,6 +700,8 @@ QNetworkManagerSettingsConnection::QNetworkManagerSettingsConnection(const QStri
QNetworkManagerSettingsConnection::~QNetworkManagerSettingsConnection()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -701,6 +726,9 @@ bool QNetworkManagerSettingsConnection::setConnections()
qDebug() << error.name() << error.message() << error.type();
}
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper, SIGNAL(pathForSettingsRemoved(const QString &)),
this,SIGNAL(removed( const QString &)));
@@ -884,6 +912,7 @@ public:
};
QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString &activeConnectionObjectPath, QObject *parent)
+ : QObject(parent), nmDBusHelper(0)
{
d = new QNetworkManagerConnectionActivePrivate();
d->path = activeConnectionObjectPath;
@@ -901,6 +930,8 @@ QNetworkManagerConnectionActive::QNetworkManagerConnectionActive( const QString
QNetworkManagerConnectionActive::~QNetworkManagerConnectionActive()
{
+ if (nmDBusHelper)
+ delete nmDBusHelper;
delete d->connectionInterface;
delete d;
}
@@ -916,6 +947,9 @@ bool QNetworkManagerConnectionActive::setConnections()
return false;
bool allOk = false;
+ if (nmDBusHelper)
+ delete nmDBusHelper;
+ nmDBusHelper = 0;
nmDBusHelper = new QNmDBusHelper;
connect(nmDBusHelper, SIGNAL(pathForPropertiesChanged(const QString &,QMap<QString,QVariant>)),
this,SIGNAL(propertiesChanged( const QString &, QMap<QString,QVariant>)));
@@ -979,6 +1013,7 @@ public:
};
QNetworkManagerIp4Config::QNetworkManagerIp4Config( const QString &deviceObjectPath, QObject *parent)
+ : QObject(parent)
{
d = new QNetworkManagerIp4ConfigPrivate();
d->path = deviceObjectPath;
diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp
index bf0d74f..be1cd28 100644
--- a/src/plugins/bearer/nla/qnlaengine.cpp
+++ b/src/plugins/bearer/nla/qnlaengine.cpp
@@ -131,7 +131,7 @@ static QString qGetInterfaceType(const QString &interface)
HANDLE handle = CreateFile((TCHAR *)QString(QLatin1String("\\\\.\\%1")).arg(interface).utf16(),
0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0);
if (handle == INVALID_HANDLE_VALUE)
- return QString();
+ return QLatin1String("Unknown");
oid = OID_GEN_MEDIA_SUPPORTED;
bytesWritten = 0;
@@ -139,7 +139,7 @@ static QString qGetInterfaceType(const QString &interface)
&medium, sizeof(medium), &bytesWritten, 0);
if (!result) {
CloseHandle(handle);
- return QString();
+ return QLatin1String("Unknown");
}
oid = OID_GEN_PHYSICAL_MEDIUM;
@@ -152,7 +152,7 @@ static QString qGetInterfaceType(const QString &interface)
if (medium == NdisMedium802_3)
return QLatin1String("Ethernet");
else
- return QString();
+ return QLatin1String("Unknown");
}
CloseHandle(handle);
@@ -179,7 +179,7 @@ static QString qGetInterfaceType(const QString &interface)
#endif
- return QString();
+ return QLatin1String("Unknown");
}
class QNlaThread : public QThread
@@ -406,6 +406,8 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query
cpPriv->id = QString::number(qHash(QLatin1String("NLA:") + cpPriv->name));
cpPriv->state = QNetworkConfiguration::Defined;
cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+ if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent()))
+ config->bearer = engine->bearerName(config->id);
#ifdef BEARER_MANAGEMENT_DEBUG
qDebug() << "size:" << querySet->dwSize;
diff --git a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro
index b539dd3..05d17f1 100644
--- a/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro
+++ b/tests/auto/qnetworkconfigmanager/qnetworkconfigmanager.pro
@@ -3,3 +3,7 @@ SOURCES += tst_qnetworkconfigmanager.cpp
HEADERS += ../qbearertestcommon.h
QT = core network
+
+symbian {
+ TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
+}
diff --git a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp
index f065f78..3052330 100644
--- a/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp
+++ b/tests/auto/qnetworkconfigmanager/tst_qnetworkconfigmanager.cpp
@@ -44,7 +44,7 @@
#include "qnetworkconfiguration.h"
#include "qnetworkconfigmanager.h"
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -66,7 +66,7 @@ private slots:
void configurationFromIdentifier();
private:
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -78,7 +78,7 @@ private:
void tst_QNetworkConfigurationManager::initTestCase()
{
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -152,7 +152,7 @@ void tst_QNetworkConfigurationManager::initTestCase()
void tst_QNetworkConfigurationManager::cleanupTestCase()
{
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf->clear();
delete iapconf;
iapconf2->clear();
diff --git a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro
index 078983d..ce11cc7 100644
--- a/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro
+++ b/tests/auto/qnetworkconfiguration/qnetworkconfiguration.pro
@@ -3,3 +3,7 @@ SOURCES += tst_qnetworkconfiguration.cpp
HEADERS += ../qbearertestcommon.h
QT = core network
+
+symbian {
+ TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
+}
diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
index 9ac9e47..70f4447 100644
--- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
+++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp
@@ -44,7 +44,7 @@
#include "qnetworkconfiguration.h"
#include "qnetworkconfigmanager.h"
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -65,7 +65,7 @@ private slots:
void isRoamingAvailable();
private:
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -77,7 +77,7 @@ private:
void tst_QNetworkConfiguration::initTestCase()
{
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -150,7 +150,7 @@ void tst_QNetworkConfiguration::initTestCase()
void tst_QNetworkConfiguration::cleanupTestCase()
{
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf->clear();
delete iapconf;
iapconf2->clear();
diff --git a/tests/auto/qnetworksession/lackey/main.cpp b/tests/auto/qnetworksession/lackey/main.cpp
index 9f32696..a84021d 100644
--- a/tests/auto/qnetworksession/lackey/main.cpp
+++ b/tests/auto/qnetworksession/lackey/main.cpp
@@ -107,7 +107,7 @@ int main(int argc, char** argv)
session->open();
session->waitForOpened();
- } while (!(session && session->isActive()));
+ } while (!(session && session->isOpen()));
qDebug() << "loop done";
diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp
index c7ce963..061108a 100644
--- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp
+++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.cpp
@@ -46,7 +46,7 @@
#include <qnetworkconfigmanager.h>
#include <qnetworksession.h>
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
#include <stdio.h>
#include <iapconf.h>
#endif
@@ -84,7 +84,7 @@ private:
uint inProcessSessionManagementCount;
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
Maemo::IAPConf *iapconf;
Maemo::IAPConf *iapconf2;
Maemo::IAPConf *gprsiap;
@@ -100,7 +100,7 @@ void tst_QNetworkSession::initTestCase()
qRegisterMetaType<QNetworkSession::SessionError>("QNetworkSession::SessionError");
qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration");
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf = new Maemo::IAPConf("007");
iapconf->setValue("ipv4_type", "AUTO");
iapconf->setValue("wlan_wepkey1", "connt");
@@ -186,7 +186,7 @@ void tst_QNetworkSession::cleanupTestCase()
"tests in inProcessSessionManagement()");
}
-#ifdef MAEMO
+#ifdef Q_WS_MAEMO_6
iapconf->clear();
delete iapconf;
iapconf2->clear();
@@ -212,7 +212,7 @@ void tst_QNetworkSession::cleanupTestCase()
void tst_QNetworkSession::invalidSession()
{
QNetworkSession session(QNetworkConfiguration(), 0);
- QVERIFY(!session.isActive());
+ QVERIFY(!session.isOpen());
QVERIFY(session.state() == QNetworkSession::Invalid);
}
@@ -236,7 +236,7 @@ void tst_QNetworkSession::sessionProperties()
QVERIFY(session.configuration() == configuration);
- QStringList validBearerNames = QStringList() << QString()
+ QStringList validBearerNames = QStringList() << QLatin1String("Unknown")
<< QLatin1String("Ethernet")
<< QLatin1String("WLAN")
<< QLatin1String("2G")
@@ -246,10 +246,21 @@ void tst_QNetworkSession::sessionProperties()
<< QLatin1String("Bluetooth")
<< QLatin1String("WiMAX");
- if (!configuration.isValid())
- QVERIFY(session.bearerName().isEmpty());
- else
- QVERIFY(validBearerNames.contains(session.bearerName()));
+ if (!configuration.isValid()) {
+ QVERIFY(configuration.bearerName().isEmpty());
+ } else {
+ switch (configuration.type())
+ {
+ case QNetworkConfiguration::ServiceNetwork:
+ case QNetworkConfiguration::UserChoice:
+ default:
+ QVERIFY(configuration.bearerName().isEmpty());
+ break;
+ case QNetworkConfiguration::InternetAccessPoint:
+ QVERIFY(validBearerNames.contains(configuration.bearerName()));
+ break;
+ }
+ }
// QNetworkSession::interface() should return an invalid interface unless
// session is in the connected state.
@@ -302,9 +313,9 @@ void tst_QNetworkSession::userChoiceSession()
QVERIFY(session.configuration() == configuration);
- QVERIFY(!session.isActive());
+ QVERIFY(!session.isOpen());
- QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString().isEmpty());
+ QVERIFY(session.sessionProperty("ActiveConfiguration").toString().isEmpty());
// The remaining tests require the session to be not NotAvailable.
@@ -324,7 +335,7 @@ void tst_QNetworkSession::userChoiceSession()
session.waitForOpened();
- if (session.isActive())
+ if (session.isOpen())
QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty());
if (!errorSpy.isEmpty()) {
QNetworkSession::SessionError error =
@@ -359,7 +370,7 @@ void tst_QNetworkSession::userChoiceSession()
QVERIFY(session.interface().isValid());
const QString userChoiceIdentifier =
- session.sessionProperty("UserChoiceConfigurationIdentifier").toString();
+ session.sessionProperty("UserChoiceConfiguration").toString();
QVERIFY(!userChoiceIdentifier.isEmpty());
QVERIFY(userChoiceIdentifier != configuration.identifier());
@@ -371,12 +382,12 @@ void tst_QNetworkSession::userChoiceSession()
QVERIFY(userChoiceConfiguration.type() != QNetworkConfiguration::UserChoice);
const QString testIdentifier("abc");
- //resetting UserChoiceConfigurationIdentifier is ignored (read only property)
- session.setSessionProperty("UserChoiceConfigurationIdentifier", testIdentifier);
- QVERIFY(session.sessionProperty("UserChoiceConfigurationIdentifier").toString() != testIdentifier);
+ //resetting UserChoiceConfiguration is ignored (read only property)
+ session.setSessionProperty("UserChoiceConfiguration", testIdentifier);
+ QVERIFY(session.sessionProperty("UserChoiceConfiguration").toString() != testIdentifier);
const QString activeIdentifier =
- session.sessionProperty("ActiveConfigurationIdentifier").toString();
+ session.sessionProperty("ActiveConfiguration").toString();
QVERIFY(!activeIdentifier.isEmpty());
QVERIFY(activeIdentifier != configuration.identifier());
@@ -387,9 +398,9 @@ void tst_QNetworkSession::userChoiceSession()
QVERIFY(activeConfiguration.isValid());
QVERIFY(activeConfiguration.type() == QNetworkConfiguration::InternetAccessPoint);
- //resetting ActiveConfigurationIdentifier is ignored (read only property)
- session.setSessionProperty("ActiveConfigurationIdentifier", testIdentifier);
- QVERIFY(session.sessionProperty("ActiveConfigurationIdentifier").toString() != testIdentifier);
+ //resetting ActiveConfiguration is ignored (read only property)
+ session.setSessionProperty("ActiveConfiguration", testIdentifier);
+ QVERIFY(session.sessionProperty("ActiveConfiguration").toString() != testIdentifier);
if (userChoiceConfiguration.type() == QNetworkConfiguration::InternetAccessPoint) {
QVERIFY(userChoiceConfiguration == activeConfiguration);
@@ -429,7 +440,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
// Test initial state of the session.
{
QVERIFY(session.configuration() == configuration);
- QVERIFY(!session.isActive());
+ QVERIFY(!session.isOpen());
// session may be invalid if configuration is removed between when
// sessionOpenCloseStop_data() is called and here.
QVERIFY((configuration.isValid() && (session.state() != QNetworkSession::Invalid)) ||
@@ -455,7 +466,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
session.waitForOpened();
- if (session.isActive())
+ if (session.isOpen())
QVERIFY(!sessionOpenedSpy.isEmpty() || !errorSpy.isEmpty());
if (!errorSpy.isEmpty()) {
QNetworkSession::SessionError error =
@@ -519,7 +530,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
// Test opening a second session.
{
QVERIFY(session2.configuration() == configuration);
- QVERIFY(!session2.isActive());
+ QVERIFY(!session2.isOpen());
QVERIFY(session2.state() == QNetworkSession::Connected);
QVERIFY(session.error() == QNetworkSession::UnknownSessionError);
@@ -527,8 +538,8 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QTRY_VERIFY(!sessionOpenedSpy2.isEmpty() || !errorSpy2.isEmpty());
- QVERIFY(session.isActive());
- QVERIFY(session2.isActive());
+ QVERIFY(session.isOpen());
+ QVERIFY(session2.isOpen());
QVERIFY(session.state() == QNetworkSession::Connected);
QVERIFY(session2.state() == QNetworkSession::Connected);
QVERIFY(session.interface().isValid());
@@ -552,7 +563,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QTRY_VERIFY(!sessionClosedSpy2.isEmpty() || !errorSpy2.isEmpty());
- QVERIFY(!session2.isActive());
+ QVERIFY(!session2.isOpen());
if (!errorSpy2.isEmpty()) {
QVERIFY(!errorSpy.isEmpty());
@@ -634,7 +645,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
}
}
if (roamedSuccessfully) {
- QString configId = session.sessionProperty("ActiveConfigurationIdentifier").toString();
+ QString configId = session.sessionProperty("ActiveConfiguration").toString();
QNetworkConfiguration config = manager.configurationFromIdentifier(configId);
QNetworkSession session3(config);
QSignalSpy errorSpy3(&session3, SIGNAL(error(QNetworkSession::SessionError)));
@@ -643,7 +654,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
session3.open();
session3.waitForOpened();
- if (session.isActive())
+ if (session.isOpen())
QVERIFY(!sessionOpenedSpy3.isEmpty() || !errorSpy3.isEmpty());
session.stop();
@@ -684,9 +695,9 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QVERIFY(!sessionClosedSpy2.isEmpty());
#ifndef Q_CC_NOKIAX86
- QVERIFY(!session.isActive());
+ QVERIFY(!session.isOpen());
#endif
- QVERIFY(!session2.isActive());
+ QVERIFY(!session2.isOpen());
} else {
// Test closing the second session.
{
@@ -700,8 +711,8 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QVERIFY(sessionClosedSpy.isEmpty());
- QVERIFY(session.isActive());
- QVERIFY(!session2.isActive());
+ QVERIFY(session.isOpen());
+ QVERIFY(!session2.isOpen());
QVERIFY(session.state() == QNetworkSession::Connected);
QVERIFY(session2.state() == QNetworkSession::Connected);
QVERIFY(session.interface().isValid());
@@ -726,7 +737,7 @@ void tst_QNetworkSession::sessionOpenCloseStop()
QTRY_VERIFY(!sessionClosedSpy.isEmpty() || !errorSpy.isEmpty());
- QVERIFY(!session.isActive());
+ QVERIFY(!session.isOpen());
if (expectStateChange)
QTRY_VERIFY(!stateChangedSpy.isEmpty() || !errorSpy.isEmpty());
@@ -783,12 +794,15 @@ void tst_QNetworkSession::outOfProcessSession()
QList<QNetworkConfiguration> before = manager.allConfigurations(QNetworkConfiguration::Active);
- QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)));
-
+ QSignalSpy spy(&manager, SIGNAL(configurationChanged(QNetworkConfiguration)));
+
// Cannot read/write to processes on WinCE or Symbian.
// Easiest alternative is to use sockets for IPC.
QLocalServer oopServer;
+ // First remove possible earlier listening address which would cause listen to fail
+ // (e.g. previously abruptly ended unit test might cause this)
+ QLocalServer::removeServer("tst_qnetworksession");
oopServer.listen("tst_qnetworksession");
QProcess lackey;
diff --git a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro
index bf33122..85aa5aa 100644
--- a/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro
+++ b/tests/auto/qnetworksession/tst_qnetworksession/tst_qnetworksession.pro
@@ -3,3 +3,7 @@ SOURCES += tst_qnetworksession.cpp
HEADERS += ../../qbearertestcommon.h
QT = core network
+
+symbian {
+ TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData
+} \ No newline at end of file
diff --git a/tests/manual/bearerex/bearerex.cpp b/tests/manual/bearerex/bearerex.cpp
index c5bf786..19246a2 100644
--- a/tests/manual/bearerex/bearerex.cpp
+++ b/tests/manual/bearerex/bearerex.cpp
@@ -70,10 +70,6 @@ void BearerEx::createMenus()
menuBar()->addAction(act1);
connect(act1, SIGNAL(triggered()), this, SLOT(on_showDetailsButton_clicked()));
- m_openAction = new QAction(tr("Open Session"), this);
- menuBar()->addAction(m_openAction);
- connect(m_openAction, SIGNAL(triggered()), this, SLOT(on_openSessionButton_clicked()));
-
QAction* exitAct = new QAction(tr("Exit"), this);
menuBar()->addAction(exitAct);
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
@@ -291,7 +287,7 @@ SessionTab::SessionTab(QNetworkConfiguration* apNetworkConfiguration,
} else if (apNetworkConfiguration->type() == QNetworkConfiguration::ServiceNetwork) {
snapLineEdit->setText(apNetworkConfiguration->name()+" ("+apNetworkConfiguration->identifier()+")");
}
- bearerLineEdit->setText(m_NetworkSession->bearerName());
+ bearerLineEdit->setText(apNetworkConfiguration->bearerName());
sentRecDataLineEdit->setText(QString::number(m_NetworkSession->bytesWritten())+
QString(" / ")+
QString::number(m_NetworkSession->bytesReceived()));
@@ -342,7 +338,7 @@ void SessionTab::on_sendRequestButton_clicked()
void SessionTab::on_openSessionButton_clicked()
{
m_NetworkSession->open();
- if (m_NetworkSession->isActive()) {
+ if (m_NetworkSession->isOpen()) {
newState(m_NetworkSession->state());
}
}
@@ -350,7 +346,7 @@ void SessionTab::on_openSessionButton_clicked()
void SessionTab::on_closeSessionButton_clicked()
{
m_NetworkSession->close();
- if (!m_NetworkSession->isActive()) {
+ if (!m_NetworkSession->isOpen()) {
newState(m_NetworkSession->state());
}
}
@@ -419,7 +415,7 @@ void SessionTab::opened()
listItem->setText(QString("S")+QString::number(m_index)+QString(" - ")+QString("Opened"));
m_eventListWidget->addItem(listItem);
- QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier");
+ QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
if (!identifier.isNull()) {
QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
@@ -429,7 +425,7 @@ void SessionTab::opened()
}
if (m_NetworkSession->configuration().type() == QNetworkConfiguration::UserChoice) {
- QVariant identifier = m_NetworkSession->property("UserChoiceConfigurationIdentifier");
+ QVariant identifier = m_NetworkSession->property("UserChoiceConfiguration");
if (!identifier.isNull()) {
QString configId = identifier.toString();
QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
@@ -491,22 +487,21 @@ void SessionTab::stateChanged(QNetworkSession::State state)
void SessionTab::newState(QNetworkSession::State state)
{
- if (state == QNetworkSession::Connected) {
- QVariant identifier = m_NetworkSession->property("ActiveConfigurationIdentifier");
- if (!identifier.isNull()) {
- QString configId = identifier.toString();
- QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
- if (config.isValid()) {
- iapLineEdit->setText(config.name()+" ("+config.identifier()+")");
- }
+ QVariant identifier = m_NetworkSession->property("ActiveConfiguration");
+ if (state == QNetworkSession::Connected && !identifier.isNull()) {
+ QString configId = identifier.toString();
+ QNetworkConfiguration config = m_ConfigManager->configurationFromIdentifier(configId);
+ if (config.isValid()) {
+ iapLineEdit->setText(config.name()+" ("+config.identifier()+")");
+ bearerLineEdit->setText(config.bearerName());
}
+ } else {
+ bearerLineEdit->setText(m_NetworkSession->configuration().bearerName());
}
- bearerLineEdit->setText(m_NetworkSession->bearerName());
-
QString active;
- if (m_NetworkSession->isActive()) {
- active = " (A)";
+ if (m_NetworkSession->isOpen()) {
+ active = " (O)";
}
stateLineEdit->setText(stateString(state)+active);
}
diff --git a/tests/manual/bearerex/bearerex.h b/tests/manual/bearerex/bearerex.h
index ff5f23c..2875d6a 100644
--- a/tests/manual/bearerex/bearerex.h
+++ b/tests/manual/bearerex/bearerex.h
@@ -52,7 +52,10 @@
#include "qnetworksession.h"
#include "xqlistwidget.h"
+QT_BEGIN_NAMESPACE
class QHttp;
+QT_END_NAMESPACE
+
class SessionTab;
QT_USE_NAMESPACE
diff --git a/tests/manual/bearerex/bearerex.pro b/tests/manual/bearerex/bearerex.pro
index 476e87c..927f982 100644
--- a/tests/manual/bearerex/bearerex.pro
+++ b/tests/manual/bearerex/bearerex.pro
@@ -16,3 +16,5 @@ HEADERS += bearerex.h \
SOURCES += bearerex.cpp \
main.cpp \
xqlistwidget.cpp
+
+symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData \ No newline at end of file
diff --git a/tests/manual/networkmanager/nmview.cpp b/tests/manual/networkmanager/nmview.cpp
index f7611f0..9e28ff0 100644
--- a/tests/manual/networkmanager/nmview.cpp
+++ b/tests/manual/networkmanager/nmview.cpp
@@ -188,8 +188,6 @@ void NMView::getActiveConnections()
void NMView::update()
{
-// if(sess)
-// qWarning() << __FUNCTION__<< sess->bytesWritten() << sess->bearerName();
// QNetworkManagerInterface *dbIface;
// dbIface = new QNetworkManagerInterface;
// QList <QDBusObjectPath> connections = dbIface->activeConnections();
diff --git a/tests/manual/networkmanager/nmview.h b/tests/manual/networkmanager/nmview.h
index b725ade..41ee04f 100644
--- a/tests/manual/networkmanager/nmview.h
+++ b/tests/manual/networkmanager/nmview.h
@@ -49,9 +49,11 @@
QT_USE_NAMESPACE
+QT_BEGIN_NAMESPACE
class QListWidget;
class QTreeWidget;
class QTreeWidgetItem;
+QT_END_NAMESPACE
class NMView : public QDialog, private Ui::Dialog
{