KUtils
kreplace.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KREPLACE_H
00022 #define KREPLACE_H
00023
00024 #include "kfind.h"
00025
00026 class KReplaceNextDialog;
00027
00097 class KUTILS_EXPORT KReplace :
00098 public KFind
00099 {
00100 Q_OBJECT
00101
00102 public:
00103
00112 KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent = 0);
00124 KReplace(const QString &pattern, const QString &replacement, long options, QWidget *parent, QWidget* replaceDialog);
00125
00129 virtual ~KReplace();
00130
00138 int numReplacements() const { return m_replacements; }
00139
00145 virtual void resetCounts();
00146
00153 Result replace();
00154
00163 KDialogBase* replaceNextDialog( bool create = false );
00164
00170 void closeReplaceNextDialog();
00171
00189 static int replace( QString &text, const QString &pattern, const QString &replacement, int index, long options, int *replacedLength );
00190
00207 static int replace( QString &text, const QRegExp &pattern, const QString &replacement, int index, long options, int *replacedLength );
00208
00225 virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
00226
00231 virtual void displayFinalDialog() const;
00232
00233 signals:
00234
00249 void replace(const QString &text, int replacementIndex, int replacedLength, int matchedLength);
00250
00251 protected slots:
00252
00253 void slotSkip();
00254 void slotReplace();
00255 void slotReplaceAll();
00256
00257 private:
00258 KReplaceNextDialog* dialog();
00259 void doReplace();
00260 static int replace( QString &text, const QString &replacement, int index, long options, int length );
00261
00262 QString m_replacement;
00263 unsigned m_replacements;
00264
00265
00266 class KReplacePrivate;
00267 KReplacePrivate *d;
00268 };
00269 #endif