org.kde.koala

Class KRegExpEditorInterface

public class KRegExpEditorInterface extends Object implements QtSupport

A graphical editor for regular expressions. The actual editor is located in kdeutils, with an interface in kdelibs. This means that it is a bit more complicated to create an instance of the editor, but only a little bit more complicated. To check if kregexpeditor in kdeutils is installed and available use this line:
 boolean installed=!KTrader.self().query("KRegExpEditor/KRegExpEditor").isEmpty();
 
The following is a template for what you need to do to create an instance of the regular expression dialog:
 QDialog editorDialog = KParts.ComponentFactory.createInstanceFromQuery( "KRegExpEditor/KRegExpEditor" );
 if ( editorDialog ) {
   // kdeutils was installed, so the dialog was found fetch the editor interface
   KRegExpEditorInterface editor = (KRegExpEditorInterface)( editorDialog.qt_cast( "KRegExpEditorInterface" ) );
   Q_ASSERT( editor ); // This should not fail!
   // now use the editor.
   editor.setRegExp("^kde$");
   // Finally exec the dialog
   editorDialog.exec();
 }
 else {
   // Don't offer the dialog.
 }
 
Note: signals and slots must be connected to the editorDialog object, not to the editor object:
 connect( editorDialog, SIGNAL("canUndo( boolean )"), undoBut, SLOT("setEnabled( boolean )") );
 
If you want to create an instance of the editor widget, i.e. not the dialog, then you must do it in the following way:
 QWidget editorWidget =
 KParts.ComponentFactory.createInstanceFromQuery( 
     "KRegExpEditor/KRegExpEditor", null, parent );
 if ( editorWidget ) {
   // kdeutils was installed, so the widget was found fetch the editor interface
   KRegExpEditorInterface editor = (KRegExpEditorInterface)( editorWidget.qt_cast( "KRegExpEditorInterface" ) );
   Q_ASSERT( editor ); // This should not fail!
   // now use the editor.
   editor.setRegExp("^kde$");
   // Finally insert the widget into the layout of its parent
   layout.addWidget( editorWidget );
 }
 else {
   // Don't offer the editor widget.
 }
 

Author: Jesper K. Pedersen blackie@kde.org

UNKNOWN: A graphical editor for regular expressions.

Constructor Summary
protected KRegExpEditorInterface(Class dummy)
Method Summary
voidredo()
StringregExp()
returns the regular expression of the editor in Qt3 QRegExp syntax.
voidsetMatchText(String arg1)
Set text to use when showing matches.
voidsetRegExp(String regexp)
Set the regular expression for the editor.
voidundo()

Constructor Detail

KRegExpEditorInterface

protected KRegExpEditorInterface(Class dummy)

Method Detail

redo

public void redo()

regExp

public String regExp()
returns the regular expression of the editor in Qt3 QRegExp syntax. Note, there is also a 'regexp' Qt property available.

UNKNOWN: returns the regular expression of the editor in Qt3 QRegExp syntax.

setMatchText

public void setMatchText(String arg1)
Set text to use when showing matches. NOT IMPLEMENTED YET! This method is not yet implemented. In later version of the widget this method will be used to give the widget a text to show matches of the regular expression on.

UNKNOWN: Set text to use when showing matches.

setRegExp

public void setRegExp(String regexp)
Set the regular expression for the editor. The syntax must be Qt3 QRegExp syntax.

UNKNOWN: Set the regular expression for the editor.

undo

public void undo()