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

KDEUI

kfind.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001, S.R.Haque <srhaque@iee.org>.
00003     Copyright (C) 2002, David Faure <david@mandrakesoft.com>
00004     This file is part of the KDE project
00005 
00006     This library is free software; you can redistribute it and/or
00007     modify it under the terms of the GNU Library General Public
00008     License version 2, as published by the Free Software Foundation.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
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         // Note that KReplaceDialog uses 256 and 512
00119         // User extensions can use boolean options above this value.
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     // ## TODO docu
00337     // findprevious will also emit findNext, after temporarily switching the value
00338     // of FindBackwards
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

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal