kfinddialog.h
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 KFINDDIALOG_H 00022 #define KFINDDIALOG_H 00023 00024 #include <kdialogbase.h> 00025 class KHistoryCombo; 00026 class QPushButton; 00027 class QPopupMenu; 00028 class QGridLayout; 00029 class QLabel; 00030 class QGroupBox; 00031 class QCheckBox; 00032 00074 class KUTILS_EXPORT KFindDialog: 00075 public KDialogBase 00076 { 00077 Q_OBJECT 00078 00079 public: 00080 00081 // Options. 00082 00083 // KDE4: move to KFind 00087 enum Options 00088 { 00089 WholeWordsOnly = 1, 00090 FromCursor = 2, 00091 SelectedText = 4, 00092 CaseSensitive = 8, 00093 FindBackwards = 16, 00094 RegularExpression = 32, 00095 FindIncremental = 64, 00096 // Note that KReplaceDialog uses 256 and 512 00097 // User extensions can use boolean options above this value. 00098 MinimumUserOption = 65536 00099 }; 00100 00110 KFindDialog( QWidget *parent = 0, const char *name = 0, long options = 0, 00111 const QStringList &findStrings = QStringList(), bool hasSelection = false ); 00112 // KDE4: fix ambiguity with private constructor 00113 // Maybe remove options (there's setOptions) and findStrings (setFindHistory) and hasSelection (setHasSelection) 00114 00125 KFindDialog( bool modal, QWidget *parent = 0, const char *name = 0, long options = 0, 00126 const QStringList &findStrings = QStringList(), bool hasSelection = false ); 00127 // KDE4: consider simplifying 00128 00132 virtual ~KFindDialog(); 00133 00142 void setFindHistory( const QStringList &history ); 00143 00150 QStringList findHistory() const; 00151 00158 void setHasSelection( bool hasSelection ); 00159 00167 void setHasCursor( bool hasCursor ); 00168 00177 void setSupportsBackwardsFind( bool supports ); 00178 00187 void setSupportsCaseSensitiveFind( bool supports ); 00188 00197 void setSupportsWholeWordsFind( bool supports ); 00198 00207 void setSupportsRegularExpressionFind( bool supports ); 00208 00215 void setOptions( long options ); 00216 00224 long options() const; 00225 00230 QString pattern() const; 00231 00236 void setPattern ( const QString &pattern ); 00237 00245 QWidget *findExtension(); 00246 00247 protected slots: 00248 00249 void slotOk(); 00250 void slotSelectedTextToggled(bool); 00251 void showPatterns(); 00252 void showPlaceholders(); 00253 void textSearchChanged( const QString &); 00254 00255 protected: 00256 virtual void showEvent ( QShowEvent * ); 00257 00258 private slots: 00263 void slotPlaceholdersAboutToShow(); 00264 00265 private: 00266 00267 QGroupBox *m_findGrp; 00268 QLabel *m_findLabel; 00269 KHistoryCombo *m_find; 00270 QCheckBox *m_regExp; 00271 QPushButton *m_regExpItem; 00272 QGridLayout *m_findLayout; 00273 QWidget *m_findExtension; 00274 00275 QGroupBox *m_optionGrp; 00276 QCheckBox *m_wholeWordsOnly; 00277 QCheckBox *m_fromCursor; 00278 QCheckBox *m_selectedText; 00279 QCheckBox *m_caseSensitive; 00280 QCheckBox *m_findBackwards; 00281 00282 QPopupMenu *m_patterns; 00283 00284 // Our dirty little secret is that we also implement the "replace" dialog. But we 00285 // keep that fact hidden from all but our friends. 00286 00287 friend class KReplaceDialog; 00288 00295 KFindDialog( QWidget *parent, const char *name, bool forReplace ); 00296 void init( bool forReplace, const QStringList &findStrings, bool hasSelection ); 00297 00298 QGroupBox *m_replaceGrp; 00299 QLabel *m_replaceLabel; 00300 KHistoryCombo *m_replace; 00301 QCheckBox* m_backRef; 00302 QPushButton* m_backRefItem; 00303 QGridLayout *m_replaceLayout; 00304 QWidget *m_replaceExtension; 00305 00306 QCheckBox* m_promptOnReplace; 00307 00308 QPopupMenu *m_placeholders; 00309 00310 // Binary compatible extensibility. 00311 class KFindDialogPrivate; 00312 KFindDialogPrivate *d; 00313 }; 00314 00315 #endif // KFINDDIALOG_H