interfaces: remove unused and non-operational KRegExpEditorInterface

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-28 05:43:19 +03:00
parent fa959c8c29
commit f1a36b91e5
9 changed files with 62 additions and 265 deletions

View file

@ -237,7 +237,6 @@ install(
KRecentDocument
KRecentFilesAction
KRecursiveFilterProxyModel
KRegExpEditorInterface
KRemoteEncoding
KReplace
KReplaceDialog

View file

@ -1 +0,0 @@
#include "../kregexpeditorinterface.h"

View file

@ -3,7 +3,6 @@
project(interfaces)
add_subdirectory( ktexteditor )
add_subdirectory( kregexpeditor )
add_subdirectory( terminal )
########### install files ###############

View file

@ -1,9 +0,0 @@
install(
FILES kregexpeditor.desktop
DESTINATION ${KDE4_SERVICETYPES_INSTALL_DIR}
)
install(
FILES kregexpeditorinterface.h
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}
)

View file

@ -1,4 +0,0 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=KRegExpEditor/KRegExpEditor

View file

@ -1,164 +0,0 @@
/*
* 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 = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "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 Qt QRegExp
* syntax. Note, there is also a 'regexp' Qt property available.
*/
virtual QString regExp() const = 0;
virtual ~KRegExpEditorInterface(){}
protected:
// These are 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 slots: in classes that implement the interface.
/**
* Set the regular expression for the editor. The syntax must be Qt
* QRegExp syntax.
*/
virtual void setRegExp( const QString &regexp ) = 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!
*
* KDE has a policy of keeping binary compatibility for all major
* version of KDE. This means that new methods can not be added to this
* API before KDE version 4.0.
*
* This method is an escape door for that.
*
* Conclusion: You should not use this method in this version of KDE!
*/
virtual void doSomething( QString method, void* arguments ) = 0;
};
Q_DECLARE_INTERFACE(KRegExpEditorInterface, "org.kde.KRegExpEditorInterface/1.0")
#endif

View file

@ -2,7 +2,6 @@ project(kdeui)
include_directories(
${CMAKE_SOURCE_DIR}/interfaces
${CMAKE_SOURCE_DIR}/interfaces/kregexpeditor
${CMAKE_SOURCE_DIR}/kdeui
${KDE4_KDECORE_INCLUDES}
actions

View file

@ -35,11 +35,11 @@
#include <kdebug.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <assert.h>
#include <kfind.h>
#include <kregexpeditorinterface.h>
#include <kservicetypetrader.h>
#include <assert.h>
KFindDialog::KFindDialog(QWidget *parent, long options, const QStringList &findStrings, bool hasSelection, bool replaceDialog)
: KDialog(parent),
d(new KFindDialogPrivate(this))
@ -409,31 +409,13 @@ void KFindDialog::setOptions(long options)
// compose a regular expression search pattern.
void KFindDialog::KFindDialogPrivate::_k_showPatterns()
{
if ( !regexpDialogQueryDone )
{
regexpDialog = KServiceTypeTrader::createInstanceFromQuery<QDialog>( "KRegExpEditor/KRegExpEditor", QString(), q );
regexpDialogQueryDone = true;
}
if ( regexpDialog )
{
KRegExpEditorInterface *iface = qobject_cast<KRegExpEditorInterface*>( regexpDialog );
assert( iface );
iface->setRegExp( q->pattern() );
if ( regexpDialog->exec() == QDialog::Accepted )
q->setPattern( iface->regExp() );
}
else // No complete regexp-editor available, bring up the old popupmenu
{
typedef struct
{
const char *description;
const char *regExp;
int cursorAdjustment;
} term;
static const term items[] =
{
static const term items[] = {
{ I18N_NOOP("Any Character"), ".", 0 },
{ I18N_NOOP("Start of Line"), "^", 0 },
{ I18N_NOOP("End of Line"), "$", 0 },
@ -494,7 +476,6 @@ void KFindDialog::KFindDialogPrivate::_k_showPatterns()
editor->setCursorPosition(editor->cursorPosition() + regExpAction->cursor());
}
}
}
}
class PlaceHolderAction : public QAction

View file

@ -39,12 +39,11 @@ class KFindDialog::KFindDialogPrivate
public:
KFindDialogPrivate(KFindDialog *q)
: q(q),
regexpDialog(0),
regexpDialogQueryDone(false),
initialShowDone(false),
enabled(KFind::WholeWordsOnly | KFind::FromCursor | KFind::SelectedText | KFind::CaseSensitive | KFind::FindBackwards | KFind::RegularExpression),
findExtension(0)
{}
{
}
void init( bool forReplace, const QStringList &findStrings, bool hasSelection );
@ -56,8 +55,6 @@ public:
void _k_textSearchChanged(const QString&);
KFindDialog *q;
QDialog *regexpDialog;
bool regexpDialogQueryDone : 1;
bool initialShowDone : 1;
long enabled; // uses Options to define which search options are enabled
QStringList findStrings;