summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/network/bearercloud/cloud.cpp34
-rw-r--r--examples/network/bearermonitor/sessionwidget.cpp4
-rw-r--r--examples/network/fortuneserver/fortuneserver.pro2
-rw-r--r--examples/tutorials/addressbook-fr/part2/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook-fr/part3/addressbook.cpp3
-rw-r--r--examples/tutorials/addressbook-fr/part4/addressbook.cpp3
-rw-r--r--examples/tutorials/addressbook-fr/part5/addressbook.cpp5
-rw-r--r--examples/tutorials/addressbook-fr/part6/addressbook.cpp3
-rw-r--r--examples/tutorials/addressbook-fr/part7/addressbook.cpp3
-rw-r--r--examples/tutorials/addressbook/part2/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook/part3/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook/part4/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook/part5/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook/part6/addressbook.cpp2
-rw-r--r--examples/tutorials/addressbook/part7/addressbook.cpp2
15 files changed, 42 insertions, 29 deletions
diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp
index 980efbf..8deaab3 100644
--- a/examples/network/bearercloud/cloud.cpp
+++ b/examples/network/bearercloud/cloud.cpp
@@ -53,7 +53,7 @@
#include <math.h>
-static QMap<QString, QSvgRenderer *> svgCache;
+static QMap<QNetworkConfiguration::BearerType, QSvgRenderer *> svgCache;
//! [0]
Cloud::Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent)
@@ -261,9 +261,9 @@ void Cloud::stateChanged(QNetworkSession::State state)
tooltip += tr("<br>Id: %1").arg(configuration.identifier());
#endif
- const QString bearerName = configuration.bearerName();
- if (!bearerName.isEmpty())
- tooltip += tr("<br>Bearer: %1").arg(bearerName);
+ const QString bearerTypeName = configuration.bearerTypeName();
+ if (!bearerTypeName.isEmpty())
+ tooltip += tr("<br>Bearer: %1").arg(bearerTypeName);
QString s = tr("<br>State: %1 (%2)");
switch (state) {
@@ -313,17 +313,25 @@ void Cloud::stateChanged(QNetworkSession::State state)
//! [1]
void Cloud::newConfigurationActivated()
{
- const QString bearerName = configuration.bearerName();
- if (!svgCache.contains(bearerName)) {
- if (bearerName == QLatin1String("WLAN"))
- svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg")));
- else if (bearerName == QLatin1String("Ethernet"))
- svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":lan.svg")));
- else
- svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":unknown.svg")));
+ QNetworkConfiguration::BearerType bearerType = configuration.bearerType();
+ if (!svgCache.contains(bearerType)) {
+ QSvgRenderer *renderer = 0;
+ switch (bearerType) {
+ case QNetworkConfiguration::BearerWLAN:
+ renderer = new QSvgRenderer(QLatin1String(":wlan.svg"));
+ break;
+ case QNetworkConfiguration::BearerEthernet:
+ renderer = new QSvgRenderer(QLatin1String(":lan.svg"));
+ break;
+ default:
+ renderer = new QSvgRenderer(QLatin1String(":unknown.svg"));
+ }
+
+ if (renderer)
+ svgCache.insert(bearerType, renderer);
}
- icon->setSharedRenderer(svgCache[bearerName]);
+ icon->setSharedRenderer(svgCache[bearerType]);
if (configuration.name().isEmpty()) {
text->setPlainText(tr("HIDDEN NETWORK"));
diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp
index 8b5693a..ecc2a93 100644
--- a/examples/network/bearermonitor/sessionwidget.cpp
+++ b/examples/network/bearermonitor/sessionwidget.cpp
@@ -111,11 +111,11 @@ void SessionWidget::updateSession()
killTimer(statsTimer);
if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint)
- bearer->setText(session->configuration().bearerName());
+ bearer->setText(session->configuration().bearerTypeName());
else {
QNetworkConfigurationManager mgr;
QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString());
- bearer->setText(c.bearerName());
+ bearer->setText(c.bearerTypeName());
}
#ifndef QT_NO_NETWORKINTERFACE
diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro
index e13f309..0ef3e97 100644
--- a/examples/network/fortuneserver/fortuneserver.pro
+++ b/examples/network/fortuneserver/fortuneserver.pro
@@ -10,7 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver
INSTALLS += target sources
symbian {
- TARGET.UID3 = 0xA000CF71
+ TARGET.UID3 = 0xA000E406
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
TARGET.CAPABILITY = "NetworkServices ReadUserData"
TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
diff --git a/examples/tutorials/addressbook-fr/part2/addressbook.cpp b/examples/tutorials/addressbook-fr/part2/addressbook.cpp
index 1fa9d52..8d5b0e1 100644
--- a/examples/tutorials/addressbook-fr/part2/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part2/addressbook.cpp
@@ -111,7 +111,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if ( name.isEmpty()|| address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook-fr/part3/addressbook.cpp b/examples/tutorials/addressbook-fr/part3/addressbook.cpp
index 840f529..2d182c5 100644
--- a/examples/tutorials/addressbook-fr/part3/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part3/addressbook.cpp
@@ -122,9 +122,10 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
+ return;
}
if (!contacts.contains(name)) {
diff --git a/examples/tutorials/addressbook-fr/part4/addressbook.cpp b/examples/tutorials/addressbook-fr/part4/addressbook.cpp
index f6390a4..d3bf030 100644
--- a/examples/tutorials/addressbook-fr/part4/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part4/addressbook.cpp
@@ -131,9 +131,10 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
+ return;
}
//! [submitContact() function part1]
if (currentMode == AddingMode) {
diff --git a/examples/tutorials/addressbook-fr/part5/addressbook.cpp b/examples/tutorials/addressbook-fr/part5/addressbook.cpp
index 80c18c3..d5f5778 100644
--- a/examples/tutorials/addressbook-fr/part5/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part5/addressbook.cpp
@@ -138,10 +138,11 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
- }
+ return;
+ }
if (currentMode == AddingMode) {
diff --git a/examples/tutorials/addressbook-fr/part6/addressbook.cpp b/examples/tutorials/addressbook-fr/part6/addressbook.cpp
index fc41190..7c57db7 100644
--- a/examples/tutorials/addressbook-fr/part6/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part6/addressbook.cpp
@@ -144,9 +144,10 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
+ return;
}
if (currentMode == AddingMode) {
diff --git a/examples/tutorials/addressbook-fr/part7/addressbook.cpp b/examples/tutorials/addressbook-fr/part7/addressbook.cpp
index 3ab8702..b0f35a7 100644
--- a/examples/tutorials/addressbook-fr/part7/addressbook.cpp
+++ b/examples/tutorials/addressbook-fr/part7/addressbook.cpp
@@ -146,9 +146,10 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
+ return;
}
if (currentMode == AddingMode) {
diff --git a/examples/tutorials/addressbook/part2/addressbook.cpp b/examples/tutorials/addressbook/part2/addressbook.cpp
index 1fa9d52..f2f0d65 100644
--- a/examples/tutorials/addressbook/part2/addressbook.cpp
+++ b/examples/tutorials/addressbook/part2/addressbook.cpp
@@ -111,7 +111,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook/part3/addressbook.cpp b/examples/tutorials/addressbook/part3/addressbook.cpp
index 28a570a..4e58fa1 100644
--- a/examples/tutorials/addressbook/part3/addressbook.cpp
+++ b/examples/tutorials/addressbook/part3/addressbook.cpp
@@ -122,7 +122,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook/part4/addressbook.cpp b/examples/tutorials/addressbook/part4/addressbook.cpp
index 55d551f..896a427 100644
--- a/examples/tutorials/addressbook/part4/addressbook.cpp
+++ b/examples/tutorials/addressbook/part4/addressbook.cpp
@@ -131,7 +131,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook/part5/addressbook.cpp b/examples/tutorials/addressbook/part5/addressbook.cpp
index 1b3f451..874b151 100644
--- a/examples/tutorials/addressbook/part5/addressbook.cpp
+++ b/examples/tutorials/addressbook/part5/addressbook.cpp
@@ -138,7 +138,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp
index 724971c..a6bb4a5 100644
--- a/examples/tutorials/addressbook/part6/addressbook.cpp
+++ b/examples/tutorials/addressbook/part6/addressbook.cpp
@@ -144,7 +144,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;
diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp
index bf00298..fb70ba4 100644
--- a/examples/tutorials/addressbook/part7/addressbook.cpp
+++ b/examples/tutorials/addressbook/part7/addressbook.cpp
@@ -146,7 +146,7 @@ void AddressBook::submitContact()
QString name = nameLine->text();
QString address = addressText->toPlainText();
- if (name == "" || address == "") {
+ if (name.isEmpty() || address.isEmpty()) {
QMessageBox::information(this, tr("Empty Field"),
tr("Please enter a name and address."));
return;