kmail
kmfilterdlg.h00001
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 <tqvgroupbox.h>
00017 #include <tqgroupbox.h>
00018 #include <tqhbox.h>
00019 #include <tqstring.h>
00020 #include <tqptrlist.h>
00021 #include <tqradiobutton.h>
00022 #include <tqvbuttongroup.h>
00023 #include <tqmap.h>
00024
00025 class KMSearchPatternEdit;
00026 class TQListBox;
00027 class TQPushButton;
00028 class TQComboBox;
00029 class TQWidgetStack;
00030 class TQCheckBox;
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 TQString & title, TQWidget* parent=0, const char* name=0, bool popFilter = false);
00066
00073 void createFilter( const TQCString & field, const TQString & 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 TQValueList<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 void slotSelectSourceFolders();
00153
00154 protected:
00156 TQPtrList<KMFilter> mFilterList;
00158 TQListBox *mListBox;
00160 TQPushButton *mBtnNew, *mBtnCopy, *mBtnDelete, *mBtnRename;
00161 TQPushButton *mBtnTop, *mBtnUp, *mBtnDown, *mBtnBot;
00163 int mIdxSelItem;
00164 bool mShowLater;
00165 private:
00166 void enableControls();
00167
00168 void swapFilters( int from, int to );
00169 void swapNeighbouringFilters( int untouchedOne, int movedOne );
00170 bool bPopFilter;
00171 };
00172
00173
00195 class KMFilterActionWidget : public QHBox
00196 {
00197 Q_OBJECT
00198 public:
00201 KMFilterActionWidget( TQWidget* parent=0, const char* name=0 );
00202
00206 void setAction( const KMFilterAction * aAction );
00211 KMFilterAction *action();
00212
00213 private:
00218 TQPtrList<KMFilterAction> mActionList;
00222 TQComboBox *mComboBox;
00225 TQWidgetStack *mWidgetStack;
00226 };
00227
00228 class KMPopFilterActionWidget : public QVButtonGroup
00229 {
00230 Q_OBJECT
00231 public:
00232 KMPopFilterActionWidget( const TQString &title, TQWidget* parent=0, const char* name=0 );
00233 void setAction( KMPopFilterAction aAction );
00234 KMPopFilterAction action();
00235
00236 public slots:
00237 void reset();
00238
00239 private slots:
00240 void slotActionClicked(int aId);
00241
00242 private:
00243 KMPopFilterAction mAction;
00244 KMFilter mFilter;
00245 TQMap<KMPopFilterAction, TQRadioButton*> mActionMap;
00246 TQMap<int, KMPopFilterAction> mIdMap;
00247
00248 signals:
00249 void actionChanged(const KMPopFilterAction aAction);
00250 };
00251
00252 class KMFilterActionWidgetLister : public KWidgetLister
00253 {
00254 Q_OBJECT
00255 public:
00256 KMFilterActionWidgetLister( TQWidget *parent=0, const char* name=0 );
00257
00258 virtual ~KMFilterActionWidgetLister();
00259
00260 void setActionList( TQPtrList<KMFilterAction> * aList );
00261
00263 void updateActionList() { regenerateActionListFromWidgets(); }
00264
00265 public slots:
00266 void reset();
00267
00268 protected:
00269 virtual void clearWidget( TQWidget *aWidget );
00270 virtual TQWidget* createWidget( TQWidget *parent );
00271
00272 private:
00273 void regenerateActionListFromWidgets();
00274 TQPtrList<KMFilterAction> *mActionList;
00275
00276 };
00277
00278
00279
00335 class KMFilterDlg: public KDialogBase
00336 {
00337 Q_OBJECT
00338 public:
00342 KMFilterDlg( TQWidget* parent=0, const char* name=0, bool popFilter=false,
00343 bool createDummyFilter=true );
00344
00349 void createFilter( const TQCString & field, const TQString & value )
00350 { mFilterList->createFilter( field, value ); }
00351
00352 public slots:
00357 void slotFilterSelected(KMFilter * aFilter);
00359 void slotActionChanged(const KMPopFilterAction aAction);
00360
00361 protected slots:
00362 void slotApplicabilityChanged();
00363 void slotApplicableAccountsChanged();
00364 void slotStopProcessingButtonToggled( bool aChecked );
00365 void slotConfigureShortcutButtonToggled( bool aChecked );
00366 void slotCapturedShortcutChanged( const KShortcut& );
00367 void slotConfigureToolbarButtonToggled( bool aChecked );
00368 void slotFilterActionIconChanged( TQString icon );
00369 void slotReset();
00370 void slotUpdateFilter();
00371 void slotSaveSize();
00372
00373 void slotFinished();
00374
00375 void slotUpdateAccountList();
00376
00377
00381 void slotImportFilters();
00382
00386 void slotExportFilters();
00387
00388 protected:
00392 KMFilterListBox *mFilterList;
00394 KMSearchPatternEdit *mPatternEdit;
00396 KMFilterActionWidgetLister *mActionLister;
00398 KMPopFilterActionWidget *mActionGroup;
00401 TQCheckBox *mApplyOnIn, *mApplyOnOut, *mApplyOnCtrlJ;
00404 TQRadioButton *mApplyOnForAll, *mApplyOnForTraditional, *mApplyOnForChecked;
00406 KListView *mAccountList;
00407
00408 TQCheckBox *mStopProcessingHere;
00409 TQCheckBox *mConfigureShortcut;
00410 TQCheckBox *mConfigureToolbar;
00411 TQLabel *mFilterActionLabel;
00412 KIconButton *mFilterActionIconButton;
00413 KKeyButton *mKeyButton;
00414 TQGroupBox *mAdvOptsGroup;
00415 TQVGroupBox *mGlobalsBox;
00416 TQCheckBox *mShowLaterBtn;
00417
00418 KMFilter *mFilter;
00419 bool bPopFilter;
00420 };
00421
00422
00423
00424 #endif
|