diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-13 00:49:52 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-14 03:02:28 (GMT) |
commit | e6efa3ea81dff9eb0ade1c2ba868c272ccfcc958 (patch) | |
tree | 0c4f50afef9228ae047ab02205af7b8a038b84dc | |
parent | 08b6114240a6c02dbeb0297d0deeb538ebc3fde9 (diff) | |
download | Qt-e6efa3ea81dff9eb0ade1c2ba868c272ccfcc958.zip Qt-e6efa3ea81dff9eb0ade1c2ba868c272ccfcc958.tar.gz Qt-e6efa3ea81dff9eb0ade1c2ba868c272ccfcc958.tar.bz2 |
Bearer management changes from Qt Mobility.
9286bfcc43d38e0cb3bfd1d3f99ac7ab5d88b7e3
5 files changed, 25 insertions, 4 deletions
diff --git a/examples/network/bearermonitor/bearermonitor.cpp b/examples/network/bearermonitor/bearermonitor.cpp index 4a6c6ff..0d98eff 100644 --- a/examples/network/bearermonitor/bearermonitor.cpp +++ b/examples/network/bearermonitor/bearermonitor.cpp @@ -255,6 +255,7 @@ void BearerMonitor::onlineStateChanged(bool isOnline) void BearerMonitor::registerNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -276,6 +277,7 @@ void BearerMonitor::registerNetwork() void BearerMonitor::unregisterNetwork() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; QNetworkConfiguration configuration = manager.configurationFromIdentifier(item->data(0, Qt::UserRole).toString()); @@ -384,6 +386,7 @@ void BearerMonitor::createSessionFor(QTreeWidgetItem *item) void BearerMonitor::createNewSession() { QTreeWidgetItem *item = treeWidget->currentItem(); + if (!item) return; createSessionFor(item); } diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 443f4b2..3a8e5ea 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -59,7 +59,7 @@ SessionWidget::SessionWidget(const QNetworkConfiguration &config, QWidget *paren connect(session, SIGNAL(stateChanged(QNetworkSession::State)), this, SLOT(updateSession())); connect(session, SIGNAL(error(QNetworkSession::SessionError)), - this, SLOT(updateSession())); + this, SLOT(updateSessionError(QNetworkSession::SessionError))); updateSession(); @@ -105,7 +105,6 @@ void SessionWidget::deleteSession() void SessionWidget::updateSession() { updateSessionState(session->state()); - updateSessionError(session->error()); if (session->state() == QNetworkSession::Connected) statsTimer = startTimer(1000); @@ -128,12 +127,14 @@ void SessionWidget::updateSession() void SessionWidget::openSession() { + clearError(); session->open(); updateSession(); } void SessionWidget::openSyncSession() { + clearError(); session->open(); session->waitForOpened(); updateSession(); @@ -141,12 +142,14 @@ void SessionWidget::openSyncSession() void SessionWidget::closeSession() { + clearError(); session->close(); updateSession(); } void SessionWidget::stopSession() { + clearError(); session->stop(); updateSession(); } @@ -195,3 +198,8 @@ void SessionWidget::updateSessionError(QNetworkSession::SessionError error) errorString->setText(session->errorString()); } +void SessionWidget::clearError() +{ + lastError->clear(); + errorString->clear(); +} diff --git a/examples/network/bearermonitor/sessionwidget.h b/examples/network/bearermonitor/sessionwidget.h index 5e9d62c..b299b47 100644 --- a/examples/network/bearermonitor/sessionwidget.h +++ b/examples/network/bearermonitor/sessionwidget.h @@ -63,7 +63,7 @@ public: private: void updateSessionState(QNetworkSession::State state); - void updateSessionError(QNetworkSession::SessionError error); + void clearError(); private Q_SLOTS: void openSession(); @@ -71,9 +71,12 @@ private Q_SLOTS: void closeSession(); void stopSession(); void updateSession(); + void updateSessionError(QNetworkSession::SessionError error); #if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) void deleteSession(); #endif + + private: QNetworkSession *session; int statsTimer; diff --git a/examples/network/bearermonitor/sessionwidget.ui b/examples/network/bearermonitor/sessionwidget.ui index 45135f5..56a2d0e 100644 --- a/examples/network/bearermonitor/sessionwidget.ui +++ b/examples/network/bearermonitor/sessionwidget.ui @@ -195,7 +195,7 @@ <item> <widget class="QLabel" name="errorStringLabel"> <property name="text"> - <string>Error String</string> + <string>Error String:</string> </property> </widget> </item> diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index ce3acb7..a3cccb2 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -45,6 +45,13 @@ #include <QtNetwork/qnetworkconfiguration.h> #include <QtNetwork/qnetworkconfigmanager.h> +/* + Although this unit test doesn't use QNetworkAccessManager + this include is used to ensure that bearer continues to compile against + Qt 4.7+ which has a QNetworkConfiguration enabled QNetworkAccessManager +*/ +#include <QNetworkAccessManager> + #if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) #include <stdio.h> #include <iapconf.h> |