kmail
kmfilterdlg.hGo to the documentation of this file.00001
00002
00003
00004
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 class KKeyButton;
00033 class KListView;
00034
00035
00060 class KMFilterListBox : public QGroupBox
00061 {
00062 Q_OBJECT
00063 public:
00065 KMFilterListBox( const QString & title, QWidget* parent=0, const char* name=0, bool popFilter = false);
00066
00073 void createFilter( const QCString & field, const QString & value );
00074
00079 void loadFilterList( bool createDummyFilter );
00080
00082 bool showLaterMsgs();
00083
00084 void insertFilter( KMFilter* aFilter );
00085
00086 void appendFilter( KMFilter* aFilter );
00087
00091 QValueList<KMFilter*> filtersForSaving() const;
00092
00093 signals:
00097 void filterSelected( KMFilter* filter );
00098
00103 void resetWidgets();
00104
00107 void applyWidgets();
00108
00109 public slots:
00114 void slotUpdateFilterName();
00117 void slotApplyFilterChanges();
00120 void slotShowLaterToggled(bool aOn);
00121
00122 protected slots:
00126 void slotSelected( int aIdx );
00129 void slotNew();
00132 void slotCopy();
00135 void slotDelete();
00138 void slotTop();
00141 void slotUp();
00144 void slotDown();
00147 void slotBottom();
00150 void slotRename();
00151
00152 protected:
00154 QPtrList<KMFilter> mFilterList;
00156 QListBox *mListBox;
00158 QPushButton *mBtnNew, *mBtnCopy, *mBtnDelete, *mBtnRename;
00159 QPushButton *mBtnTop, *mBtnUp, *mBtnDown, *mBtnBot;
00161 int mIdxSelItem;
00162 bool mShowLater;
00163 private:
00164 void enableControls();
00165
00166 void swapFilters( int from, int to );
00167 void swapNeighbouringFilters( int untouchedOne, int movedOne );
00168 bool bPopFilter;
00169 };
00170
00171
00193 class KMFilterActionWidget : public QHBox
00194 {
00195 Q_OBJECT
00196 public:
00199 KMFilterActionWidget( QWidget* parent=0, const char* name=0 );
00200
00204 void setAction( const KMFilterAction * aAction );
00209 KMFilterAction *action();
00210
00211 private:
00216 QPtrList<KMFilterAction> mActionList;
00220 QComboBox *mComboBox;
00223 QWidgetStack *mWidgetStack;
00224 };
00225
00226 class KMPopFilterActionWidget : public QVButtonGroup
00227 {
00228 Q_OBJECT
00229 public:
00230 KMPopFilterActionWidget( const QString &title, QWidget* parent=0, const char* name=0 );
00231 void setAction( KMPopFilterAction aAction );
00232 KMPopFilterAction action();
00233
00234 public slots:
00235 void reset();
00236
00237 private slots:
00238 void slotActionClicked(int aId);
00239
00240 private:
00241 KMPopFilterAction mAction;
00242 KMFilter mFilter;
00243 QMap<KMPopFilterAction, QRadioButton*> mActionMap;
00244 QMap<int, KMPopFilterAction> mIdMap;
00245
00246 signals:
00247 void actionChanged(const KMPopFilterAction aAction);
00248 };
00249
00250 class KMFilterActionWidgetLister : public KWidgetLister
00251 {
00252 Q_OBJECT
00253 public:
00254 KMFilterActionWidgetLister( QWidget *parent=0, const char* name=0 );
00255
00256 virtual ~KMFilterActionWidgetLister();
00257
00258 void setActionList( QPtrList<KMFilterAction> * aList );
00259
00261 void updateActionList() { regenerateActionListFromWidgets(); }
00262
00263 public slots:
00264 void reset();
00265
00266 protected:
00267 virtual void clearWidget( QWidget *aWidget );
00268 virtual QWidget* createWidget( QWidget *parent );
00269
00270 private:
00271 void regenerateActionListFromWidgets();
00272 QPtrList<KMFilterAction> *mActionList;
00273
00274 };
00275
00276
00277
00333 class KMFilterDlg: public KDialogBase
00334 {
00335 Q_OBJECT
00336 public:
00340 KMFilterDlg( QWidget* parent=0, const char* name=0, bool popFilter=false,
00341 bool createDummyFilter=true );
00342
00347 void createFilter( const QCString & field, const QString & value )
00348 { mFilterList->createFilter( field, value ); }
00349
00350 public slots:
00355 void slotFilterSelected(KMFilter * aFilter);
00357 void slotActionChanged(const KMPopFilterAction aAction);
00358
00359 protected slots:
00360 void slotApplicabilityChanged();
00361 void slotApplicableAccountsChanged();
00362 void slotStopProcessingButtonToggled( bool aChecked );
00363 void slotConfigureShortcutButtonToggled( bool aChecked );
00364 void slotCapturedShortcutChanged( const KShortcut& );
00365 void slotConfigureToolbarButtonToggled( bool aChecked );
00366 void slotFilterActionIconChanged( QString icon );
00367 void slotReset();
00368 void slotUpdateFilter();
00369 void slotSaveSize();
00370
00371 void slotFinished();
00372
00373 void slotUpdateAccountList();
00374
00375
00379 void slotImportFilters();
00380
00384 void slotExportFilters();
00385
00386 protected:
00390 KMFilterListBox *mFilterList;
00392 KMSearchPatternEdit *mPatternEdit;
00394 KMFilterActionWidgetLister *mActionLister;
00396 KMPopFilterActionWidget *mActionGroup;
00399 QCheckBox *mApplyOnIn, *mApplyOnOut, *mApplyOnCtrlJ;
00402 QRadioButton *mApplyOnForAll, *mApplyOnForTraditional, *mApplyOnForChecked;
00404 KListView *mAccountList;
00405
00406 QCheckBox *mStopProcessingHere;
00407 QCheckBox *mConfigureShortcut;
00408 QCheckBox *mConfigureToolbar;
00409 QLabel *mFilterActionLabel;
00410 KIconButton *mFilterActionIconButton;
00411 KKeyButton *mKeyButton;
00412 QGroupBox *mAdvOptsGroup;
00413 QVGroupBox *mGlobalsBox;
00414 QCheckBox *mShowLaterBtn;
00415
00416 KMFilter *mFilter;
00417 bool bPopFilter;
00418 };
00419
00420
00421
00422 #endif
|