KDEUI
kfind.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 KFIND_H
00022 #define KFIND_H
00023
00024 #include <kdialog.h>
00025 #include <QtCore/QRect>
00026
00101 class KDEUI_EXPORT KFind :
00102 public QObject
00103 {
00104 Q_OBJECT
00105
00106 public:
00107
00109 enum Options
00110 {
00111 WholeWordsOnly = 1,
00112 FromCursor = 2,
00113 SelectedText = 4,
00114 CaseSensitive = 8,
00115 FindBackwards = 16,
00116 RegularExpression = 32,
00117 FindIncremental = 64,
00118
00119
00120 MinimumUserOption = 65536
00121 };
00122
00127 KFind(const QString &pattern, long options, QWidget *parent);
00128
00135 KFind(const QString &pattern, long options, QWidget *parent, QWidget* findDialog);
00136 virtual ~KFind();
00137
00138 enum Result { NoMatch, Match };
00139
00146 bool needData() const;
00147
00157 void setData( const QString& data, int startPos = -1 );
00158
00170 void setData( int id, const QString& data, int startPos = -1 );
00171
00177 Result find();
00178
00188 long options() const;
00189
00196 virtual void setOptions( long options );
00197
00201 QString pattern() const;
00202
00206 void setPattern( const QString& pattern );
00207
00214 int numMatches() const;
00215
00222 virtual void resetCounts();
00223
00234 virtual bool validateMatch( const QString & text,
00235 int index,
00236 int matchedlength );
00237
00251 virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
00252
00267 static int find( const QString &text, const QString &pattern, int index, long options, int *matchedlength );
00268
00269 static int find( const QString &text, const QRegExp &pattern, int index, long options, int *matchedlength );
00270
00275 virtual void displayFinalDialog() const;
00276
00284 KDialog* findNextDialog( bool create = false );
00285
00294 void closeFindNextDialog();
00295
00302 int index() const;
00303
00304 Q_SIGNALS:
00305
00319 void highlight(const QString &text, int matchingIndex, int matchedLength);
00320
00334 void highlight(int id, int matchingIndex, int matchedLength);
00335
00336
00337
00338
00339 void findNext();
00340
00346 void optionsChanged();
00347
00354 void dialogClosed();
00355
00356 protected:
00357
00358 QWidget* parentWidget() const;
00359 QWidget* dialogsParent() const;
00360
00361 private:
00362 friend class KReplace;
00363 friend class KReplacePrivate;
00364
00365 struct Private;
00366 Private* const d;
00367
00368 Q_PRIVATE_SLOT( d, void _k_slotFindNext() )
00369 Q_PRIVATE_SLOT( d, void _k_slotDialogClosed() )
00370 };
00371
00372 #endif