kmail
kmfilter.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef kmfilter_h
00021 #define kmfilter_h
00022
00023 #include "kmsearchpattern.h"
00024 #include "kmpopheaders.h"
00025
00026 #include <tdeshortcut.h>
00027
00028 #include <tqptrlist.h>
00029
00030 class TQString;
00031 class TDEConfig;
00032 class KMMessage;
00033 class KMFilterAction;
00034 class KMFolder;
00035
00036
00037 const int FILTER_MAX_ACTIONS = 8;
00038
00039
00040 class KMFilter
00041 {
00042 public:
00054 enum ReturnCode { NoResult, GoOn, CriticalError };
00055
00065 enum AccountType { All, ButImap, Checked };
00066
00070 KMFilter( TDEConfig* aConfig=0 , bool popFilter = false);
00071
00073 KMFilter( const KMFilter & other );
00074
00076 ~KMFilter() {}
00077
00079 TQString name() const {
00080 return mPattern.name();
00081 }
00082
00094 ReturnCode execActions( KMMessage* msg, bool& stopIt ) const ;
00095
00098 bool requiresBody(KMMsgBase* msgBase);
00099
00101 KMPopFilterAction action();
00102
00104 void setAction(const KMPopFilterAction aAction);
00105
00110 void writeConfig( TDEConfig* config ) const;
00111
00116 void readConfig( TDEConfig* config );
00117
00119 void purify();
00120
00122 bool isEmpty() const;
00123
00127 TQPtrList<KMFilterAction>* actions() { return &mActions; }
00128
00130 const TQPtrList<KMFilterAction>* actions() const { return &mActions; }
00131
00135 KMSearchPattern* pattern() { return &mPattern; }
00136
00140 const KMSearchPattern* pattern() const { return &mPattern; }
00141
00146 void setApplyOnOutbound( bool aApply=true ) { bApplyOnOutbound = aApply; }
00147
00152 bool applyOnOutbound() const { return bApplyOnOutbound; }
00153
00158 void setApplyOnInbound( bool aApply=true ) { bApplyOnInbound = aApply; }
00159
00164 bool applyOnInbound() const { return bApplyOnInbound; }
00165
00170 void setApplyOnExplicit( bool aApply=true ) { bApplyOnExplicit = aApply; }
00171
00176 bool applyOnExplicit() const { return bApplyOnExplicit; }
00177
00185 void setApplicability( AccountType aApply=All ) { mApplicability = aApply; }
00186
00193 AccountType applicability() const { return mApplicability; }
00194
00201 void setApplyOnAccount( uint id, bool aApply=true );
00202
00207 bool applyOnAccount( uint id ) const;
00208
00209 void setStopProcessingHere( bool aStop ) { bStopProcessingHere = aStop; }
00210 bool stopProcessingHere() const { return bStopProcessingHere; }
00211
00214 void setConfigureShortcut( bool aShort ) {
00215 bConfigureShortcut = aShort;
00216 bConfigureToolbar = bConfigureToolbar && bConfigureShortcut;
00217 }
00218
00223 bool configureShortcut() const { return bConfigureShortcut; }
00224
00229 void setConfigureToolbar( bool aTool ) {
00230 bConfigureToolbar = aTool && bConfigureShortcut;
00231 }
00232
00237 bool configureToolbar() const { return bConfigureToolbar; }
00238
00243 void setShortcut( const TDEShortcut & shortcut ) { mShortcut = shortcut; };
00244
00248 const TDEShortcut & shortcut() const { return mShortcut; }
00249
00254 void setIcon( TQString icon ) { mIcon = icon; }
00255
00259 TQString icon() const { return mIcon; }
00260
00268 bool folderRemoved( KMFolder* aFolder, KMFolder* aNewFolder );
00269
00273 #ifndef NDEBUG
00274 const TQString asString() const;
00275 #endif
00276
00278 bool isPopFilter() const {
00279 return bPopFilter;
00280 }
00281
00286 void setAutoNaming( bool useAutomaticNames ) {
00287 bAutoNaming = useAutomaticNames;
00288 }
00289
00292 bool isAutoNaming() const { return bAutoNaming; }
00293
00294 private:
00295 KMSearchPattern mPattern;
00296 TQPtrList<KMFilterAction> mActions;
00297 TQValueList<int> mAccounts;
00298 KMPopFilterAction mAction;
00299 TQString mIcon;
00300 TDEShortcut mShortcut;
00301 bool bPopFilter : 1;
00302 bool bApplyOnInbound : 1;
00303 bool bApplyOnOutbound : 1;
00304 bool bApplyOnExplicit : 1;
00305 bool bStopProcessingHere : 1;
00306 bool bConfigureShortcut : 1;
00307 bool bConfigureToolbar : 1;
00308 bool bAutoNaming : 1;
00309 AccountType mApplicability;
00310 };
00311
00312 #endif
|