summaryrefslogtreecommitdiffstats
path: root/kexi/tests/gui
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/tests/gui')
-rw-r--r--kexi/tests/gui/finddialog/finddialog.pro18
-rw-r--r--kexi/tests/gui/finddialog/kexifinddialog.cpp67
-rw-r--r--kexi/tests/gui/finddialog/kexifinddialog.h66
-rw-r--r--kexi/tests/gui/finddialog/kexifinddialogbase.ui326
-rw-r--r--kexi/tests/gui/finddialog/main.cpp36
5 files changed, 513 insertions, 0 deletions
diff --git a/kexi/tests/gui/finddialog/finddialog.pro b/kexi/tests/gui/finddialog/finddialog.pro
new file mode 100644
index 00000000..f76b5372
--- /dev/null
+++ b/kexi/tests/gui/finddialog/finddialog.pro
@@ -0,0 +1,18 @@
+TEMPLATE = app
+
+include( $(KEXI)/common.pro )
+
+CONFIG += qt warn_on release
+DEPENDPATH = ../../include
+
+system( bash kmoc )
+
+TARGET = finddialogtest
+DESTDIR=.
+
+system( bash kmoc )
+system( bash kdcopidl )
+
+SOURCES = kexifinddialog.cpp main.cpp
+
+FORMS = kexifinddialogbase.ui
diff --git a/kexi/tests/gui/finddialog/kexifinddialog.cpp b/kexi/tests/gui/finddialog/kexifinddialog.cpp
new file mode 100644
index 00000000..64f54d51
--- /dev/null
+++ b/kexi/tests/gui/finddialog/kexifinddialog.cpp
@@ -0,0 +1,67 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Jaroslaw Staniek <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "kexifinddialog.h"
+
+#include <kstdguiitem.h>
+#include <kpushbutton.h>
+#include <kcombobox.h>
+#include <klocale.h>
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+
+KexiFindDialog::KexiFindDialog( bool replaceMode, QWidget* parent, const char* name, bool modal )
+ : KexiFindDialogBase(parent, name, modal)
+ , m_replaceMode(true)
+{
+ m_btnFind->setIconSet(KStdGuiItem::find().iconSet());
+ m_btnClose->setIconSet(KStdGuiItem::close().iconSet());
+ setReplaceMode(replaceMode);
+ m_lookIn->insertItem(i18n("(All columns)"));
+}
+
+void KexiFindDialog::setReplaceMode(bool set)
+{
+ if (m_replaceMode == set)
+ return;
+ m_replaceMode = set;
+ if (m_replaceMode) {
+ m_promptOnReplace->show();
+ m_replaceLbl->show();
+ m_textToReplace->show();
+ m_btnReplace->show();
+ m_btnReplaceAll->show();
+ }
+ else {
+ m_promptOnReplace->hide();
+ m_replaceLbl->hide();
+ m_textToReplace->hide();
+ m_btnReplace->hide();
+ m_btnReplaceAll->hide();
+ resize(width(),height()-30);
+ }
+ updateGeometry();
+}
+
+KexiFindDialog::~KexiFindDialog()
+{
+}
+
+#include "kexifinddialog.moc"
diff --git a/kexi/tests/gui/finddialog/kexifinddialog.h b/kexi/tests/gui/finddialog/kexifinddialog.h
new file mode 100644
index 00000000..9025d152
--- /dev/null
+++ b/kexi/tests/gui/finddialog/kexifinddialog.h
@@ -0,0 +1,66 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Jaroslaw Staniek <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef KEXIFINDDIALOG_H
+#define KEXIFINDDIALOG_H
+
+#include "kexifinddialogbase.h"
+
+/*! @brief A Kexi-specific "Find text" dialog.
+
+ Also used for replace.
+*/
+class KexiFindDialog : public KexiFindDialogBase
+{
+ Q_OBJECT
+ public:
+ KexiFindDialog( bool replaceMode, QWidget* parent = 0, const char* name = 0, bool modal = FALSE );
+ virtual ~KexiFindDialog();
+
+#if 0
+TODO TODO TODO TODO TODO TODO
+ /*! Sets \a columnNames list for 'look in column' combo box.
+ "(All columns)" item is also prepended. */
+ void setLookInColumnList(const QStringList& columnNames);
+
+ /*! \return a list for 'look in column' combo box.
+ "(All columns)" item is also prepended. */
+ QStringList* lookInColumnList() const;
+
+ /*! \return column name selected in 'look in column' combo box.
+ If "(All columns)" item is selected, "*" is returned. */
+ QString lookInColumn() const;
+
+ /*! Selects \a columnName to be selected 'look in column'.
+ By default "(All columns)" item is selected. To select this item, pass "*". */
+ void setLookInColumn(const QString& columnName);
+
+#endif
+
+ public slots:
+ /*! Sets or clears replace mode.
+ For replace mode 'prompt or replace' option is visible.
+ */
+ void setReplaceMode(bool set);
+
+ protected:
+ bool m_replaceMode : 1;
+};
+
+#endif
diff --git a/kexi/tests/gui/finddialog/kexifinddialogbase.ui b/kexi/tests/gui/finddialog/kexifinddialogbase.ui
new file mode 100644
index 00000000..f4684bff
--- /dev/null
+++ b/kexi/tests/gui/finddialog/kexifinddialogbase.ui
@@ -0,0 +1,326 @@
+<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
+<class>KexiFindDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>KexiFindDialogBase</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>476</width>
+ <height>224</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Find Text</string>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KHistoryCombo" row="1" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_textToReplace</cstring>
+ </property>
+ <property name="insertionPolicy">
+ <enum>AtTop</enum>
+ </property>
+ <property name="autoCompletion">
+ <bool>true</bool>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="4" column="2">
+ <property name="name">
+ <cstring>m_caseSensitive</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ <property name="text">
+ <string>C&amp;ase sensitive</string>
+ </property>
+ </widget>
+ <widget class="KHistoryCombo" row="0" column="1" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>m_textToFind</cstring>
+ </property>
+ <property name="insertionPolicy">
+ <enum>AtTop</enum>
+ </property>
+ <property name="autoCompletion">
+ <bool>true</bool>
+ </property>
+ <property name="duplicatesEnabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="4" column="1">
+ <item>
+ <property name="text">
+ <string>Any Part of Field</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Whole Field</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Start of Field</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_match</cstring>
+ </property>
+ <property name="insertionPolicy">
+ <enum>NoInsertion</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>textLabel1</cstring>
+ </property>
+ <property name="text">
+ <string>Fi&amp;nd:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_textToFind</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="1" column="0">
+ <property name="name">
+ <cstring>m_replaceLbl</cstring>
+ </property>
+ <property name="text">
+ <string>Re&amp;place with:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_textToReplace</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="0">
+ <property name="name">
+ <cstring>textLabel2_2_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Search:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_search</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="4" column="0">
+ <property name="name">
+ <cstring>textLabel2_2_3</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Match:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_match</cstring>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="3" column="1">
+ <item>
+ <property name="text">
+ <string>Up</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Down</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>All Rows</string>
+ </property>
+ </item>
+ <property name="name">
+ <cstring>m_search</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ <property name="insertionPolicy">
+ <enum>NoInsertion</enum>
+ </property>
+ </widget>
+ <widget class="KComboBox" row="2" column="1">
+ <property name="name">
+ <cstring>m_lookIn</cstring>
+ </property>
+ <property name="insertionPolicy">
+ <enum>NoInsertion</enum>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>textLabel2_2</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Look in column:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>m_lookIn</cstring>
+ </property>
+ </widget>
+ <spacer row="4" column="3">
+ <property name="name">
+ <cstring>spacer2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QCheckBox" row="5" column="2">
+ <property name="name">
+ <cstring>m_wholeWords</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ <property name="text">
+ <string>&amp;Whole words only</string>
+ </property>
+ </widget>
+ <widget class="QCheckBox" row="6" column="2">
+ <property name="name">
+ <cstring>m_promptOnReplace</cstring>
+ </property>
+ <property name="focusPolicy">
+ <enum>WheelFocus</enum>
+ </property>
+ <property name="text">
+ <string>Prompt on replace</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <spacer row="7" column="2">
+ <property name="name">
+ <cstring>spacer3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QLayoutWidget" row="0" column="4" rowspan="8" colspan="1">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_btnFind</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Find Next</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_btnClose</cstring>
+ </property>
+ <property name="text">
+ <string>Close</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_btnReplace</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Replace</string>
+ </property>
+ </widget>
+ <widget class="KPushButton">
+ <property name="name">
+ <cstring>m_btnReplaceAll</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Replace All</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>spacer8</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Vertical</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </vbox>
+ </widget>
+ </grid>
+</widget>
+<customwidgets>
+</customwidgets>
+<connections>
+ <connection>
+ <sender>m_btnClose</sender>
+ <signal>clicked()</signal>
+ <receiver>KexiFindDialogBase</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>m_textToFind</tabstop>
+ <tabstop>m_textToReplace</tabstop>
+ <tabstop>m_lookIn</tabstop>
+ <tabstop>m_search</tabstop>
+ <tabstop>m_match</tabstop>
+ <tabstop>m_caseSensitive</tabstop>
+ <tabstop>m_wholeWords</tabstop>
+</tabstops>
+<layoutdefaults spacing="6" margin="11"/>
+<includehints>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>klineedit.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kcombobox.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+ <includehint>kpushbutton.h</includehint>
+</includehints>
+</UI>
diff --git a/kexi/tests/gui/finddialog/main.cpp b/kexi/tests/gui/finddialog/main.cpp
new file mode 100644
index 00000000..7da98bf4
--- /dev/null
+++ b/kexi/tests/gui/finddialog/main.cpp
@@ -0,0 +1,36 @@
+/* This file is part of the KDE project
+ Copyright (C) 2004 Jaroslaw Staniek <[email protected]>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include <kapplication.h>
+#include <klocale.h>
+#include <kaboutdata.h>
+#include <kcmdlineargs.h>
+
+#include "kexifinddialog.h"
+
+int main( int argc, char ** argv )
+{
+ KAboutData aboutData( "test", I18N_NOOP("KFind"), "0", "", KAboutData::License_LGPL );
+ KCmdLineArgs::init( argc, argv, &aboutData );
+ KApplication app;
+
+ KexiFindDialog dlg(true, 0, "dialog");
+
+ return dlg.exec();
+}