/usr/include/KF5/KTextWidgets/kregexpeditorinterface.h is in libkf5textwidgets-dev 5.28.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /*
* kregexpeditorinterface.h - KDE RegExp Editor Interface
*
* Copyright (c) 2002 Jesper K. Pedersen <blackie@kdab.net>
* Copyright (c) 2002 Simon Hausmann <hausmann@kde.org>
*
* 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 __kregexpeditorinterface_h__
#define __kregexpeditorinterface_h__
#include <QtCore/QString>
#include <QtCore/QObject>
/**
* A graphical editor for regular expressions.
*
* @author Jesper K. Pedersen blackie@kde.org
*
* The actual editor is located in kdeutils, with an interface in
* kdelibs. This means that it is a bit more comlicated 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:
*
* \code
* bool installed=!KTrader::self()->query("KRegExpEditor/KRegExpEditor").isEmpty();
* \endcode
*
* The following is a template for what you need to do to create an instance of the
* regular expression dialog:
*
* \code
* QDialog *editorDialog = KPluginTrader::createInstanceFromQuery<QDialog>(QLatin1String("kregexpeditor"),
QLatin1String("KRegExpEditor/KRegExpEditor"));
* if ( editorDialog ) {
* // kdeutils was installed, so the dialog was found fetch the editor interface
* KRegExpEditorInterface *editor = static_cast<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.
* }
* \endcode
*
* Note: signals and slots must be connected to the editorDialog object, not to the editor object:
* \code
* connect( editorDialog, SIGNAL( canUndo( bool ) ), undoBut, SLOT( setEnabled( bool ) ) );
* \endcode
*
* 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:
*
* \code
* QWidget *editorWidget =
* KServiceTypeTrader::createInstanceFromQuery<QWidget>(
* "KRegExpEditor/KRegExpEditor", QString(), parent );
* if ( editorWidget ) {
* // kdeutils was installed, so the widget was found fetch the editor interface
* KRegExpEditorInterface *editor = static_cast<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.
* }
* \endcode
*
*/
class KRegExpEditorInterface
{
public:
/**
* returns the regular expression of the editor in Qt3 QRegExp
* syntax. Note, there is also a 'regexp' Qt property available.
*/
virtual QString regExp() const = 0;
virtual ~KRegExpEditorInterface() {}
protected:
// These are Q_SIGNALS: in classes that actually implement the interface.
/**
* This signal tells whether undo is available.
*/
virtual void canUndo(bool) = 0;
/**
* This signal tells whether redo is available.
*/
virtual void canRedo(bool) = 0;
/**
* This signal is emitted whenever the regular expression changes.
* The argument is true when the regular expression is different from
* the loaded regular expression and false when it is equal to the
* loaded regular expression.
*/
virtual void changes(bool) = 0;
public:
// These are public Q_SLOTS: in classes that implement the interface.
/**
* Set the regular expression for the editor. The syntax must be Qt3
* QRegExp syntax.
*/
virtual void setRegExp(const QString ®exp) = 0;
virtual void redo() = 0;
virtual void undo() = 0;
/**
* 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.
*/
virtual void setMatchText(const QString &) = 0;
/**
* This method allows for future changes that will not break binary
* compatibility. DO NOT USE!
*
* See http://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++
*/
virtual void doSomething(const QString& method, void *arguments) = 0;
};
Q_DECLARE_INTERFACE(KRegExpEditorInterface, "org.kde.KRegExpEditorInterface/1.0")
#endif
|