summaryrefslogtreecommitdiffstats
path: root/examples/network/loopback
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/loopback')
-rw-r--r--examples/network/loopback/dialog.cpp31
-rw-r--r--examples/network/loopback/dialog.h7
-rw-r--r--examples/network/loopback/loopback.pro6
-rw-r--r--examples/network/loopback/main.cpp6
4 files changed, 48 insertions, 2 deletions
diff --git a/examples/network/loopback/dialog.cpp b/examples/network/loopback/dialog.cpp
index 50a191e9ee..14154b47cc 100644
--- a/examples/network/loopback/dialog.cpp
+++ b/examples/network/loopback/dialog.cpp
@@ -58,6 +58,22 @@ Dialog::Dialog(QWidget *parent)
serverProgressBar = new QProgressBar;
serverStatusLabel = new QLabel(tr("Server ready"));
+#ifdef Q_OS_SYMBIAN
+ QMenu *menu = new QMenu(this);
+
+ QAction *optionsAction = new QAction(tr("Options"), this);
+ optionsAction->setSoftKeyRole(QAction::PositiveSoftKey);
+ optionsAction->setMenu(menu);
+ addAction(optionsAction);
+
+ startAction = menu->addAction(tr("Start"), this, SLOT(start()));
+
+ quitAction = new QAction(tr("Exit"), this);
+ quitAction->setSoftKeyRole(QAction::NegativeSoftKey);
+ addAction(quitAction);
+
+ connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));
+#else
startButton = new QPushButton(tr("&Start"));
quitButton = new QPushButton(tr("&Quit"));
@@ -67,6 +83,7 @@ Dialog::Dialog(QWidget *parent)
connect(startButton, SIGNAL(clicked()), this, SLOT(start()));
connect(quitButton, SIGNAL(clicked()), this, SLOT(close()));
+#endif
connect(&tcpServer, SIGNAL(newConnection()),
this, SLOT(acceptConnection()));
connect(&tcpClient, SIGNAL(connected()), this, SLOT(startTransfer()));
@@ -82,7 +99,9 @@ Dialog::Dialog(QWidget *parent)
mainLayout->addWidget(serverStatusLabel);
mainLayout->addStretch(1);
mainLayout->addSpacing(10);
+#ifndef Q_OS_SYMBIAN
mainLayout->addWidget(buttonBox);
+#endif
setLayout(mainLayout);
setWindowTitle(tr("Loopback"));
@@ -90,7 +109,11 @@ Dialog::Dialog(QWidget *parent)
void Dialog::start()
{
+#ifdef Q_OS_SYMBIAN
+ startAction->setVisible(false);
+#else
startButton->setEnabled(false);
+#endif
#ifndef QT_NO_CURSOR
QApplication::setOverrideCursor(Qt::WaitCursor);
@@ -146,7 +169,11 @@ void Dialog::updateServerProgress()
if (bytesReceived == TotalBytes) {
tcpServerConnection->close();
+#ifdef Q_OS_SYMBIAN
+ startAction->setVisible(true);
+#else
startButton->setEnabled(true);
+#endif
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
@@ -183,7 +210,11 @@ void Dialog::displayError(QAbstractSocket::SocketError socketError)
serverProgressBar->reset();
clientStatusLabel->setText(tr("Client ready"));
serverStatusLabel->setText(tr("Server ready"));
+#ifdef Q_OS_SYMBIAN
+ startAction->setVisible(true);
+#else
startButton->setEnabled(true);
+#endif
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
diff --git a/examples/network/loopback/dialog.h b/examples/network/loopback/dialog.h
index 09b4366e19..b48c090d3f 100644
--- a/examples/network/loopback/dialog.h
+++ b/examples/network/loopback/dialog.h
@@ -52,6 +52,7 @@ class QProgressBar;
class QPushButton;
class QTcpServer;
class QTcpSocket;
+class QAction;
QT_END_NAMESPACE
class Dialog : public QDialog
@@ -74,9 +75,15 @@ private:
QProgressBar *serverProgressBar;
QLabel *clientStatusLabel;
QLabel *serverStatusLabel;
+
+#ifdef Q_OS_SYMBIAN
+ QAction *startAction;
+ QAction *quitAction;
+#else
QPushButton *startButton;
QPushButton *quitButton;
QDialogButtonBox *buttonBox;
+#endif
QTcpServer tcpServer;
QTcpSocket tcpClient;
diff --git a/examples/network/loopback/loopback.pro b/examples/network/loopback/loopback.pro
index ea175b3e3c..3565058e12 100644
--- a/examples/network/loopback/loopback.pro
+++ b/examples/network/loopback/loopback.pro
@@ -9,4 +9,8 @@ sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS loopback.pro
sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/network/loopback
INSTALLS += target sources
-symbian: CONFIG += qt_example
+symbian: {
+ CONFIG += qt_example
+ TARGET.CAPABILITY = NetworkServices
+}
+maemo5: CONFIG += qt_example
diff --git a/examples/network/loopback/main.cpp b/examples/network/loopback/main.cpp
index 6810b795fc..7f26fd4357 100644
--- a/examples/network/loopback/main.cpp
+++ b/examples/network/loopback/main.cpp
@@ -46,6 +46,10 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Dialog dialog;
+#ifdef Q_OS_SYMBIAN
+ dialog.showMaximized();
+#else
dialog.show();
- return dialog.exec();
+#endif
+ return app.exec();
}