summaryrefslogtreecommitdiffstats
path: root/examples/dialogs/extension
diff options
context:
space:
mode:
Diffstat (limited to 'examples/dialogs/extension')
-rw-r--r--examples/dialogs/extension/extension.desktop11
-rw-r--r--examples/dialogs/extension/extension.pro2
-rw-r--r--examples/dialogs/extension/finddialog.cpp45
-rw-r--r--examples/dialogs/extension/main.cpp9
4 files changed, 62 insertions, 5 deletions
diff --git a/examples/dialogs/extension/extension.desktop b/examples/dialogs/extension/extension.desktop
new file mode 100644
index 0000000000..374b1c8340
--- /dev/null
+++ b/examples/dialogs/extension/extension.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Encoding=UTF-8
+Version=1.0
+Type=Application
+Terminal=false
+Name=Extension
+Exec=/opt/usr/bin/extension
+Icon=extension
+X-Window-Icon=
+X-HildonDesk-ShowInToolbar=true
+X-Osso-Type=application/x-executable
diff --git a/examples/dialogs/extension/extension.pro b/examples/dialogs/extension/extension.pro
index 492b18b4d9..5511f37150 100644
--- a/examples/dialogs/extension/extension.pro
+++ b/examples/dialogs/extension/extension.pro
@@ -10,3 +10,5 @@ INSTALLS += target sources
symbian: CONFIG += qt_example
QT += widgets
+maemo5: CONFIG += qt_example
+simulator: warning(This example might not fully work on Simulator platform)
diff --git a/examples/dialogs/extension/finddialog.cpp b/examples/dialogs/extension/finddialog.cpp
index 0b41a8a1e5..0e797edf81 100644
--- a/examples/dialogs/extension/finddialog.cpp
+++ b/examples/dialogs/extension/finddialog.cpp
@@ -63,9 +63,6 @@ FindDialog::FindDialog(QWidget *parent)
//! [0]
moreButton->setAutoDefault(false);
- buttonBox = new QDialogButtonBox(Qt::Vertical);
- buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
- buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
//! [1]
//! [2]
@@ -77,7 +74,42 @@ FindDialog::FindDialog(QWidget *parent)
//! [2]
//! [3]
+#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR)
+ // Create menu
+ QMenu *menu = new QMenu(this);
+
+ // Create Find menu item
+ menu->addAction(tr("Find"));
+
+ // Create More menu item
+ QAction *moreAction = menu->addAction(tr("More"));
+ moreAction->setCheckable(true);
+
+ // Create Options CBA
+ QAction *optionAction = new QAction(tr("Options"), this);
+
+ // Set defined menu into Options button
+ optionAction->setMenu(menu);
+ optionAction->setSoftKeyRole(QAction::PositiveSoftKey);
+ addAction(optionAction);
+
+ // Connect More menu item to setVisible slot
+ connect(moreAction, SIGNAL(triggered(bool)), extension, SLOT(setVisible(bool)));
+
+ // Create Exit CBA
+ QAction *backSoftKeyAction = new QAction(QString(tr("Exit")), this);
+ backSoftKeyAction->setSoftKeyRole(QAction::NegativeSoftKey);
+
+ // Exit button closes the application
+ connect(backSoftKeyAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+ addAction(backSoftKeyAction);
+#else
+ buttonBox = new QDialogButtonBox(Qt::Vertical);
+ buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
+ buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
+
connect(moreButton, SIGNAL(toggled(bool)), extension, SLOT(setVisible(bool)));
+#endif
QVBoxLayout *extensionLayout = new QVBoxLayout;
extensionLayout->setMargin(0);
@@ -96,13 +128,18 @@ FindDialog::FindDialog(QWidget *parent)
leftLayout->addLayout(topLeftLayout);
leftLayout->addWidget(caseCheckBox);
leftLayout->addWidget(fromStartCheckBox);
- leftLayout->addStretch(1);
QGridLayout *mainLayout = new QGridLayout;
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR)
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
+#endif
mainLayout->addLayout(leftLayout, 0, 0);
+#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_SIMULATOR)
mainLayout->addWidget(buttonBox, 0, 1);
+#endif
mainLayout->addWidget(extension, 1, 0, 1, 2);
+ mainLayout->setRowStretch(2, 1);
+
setLayout(mainLayout);
setWindowTitle(tr("Extension"));
diff --git a/examples/dialogs/extension/main.cpp b/examples/dialogs/extension/main.cpp
index d487faab69..9937b6d0b5 100644
--- a/examples/dialogs/extension/main.cpp
+++ b/examples/dialogs/extension/main.cpp
@@ -46,5 +46,12 @@ int main(int argc, char *argv[])
{
QApplication app(argc, argv);
FindDialog dialog;
- return dialog.exec();
+
+#ifdef Q_OS_SYMBIAN
+ dialog.showMaximized();
+#else
+ dialog.show();
+#endif
+
+ return app.exec();
}