summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/network/bearermonitor/bearermonitor.cpp3
-rw-r--r--examples/network/bearermonitor/sessionwidget.cpp12
-rw-r--r--examples/network/bearermonitor/sessionwidget.h5
-rw-r--r--examples/network/bearermonitor/sessionwidget.ui2
4 files changed, 18 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>