kmail Library API Documentation

kmfilterdlg.h

00001 /* Filter Dialog
00002  * Author: Marc Mutz <Marc@Mutz.com>,
00003  * based upon work by Stefan Taferner <taferner@kde.org>
00004  * This code is under GPL
00005  */
00006 #ifndef kmfilterdlg_h
00007 #define kmfilterdlg_h
00008 
00009 #include "kmfilter.h"
00010 #include "kmfilteraction.h"
00011 
00012 #include <kwidgetlister.h>
00013 
00014 #include <kdialogbase.h>
00015 
00016 #include <qvgroupbox.h>
00017 #include <qgroupbox.h>
00018 #include <qhbox.h>
00019 #include <qstring.h>
00020 #include <qptrlist.h>
00021 #include <qradiobutton.h>
00022 #include <qvbuttongroup.h>
00023 #include <qmap.h>
00024 
00025 class KMSearchPatternEdit;
00026 class QListBox;
00027 class QPushButton;
00028 class QComboBox;
00029 class QWidgetStack;
00030 class QCheckBox;
00031 class KIconButton;
00032 
00033 
00058 class KMFilterListBox : public QGroupBox
00059 {
00060   Q_OBJECT
00061 public:
00063   KMFilterListBox( const QString & title, QWidget* parent=0, const char* name=0, bool popFilter = false);
00064 
00071   void createFilter( const QCString & field, const QString & value );
00072 
00075   void loadFilterList();
00076 
00078   bool showLaterMsgs();
00079 
00080 signals:
00084   void filterSelected( KMFilter* filter );
00085 
00090   void resetWidgets();
00091 
00092 public slots:
00097   void slotUpdateFilterName();
00100   void slotApplyFilterChanges();
00103   void slotShowLaterToggled(bool aOn);
00104 
00105 protected slots:
00109   void slotSelected( int aIdx );
00112   void slotNew();
00115   void slotDelete();
00118   void slotUp();
00121   void slotDown();
00124   void slotRename();
00125 
00126 protected:
00128   QPtrList<KMFilter> mFilterList;
00130   QListBox *mListBox;
00132   QPushButton *mBtnNew, *mBtnDelete, *mBtnUp, *mBtnDown, *mBtnRename;
00134   int mIdxSelItem;
00135   bool mShowLater;
00136 private:
00137   void enableControls();
00138   void insertFilter( KMFilter* aFilter );
00139   void swapNeighbouringFilters( int untouchedOne, int movedOne);
00140   bool bPopFilter;
00141 };
00142 
00143 
00165 class KMFilterActionWidget : public QHBox
00166 {
00167   Q_OBJECT
00168 public:
00171   KMFilterActionWidget( QWidget* parent=0, const char* name=0 );
00172 
00176   void setAction( const KMFilterAction * aAction );
00181   KMFilterAction *action();
00182 
00183 private:
00188   QPtrList<KMFilterAction> mActionList;
00192   QComboBox      *mComboBox;
00195   QWidgetStack   *mWidgetStack;
00196 };
00197 
00198 class KMPopFilterActionWidget : public QVButtonGroup
00199 {
00200   Q_OBJECT
00201 public:
00202   KMPopFilterActionWidget( const QString &title, QWidget* parent=0, const char* name=0 );
00203   void setAction( KMPopFilterAction aAction );
00204   KMPopFilterAction action();
00205 
00206 public slots:
00207   void reset();
00208 
00209 private slots:
00210   void slotActionClicked(int aId);
00211 
00212 private:
00213   KMPopFilterAction mAction;
00214   KMFilter mFilter;
00215   QMap<KMPopFilterAction, QRadioButton*> mActionMap;
00216   QMap<int, KMPopFilterAction> mIdMap;
00217 
00218 signals: // Signals
00219   void actionChanged(const KMPopFilterAction aAction);
00220 };
00221 
00222 class KMFilterActionWidgetLister : public KWidgetLister
00223 {
00224   Q_OBJECT
00225 public:
00226   KMFilterActionWidgetLister( QWidget *parent=0, const char* name=0 );
00227 
00228   virtual ~KMFilterActionWidgetLister();
00229 
00230   void setActionList( QPtrList<KMFilterAction> * aList );
00231 
00232 public slots:
00233   void reset();
00234 
00235 protected:
00236   virtual void clearWidget( QWidget *aWidget );
00237   virtual QWidget* createWidget( QWidget *parent );
00238 
00239 private:
00240   void regenerateActionListFromWidgets();
00241   QPtrList<KMFilterAction> *mActionList;
00242 
00243 };
00244 
00245 
00246 
00303 class KMFilterDlg: public KDialogBase
00304 {
00305   Q_OBJECT
00306 public:
00310   KMFilterDlg(QWidget* parent=0, const char* name=0, bool popFilter=false);
00311 
00316   void createFilter( const QCString & field, const QString & value )
00317     { mFilterList->createFilter( field, value ); }
00318 
00319 public slots:
00324   void slotFilterSelected(KMFilter * aFilter);
00326   void slotActionChanged(const KMPopFilterAction aAction);
00327 
00328 protected slots:
00329   void slotApplicabilityChanged();
00330   void slotStopProcessingButtonToggled( bool aChecked );
00331   void slotConfigureShortcutButtonToggled( bool aChecked );
00332   void slotFilterActionIconChanged( QString icon );
00333   void slotReset();
00334   void slotSaveSize();
00336   void slotFinished();
00337 
00338 protected:
00342   KMFilterListBox *mFilterList;
00344   KMSearchPatternEdit *mPatternEdit;
00346   KMFilterActionWidgetLister *mActionLister;
00348   KMPopFilterActionWidget *mActionGroup;
00351   QCheckBox *mApplyOnIn, *mApplyOnOut, *mApplyOnCtrlJ;
00352   QCheckBox *mStopProcessingHere;
00353   QCheckBox *mConfigureShortcut;
00354   QLabel *mFilterActionLabel;
00355   KIconButton *mFilterActionIconButton;
00356   QGroupBox *mAdvOptsGroup;
00357   QVGroupBox *mGlobalsBox;
00358   QCheckBox *mShowLaterBtn;
00359 
00360   KMFilter *mFilter;
00361   bool bPopFilter;
00362 };
00363 
00364 
00365 
00366 #endif /*kmfilterdlg_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:37:26 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003