summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples/addressbook-sdk/part7/finddialog.cpp46
-rw-r--r--doc/examples/addressbook-sdk/part7/finddialog.h29
-rw-r--r--doc/examples/addressbook-sdk/part7/finddialog.ui42
3 files changed, 117 insertions, 0 deletions
diff --git a/doc/examples/addressbook-sdk/part7/finddialog.cpp b/doc/examples/addressbook-sdk/part7/finddialog.cpp
new file mode 100644
index 0000000000..478ab9e9cd
--- /dev/null
+++ b/doc/examples/addressbook-sdk/part7/finddialog.cpp
@@ -0,0 +1,46 @@
+#include "finddialog.h"
+#include "ui_finddialog.h"
+#include <QMessageBox>
+
+FindDialog::FindDialog(QWidget *parent) :
+ QDialog(parent),
+ m_ui(new Ui::FindDialog)
+{
+ m_ui->setupUi(this);
+ lineEdit = new QLineEdit;
+ lineEdit = m_ui->lineEdit;
+
+ findButton = new QPushButton;
+ findButton = m_ui->findButton;
+
+ findText = "";
+
+ connect(findButton, SIGNAL(clicked()), this, SLOT(findClicked()));
+
+ setWindowTitle(tr("Find a Contact"));
+}
+
+FindDialog::~FindDialog()
+{
+ delete m_ui;
+}
+
+void FindDialog::findClicked()
+{
+ QString text = lineEdit->text();
+
+ if (text.isEmpty()) {
+ QMessageBox::information(this, tr("Empty Field"),
+ tr("Please enter a name."));
+ return;
+ } else {
+ findText = text;
+ lineEdit->clear();
+ hide();
+ }
+}
+
+QString FindDialog::getFindText()
+{
+ return findText;
+}
diff --git a/doc/examples/addressbook-sdk/part7/finddialog.h b/doc/examples/addressbook-sdk/part7/finddialog.h
new file mode 100644
index 0000000000..95bdaea506
--- /dev/null
+++ b/doc/examples/addressbook-sdk/part7/finddialog.h
@@ -0,0 +1,29 @@
+#ifndef FINDDIALOG_H
+#define FINDDIALOG_H
+
+#include <QtGui/QDialog>
+#include <QtGui/QLineEdit>
+#include <QtGui/QPushButton>
+
+namespace Ui {
+ class FindDialog;
+}
+
+class FindDialog : public QDialog {
+ Q_OBJECT
+public:
+ FindDialog(QWidget *parent = 0);
+ ~FindDialog();
+ QString getFindText();
+
+public slots:
+ void findClicked();
+
+private:
+ Ui::FindDialog *m_ui;
+ QPushButton *findButton;
+ QLineEdit *lineEdit;
+ QString findText;
+};
+
+#endif // FINDDIALOG_H
diff --git a/doc/examples/addressbook-sdk/part7/finddialog.ui b/doc/examples/addressbook-sdk/part7/finddialog.ui
new file mode 100644
index 0000000000..a4cba217d9
--- /dev/null
+++ b/doc/examples/addressbook-sdk/part7/finddialog.ui
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FindDialog</class>
+ <widget class="QDialog" name="FindDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>555</width>
+ <height>73</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Enter the name of a contact:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit"/>
+ </item>
+ <item>
+ <widget class="QPushButton" name="findButton">
+ <property name="text">
+ <string>Find</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>