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   void slotSelectSourceFolders();
00134 
00135 protected:
00137   QPtrList<KMFilter> mFilterList;
00139   QListBox *mListBox;
00141   QPushButton *mBtnNew, *mBtnCopy, *mBtnDelete, *mBtnUp, *mBtnDown, *mBtnRename;
00143   int mIdxSelItem;
00144   bool mShowLater;
00145 private:
00146   void enableControls();
00147   void insertFilter( KMFilter* aFilter );
00148   void swapNeighbouringFilters( int untouchedOne, int movedOne);
00149   bool bPopFilter;
00150 };
00151 
00152 
00174 class KMFilterActionWidget : public QHBox
00175 {
00176   Q_OBJECT
00177 public:
00180   KMFilterActionWidget( QWidget* parent=0, const char* name=0 );
00181 
00185   void setAction( const KMFilterAction * aAction );
00190   KMFilterAction *action();
00191 
00192 private:
00197   QPtrList<KMFilterAction> mActionList;
00201   QComboBox      *mComboBox;
00204   QWidgetStack   *mWidgetStack;
00205 };
00206 
00207 class KMPopFilterActionWidget : public QVButtonGroup
00208 {
00209   Q_OBJECT
00210 public:
00211   KMPopFilterActionWidget( const QString &title, QWidget* parent=0, const char* name=0 );
00212   void setAction( KMPopFilterAction aAction );
00213   KMPopFilterAction action();
00214 
00215 public slots:
00216   void reset();
00217 
00218 private slots:
00219   void slotActionClicked(int aId);
00220 
00221 private:
00222   KMPopFilterAction mAction;
00223   KMFilter mFilter;
00224   QMap<KMPopFilterAction, QRadioButton*> mActionMap;
00225   QMap<int, KMPopFilterAction> mIdMap;
00226 
00227 signals: // Signals
00228   void actionChanged(const KMPopFilterAction aAction);
00229 };
00230 
00231 class KMFilterActionWidgetLister : public KWidgetLister
00232 {
00233   Q_OBJECT
00234 public:
00235   KMFilterActionWidgetLister( QWidget *parent=0, const char* name=0 );
00236 
00237   virtual ~KMFilterActionWidgetLister();
00238 
00239   void setActionList( QPtrList<KMFilterAction> * aList );
00240 
00242   void updateActionList() { regenerateActionListFromWidgets(); }
00243 
00244 public slots:
00245   void reset();
00246 
00247 protected:
00248   virtual void clearWidget( QWidget *aWidget );
00249   virtual QWidget* createWidget( QWidget *parent );
00250 
00251 private:
00252   void regenerateActionListFromWidgets();
00253   QPtrList<KMFilterAction> *mActionList;
00254 
00255 };
00256 
00257 
00258 
00315 class KMFilterDlg: public KDialogBase
00316 {
00317   Q_OBJECT
00318 public:
00322   KMFilterDlg(QWidget* parent=0, const char* name=0, bool popFilter=false);
00323 
00328   void createFilter( const QCString & field, const QString & value )
00329     { mFilterList->createFilter( field, value ); }
00330 
00331 public slots:
00336   void slotFilterSelected(KMFilter * aFilter);
00338   void slotActionChanged(const KMPopFilterAction aAction);
00339 
00340 protected slots:
00341   void slotApplicabilityChanged();
00342   void slotStopProcessingButtonToggled( bool aChecked );
00343   void slotConfigureShortcutButtonToggled( bool aChecked );
00344   void slotFilterActionIconChanged( QString icon );
00345   void slotReset();
00346   void slotUpdateFilter();
00347   void slotSaveSize();
00349   void slotFinished();
00350 
00351 protected:
00355   KMFilterListBox *mFilterList;
00357   KMSearchPatternEdit *mPatternEdit;
00359   KMFilterActionWidgetLister *mActionLister;
00361   KMPopFilterActionWidget *mActionGroup;
00364   QCheckBox *mApplyOnIn, *mApplyOnOut, *mApplyOnCtrlJ;
00365   QCheckBox *mStopProcessingHere;
00366   QCheckBox *mConfigureShortcut;
00367   QLabel *mFilterActionLabel;
00368   KIconButton *mFilterActionIconButton;
00369   QGroupBox *mAdvOptsGroup;
00370   QVGroupBox *mGlobalsBox;
00371   QCheckBox *mShowLaterBtn;
00372 
00373   KMFilter *mFilter;
00374   bool bPopFilter;
00375 };
00376 
00377 
00378 
00379 #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 Fri Dec 21 14:24:51 2007 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003