kmfilter.h
00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef kmfilter_h
00010 #define kmfilter_h
00011
00012 #include "kmsearchpattern.h"
00013 #include "kmpopheaders.h"
00014
00015 #include <qptrlist.h>
00016
00017 class QString;
00018 class KConfig;
00019 class KMMessage;
00020 class KMFilterAction;
00021 class KMFolder;
00022
00023
00024 const int FILTER_MAX_ACTIONS = 8;
00025
00026
00027 class KMFilter
00028 {
00029 public:
00041 enum ReturnCode { NoResult, GoOn, CriticalError };
00042
00046 KMFilter( KConfig* aConfig=0 , bool popFilter = false);
00047
00049 KMFilter( const KMFilter & other );
00050
00052 ~KMFilter() {}
00053
00055 QString name() const {
00056 return mPattern.name();
00057 }
00058
00070 ReturnCode execActions( KMMessage* msg, bool& stopIt ) const ;
00071
00074 bool requiresBody(KMMsgBase* msgBase);
00075
00077 KMPopFilterAction action();
00078
00080 void setAction(const KMPopFilterAction aAction);
00081
00086 void writeConfig( KConfig* config ) const;
00087
00092 void readConfig( KConfig* config );
00093
00095 void purify();
00096
00098 bool isEmpty() const;
00099
00103 QPtrList<KMFilterAction>* actions() { return &mActions; }
00104
00106 const QPtrList<KMFilterAction>* actions() const { return &mActions; }
00107
00111 KMSearchPattern* pattern() { return &mPattern; }
00112
00116 const KMSearchPattern* pattern() const { return &mPattern; }
00117
00122 void setApplyOnOutbound( bool aApply=TRUE ) { bApplyOnOutbound = aApply; }
00123
00128 bool applyOnOutbound() const { return bApplyOnOutbound; }
00129
00134 void setApplyOnInbound( bool aApply=TRUE ) { bApplyOnInbound = aApply; }
00135
00140 bool applyOnInbound() const { return bApplyOnInbound; }
00141
00146 void setApplyOnExplicit( bool aApply=TRUE ) { bApplyOnExplicit = aApply; }
00147
00152 bool applyOnExplicit() const { return bApplyOnExplicit; }
00153
00154 void setStopProcessingHere( bool aStop ) { bStopProcessingHere = aStop; }
00155 bool stopProcessingHere() const { return bStopProcessingHere; }
00156
00159 void setConfigureShortcut( bool aShort ) {
00160 bConfigureShortcut = aShort;
00161 bConfigureToolbar = bConfigureToolbar && bConfigureShortcut;
00162 }
00163
00168 bool configureShortcut() const { return bConfigureShortcut; }
00169
00174 void setConfigureToolbar( bool aTool ) {
00175 bConfigureToolbar = aTool && bConfigureShortcut;
00176 }
00177
00182 bool configureToolbar() const { return bConfigureToolbar; }
00183
00188 void setIcon( QString icon ) { mIcon = icon; }
00189
00193 QString icon() const { return mIcon; }
00194
00202 bool folderRemoved( KMFolder* aFolder, KMFolder* aNewFolder );
00203
00207 #ifndef NDEBUG
00208 const QString asString() const;
00209 #endif
00210
00211 bool isPopFilter() const {
00212 return bPopFilter;
00213 }
00214
00215 private:
00216 KMSearchPattern mPattern;
00217 QPtrList<KMFilterAction> mActions;
00218 KMPopFilterAction mAction;
00219 QString mIcon;
00220 bool bPopFilter : 1;
00221 bool bApplyOnInbound : 1;
00222 bool bApplyOnOutbound : 1;
00223 bool bApplyOnExplicit : 1;
00224 bool bStopProcessingHere : 1;
00225 bool bConfigureShortcut : 1;
00226 bool bConfigureToolbar : 1;
00227 };
00228
00229 #endif
This file is part of the documentation for kmail Library Version 3.3.2.