• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • findreplace
kfind.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
3 Copyright (C) 2002, David Faure <david@mandrakesoft.com>
4 This file is part of the KDE project
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2, as published by the Free Software Foundation.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KFIND_H
22#define KFIND_H
23
24#include <kdialog.h>
25#include <QtCore/QRect>
26
101class KDEUI_EXPORT KFind :
102 public QObject
103{
104 Q_OBJECT
105
106public:
107
109 enum Options
110 {
111 WholeWordsOnly = 1,
112 FromCursor = 2,
113 SelectedText = 4,
114 CaseSensitive = 8,
115 FindBackwards = 16,
116 RegularExpression = 32,
117 FindIncremental = 64,
118 // Note that KReplaceDialog uses 256 and 512
119 // User extensions can use boolean options above this value.
120 MinimumUserOption = 65536
121 };
122 Q_DECLARE_FLAGS(SearchOptions, Options)
123
124
128 KFind(const QString &pattern, long options, QWidget *parent);
129
136 KFind(const QString &pattern, long options, QWidget *parent, QWidget* findDialog);
137 virtual ~KFind();
138
139 enum Result { NoMatch, Match };
140
147 bool needData() const;
148
158 void setData( const QString& data, int startPos = -1 );
159
171 void setData( int id, const QString& data, int startPos = -1 );
172
178 Result find();
179
189 long options() const;
190
197 virtual void setOptions( long options );
198
202 QString pattern() const;
203
207 void setPattern( const QString& pattern );
208
215 int numMatches() const;
216
223 virtual void resetCounts();
224
235 virtual bool validateMatch( const QString & text,
236 int index,
237 int matchedlength );
238
252 virtual bool shouldRestart( bool forceAsking = false, bool showNumMatches = true ) const;
253
268 static int find( const QString &text, const QString &pattern, int index, long options, int *matchedlength );
269
270 static int find( const QString &text, const QRegExp &pattern, int index, long options, int *matchedlength );
271
276 virtual void displayFinalDialog() const;
277
285 KDialog* findNextDialog( bool create = false );
286
295 void closeFindNextDialog();
296
303 int index() const;
304
305Q_SIGNALS:
306
320 void highlight(const QString &text, int matchingIndex, int matchedLength);
321
335 void highlight(int id, int matchingIndex, int matchedLength);
336
337 // ## TODO docu
338 // findprevious will also emit findNext, after temporarily switching the value
339 // of FindBackwards
340 void findNext();
341
347 void optionsChanged();
348
355 void dialogClosed();
356
357protected:
358
359 QWidget* parentWidget() const;
360 QWidget* dialogsParent() const;
361
362private:
363 friend class KReplace;
364 friend class KReplacePrivate;
365
366 struct Private;
367 Private* const d;
368
369 Q_PRIVATE_SLOT( d, void _k_slotFindNext() )
370 Q_PRIVATE_SLOT( d, void _k_slotDialogClosed() )
371};
372
373Q_DECLARE_OPERATORS_FOR_FLAGS(KFind::SearchOptions)
374
375#endif
KDialog
A dialog base class with standard buttons and predefined layouts.
Definition: kdialog.h:129
KFind
A generic implementation of the "find" function.
Definition: kfind.h:103
KFind::Result
Result
Definition: kfind.h:139
KFind::highlight
void highlight(int id, int matchingIndex, int matchedLength)
Connect to this signal to implement highlighting of found text during the find operation.
KFind::dialogClosed
void dialogClosed()
Emitted when the 'find next' dialog is being closed.
KFind::optionsChanged
void optionsChanged()
Emitted when the options have changed.
KFind::findNext
void findNext()
KFind::Options
Options
the options
Definition: kfind.h:110
KFind::highlight
void highlight(const QString &text, int matchingIndex, int matchedLength)
Connect to this signal to implement highlighting of found text during the find operation.
KReplace
A generic implementation of the "replace" function.
Definition: kreplace.h:98
QObject
QWidget
kdialog.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal