summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-07-24 17:14:01 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-07-24 17:14:01 (GMT)
commit45edfc7465db4ca377db308d0a8fa80c068b2c11 (patch)
tree30dcaafdb16f08240429d951df0eb59fc9c5d0fb /examples
parente49bf3037c2cd170c93c35f7657bef0e7af3d189 (diff)
downloadQt-45edfc7465db4ca377db308d0a8fa80c068b2c11.zip
Qt-45edfc7465db4ca377db308d0a8fa80c068b2c11.tar.gz
Qt-45edfc7465db4ca377db308d0a8fa80c068b2c11.tar.bz2
Adaptation done to make network-chat work on S60.
"Many attempts to communicate are nullified by saying too much." Robert Greenleaf(1904-1990)
Diffstat (limited to 'examples')
-rw-r--r--examples/network/network-chat/chatdialog.cpp4
-rw-r--r--examples/network/network-chat/main.cpp11
-rw-r--r--examples/network/network-chat/network-chat.pro7
-rw-r--r--examples/network/network-chat/peermanager.cpp11
4 files changed, 31 insertions, 2 deletions
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();
}