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 
00094   void applyWidgets();
00095 
00096 public slots:
00101   void slotUpdateFilterName();
00104   void slotApplyFilterChanges();
00107   void slotShowLaterToggled(bool aOn);
00108 
00109 protected slots:
00113   void slotSelected( int aIdx );
00116   void slotNew();
00119   void slotCopy();
00122   void slotDelete();
00125   void slotUp();
00128   void slotDown();
00131   void slotRename();
00132 
00133 protected:
00135   QPtrList<KMFilter> mFilterList;
00137   QListBox *mListBox;
00139   QPushButton *mBtnNew, *mBtnCopy, *mBtnDelete, *mBtnUp, *mBtnDown, *mBtnRename;
00141   int mIdxSelItem;
00142   bool mShowLater;
00143 private:
00144   void enableControls();
00145   void insertFilter( KMFilter* aFilter );
00146   void swapNeighbouringFilters( int untouchedOne, int movedOne);
00147   bool bPopFilter;
00148 };
00149 
00150 
00172 class KMFilterActionWidget : public QHBox
00173 {
00174   Q_OBJECT
00175 public:
00178   KMFilterActionWidget( QWidget* parent=0, const char* name=0 );
00179 
00183   void setAction( const KMFilterAction * aAction );
00188   KMFilterAction *action();
00189 
00190 private:
00195   QPtrList<KMFilterAction> mActionList;
00199   QComboBox      *mComboBox;
00202   QWidgetStack   *mWidgetStack;
00203 };
00204 
00205 class KMPopFilterActionWidget : public QVButtonGroup
00206 {
00207   Q_OBJECT
00208 public:
00209   KMPopFilterActionWidget( const QString &title, QWidget* parent=0, const char* name=0 );
00210   void setAction( KMPopFilterAction aAction );
00211   KMPopFilterAction action();
00212 
00213 public slots:
00214   void reset();
00215 
00216 private slots:
00217   void slotActionClicked(int aId);
00218 
00219 private:
00220   KMPopFilterAction mAction;
00221   KMFilter mFilter;
00222   QMap<KMPopFilterAction, QRadioButton*> mActionMap;
00223   QMap<int, KMPopFilterAction> mIdMap;
00224 
00225 signals: // Signals
00226   void actionChanged(const KMPopFilterAction aAction);
00227 };
00228 
00229 class KMFilterActionWidgetLister : public KWidgetLister
00230 {
00231   Q_OBJECT
00232 public:
00233   KMFilterActionWidgetLister( QWidget *parent=0, const char* name=0 );
00234 
00235   virtual ~KMFilterActionWidgetLister();
00236 
00237   void setActionList( QPtrList<KMFilterAction> * aList );
00238 
00240   void updateActionList() { regenerateActionListFromWidgets(); }
00241 
00242 public slots:
00243   void reset();
00244 
00245 protected:
00246   virtual void clearWidget( QWidget *aWidget );
00247   virtual QWidget* createWidget( QWidget *parent );
00248 
00249 private:
00250   void regenerateActionListFromWidgets();
00251   QPtrList<KMFilterAction> *mActionList;
00252 
00253 };
00254 
00255 
00256 
00313 class KMFilterDlg: public KDialogBase
00314 {
00315   Q_OBJECT
00316 public:
00320   KMFilterDlg(QWidget* parent=0, const char* name=0, bool popFilter=false);
00321 
00326   void createFilter( const QCString & field, const QString & value )
00327     { mFilterList->createFilter( field, value ); }
00328 
00329 public slots:
00334   void slotFilterSelected(KMFilter * aFilter);
00336   void slotActionChanged(const KMPopFilterAction aAction);
00337 
00338 protected slots:
00339   void slotApplicabilityChanged();
00340   void slotStopProcessingButtonToggled( bool aChecked );
00341   void slotConfigureShortcutButtonToggled( bool aChecked );
00342   void slotFilterActionIconChanged( QString icon );
00343   void slotReset();
00344   void slotUpdateFilter();
00345   void slotSaveSize();
00347   void slotFinished();
00348 
00349 protected:
00353   KMFilterListBox *mFilterList;
00355   KMSearchPatternEdit *mPatternEdit;
00357   KMFilterActionWidgetLister *mActionLister;
00359   KMPopFilterActionWidget *mActionGroup;
00362   QCheckBox *mApplyOnIn, *mApplyOnOut, *mApplyOnCtrlJ;
00363   QCheckBox *mStopProcessingHere;
00364   QCheckBox *mConfigureShortcut;
00365   QLabel *mFilterActionLabel;
00366   KIconButton *mFilterActionIconButton;
00367   QGroupBox *mAdvOptsGroup;
00368   QVGroupBox *mGlobalsBox;
00369   QCheckBox *mShowLaterBtn;
00370 
00371   KMFilter *mFilter;
00372   bool bPopFilter;
00373 };
00374 
00375 
00376 
00377 #endif /*kmfilterdlg_h*/
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:54:55 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003