summaryrefslogtreecommitdiffstats
path: root/parts/regexptest
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit114a878c64ce6f8223cfd22d76a20eb16d177e5e (patch)
treeacaf47eb0fa12142d3896416a69e74cbf5a72242 /parts/regexptest
downloadtdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.tar.gz
tdevelop-114a878c64ce6f8223cfd22d76a20eb16d177e5e.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdevelop@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'parts/regexptest')
-rw-r--r--parts/regexptest/Makefile.am17
-rw-r--r--parts/regexptest/README.dox49
-rw-r--r--parts/regexptest/kdevregexptest.desktop82
-rw-r--r--parts/regexptest/kdevregexptest.rc9
-rw-r--r--parts/regexptest/regexptestdlg.cpp263
-rw-r--r--parts/regexptest/regexptestdlg.h46
-rw-r--r--parts/regexptest/regexptestdlgbase.ui352
-rw-r--r--parts/regexptest/regexptestpart.cpp63
-rw-r--r--parts/regexptest/regexptestpart.h37
9 files changed, 918 insertions, 0 deletions
diff --git a/parts/regexptest/Makefile.am b/parts/regexptest/Makefile.am
new file mode 100644
index 00000000..43edb690
--- /dev/null
+++ b/parts/regexptest/Makefile.am
@@ -0,0 +1,17 @@
+# Here resides the regexptest part
+
+INCLUDES = -I$(top_srcdir)/lib/interfaces $(all_includes)
+
+kde_module_LTLIBRARIES = libkdevregexptest.la
+libkdevregexptest_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN)
+libkdevregexptest_la_LIBADD = $(top_builddir)/lib/libkdevelop.la
+
+libkdevregexptest_la_SOURCES = regexptestpart.cpp regexptestdlg.cpp regexptestdlgbase.ui
+
+METASOURCES = AUTO
+
+servicedir = $(kde_servicesdir)
+service_DATA = kdevregexptest.desktop
+
+rcdir = $(kde_datadir)/kdevregexptest
+rc_DATA = kdevregexptest.rc
diff --git a/parts/regexptest/README.dox b/parts/regexptest/README.dox
new file mode 100644
index 00000000..d145ae76
--- /dev/null
+++ b/parts/regexptest/README.dox
@@ -0,0 +1,49 @@
+/** \class RegexpTestPart
+Put a brief description here, the brief description ends at the first dot.
+Put a more detailed description of your part in these lines. It can span
+over several lines. You can even use some html commands in these lines like:
+<code>This is code</code>, html links <a href="http://somelocation">link text</a>,
+and images.
+
+\authors <a href="mailto:bernd AT kdevelop.org">Bernd Gehrmann</a>
+
+\maintainer <a href="mailto:$EMAIL$">$AUTHOR$</a>
+\maintainer <a href="mailto:2nd maintainer AT provider.com">2nd maintainer full name</a>
+...
+\maintainer <a href="mailto:nth maintainer AT provider.com">nth maintainer full name</a>
+
+\feature Describe the first feature
+\feature Describe the second feature
+...
+\feature Describe the last feature
+
+\bug Describe a the 1st bug that you know of, but probably hasn't been reported yet.
+..
+\bug Describe a the nth bug that you know of, but probably hasn't been reported yet.
+
+\requirement Describe a the 1st requirement of your part.
+\requirement Describe a the 2nd requirement of your part.
+...
+\requirement Describe a the nth requirement of your part.
+
+\todo Describe a the 1st TODO of your part.
+\todo Describe a the 2nd TODO of your part.
+...
+\todo Describe a the nth TODO of your part.
+
+\faq <b>First frequenly asked question about your part ?</b> Answer.
+\faq <b>Second frequenly asked question about your part ?</b> Answer.
+...
+\faq <b>Last frequenly asked question about your part ?</b> Answer.
+
+\note First note text.
+\note Second note text.
+...
+\note Last note text.
+
+\warning First warning text.
+\warning Second warning text.
+...
+\warning Last warning text.
+
+*/
diff --git a/parts/regexptest/kdevregexptest.desktop b/parts/regexptest/kdevregexptest.desktop
new file mode 100644
index 00000000..85370fbf
--- /dev/null
+++ b/parts/regexptest/kdevregexptest.desktop
@@ -0,0 +1,82 @@
+[Desktop Entry]
+Type=Service
+Exec=blubb
+Comment=Tool to design and test regular expressions against common regexp syntaxes.
+Comment[ca]=Eina per a dissenyar i provar expressions regulars amb sintaxis d'expressions regulars comuns.
+Comment[da]=Værktøj til at designe og teste regulære udtryk imod almindelige regexp syntakser.
+Comment[de]=Ein Werkzeug zum Erstellen und Testen regulärer Ausdrücke.
+Comment[el]=Εργαλείο για το σχεδιασμό και τη δοκιμή κανονικών εκφράσεων με κοινή σύνταξη κανονικών εκφράσεων.
+Comment[es]=Herramienta para diseñar y probar expresiones regulares con sintaxis comunes.
+Comment[et]=Vahend regulaaravaldiste loomiseks ja korrektsuse testimiseks.
+Comment[eu]=Ohizko regexp sintaxiaren arabera espresio erregularra diseinatu eta egiaztatzeko tresna.
+Comment[fa]=ابزاری برای طراحی و آزمودن عبارتهای منظم در برابر نحوهای مشترک عبارت منظم
+Comment[fr]=Outil pour créer et tester des expressions rationnelles par rapport aux syntaxes des expressions rationnnelles communes.
+Comment[gl]=Ferramenta para deseñar e probar expresións regulares con sintaxes típicas para expresións regulares
+Comment[hu]=Tervezőprogram reguláris kifejezések tervezéséhez és teszteléséhez, többféle szintaxis szerint
+Comment[it]=Strumento per progettare e verificare espressioni regolari con le sintassi comuni di regexp.
+Comment[ja]=共通の regexp 構文に対する正規表現を設計したりテストするツール
+Comment[ms]=Alatan untuk mereka dan menguji regular expressions berbanding sintaks biasa regexp.
+Comment[nds]=En Warktüüch för't Opstellen un Utproberen vun reguleer Utdrück in en Reeg "regexp"-Schriefwiesen.
+Comment[ne]=साझा रेगेक्प वाक्य संरचनाको बिरूद्ध नियमित अभिव्यक्ति डिजाइन र परीक्षण गर्ने उपकरण ।
+Comment[nl]=Gereedschap voor het ontwerpen en testen van reguliere expressies.
+Comment[pl]=Narzędzie do tworzenia i testowania wyrażeń regularnych.
+Comment[pt]=Uma ferramenta para desenhar e testar expressões regulares sobre várias sintaxes comuns de expressões.
+Comment[pt_BR]=Ferramenta para desenvolver e testar expressões regulares com base na sintaxe comum das regexp.
+Comment[ru]=Средство для определения и проверки регулярных выражений на предмет соответствия их наиболее распространённым вариантам синтаксиса.
+Comment[sk]=Nástroj pre dizajn a testovanie regulárnych výrazov.
+Comment[sr]=Алат за дизајн и тестирање регуларних израза насупрот уобичајеним рег.из. синтаксама.
+Comment[sr@Latn]=Alat za dizajn i testiranje regularnih izraza nasuprot uobičajenim reg.iz. sintaksama.
+Comment[sv]=Verktyg för att skapa och testa reguljära uttryck mot vanlig syntax för reguljära uttryck.
+Comment[ta]=ரேக்ஸ்ப் தொடரமைப்பதற்கு எதிராக கருவி உபயோகித்து வரைதல் மற்றும் வாடிக்கையான தொடர்களை பரிசோதிக்க.
+Comment[tg]=Восита барои муаян намудан ва тафтиш намудани баёни ботартиб дар асоси ҷорӣ шудаи вариантҳои синтаксисӣ менамояд.
+Comment[tr]=Genel regexp söz dizimlerine karşı düzenli ifadeleri düzenlemeye ve test etmeye yarayan araç.
+Comment[zh_CN]=依据通用正则表达式语法进行正则表达式设计和测试的工具。
+Comment[zh_TW]=設計、測試正規表示式語法的工具。
+Name=KDevRegexpTest
+Name[da]=KDevelop test af regulære udtryk
+Name[de]=RegExp-Überprüfung (KDevelop)
+Name[hi]=के-डेव-रेगएक्सपी-टेक्स्ट
+Name[nds]=RegExp-Prööv (KDevelop)
+Name[pl]=KDevTestWyrReg
+Name[sk]=KDev Regexp test
+Name[sv]=KDevelop test av reguljära uttryck
+Name[ta]=Kடேவ்ரெக்ஸ்ப் சோதனை
+Name[zh_TW]=KDevelop 正規表示式測試
+GenericName=Regular Expression Tester
+GenericName[ca]=Comprovador d'expressions regulars
+GenericName[da]=Test af regulære udtryk
+GenericName[de]=RegExp-Überprüfung
+GenericName[el]=Δοκιμαστής κανονικών εκφράσεων
+GenericName[es]=Comprobador de expresiones regulares
+GenericName[et]=Regulaaravaldiste testija
+GenericName[eu]=Espresio erregular egiaztatzailea
+GenericName[fa]=آزمایندۀ عبارت منظم
+GenericName[fr]=Testeur d'expressions rationnelles
+GenericName[gl]=Comprobador de expresións regulares
+GenericName[hi]=रेगुलर एक्सप्रेशन टेस्टर
+GenericName[hu]=Tesztprogram reguláris kifejezésekhez
+GenericName[it]=Verificatore per espressioni regolari
+GenericName[ja]=正規表現テスタ
+GenericName[ms]=Penguji Regular Expression
+GenericName[nds]=RegExp-Prööv
+GenericName[ne]=नियमित अभिव्यक्ति परीक्षक
+GenericName[nl]=Reguliere expressie-tester
+GenericName[pl]=Tester wyrażeń regularnych
+GenericName[pt]=Ferramenta de Teste de Expressões Regulares
+GenericName[pt_BR]=Testador de Expressão Regular
+GenericName[ru]=Проверка регулярных выражений
+GenericName[sk]=Tester pre regulárne výrazy
+GenericName[sl]=Preverjalnik regularnih izrazov
+GenericName[sr]=Тестер регуларних израза
+GenericName[sr@Latn]=Tester regularnih izraza
+GenericName[sv]=Test av reguljära uttryck
+GenericName[ta]=வாடிக்கையான தொடர்களை பரிசோதிப்பவர்.
+GenericName[tg]=Тафтиши баёни ботартиб
+GenericName[tr]=Düzenli İfade Test Edicisi
+GenericName[zh_CN]=正则表达式测试
+GenericName[zh_TW]=正規表示式測試器
+ServiceTypes=KDevelop/Plugin
+X-KDE-Library=libkdevregexptest
+X-KDevelop-Version=5
+X-KDevelop-Scope=Global
+X-KDevelop-Properties=ScriptDevelopment,CDevelopment,CPPDevelopment
diff --git a/parts/regexptest/kdevregexptest.rc b/parts/regexptest/kdevregexptest.rc
new file mode 100644
index 00000000..99893d7f
--- /dev/null
+++ b/parts/regexptest/kdevregexptest.rc
@@ -0,0 +1,9 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="KDevRegExpTest" version="1">
+<MenuBar>
+ <Menu name="tools" >
+ <Action name="tools_regexptest" group="tools_file_operations"/>
+ </Menu>
+</MenuBar>
+</kpartgui>
+
diff --git a/parts/regexptest/regexptestdlg.cpp b/parts/regexptest/regexptestdlg.cpp
new file mode 100644
index 00000000..a211a797
--- /dev/null
+++ b/parts/regexptest/regexptestdlg.cpp
@@ -0,0 +1,263 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "regexptestdlg.h"
+
+#include <sys/types.h>
+#include <string.h>
+#include <stdlib.h>
+#include <regex.h>
+#include <qlabel.h>
+#include <qlistview.h>
+#include <qradiobutton.h>
+#include <qpushbutton.h>
+#include <qregexp.h>
+#include <klineedit.h>
+#include <kdeversion.h>
+#include <kregexp.h>
+#include <kdebug.h>
+#include <kglobalsettings.h>
+#include <klocale.h>
+#include <kparts/part.h>
+#include <ktexteditor/viewcursorinterface.h>
+#include <ktexteditor/editinterface.h>
+#include <kparts/componentfactory.h>
+#include <kregexpeditorinterface.h>
+
+#include "kdevplugin.h"
+#include "kdevpartcontroller.h"
+
+
+RegexpTestDialog::RegexpTestDialog(KDevPlugin *part)
+ : RegexpTestDialogBase(0, "regexp test dialog", false), _regexp_dialog(0)
+{
+ pattern_edit->setFocus();
+ pattern_edit->setFont(KGlobalSettings::fixedFont());
+ teststring_edit->setFont(KGlobalSettings::fixedFont());
+ subgroups_listview->setSorting(0);
+
+ m_part = part;
+}
+
+
+RegexpTestDialog::~RegexpTestDialog()
+{}
+
+
+void RegexpTestDialog::showEvent(QShowEvent *)
+{
+ KParts::ReadWritePart *rwpart = dynamic_cast<KParts::ReadWritePart*>
+ (m_part->partController()->activePart());
+ insertbutton->setEnabled(rwpart);
+}
+
+
+void RegexpTestDialog::somethingChanged()
+{
+ success_label->clear();
+ subgroups_listview->clear();
+
+ if ( qregexp_button->isChecked() || qregexp_min_button->isChecked() )
+ checkQRegExp();
+ else if ( kregexp_button->isChecked() )
+ checkKRegExp();
+ else
+ checkPOSIX();
+}
+
+void RegexpTestDialog::checkQRegExp()
+{
+ QRegExp rx( pattern_edit->text() );
+ rx.setMinimal( qregexp_min_button->isChecked() );
+ if ( !rx.isValid() ) {
+#if QT_VERSION >= 0x030100
+ success_label->setText( rx.errorString() );
+#else
+ success_label->setText( i18n("Error compiling the regular expression.") );
+#endif
+ return;
+ }
+ if ( rx.search( teststring_edit->text() ) < 0 ) {
+ success_label->setText( i18n( "No match" ) );
+ return;
+ }
+ success_label->setText( i18n("Successfully matched") );
+#if QT_VERSION >= 0x030100
+ int numCaptures = rx.numCaptures() + 1;
+#else
+ int numCaptures = 10;
+#endif
+ for ( int i = 0; i < numCaptures; ++i ) {
+ new QListViewItem( subgroups_listview, QString::number( i ), rx.cap( i ) );
+ }
+}
+
+void RegexpTestDialog::checkKRegExp()
+{
+ KRegExp rx;
+ if ( !rx.compile( pattern_edit->text().latin1() ) ) {
+ success_label->setText( i18n( "Compile error, your regexp is invalid" ) );
+ return;
+ }
+ if ( !rx.match( teststring_edit->text().latin1() ) ) {
+ success_label->setText( i18n( "No match" ) );
+ return;
+ }
+ success_label->setText( i18n("Successfully matched") );
+ for ( int i = 0; i <= 9; ++i ) {
+ const char* grp = rx.group( i );
+ if ( grp )
+ new QListViewItem( subgroups_listview, QString::number( i ), QString( grp ) );
+ }
+}
+
+void RegexpTestDialog::checkPOSIX()
+{
+ regex_t compiledPattern;
+ regmatch_t matches[20];
+ int cflags = extendedposix_button->isChecked()? REG_EXTENDED : 0;
+ QCString regexp = pattern_edit->text().local8Bit();
+ int res = regcomp(&compiledPattern, regexp, cflags);
+ if (res != 0) {
+ QString regcompMessage;
+ switch (res)
+ {
+ case REG_BADRPT:
+ regcompMessage = i18n("Repetition operators must not appear as first character");
+ break;
+ case REG_BADBR:
+ regcompMessage = i18n("Invalid use of back reference operator");
+ break;
+ case REG_EBRACE:
+ regcompMessage = i18n("Unmatched brace interval operators");
+ break;
+ case REG_EBRACK:
+ regcompMessage = i18n("Unmatched bracket list operators");
+ break;
+ case REG_ERANGE:
+ regcompMessage = i18n("Invalid use of range operator");
+ break;
+ case REG_ECTYPE:
+ regcompMessage = i18n("Unknown character class");
+ break;
+ case REG_ECOLLATE:
+ regcompMessage = i18n("Invalid collating element");
+ break;
+ case REG_EPAREN:
+ regcompMessage = i18n("Unmatched parenthesis group operators");
+ break;
+ case REG_ESUBREG:
+ regcompMessage = i18n("Invalid back reference to subexpression");
+ break;
+ case REG_EESCAPE:
+ regcompMessage = i18n("Trailing backslash");
+ break;
+ case REG_BADPAT:
+ regcompMessage = i18n("Invalid use of pattern operators");
+ break;
+#ifdef REG_ESIZE
+ case REG_ESIZE:
+ regcompMessage = i18n("Regular expression too large");
+ break;
+#endif
+ default:
+ regcompMessage = i18n("Unknown error");
+ break;
+ }
+ success_label->setText(regcompMessage);
+ return;
+ }
+
+ for (int i = 0; i < 20; ++i) {
+ matches[i].rm_so = -1;
+ matches[i].rm_eo = -1;
+ }
+
+ QCString testString = teststring_edit->text().local8Bit();
+ res = regexec(&compiledPattern, testString, 20, matches, 0);
+ if (res != 0) {
+ success_label->setText(i18n("No match"));
+ return;
+ }
+
+ success_label->setText(i18n("Successfully matched"));
+ int len = testString.length();
+ for (int i = 0; i < 20; ++i) {
+ if (matches[i].rm_so >= 0 && matches[i].rm_so <= len &&
+ matches[i].rm_eo >= 0 && matches[i].rm_eo <= len &&
+ matches[i].rm_so <= matches[i].rm_eo) {
+ QCString subGroup = testString.mid(matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so);
+ new QListViewItem(subgroups_listview, QString::number(i), subGroup);
+ }
+ }
+ regfree(&compiledPattern);
+}
+
+
+void RegexpTestDialog::insertQuoted()
+{
+ QString rawstr = pattern_edit->text();
+
+ QString str;
+
+ int len = rawstr.length();
+ for (int i=0; i < len; ++i) {
+ QChar ch = rawstr[i];
+ if (ch == '"')
+ str += "\\\"";
+ else if (ch == '\\')
+ str += "\\\\";
+ else
+ str += ch;
+ }
+
+ KParts::ReadWritePart *rwpart
+ = dynamic_cast<KParts::ReadWritePart*>(m_part->partController()->activePart());
+ QWidget *view = m_part->partController()->activeWidget();
+
+ KTextEditor::EditInterface *editiface
+ = dynamic_cast<KTextEditor::EditInterface*>(rwpart);
+ if (!editiface) {
+ kdDebug() << "no edit" << endl;
+ return;
+ }
+ KTextEditor::ViewCursorInterface *cursoriface
+ = dynamic_cast<KTextEditor::ViewCursorInterface*>(view);
+ if (!cursoriface) {
+ kdDebug() << "no viewcursor" << endl;
+ return;
+ }
+
+ uint line, col;
+ cursoriface->cursorPositionReal(&line, &col);
+ editiface->insertText(line, col, str);
+ reject();
+}
+
+void RegexpTestDialog::showRegExpEditor( )
+{
+ _regexp_dialog = KParts::ComponentFactory::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor" );
+
+ if ( _regexp_dialog )
+ {
+ KRegExpEditorInterface *editor =
+ static_cast<KRegExpEditorInterface *>( _regexp_dialog->qt_cast( "KRegExpEditorInterface" ) );
+
+ editor->setRegExp( pattern_edit->text() );
+
+ if ( _regexp_dialog->exec() == QDialog::Accepted )
+ {
+ pattern_edit->setText( editor->regExp() );
+ }
+ }
+}
+
+#include "regexptestdlg.moc"
diff --git a/parts/regexptest/regexptestdlg.h b/parts/regexptest/regexptestdlg.h
new file mode 100644
index 00000000..e1c1a4e3
--- /dev/null
+++ b/parts/regexptest/regexptestdlg.h
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _REGEXPTESTDLG_H_
+#define _REGEXPTESTDLG_H_
+
+#include "regexptestdlgbase.h"
+
+class KDevPlugin;
+
+
+class RegexpTestDialog : public RegexpTestDialogBase
+{
+ Q_OBJECT
+
+public:
+ RegexpTestDialog( KDevPlugin *part );
+ ~RegexpTestDialog();
+
+protected:
+ virtual void showEvent(QShowEvent *e);
+
+protected slots:
+ void showRegExpEditor();
+
+private:
+ virtual void somethingChanged();
+ virtual void checkPOSIX();
+ virtual void checkQRegExp();
+ virtual void checkKRegExp();
+ virtual void insertQuoted();
+
+ KDevPlugin *m_part;
+
+ QDialog * _regexp_dialog;
+};
+
+#endif
diff --git a/parts/regexptest/regexptestdlgbase.ui b/parts/regexptest/regexptestdlgbase.ui
new file mode 100644
index 00000000..7b52620a
--- /dev/null
+++ b/parts/regexptest/regexptestdlgbase.ui
@@ -0,0 +1,352 @@
+<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
+<class>RegexpTestDialogBase</class>
+<widget class="QDialog">
+ <property name="name">
+ <cstring>regexp_test_dialog</cstring>
+ </property>
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>541</width>
+ <height>367</height>
+ </rect>
+ </property>
+ <property name="caption">
+ <string>Test Regular Expression</string>
+ </property>
+ <property name="sizeGripEnabled">
+ <bool>false</bool>
+ </property>
+ <grid>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel" row="0" column="0">
+ <property name="name">
+ <cstring>pattern_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Regular expression:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>pattern_edit</cstring>
+ </property>
+ </widget>
+ <widget class="QLabel" row="2" column="0">
+ <property name="name">
+ <cstring>teststring_label</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Test string:</string>
+ </property>
+ <property name="buddy" stdset="0">
+ <cstring>teststring_edit</cstring>
+ </property>
+ </widget>
+ <widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>teststring_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Enter a string which will be matched against the regular expression</string>
+ </property>
+ </widget>
+ <widget class="QLabel" row="3" column="1" rowspan="1" colspan="2">
+ <property name="name">
+ <cstring>success_label</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>1</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string></string>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="5" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>Layout4</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>insertbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Insert Quoted</string>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Inserts the regular expression into the currently opened source code file. Escapes any special characters like backslash.</string>
+ </property>
+ </widget>
+ <spacer>
+ <property name="name">
+ <cstring>Horizontal Spacing2</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Expanding</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget class="QPushButton">
+ <property name="name">
+ <cstring>cancelbutton</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Close</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Closes the dialog</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ <widget class="KLineEdit" row="0" column="1">
+ <property name="name">
+ <cstring>pattern_edit</cstring>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>enter a regular expression, for example &lt;tt&gt;KD.*&lt;/tt&gt;, which matches all strings beginning with "KD"</string>
+ </property>
+ </widget>
+ <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>flavor_group</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>5</hsizetype>
+ <vsizetype>4</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string>Regular Expression T&amp;ype</string>
+ </property>
+ <vbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>basicposix_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Basic POSIX syntax (used by grep)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the grep manpage</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>extendedposix_button</cstring>
+ </property>
+ <property name="text">
+ <string>E&amp;xtended POSIX syntax (used by egrep)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the grep manpage</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>qregexp_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;QRegExp syntax</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the documentation of the QRegExp class</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>qregexp_min_button</cstring>
+ </property>
+ <property name="text">
+ <string>QRegExp syntax (&amp;minimal)</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Matches a QRegExp non-greedy. Please read the QRegExp::setMinimal documentation for more details.</string>
+ </property>
+ </widget>
+ <widget class="QRadioButton">
+ <property name="name">
+ <cstring>kregexp_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;KRegExp syntax</string>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>A description of this syntax can be found in the KDE API documentation.</string>
+ </property>
+ </widget>
+ </vbox>
+ </widget>
+ <widget class="QPushButton" row="0" column="2">
+ <property name="name">
+ <cstring>rxedit_button</cstring>
+ </property>
+ <property name="text">
+ <string>&amp;Edit...</string>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLayoutWidget" row="4" column="0" rowspan="1" colspan="3">
+ <property name="name">
+ <cstring>layout2</cstring>
+ </property>
+ <hbox>
+ <property name="name">
+ <cstring>unnamed</cstring>
+ </property>
+ <widget class="QLabel">
+ <property name="name">
+ <cstring>subgroups_label</cstring>
+ </property>
+ <property name="text">
+ <string>Matched subgroups:</string>
+ </property>
+ </widget>
+ <widget class="QListView">
+ <column>
+ <property name="text">
+ <string>Group</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <column>
+ <property name="text">
+ <string>Value</string>
+ </property>
+ <property name="clickable">
+ <bool>true</bool>
+ </property>
+ <property name="resizable">
+ <bool>true</bool>
+ </property>
+ </column>
+ <property name="name">
+ <cstring>subgroups_listview</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>5</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="allColumnsShowFocus">
+ <bool>true</bool>
+ </property>
+ <property name="resizeMode">
+ <enum>AllColumns</enum>
+ </property>
+ <property name="whatsThis" stdset="0">
+ <string>Shows which groups were matched. See the corresponding documentation for how groups are matched.</string>
+ </property>
+ </widget>
+ </hbox>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>cancelbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>reject()</slot>
+ </connection>
+ <connection>
+ <sender>flavor_group</sender>
+ <signal>clicked(int)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>pattern_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>teststring_edit</sender>
+ <signal>textChanged(const QString&amp;)</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>somethingChanged()</slot>
+ </connection>
+ <connection>
+ <sender>insertbutton</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>insertQuoted()</slot>
+ </connection>
+ <connection>
+ <sender>rxedit_button</sender>
+ <signal>clicked()</signal>
+ <receiver>regexp_test_dialog</receiver>
+ <slot>showRegExpEditor()</slot>
+ </connection>
+</connections>
+<tabstops>
+ <tabstop>pattern_edit</tabstop>
+ <tabstop>rxedit_button</tabstop>
+ <tabstop>basicposix_button</tabstop>
+ <tabstop>teststring_edit</tabstop>
+ <tabstop>subgroups_listview</tabstop>
+ <tabstop>insertbutton</tabstop>
+ <tabstop>cancelbutton</tabstop>
+ <tabstop>extendedposix_button</tabstop>
+</tabstops>
+<includes>
+ <include location="global" impldecl="in implementation">kdialog.h</include>
+</includes>
+<slots>
+ <slot access="protected">insertQuoted()</slot>
+ <slot>somethingChanged()</slot>
+ <slot access="protected">showRegExpEditor()</slot>
+</slots>
+<layoutdefaults spacing="6" margin="11"/>
+<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+ <includehint>klineedit.h</includehint>
+</includehints>
+</UI>
diff --git a/parts/regexptest/regexptestpart.cpp b/parts/regexptest/regexptestpart.cpp
new file mode 100644
index 00000000..7b6b5193
--- /dev/null
+++ b/parts/regexptest/regexptestpart.cpp
@@ -0,0 +1,63 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "regexptestpart.h"
+
+#include <klocale.h>
+#include <kdevgenericfactory.h>
+#include <kdevplugininfo.h>
+#include <kaction.h>
+
+#include "kdevcore.h"
+#include "regexptestdlg.h"
+
+static const KDevPluginInfo data("kdevregexptest");
+
+typedef KDevGenericFactory<RegexpTestPart> RegexpTestFactory;
+K_EXPORT_COMPONENT_FACTORY( libkdevregexptest, RegexpTestFactory( data ) )
+
+RegexpTestPart::RegexpTestPart(QObject *parent, const char *name, const QStringList &)
+ : KDevPlugin(&data, parent, name ? name : "RegexpTestPart")
+{
+ setInstance(RegexpTestFactory::instance());
+ setXMLFile("kdevregexptest.rc");
+
+ KAction *action;
+
+ action = new KAction( i18n("Debug Regular Expression..."), 0,
+ this, SLOT(slotRegexpTest()),
+ actionCollection(), "tools_regexptest" );
+ action->setToolTip(i18n("Debug regular expression"));
+ action->setWhatsThis(i18n("<b>Debug regular expression</b><p>Allows to enter a regular expression "
+ "and validate it. It is possible to check syntax of basic POSIX, extended POSIX "
+ "regular expressions and also syntax allowed by QRegExp and KRegExp classes."));
+
+ m_dialog = 0;
+}
+
+
+RegexpTestPart::~RegexpTestPart()
+{
+ delete m_dialog;
+}
+
+
+void RegexpTestPart::slotRegexpTest()
+{
+ if (!m_dialog) {
+ m_dialog = new RegexpTestDialog(this);
+ }
+
+ m_dialog->show();
+}
+
+
+#include "regexptestpart.moc"
diff --git a/parts/regexptest/regexptestpart.h b/parts/regexptest/regexptestpart.h
new file mode 100644
index 00000000..7eabeffc
--- /dev/null
+++ b/parts/regexptest/regexptestpart.h
@@ -0,0 +1,37 @@
+/***************************************************************************
+ * Copyright (C) 2001 by Bernd Gehrmann *
+ * bernd@kdevelop.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef _REGEXPTESTPART_H_
+#define _REGEXPTESTPART_H_
+
+#include <qguardedptr.h>
+#include <kdialogbase.h>
+#include "kdevplugin.h"
+
+class RegexpTestDialog;
+
+
+class RegexpTestPart : public KDevPlugin
+{
+ Q_OBJECT
+
+public:
+ RegexpTestPart( QObject *parent, const char *name, const QStringList & );
+ ~RegexpTestPart();
+
+private slots:
+ void slotRegexpTest();
+
+private:
+ RegexpTestDialog *m_dialog;
+};
+
+#endif