summaryrefslogtreecommitdiffstats
path: root/examples/network
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network')
-rw-r--r--examples/network/blockingfortuneclient/blockingfortuneclient.pro2
-rw-r--r--examples/network/broadcastreceiver/broadcastreceiver.pro2
-rw-r--r--examples/network/broadcastsender/broadcastsender.pro2
-rw-r--r--examples/network/download/download.pro2
-rw-r--r--examples/network/downloadmanager/downloadmanager.pro2
-rw-r--r--examples/network/fortuneclient/client.cpp14
-rw-r--r--examples/network/fortuneclient/client.h3
-rw-r--r--examples/network/fortuneclient/fortuneclient.pro9
-rw-r--r--examples/network/fortuneclient/main.cpp6
-rw-r--r--examples/network/fortuneserver/fortuneserver.pro10
-rw-r--r--examples/network/fortuneserver/main.cpp11
-rw-r--r--examples/network/fortuneserver/server.cpp9
-rw-r--r--examples/network/ftp/ftp.pro10
-rw-r--r--examples/network/ftp/ftpwindow.cpp30
-rw-r--r--examples/network/ftp/ftpwindow.h4
-rw-r--r--examples/network/ftp/main.cpp19
-rw-r--r--examples/network/ftp/sym_iap_util.h318
-rw-r--r--examples/network/http/http.pro2
-rw-r--r--examples/network/loopback/loopback.pro2
-rw-r--r--examples/network/network-chat/network-chat.pro2
-rw-r--r--examples/network/network.pro11
-rw-r--r--examples/network/securesocketclient/securesocketclient.pro4
-rw-r--r--examples/network/securesocketclient/sslclient.cpp2
-rw-r--r--examples/network/threadedfortuneserver/threadedfortuneserver.pro2
-rw-r--r--examples/network/torrent/torrent.pro2
25 files changed, 470 insertions, 10 deletions
diff --git a/examples/network/blockingfortuneclient/blockingfortuneclient.pro b/examples/network/blockingfortuneclient/blockingfortuneclient.pro
index fa146fa..96fbc1f 100644
--- a/examples/network/blockingfortuneclient/blockingfortuneclient.pro
+++ b/examples/network/blockingfortuneclient/blockingfortuneclient.pro
@@ -10,3 +10,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/blockingfortuneclient
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS blockingfortuneclient.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/blockingfortuneclient
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/broadcastreceiver/broadcastreceiver.pro b/examples/network/broadcastreceiver/broadcastreceiver.pro
index ad04e2c..36ad096 100644
--- a/examples/network/broadcastreceiver/broadcastreceiver.pro
+++ b/examples/network/broadcastreceiver/broadcastreceiver.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastreceiver
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS broadcastreceiver.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastreceiver
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/broadcastsender/broadcastsender.pro b/examples/network/broadcastsender/broadcastsender.pro
index b300a50..84e6593 100644
--- a/examples/network/broadcastsender/broadcastsender.pro
+++ b/examples/network/broadcastsender/broadcastsender.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastsender
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS broadcastsender.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/broadcastsender
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/download/download.pro b/examples/network/download/download.pro
index 254c356..f0db340 100644
--- a/examples/network/download/download.pro
+++ b/examples/network/download/download.pro
@@ -17,3 +17,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/download
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/network/download
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/downloadmanager/downloadmanager.pro b/examples/network/downloadmanager/downloadmanager.pro
index 1b979ca..ef7052c 100644
--- a/examples/network/downloadmanager/downloadmanager.pro
+++ b/examples/network/downloadmanager/downloadmanager.pro
@@ -18,3 +18,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/downloadmanager
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png
sources.path = $$[QT_INSTALL_EXAMPLES]/network/downloadmanager
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/fortuneclient/client.cpp b/examples/network/fortuneclient/client.cpp
index f3947e2..9828d86 100644
--- a/examples/network/fortuneclient/client.cpp
+++ b/examples/network/fortuneclient/client.cpp
@@ -44,6 +44,10 @@
#include "client.h"
+#ifdef Q_OS_SYMBIAN
+#include "sym_iap_util.h"
+#endif
+
//! [0]
Client::Client(QWidget *parent)
: QDialog(parent)
@@ -102,6 +106,10 @@ Client::Client(QWidget *parent)
setWindowTitle(tr("Fortune Client"));
portLineEdit->setFocus();
+
+#ifdef Q_OS_SYMBIAN
+ isDefaultIapSet = false;
+#endif
//! [5]
}
//! [5]
@@ -110,6 +118,12 @@ Client::Client(QWidget *parent)
void Client::requestNewFortune()
{
getFortuneButton->setEnabled(false);
+#ifdef Q_OS_SYMBIAN
+ if(!isDefaultIapSet) {
+ qt_SetDefaultIap();
+ isDefaultIapSet = true;
+ }
+#endif
blockSize = 0;
tcpSocket->abort();
//! [7]
diff --git a/examples/network/fortuneclient/client.h b/examples/network/fortuneclient/client.h
index c8b8b26..714d871 100644
--- a/examples/network/fortuneclient/client.h
+++ b/examples/network/fortuneclient/client.h
@@ -80,6 +80,9 @@ private:
QTcpSocket *tcpSocket;
QString currentFortune;
quint16 blockSize;
+#ifdef Q_OS_SYMBIAN
+ bool isDefaultIapSet;
+#endif
};
//! [0]
diff --git a/examples/network/fortuneclient/fortuneclient.pro b/examples/network/fortuneclient/fortuneclient.pro
index 1c7b0a8..4765208 100644
--- a/examples/network/fortuneclient/fortuneclient.pro
+++ b/examples/network/fortuneclient/fortuneclient.pro
@@ -8,3 +8,12 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneclient
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fortuneclient.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneclient
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
+
+symbian {
+ HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h
+ LIBS += -lesock
+ TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData"
+ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
+}
diff --git a/examples/network/fortuneclient/main.cpp b/examples/network/fortuneclient/main.cpp
index 0cc7378..4db555c 100644
--- a/examples/network/fortuneclient/main.cpp
+++ b/examples/network/fortuneclient/main.cpp
@@ -40,13 +40,17 @@
****************************************************************************/
#include <QApplication>
-
#include "client.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Client client;
+#ifdef Q_OS_SYMBIAN
+ // Make application better looking and more usable on small screen
+ client.showMaximized();
+#else
client.show();
+#endif
return client.exec();
}
diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro
index e98385a..ea37b58 100644
--- a/examples/network/fortuneserver/fortuneserver.pro
+++ b/examples/network/fortuneserver/fortuneserver.pro
@@ -8,3 +8,13 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS fortuneserver.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
+
+symbian {
+ HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h
+ LIBS += -lesock
+ TARGET.UID3 = 0xA000CF71
+ TARGET.CAPABILITY = "All -TCB"
+ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000
+} \ No newline at end of file
diff --git a/examples/network/fortuneserver/main.cpp b/examples/network/fortuneserver/main.cpp
index d742fb1..3394c1c 100644
--- a/examples/network/fortuneserver/main.cpp
+++ b/examples/network/fortuneserver/main.cpp
@@ -46,11 +46,22 @@
#include "server.h"
+#ifdef Q_OS_SYMBIAN
+#include "sym_iap_util.h"
+#endif
+
int main(int argc, char *argv[])
{
+#ifdef Q_OS_SYMBIAN
+ qt_SetDefaultIap();
+#endif
QApplication app(argc, argv);
Server server;
+#ifdef Q_OS_SYMBIAN
+ server.showMaximized();
+#else
server.show();
+#endif
qsrand(QTime(0,0,0).secsTo(QTime::currentTime()));
return server.exec();
}
diff --git a/examples/network/fortuneserver/server.cpp b/examples/network/fortuneserver/server.cpp
index a102ef2..5da43ab 100644
--- a/examples/network/fortuneserver/server.cpp
+++ b/examples/network/fortuneserver/server.cpp
@@ -63,10 +63,15 @@ Server::Server(QWidget *parent)
return;
}
//! [0]
+ QList<QHostAddress> ipAddresseList = QNetworkInterface::allAddresses();
+ QString ipAddresses;
+ for (int i = 0; i < ipAddresseList.size(); ++i) {
+ ipAddresses.append(ipAddresseList.at(i).toString()).append("\n");
+ }
- statusLabel->setText(tr("The server is running on port %1.\n"
+ statusLabel->setText(tr("The server is running on \n IP: \n%1 PORT: \n%2\n"
"Run the Fortune Client example now.")
- .arg(tcpServer->serverPort()));
+ .arg(ipAddresses).arg(tcpServer->serverPort()));
//! [1]
//! [2]
diff --git a/examples/network/ftp/ftp.pro b/examples/network/ftp/ftp.pro
index cabc003..ac3d3e6 100644
--- a/examples/network/ftp/ftp.pro
+++ b/examples/network/ftp/ftp.pro
@@ -9,3 +9,13 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/ftp
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS ftp.pro images
sources.path = $$[QT_INSTALL_EXAMPLES]/network/ftp
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
+
+symbian {
+ HEADERS += sym_iap_util.h
+ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+ TARGET.CAPABILITY="NetworkServices ReadUserData WriteUserData"
+ TARGET.UID3 = 0xA000A648
+ LIBS+=-lesock -lcommdb # For IAP selection
+} \ No newline at end of file
diff --git a/examples/network/ftp/ftpwindow.cpp b/examples/network/ftp/ftpwindow.cpp
index 3e4a128..ffab8b4 100644
--- a/examples/network/ftp/ftpwindow.cpp
+++ b/examples/network/ftp/ftpwindow.cpp
@@ -44,6 +44,10 @@
#include "ftpwindow.h"
+#ifdef Q_OS_SYMBIAN
+#include "sym_iap_util.h"
+#endif
+
FtpWindow::FtpWindow(QWidget *parent)
: QDialog(parent), ftp(0)
{
@@ -52,6 +56,10 @@ FtpWindow::FtpWindow(QWidget *parent)
ftpServerLabel->setBuddy(ftpServerLineEdit);
statusLabel = new QLabel(tr("Please enter the name of an FTP server."));
+#ifdef Q_OS_SYMBIAN
+ // Use word wrapping to fit the text on screen
+ statusLabel->setWordWrap( true );
+#endif
fileList = new QTreeWidget;
fileList->setEnabled(false);
@@ -90,16 +98,31 @@ FtpWindow::FtpWindow(QWidget *parent)
QHBoxLayout *topLayout = new QHBoxLayout;
topLayout->addWidget(ftpServerLabel);
topLayout->addWidget(ftpServerLineEdit);
+#ifndef Q_OS_SYMBIAN
topLayout->addWidget(cdToParentButton);
topLayout->addWidget(connectButton);
+#else
+ // Make app better lookin on small screen
+ QHBoxLayout *topLayout2 = new QHBoxLayout;
+ topLayout2->addWidget(cdToParentButton);
+ topLayout2->addWidget(connectButton);
+#endif
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addLayout(topLayout);
+#ifdef Q_OS_SYMBIAN
+ // Make app better lookin on small screen
+ mainLayout->addLayout(topLayout2);
+#endif
mainLayout->addWidget(fileList);
mainLayout->addWidget(statusLabel);
mainLayout->addWidget(buttonBox);
setLayout(mainLayout);
+#ifdef Q_OS_SYMBIAN
+ bDefaultIapSet = false;
+#endif
+
setWindowTitle(tr("FTP"));
}
@@ -111,6 +134,12 @@ QSize FtpWindow::sizeHint() const
//![0]
void FtpWindow::connectOrDisconnect()
{
+#ifdef Q_OS_SYMBIAN
+ if(!bDefaultIapSet) {
+ qt_SetDefaultIap();
+ bDefaultIapSet = true;
+ }
+#endif
if (ftp) {
ftp->abort();
ftp->deleteLater();
@@ -124,6 +153,7 @@ void FtpWindow::connectOrDisconnect()
#ifndef QT_NO_CURSOR
setCursor(Qt::ArrowCursor);
#endif
+ statusLabel->setText(tr("Please enter the name of an FTP server."));
return;
}
diff --git a/examples/network/ftp/ftpwindow.h b/examples/network/ftp/ftpwindow.h
index 4f4b480..17736a8 100644
--- a/examples/network/ftp/ftpwindow.h
+++ b/examples/network/ftp/ftpwindow.h
@@ -98,6 +98,10 @@ private:
QString currentPath;
QFtp *ftp;
QFile *file;
+
+#ifdef Q_OS_SYMBIAN
+ bool bDefaultIapSet;
+#endif
//![1]
};
diff --git a/examples/network/ftp/main.cpp b/examples/network/ftp/main.cpp
index 8488dd0..f928bcb 100644
--- a/examples/network/ftp/main.cpp
+++ b/examples/network/ftp/main.cpp
@@ -40,15 +40,28 @@
****************************************************************************/
#include <QApplication>
-
#include "ftpwindow.h"
+#ifdef Q_OS_SYMBIAN
+#include <QDir>
+#include <QDesktopWidget>
+#endif
+
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(ftp);
-
- QApplication app(argc, argv);
+#ifdef Q_OS_SYMBIAN
+ // Change current directory from default private to c:\data
+ // in order that user can access the downloaded content
+ QDir::setCurrent( "c:\\data" );
+#endif
+ QApplication app(argc, argv);
FtpWindow ftpWin;
+#ifdef Q_OS_SYMBIAN
+ // Make application better looking and more usable on small screen
+ ftpWin.showMaximized();
+#else
ftpWin.show();
+#endif
return ftpWin.exec();
}
diff --git a/examples/network/ftp/sym_iap_util.h b/examples/network/ftp/sym_iap_util.h
new file mode 100644
index 0000000..6d52b1d
--- /dev/null
+++ b/examples/network/ftp/sym_iap_util.h
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (qt-info@nokia.com)
+**
+** This file is part of the examples 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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef QSYM_IAP_UTIL_H
+#define QSYM_IAP_UTIL_H
+
+// Symbian
+#include <es_sock.h>
+#include <es_enum.h>
+#include <commdbconnpref.h>
+
+// OpenC
+#include <sys/socket.h>
+#include <net/if.h>
+
+//Qt
+#include <QSettings>
+#include <QStringList>
+
+_LIT(KIapNameSetting, "IAP\\Name"); // text - mandatory
+_LIT(KIapDialogPref, "IAP\\DialogPref"); // TUnit32 - optional
+_LIT(KIapService, "IAP\\IAPService"); // TUnit32 - mandatory
+_LIT(KIapServiceType, "IAP\\IAPServiceType"); // text - mandatory
+_LIT(KIapBearer, "IAP\\IAPBearer"); // TUint32 - optional
+_LIT(KIapBearerType, "IAP\\IAPBearerType"); // text - optional
+_LIT(KIapNetwork, "IAP\\IAPNetwork"); // TUint32 - optional
+
+const QLatin1String qtOrganizationTag("Trolltech");
+const QLatin1String qtNetworkModuleTag("QtNetwork");
+const QLatin1String iapGroupTag("IAP");
+const QLatin1String iapNamesArrayTag("Names");
+const QLatin1String iapNameItemTag("Name");
+
+void clearIapNamesSettings(QSettings &settings) {
+ settings.beginGroup(qtNetworkModuleTag);
+ settings.beginGroup(iapGroupTag);
+ settings.remove(iapNamesArrayTag);
+ settings.endGroup();
+ settings.endGroup();
+}
+
+void writeIapNamesSettings(QSettings &settings, const QStringList& iapNames) {
+ clearIapNamesSettings(settings);
+ settings.beginGroup(qtNetworkModuleTag);
+ settings.beginGroup(iapGroupTag);
+ settings.beginWriteArray(iapNamesArrayTag);
+ for (int index = 0; index < iapNames.size(); ++index) {
+ settings.setArrayIndex(index);
+ settings.setValue(iapNameItemTag, iapNames.at(index));
+ }
+ settings.endArray();
+ settings.endGroup();
+ settings.endGroup();
+}
+
+void readIapNamesSettings(QSettings &settings, QStringList& iapNames) {
+ settings.beginGroup(qtNetworkModuleTag);
+ settings.beginGroup(iapGroupTag);
+ int last = settings.beginReadArray(iapNamesArrayTag);
+ for (int index = 0; index < last; ++index) {
+ settings.setArrayIndex(index);
+ iapNames.append(settings.value(iapNameItemTag).toString());
+ }
+ settings.endArray();
+ settings.endGroup();
+ settings.endGroup();
+}
+
+QString qt_TDesC2QStringL(const TDesC& aDescriptor)
+{
+#ifdef QT_NO_UNICODE
+ return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length());
+#else
+ return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length());
+#endif
+}
+
+static bool qt_SetDefaultIapName(const QString &iapName, int &error) {
+ struct ifreq ifReq;
+ // clear structure
+ memset(&ifReq, 0, sizeof(struct ifreq));
+ // set IAP name value
+ // make sure it is in UTF8
+ strcpy(ifReq.ifr_name, iapName.toUtf8().data());
+
+ if(setdefaultif(&ifReq) == 0) {
+ // OK
+ error = 0;
+ return true;
+ } else {
+ error = errno;
+ return false;
+ }
+
+}
+static bool qt_SetDefaultSnapId(const int snapId, int &error) {
+ struct ifreq ifReq;
+ // clear structure
+ memset(&ifReq, 0, sizeof(struct ifreq));
+ // set SNAP ID value
+ ifReq.ifr_ifru.snap_id = snapId;
+
+ if(setdefaultif(&ifReq) == 0) {
+ // OK
+ error = 0;
+ return true;
+ } else {
+ error = errno;
+ return false;
+ }
+
+}
+
+static void qt_SaveIapName(QSettings& settings, QStringList& iapNames, QString& iapNameValue) {
+ if(iapNames.contains(iapNameValue) && iapNames.first() == iapNameValue) {
+ // no need to update
+ } else {
+ if(iapNameValue != QString("Easy WLAN")) {
+ // new selection alway on top
+ iapNames.removeAll(iapNameValue);
+ iapNames.prepend(iapNameValue);
+ writeIapNamesSettings(settings, iapNames);
+ } else {
+ // Unbeliveable ... if IAP dodn't exist before
+ // no matter what you choose from IAP selection list
+ // you will get "Easy WLAN" as IAP name value
+
+ // somehow commsdb is not in sync
+ }
+ }
+}
+
+static QString qt_OfferIapDialog() {
+ TBuf8<256> iapName;
+
+ RSocketServ socketServ;
+ CleanupClosePushL(socketServ);
+
+ RConnection connection;
+ CleanupClosePushL(connection);
+
+ socketServ.Connect();
+ connection.Open(socketServ);
+ connection.Start();
+
+ connection.GetDesSetting(TPtrC(KIapNameSetting), iapName);
+
+ //connection.Stop();
+
+ iapName.ZeroTerminate();
+ QString strIapName((char*)iapName.Ptr());
+
+ int error = 0;
+ if(!qt_SetDefaultIapName(strIapName, error)) {
+ //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error);
+ strIapName = QString("");
+ }
+
+ CleanupStack::PopAndDestroy(&connection);
+ CleanupStack::PopAndDestroy(&socketServ);
+
+ return strIapName;
+}
+
+static QString qt_CheckForActiveConnection() {
+ TUint count;
+
+ RSocketServ serv;
+ CleanupClosePushL(serv);
+
+ RConnection conn;
+ CleanupClosePushL(conn);
+
+ serv.Connect();
+ conn.Open(serv);
+
+ TConnectionInfoBuf connInfo;
+
+ TBuf8<256> iapName;
+ TBuf8<256> iapServiceType;
+
+ QString strIapName;
+
+ if (conn.EnumerateConnections(count) == KErrNone) {
+ if(count > 0) {
+ for (TUint i = 1; i <= count; i++) {
+ if (conn.GetConnectionInfo(i, connInfo) == KErrNone) {
+ RConnection tempConn;
+ CleanupClosePushL(tempConn);
+ tempConn.Open(serv);
+ if (tempConn.Attach(connInfo, RConnection::EAttachTypeNormal) == KErrNone) {
+ tempConn.GetDesSetting(TPtrC(KIapNameSetting), iapName);
+ tempConn.GetDesSetting(TPtrC(KIapServiceType), iapServiceType);
+ //tempConn.Stop();
+ iapName.ZeroTerminate();
+ iapServiceType.ZeroTerminate();
+
+// if(iapServiceType.Find(_L8("LANService")) != KErrNotFound) {
+// activeLanConnectionFound = ETrue;
+// break;
+// }
+ strIapName = QString((char*)iapName.Ptr());
+ int error = 0;
+ if(!qt_SetDefaultIapName(strIapName, error)) {
+ //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error);
+ strIapName = QString("");
+ }
+
+ CleanupStack::PopAndDestroy(&tempConn);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ //conn.Stop();
+
+ CleanupStack::PopAndDestroy(&conn);
+ CleanupStack::PopAndDestroy(&serv);
+
+ return strIapName;
+}
+
+static QString qt_CheckSettingsForConnection(QStringList& iapNames) {
+ QString strIapName;
+ for(int index = 0; index < iapNames.size(); ++index) {
+ strIapName = iapNames.at(index);
+ int error = 0;
+ if(!qt_SetDefaultIapName(strIapName, error)) {
+ //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error);
+ strIapName = QString("");
+ } else {
+ return strIapName;
+ }
+ }
+ return strIapName;
+}
+
+static void qt_SetDefaultIapL()
+{
+ // settings @ /c/data/.config/Trolltech.com
+ QSettings settings(QSettings::UserScope, qtOrganizationTag);
+ // populate iap name list
+ QStringList iapNames;
+ readIapNamesSettings(settings, iapNames);
+
+ QString iapNameValue;
+
+ iapNameValue = qt_CheckForActiveConnection();
+
+ if(!iapNameValue.isEmpty()) {
+ qt_SaveIapName(settings, iapNames, iapNameValue);
+ return;
+ }
+
+ iapNameValue = qt_CheckSettingsForConnection(iapNames);
+
+ if(!iapNameValue.isEmpty()) {
+ qt_SaveIapName(settings, iapNames, iapNameValue);
+ return;
+ }
+
+ /*
+ * no active LAN connections yet
+ * no IAP in settings
+ * offer IAP dialog to user
+ */
+ iapNameValue = qt_OfferIapDialog();
+ qt_SaveIapName(settings, iapNames, iapNameValue);
+ return;
+
+}
+
+static int qt_SetDefaultIap()
+{
+ TRAPD(err, qt_SetDefaultIapL());
+ return err;
+}
+
+#endif // QSYM_IAP_UTIL_H
diff --git a/examples/network/http/http.pro b/examples/network/http/http.pro
index 7f58d9f..99aa717 100644
--- a/examples/network/http/http.pro
+++ b/examples/network/http/http.pro
@@ -9,3 +9,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/http
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS http.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/http
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/loopback/loopback.pro b/examples/network/loopback/loopback.pro
index 88b7a8b..0a09e34 100644
--- a/examples/network/loopback/loopback.pro
+++ b/examples/network/loopback/loopback.pro
@@ -8,3 +8,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/loopback
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS loopback.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/loopback
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro
index 5d5efea..6967228 100644
--- a/examples/network/network-chat/network-chat.pro
+++ b/examples/network/network-chat/network-chat.pro
@@ -17,3 +17,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/network-chat
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS network-chat.pro *.chat
sources.path = $$[QT_INSTALL_EXAMPLES]/network/network-chat
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/network.pro b/examples/network/network.pro
index adf998f..69b460e 100644
--- a/examples/network/network.pro
+++ b/examples/network/network.pro
@@ -1,9 +1,9 @@
TEMPLATE = subdirs
SUBDIRS = blockingfortuneclient \
- broadcastreceiver \
+ broadcastreceiver \
broadcastsender \
- download \
- downloadmanager \
+ download \
+ downloadmanager \
fortuneclient \
fortuneserver \
ftp \
@@ -11,8 +11,9 @@ SUBDIRS = blockingfortuneclient \
loopback \
threadedfortuneserver \
googlesuggest \
- torrent
+ torrent
+symbian: SUBDIRS = ftp
# no QProcess
!vxworks:!qnx:SUBDIRS += network-chat
@@ -22,3 +23,5 @@ contains(QT_CONFIG, openssl):SUBDIRS += securesocketclient
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS network.pro README
sources.path = $$[QT_INSTALL_EXAMPLES]/network
INSTALLS += sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/securesocketclient/securesocketclient.pro b/examples/network/securesocketclient/securesocketclient.pro
index 4d70a71..2e9141d 100644
--- a/examples/network/securesocketclient/securesocketclient.pro
+++ b/examples/network/securesocketclient/securesocketclient.pro
@@ -14,3 +14,7 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/securesocketclient
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.jpg images
sources.path = $$[QT_INSTALL_EXAMPLES]/network/securesocketclient
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
+
+symbian:TARGET.UID3 = 0xA000CF67 \ No newline at end of file
diff --git a/examples/network/securesocketclient/sslclient.cpp b/examples/network/securesocketclient/sslclient.cpp
index e0543cf..986af85 100644
--- a/examples/network/securesocketclient/sslclient.cpp
+++ b/examples/network/securesocketclient/sslclient.cpp
@@ -145,7 +145,9 @@ void SslClient::socketEncrypted()
if (!padLock) {
padLock = new QToolButton;
padLock->setIcon(QIcon(":/encrypted.png"));
+#ifndef QT_NO_CURSOR
padLock->setCursor(Qt::ArrowCursor);
+#endif
padLock->setToolTip(tr("Display encryption details."));
int extent = form->hostNameEdit->height() - 2;
diff --git a/examples/network/threadedfortuneserver/threadedfortuneserver.pro b/examples/network/threadedfortuneserver/threadedfortuneserver.pro
index 0867dac..94543bf 100644
--- a/examples/network/threadedfortuneserver/threadedfortuneserver.pro
+++ b/examples/network/threadedfortuneserver/threadedfortuneserver.pro
@@ -12,3 +12,5 @@ target.path = $$[QT_INSTALL_EXAMPLES]/network/threadedfortuneserver
sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS threadedfortuneserver.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/network/threadedfortuneserver
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)
diff --git a/examples/network/torrent/torrent.pro b/examples/network/torrent/torrent.pro
index 10b2672..bfd5767 100644
--- a/examples/network/torrent/torrent.pro
+++ b/examples/network/torrent/torrent.pro
@@ -35,3 +35,5 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES torrent.pro *.torrent
sources.files += icons forms 3rdparty
sources.path = $$[QT_INSTALL_EXAMPLES]/network/torrent
INSTALLS += target sources
+
+include($$QT_SOURCE_TREE/examples/examplebase.pri)