diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-01-04 23:06:49 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-01-04 23:45:12 (GMT) |
commit | 31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41 (patch) | |
tree | 0f013fe0a7407737aac96d8d0dab5ccf83815261 /examples/network | |
parent | 0f31f63e11d4fcb2b399979de28368a89275b911 (diff) | |
download | Qt-31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41.zip Qt-31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41.tar.gz Qt-31e6fc5ae7f7fbe2f23b519cb76dcc579dac1f41.tar.bz2 |
Bearer Management Integration 2.
Diffstat (limited to 'examples/network')
-rw-r--r-- | examples/network/bearercloud/bearercloud.pro | 13 | ||||
-rw-r--r-- | examples/network/bearercloud/cloud.cpp | 12 | ||||
-rw-r--r-- | examples/network/bearercloud/cloud.h | 2 | ||||
-rw-r--r-- | examples/network/bearermonitor/bearermonitor.pro | 12 | ||||
-rw-r--r-- | examples/network/bearermonitor/sessionwidget.cpp | 15 |
5 files changed, 26 insertions, 28 deletions
diff --git a/examples/network/bearercloud/bearercloud.pro b/examples/network/bearercloud/bearercloud.pro index 308ddda..75e3049 100644 --- a/examples/network/bearercloud/bearercloud.pro +++ b/examples/network/bearercloud/bearercloud.pro @@ -15,16 +15,9 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer CONFIG += console -include(../examples.pri) - - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - INCLUDEPATH += ../../ - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 4a1bde7..61bd88e 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 4ce43df..b542bf7 100644 --- a/examples/network/bearercloud/cloud.h +++ b/examples/network/bearercloud/cloud.h @@ -45,8 +45,10 @@ #include <QGraphicsItem> QTM_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 c8fb3c2..acbee71 100644 --- a/examples/network/bearermonitor/bearermonitor.pro +++ b/examples/network/bearermonitor/bearermonitor.pro @@ -17,16 +17,12 @@ INCLUDEPATH += ../../src/bearer include(../examples.pri) -qtAddLibrary(QtBearer) +CONFIG += mobility +MOBILITY = bearer + win32:!wince*:LIBS += -lWs2_32 wince*:LIBS += -lWs2 CONFIG += console -include(../examples.pri) - -macx: { - contains(QT_CONFIG,qt_framework):LIBS += -framework QtBearer - contains(CONFIG, debug) { - } -} +symbian:TARGET.CAPABILITY = NetworkServices NetworkControl ReadUserData diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 7633dd7..0277d87 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); } |