KUtils
kfinddialog.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 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     
00082 
00083     
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         
00097         
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     
00113     
00114 
00125     KFindDialog( bool modal, QWidget *parent = 0, const char *name = 0, long options = 0,
00126                  const QStringList &findStrings = QStringList(), bool hasSelection = false );
00127     
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     
00285     
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     
00311     class KFindDialogPrivate;
00312     KFindDialogPrivate *d;
00313 };
00314 
00315 #endif // KFINDDIALOG_H