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

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • 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 
101 class KDEUI_EXPORT KFind :
102  public QObject
103 {
104  Q_OBJECT
105 
106 public:
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 
305 Q_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 
357 protected:
358 
359  QWidget* parentWidget() const;
360  QWidget* dialogsParent() const;
361 
362 private:
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 
373 Q_DECLARE_OPERATORS_FOR_FLAGS(KFind::SearchOptions)
374 
375 #endif
kdialog.h
QWidget
KStandardAction::find
KAction * find(const QObject *recvr, const char *slot, QObject *parent)
Initiate a 'find' request in the current document.
Definition: kstandardaction.cpp:329
KDialog
A dialog base class with standard buttons and predefined layouts.
Definition: kdialog.h:128
QString
QObject
KStandardAction::findNext
KAction * findNext(const QObject *recvr, const char *slot, QObject *parent)
Find the next instance of a stored 'find'.
Definition: kstandardaction.cpp:334
KReplace
A generic implementation of the "replace" function.
Definition: kreplace.h:96
KFind::Result
Result
Definition: kfind.h:139
KFind
A generic implementation of the "find" function.
Definition: kfind.h:101
KFind::Options
Options
the options
Definition: kfind.h:109
KStandardAction::create
KAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
Creates an action corresponding to one of the KStandardAction::StandardAction actions, which is connected to the given object and slot, and is owned by parent.
Definition: kstandardaction.cpp:82
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:14 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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