kmsearchpatternedit.h
00001
00002
00003
00004
00005 #ifndef KMFILTERRULESEDIT_H
00006 #define KMFILTERRULESEDIT_H
00007
00008 #include "kwidgetlister.h"
00009
00010 #include <qhbox.h>
00011 #include <qgroupbox.h>
00012 #include <qstringlist.h>
00013
00014 class KMSearchRule;
00015 class KMSearchPattern;
00016
00017 class QPushButton;
00018 class QDialog;
00019 template <typename T> class QPtrList;
00020 class QString;
00021 class QComboBox;
00022 class QLineEdit;
00023 class QRadioButton;
00024 class QPushButton;
00025 class QWidgetStack;
00026
00041 class KMSearchRuleWidget: public QHBox
00042 {
00043 Q_OBJECT
00044 public:
00047 KMSearchRuleWidget( QWidget* parent=0, KMSearchRule* aRule=0, const char* name=0, bool headersOnly = false, bool absoluteDates = false );
00048
00054 void setRule( KMSearchRule* aRule );
00056 KMSearchRule* rule() const;
00059 void reset();
00060
00061 signals:
00065 void fieldChanged( const QString & );
00066
00069 void contentsChanged( const QString & );
00070
00071 protected:
00074 static QCString ruleFieldToEnglish(const QString & i18nVal);
00077 static QCString statusToEnglish(const QString & i18nVal);
00080 int indexOfRuleField(const QString & aName) const;
00081 int indexOfStatus(const QString & aStatus) const;
00082
00083 protected slots:
00084 void editRegExp();
00085 void functionChanged( int which );
00086 void slotRuleChanged( int which );
00087
00088 private:
00089 void initWidget();
00090 void initLists(bool headersOnly, bool absoluteDates);
00091
00092 QComboBox* mRuleField;
00093 QComboBox* mRuleFunc;
00094 QWidgetStack* mValueWidgetStack;
00095 QLineEdit* mRuleValue;
00096 QComboBox* mStati;
00097 QPushButton* mRuleEditBut;
00098 QDialog* mRegExpEditDialog;
00099 QStringList mFilterFieldList, mFilterFuncList, mStatiList;
00100 };
00101
00102
00103 class KMSearchRuleWidgetLister : public KWidgetLister
00104 {
00105 Q_OBJECT
00106
00107 friend class KMSearchPatternEdit;
00108
00109 public:
00110 KMSearchRuleWidgetLister( QWidget *parent=0, const char* name=0, bool headersOnly = false, bool absoluteDates = false );
00111
00112 virtual ~KMSearchRuleWidgetLister();
00113
00114 void setRuleList( QPtrList<KMSearchRule> * aList );
00115
00116 public slots:
00117 void reset();
00118
00119 protected:
00120 virtual void clearWidget( QWidget *aWidget );
00121 virtual QWidget* createWidget( QWidget *parent );
00122
00123 private:
00124 void regenerateRuleListFromWidgets();
00125 QPtrList<KMSearchRule> *mRuleList;
00126 bool mHeadersOnly;
00127 bool mAbsoluteDates;
00128 };
00129
00130
00163 class KMSearchPatternEdit : public QGroupBox {
00164 Q_OBJECT
00165 public:
00168 KMSearchPatternEdit(QWidget *parent=0, const char *name=0, bool headersOnly = false, bool absoluteDates = false);
00171 KMSearchPatternEdit(const QString & title, QWidget *parent=0, const char *name=0, bool headersOnly = false, bool absoluteDates = false);
00172 ~KMSearchPatternEdit();
00173
00178 void setSearchPattern( KMSearchPattern* aPattern );
00179
00181 void updateSearchPattern() { mRuleLister->regenerateRuleListFromWidgets(); }
00182
00183 public slots:
00186 void reset();
00187
00188 signals:
00191 void maybeNameChanged();
00192
00193 private slots:
00194 void slotRadioClicked(int aIdx);
00195 void slotAutoNameHack();
00196
00197 private:
00198 void initLayout( bool headersOnly, bool absoluteDates );
00199
00200 KMSearchPattern *mPattern;
00201 QRadioButton *mAllRBtn, *mAnyRBtn;
00202 KMSearchRuleWidgetLister *mRuleLister;
00203 };
00204
00205 #endif
This file is part of the documentation for kmail Library Version 3.2.2.