kreplace.h
/*
Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
Copyright (C) 2002, David Faure <david@mandrakesoft.com>
This file is part of the KDE project
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2, as published by the Free Software Foundation.
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 KREPLACE_H
#define KREPLACE_H
#include "kfind.h"
class KReplaceNextDialog;
class KUTILS_EXPORT KReplace :
public KFind
{
Q_OBJECT
public:
KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent = 0);
KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent, QWidget* replaceDialog);
virtual ~KReplace();
int numReplacements() const { return m_replacements; }
virtual void resetCounts();
Result replace();
KDialogBase* replaceNextDialog( bool create = false );
void closeReplaceNextDialog();
static int replace( QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength );
static int replace( QString &text, const QRegExp &pattern, const QString &replacement, int index, long options, int *replacedLength );
virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
virtual void displayFinalDialog() const;
signals:
void replace(const QString &text, int replacementIndex, int replacedLength, int matchedLength);
protected slots:
void slotSkip();
void slotReplace();
void slotReplaceAll();
private:
KReplaceNextDialog* dialog();
void doReplace();
static int replace( QString &text, const QString &replacement, int index, long options, int length );
QString m_replacement;
unsigned m_replacements;
// Binary compatible extensibility.
class KReplacePrivate;
KReplacePrivate *d;
};
#endif
KFind::resetCounts
virtual void resetCounts()
Call this to reset the numMatches count (and the numReplacements count for a KReplace).
Definition: kfind.h:231
KReplace::numReplacements
int numReplacements() const
Return the number of replacements made (i.e.
Definition: kreplace.h:138
KDialogBase
KReplace
A generic implementation of the "replace" function.
Definition: kreplace.h:97
KFind::displayFinalDialog
virtual void displayFinalDialog() const
Displays the final dialog saying "no match was found", if that was the case.
Definition: kfind.cpp:619
KFind
A generic implementation of the "find" function.
Definition: kfind.h:103
KFind::shouldRestart
virtual bool shouldRestart(bool forceAsking=false, bool showNumMatches=true) const
Returns true if we should restart the search from scratch.
Definition: kfind.cpp:629

KDE Home | KDE Accessibility Home | Description of Access Keys