org.kde.koala
Class KRegExpEditorInterface

java.lang.Object
  extended by org.kde.koala.KRegExpEditorInterface
All Implemented Interfaces:
org.kde.qt.QtSupport

public class KRegExpEditorInterface
extends java.lang.Object
implements org.kde.qt.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

Constructor Summary
protected KRegExpEditorInterface(java.lang.Class dummy)
           
 
Method Summary
 void redo()
           
 java.lang.String regExp()
          returns the regular expression of the editor in Qt3 QRegExp syntax.
 void setMatchText(java.lang.String arg1)
          Set text to use when showing matches.
 void setRegExp(java.lang.String regexp)
          Set the regular expression for the editor.
 void undo()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KRegExpEditorInterface

protected KRegExpEditorInterface(java.lang.Class dummy)
Method Detail

regExp

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


setRegExp

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


redo

public void redo()

undo

public void undo()

setMatchText

public void setMatchText(java.lang.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.