kmail Library API Documentation

kmsearchpatternedit.h

00001 // -*- mode: C++; c-file-style: "gnu" -*-
00002 // kmfilterrulesedit.h
00003 // Author: Marc Mutz <Marc@Mutz.com>
00004 // This code is under GPL
00005 
00006 #ifndef KMFILTERRULESEDIT_H
00007 #define KMFILTERRULESEDIT_H
00008 
00009 #include "kwidgetlister.h"
00010 
00011 #include <qgroupbox.h>
00012 #include <qstringlist.h>
00013 
00014 class KMSearchRule;
00015 class KMSearchPattern;
00016 
00017 template <typename T> class QPtrList;
00018 class QString;
00019 class QComboBox;
00020 class QLineEdit;
00021 class QRadioButton;
00022 class QWidgetStack;
00023 class QLabel;
00024 
00039 class KMSearchRuleWidget : public QWidget
00040 {
00041   Q_OBJECT
00042 public:
00045   KMSearchRuleWidget( QWidget* parent=0, KMSearchRule* aRule=0, const char* name=0, bool headersOnly = false, bool absoluteDates = false );
00046 
00047   enum { Message, Body, AnyHeader, Recipients, Size, AgeInDays, Status };
00048 
00052   void setHeadersOnly( bool headersOnly );
00058   void setRule( KMSearchRule* aRule );
00060   KMSearchRule* rule() const;
00063   void reset();
00064   static int ruleFieldToId( const QString & i18nVal );
00065 
00066 public slots:
00067   void slotFunctionChanged();
00068   void slotValueChanged();
00069 
00070 signals:
00074   void fieldChanged( const QString & );
00075 
00078   void contentsChanged( const QString & );
00079 
00080 protected:
00083   static QCString ruleFieldToEnglish(const QString & i18nVal);
00086   int indexOfRuleField( const QCString & aName ) const;
00087 
00088 protected slots:
00089   void slotRuleFieldChanged( const QString & );
00090 
00091 private:
00092   void initWidget();
00093   void initFieldList( bool headersOnly, bool absoluteDates );
00094 
00095   QStringList mFilterFieldList;
00096   QComboBox *mRuleField;
00097   QWidgetStack *mFunctionStack;
00098   QWidgetStack *mValueStack;
00099   bool mAbsoluteDates;
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   void setHeadersOnly( bool headersOnly );
00116 
00117 public slots:
00118   void reset();
00119 
00120 protected:
00121   virtual void clearWidget( QWidget *aWidget );
00122   virtual QWidget* createWidget( QWidget *parent );
00123 
00124 private:
00125   void regenerateRuleListFromWidgets();
00126   QPtrList<KMSearchRule> *mRuleList;
00127   bool mHeadersOnly;
00128   bool mAbsoluteDates;
00129 };
00130 
00131 
00164 class KMSearchPatternEdit : public QGroupBox  {
00165   Q_OBJECT
00166 public:
00169   KMSearchPatternEdit(QWidget *parent=0, const char *name=0, bool headersOnly = false, bool absoluteDates = false);
00172   KMSearchPatternEdit(const QString & title, QWidget *parent=0, const char *name=0, bool headersOnly = false, bool absoluteDates = false);
00173   ~KMSearchPatternEdit();
00174 
00179   void setSearchPattern( KMSearchPattern* aPattern );
00183   void setHeadersOnly( bool headersOnly );
00184 
00186   void updateSearchPattern() { mRuleLister->regenerateRuleListFromWidgets(); }
00187 
00188 public slots:
00191   void reset();
00192 
00193 signals:
00196   void maybeNameChanged();
00197 
00198 private slots:
00199   void slotRadioClicked(int aIdx);
00200   void slotAutoNameHack();
00201 
00202 private:
00203   void initLayout( bool headersOnly, bool absoluteDates );
00204 
00205   KMSearchPattern *mPattern;
00206   QRadioButton    *mAllRBtn, *mAnyRBtn;
00207   KMSearchRuleWidgetLister *mRuleLister;
00208 };
00209 
00210 #endif
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jan 31 15:55:07 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003