diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-04 11:17:47 (GMT) |
commit | be212bf108e71ba3b5b75802b1f4de6613ba315c (patch) | |
tree | c541ad12e8698f04e8fe386c2e1b94e8baca6c1b /examples | |
parent | 67ae1b0dac175f48875507f3187ed49276a29ddf (diff) | |
parent | e6bb00250b321b149dd80259dc4f479088d5949b (diff) | |
download | Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.zip Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.gz Qt-be212bf108e71ba3b5b75802b1f4de6613ba315c.tar.bz2 |
Merge commit 'origin/master'
Conflicts:
src/corelib/global/qglobal.h
src/corelib/kernel/qmetatype.cpp
src/corelib/kernel/qobject.cpp
src/corelib/thread/qthread_unix.cpp
src/gui/graphicsview/qgraphicssceneevent.h
src/gui/itemviews/qheaderview.h
src/gui/kernel/qapplication_qws.cpp
src/gui/kernel/qgesture.h
src/gui/kernel/qgesturerecognizer.h
src/gui/painting/qpaintengine_raster.cpp
src/network/access/qhttpnetworkreply.cpp
src/network/access/qnetworkcookie.h
src/network/socket/qnativesocketengine_unix.cpp
Diffstat (limited to 'examples')
-rw-r--r-- | examples/examplebase.pri | 14 | ||||
-rw-r--r-- | examples/examples.pro | 1 | ||||
-rw-r--r-- | examples/network/ftp/ftp.pro | 2 | ||||
-rw-r--r-- | examples/network/ftp/sym_iap_util.h | 200 | ||||
-rw-r--r-- | examples/network/network-chat/chatdialog.cpp | 4 | ||||
-rw-r--r-- | examples/network/network-chat/main.cpp | 11 | ||||
-rw-r--r-- | examples/network/network-chat/network-chat.pro | 7 | ||||
-rw-r--r-- | examples/network/network-chat/peermanager.cpp | 11 | ||||
-rw-r--r-- | examples/script/qsdbg/scriptdebugger.h | 2 |
9 files changed, 243 insertions, 9 deletions
diff --git a/examples/examplebase.pri b/examples/examplebase.pri index eff6588..70e1c37 100644 --- a/examples/examplebase.pri +++ b/examples/examplebase.pri @@ -1 +1,13 @@ -symbian:RSS_RULES ="group_name=\"QtExamples\";"
\ No newline at end of file +symbian { + RSS_RULES ="group_name=\"QtExamples\";" + + vendorinfo = \ + "; Localised Vendor name" \ + "%{\"Nokia, Qt Software\"}" \ + " " \ + "; Unique Vendor name" \ + ":\"Nokia, Qt Software\"" \ + " " + default_deployment.pkg_prerules += vendorinfo +} +
\ No newline at end of file diff --git a/examples/examples.pro b/examples/examples.pro index 27d6709..fb5fa57 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -36,6 +36,7 @@ symbian: SUBDIRS = \ mainwindows \ script \ sql \ + uitools \ xml contains(QT_CONFIG, phonon):!static: SUBDIRS += phonon diff --git a/examples/network/ftp/ftp.pro b/examples/network/ftp/ftp.pro index ac3d3e6..0ddcb6c 100644 --- a/examples/network/ftp/ftp.pro +++ b/examples/network/ftp/ftp.pro @@ -17,5 +17,5 @@ symbian { INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE TARGET.CAPABILITY="NetworkServices ReadUserData WriteUserData" TARGET.UID3 = 0xA000A648 - LIBS+=-lesock -lcommdb # For IAP selection + LIBS+=-lesock -lcommdb -linsock # For IAP selection }
\ No newline at end of file diff --git a/examples/network/ftp/sym_iap_util.h b/examples/network/ftp/sym_iap_util.h index 6d52b1d..74fe93a 100644 --- a/examples/network/ftp/sym_iap_util.h +++ b/examples/network/ftp/sym_iap_util.h @@ -42,9 +42,13 @@ #define QSYM_IAP_UTIL_H // Symbian +#include <utf.h> #include <es_sock.h> +#include <in_sock.h> #include <es_enum.h> +#include <in_iface.h> #include <commdbconnpref.h> +#include <e32cmn.h> // OpenC #include <sys/socket.h> @@ -53,6 +57,7 @@ //Qt #include <QSettings> #include <QStringList> +//#include <QTextCodec> _LIT(KIapNameSetting, "IAP\\Name"); // text - mandatory _LIT(KIapDialogPref, "IAP\\DialogPref"); // TUnit32 - optional @@ -68,6 +73,8 @@ const QLatin1String iapGroupTag("IAP"); const QLatin1String iapNamesArrayTag("Names"); const QLatin1String iapNameItemTag("Name"); +static QTextCodec *utf16LETextCodec = 0; + void clearIapNamesSettings(QSettings &settings) { settings.beginGroup(qtNetworkModuleTag); settings.beginGroup(iapGroupTag); @@ -103,6 +110,189 @@ void readIapNamesSettings(QSettings &settings, QStringList& iapNames) { settings.endGroup(); } +static QString qt_TNameToQString(TName data) { + if(utf16LETextCodec == 0) + utf16LETextCodec = QTextCodec::codecForName("UTF-16LE"); + + QByteArray tmpByteArray = QByteArray::fromRawData((char*)(data.PtrZ()), data.Length() * 2); + return utf16LETextCodec->toUnicode(tmpByteArray); +} + +static QString qt_InterfaceInfoL() +{ + QString output; + + TBuf8<512> buffer; + TBuf<128> t; + TAutoClose<RSocketServ> ss; + User::LeaveIfError(ss.iObj.Connect()); + ss.PushL(); + + TAutoClose<RSocket> sock; + User::LeaveIfError(sock.iObj.Open(ss.iObj, _L("udp"))); + sock.PushL(); + + User::LeaveIfError(sock.iObj.SetOpt(KSoInetEnumInterfaces, KSolInetIfCtrl)); + + TProtocolDesc in; + User::LeaveIfError(sock.iObj.Info(in)); + printf("EPOC32 IP Configuration TCPIP Version %d.%d.%d\n", in.iVersion.iMajor, in.iVersion.iMinor, in.iVersion.iBuild); + + TPckgBuf<TSoInetInterfaceInfo> info, next; + + TInt res=sock.iObj.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, info); + if(res!=KErrNone) + User::Leave(res); + TInt count = 0; + while(res==KErrNone) { + res=sock.iObj.GetOpt(KSoInetNextInterface, KSolInetIfCtrl, next); + + if(info().iName != _L("") && info().iName != _L("loop6") && info().iName != _L("loop4")) { + printf("Interface %d\n", count++); + + printf("Name \"%s\"\n", qt_TNameToQString(info().iName).toLatin1().data()); + printf("NIF tag \"%s\"\n", qt_TNameToQString(info().iTag).toLatin1().data()); + + printf("State "); + switch (info().iState) + { + case EIfPending: + printf("pending\n"); + break; + case EIfUp: + printf("up\n"); + break; + case EIfBusy: + printf("busy\n"); + break; + default: + printf("down\n"); + break; + } + + printf("Mtu %d\n", info().iMtu); + printf("Speed Metric %d\n", info().iSpeedMetric); + + printf("Features:"); + info().iFeatures & KIfIsLoopback ? printf(" loopback") : printf(""); + info().iFeatures & KIfIsDialup ? printf(" dialup") : printf(""); + info().iFeatures & KIfIsPointToPoint ? printf(" pointtopoint") : printf(""); + info().iFeatures & KIfCanBroadcast ? printf(" canbroadcast") : printf(""); + info().iFeatures & KIfCanMulticast ? printf(" canmulticast") : printf(""); + info().iFeatures & KIfCanSetMTU ? printf(" cansetmtu") : printf(""); + info().iFeatures & KIfHasHardwareAddr ? printf(" hardwareaddr") : printf(""); + info().iFeatures & KIfCanSetHardwareAddr ? printf(" cansethardwareaddr") : printf(""); + printf("\n"); + + TName address; + info().iAddress.Output(address); + printf("Addr: %s\n", qt_TNameToQString(address).toLatin1().data()); + + if(info().iAddress.IsLinkLocal()) { + printf(" -link local\n"); + } else if(info().iAddress.IsSiteLocal()) { + printf(" -site local\n"); + } else { + printf(" -global\n"); + } + + info().iNetMask.Output(address); + printf("Netmask %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iBrdAddr.Output(address); + printf("Broadcast address %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iDefGate.Output(address); + printf("Gatew: %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iNameSer1.Output(address); + printf("DNS 1: %s\n", qt_TNameToQString(address).toLatin1().data()); + + info().iNameSer2.Output(address); + printf("DNS 2: %s\n", qt_TNameToQString(address).toLatin1().data()); + + if (info().iHwAddr.Family() != KAFUnspec) { + printf("Hardware address "); + TUint j; + for(j = sizeof(SSockAddr) ; j < sizeof(SSockAddr) + 6 ; ++j) { + if(j < (TUint)info().iHwAddr.Length()) { + printf("%02X", info().iHwAddr[j]); + } else { + printf("??"); + } + if(j < sizeof(SSockAddr) + 5) + printf("-"); + else + printf("\n"); + } + } + } + if(res == KErrNone) { + info = next; + printf("\n"); + } else { + printf("\n"); + } + } + + sock.Pop(); + ss.Pop(); + + return output; +} + +static QString qt_RouteInfoL() { + QString output; + TAutoClose<RSocketServ> ss; + User::LeaveIfError(ss.iObj.Connect()); + ss.PushL(); + + TAutoClose<RSocket> sock; + User::LeaveIfError(sock.iObj.Open(ss.iObj, _L("udp"))); + sock.PushL(); + + TSoInetRouteInfo routeInfo; + TPckg<TSoInetRouteInfo> routeInfoPkg(routeInfo); + + TName destAddr; + TName netMask; + TName gateway; + TName ifAddr; + + // Begins enumeration of routes by setting this option + User::LeaveIfError(sock.iObj.SetOpt(KSoInetEnumRoutes, KSolInetRtCtrl)); + + // The TSoInetRouteInfo contains information for a new route each time GetOpt returns KErrNone + for(TInt i = 0; sock.iObj.GetOpt(KSoInetNextRoute, KSolInetRtCtrl, routeInfoPkg) == KErrNone ; i++) + { + // Extract the destination and netmask + routeInfo.iDstAddr.Output(destAddr); + routeInfo.iNetMask.Output(netMask); + routeInfo.iGateway.Output(gateway); + routeInfo.iIfAddr.Output(ifAddr); +/* + if(destAddr.Length() <= 2) + continue; + + if(netMask.Find(_L("255.255.255.255")) != KErrNotFound + || netMask.Find(_L("0.0.0.0")) != KErrNotFound + || netMask.Find(_L("ffff:ffff:ffff:ffff")) != KErrNotFound) + continue; +*/ + printf("Route Info #[%i]\n", i); + printf("DstAddr %s\n", qt_TNameToQString(destAddr).toLatin1().data()); + printf("NetMask %s\n", qt_TNameToQString(netMask).toLatin1().data()); + printf("Gateway %s\n", qt_TNameToQString(gateway).toLatin1().data()); + printf("IfAddr %s\n", qt_TNameToQString(ifAddr).toLatin1().data()); + printf("\n"); + } + + sock.Pop(); + ss.Pop(); + + return output; +} + QString qt_TDesC2QStringL(const TDesC& aDescriptor) { #ifdef QT_NO_UNICODE @@ -230,13 +420,13 @@ static QString qt_CheckForActiveConnection() { tempConn.GetDesSetting(TPtrC(KIapServiceType), iapServiceType); //tempConn.Stop(); iapName.ZeroTerminate(); - iapServiceType.ZeroTerminate(); + iapServiceType.ZeroTerminate(); // if(iapServiceType.Find(_L8("LANService")) != KErrNotFound) { // activeLanConnectionFound = ETrue; // break; // } - strIapName = QString((char*)iapName.Ptr()); + 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); @@ -311,8 +501,10 @@ static void qt_SetDefaultIapL() static int qt_SetDefaultIap() { - TRAPD(err, qt_SetDefaultIapL()); - return err; + TRAPD(err1, qt_SetDefaultIapL()); +// TRAPD(err2, qt_InterfaceInfoL()); +// TRAPD(err3, qt_RouteInfoL()); + return err1; } #endif // QSYM_IAP_UTIL_H diff --git a/examples/network/network-chat/chatdialog.cpp b/examples/network/network-chat/chatdialog.cpp index b461412..c3b978d 100644 --- a/examples/network/network-chat/chatdialog.cpp +++ b/examples/network/network-chat/chatdialog.cpp @@ -54,6 +54,10 @@ ChatDialog::ChatDialog(QWidget *parent) listWidget->setFocusPolicy(Qt::NoFocus); connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); +#ifdef Q_OS_SYMBIAN + connect(sendButton, SIGNAL(clicked()), this, SLOT(returnPressed())); +#endif + connect(lineEdit, SIGNAL(returnPressed()), this, SLOT(returnPressed())); connect(&client, SIGNAL(newMessage(const QString &, const QString &)), this, SLOT(appendMessage(const QString &, const QString &))); connect(&client, SIGNAL(newParticipant(const QString &)), diff --git a/examples/network/network-chat/main.cpp b/examples/network/network-chat/main.cpp index e373095..79039a0 100644 --- a/examples/network/network-chat/main.cpp +++ b/examples/network/network-chat/main.cpp @@ -42,11 +42,22 @@ #include <QApplication> #include "chatdialog.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); ChatDialog dialog; +#ifdef Q_OS_SYMBIAN + // Make application better looking and more usable on small screen + dialog.showMaximized(); +#else dialog.show(); +#endif return app.exec(); } diff --git a/examples/network/network-chat/network-chat.pro b/examples/network/network-chat/network-chat.pro index 6967228..5ba2289 100644 --- a/examples/network/network-chat/network-chat.pro +++ b/examples/network/network-chat/network-chat.pro @@ -19,3 +19,10 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/network/network-chat INSTALLS += target sources include($$QT_SOURCE_TREE/examples/examplebase.pri) + +symbian { + HEADERS += $$QT_SOURCE_TREE/examples/network/ftp/sym_iap_util.h + LIBS += -lesock -lconnmon -lcharconv -linsock + TARGET.CAPABILITY = "NetworkServices ReadUserData WriteUserData" + TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 +} diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp index 7fb91b1..c812505 100644 --- a/examples/network/network-chat/peermanager.cpp +++ b/examples/network/network-chat/peermanager.cpp @@ -70,7 +70,11 @@ PeerManager::PeerManager(Client *client) } if (username.isEmpty()) +#ifndef Q_OS_SYMBIAN username = "unknown"; +#else + username = "QtS60"; +#endif updateAddresses(); serverPort = 0; @@ -160,8 +164,11 @@ void PeerManager::updateAddresses() foreach (QNetworkInterface interface, QNetworkInterface::allInterfaces()) { foreach (QNetworkAddressEntry entry, interface.addressEntries()) { QHostAddress broadcastAddress = entry.broadcast(); - if (broadcastAddress != QHostAddress::Null && - entry.ip() != QHostAddress::LocalHost) { + if (broadcastAddress != QHostAddress::Null && entry.ip() != QHostAddress::LocalHost) { + //printf("entry.ip: %s\n", entry.ip().toString().toLatin1().data()); + //printf("entry.netmask: %s\n", entry.netmask().toString().toLatin1().data()); + //printf("entry.prefixLength: %i\n", entry.prefixLength()); + //printf("entry.broadcast %s \n", broadcastAddress.toString().toLatin1().data()); broadcastAddresses << broadcastAddress; ipAddresses << entry.ip(); } diff --git a/examples/script/qsdbg/scriptdebugger.h b/examples/script/qsdbg/scriptdebugger.h index 2d4ba07..4752511 100644 --- a/examples/script/qsdbg/scriptdebugger.h +++ b/examples/script/qsdbg/scriptdebugger.h @@ -78,7 +78,7 @@ protected: ScriptDebuggerPrivate *d_ptr; private: - Q_DECLARE_PRIVATE(ScriptDebugger) + Q_DECLARE_SCOPED_PRIVATE(ScriptDebugger) Q_DISABLE_COPY(ScriptDebugger) }; |