kmail Library API Documentation

kmfilter.h

00001 /* -*- mode: C++; c-file-style: "gnu" -*- 00002 * Mail Filter Rule : incoming mail is sent trough the list of mail filter 00003 * rules before it is placed in the associated mail folder (usually "inbox"). 00004 * This class represents one mail filter rule. 00005 * 00006 * Author: Stefan Taferner <taferner@kde.org> 00007 * This code is under GPL 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 // maximum number of filter actions per filter 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 00117 void setApplyOnOutbound( bool aApply=TRUE ) { bApplyOnOutbound = aApply; } 00118 00123 bool applyOnOutbound() const { return bApplyOnOutbound; } 00124 00129 void setApplyOnInbound( bool aApply=TRUE ) { bApplyOnInbound = aApply; } 00130 00135 bool applyOnInbound() const { return bApplyOnInbound; } 00136 00141 void setApplyOnExplicit( bool aApply=TRUE ) { bApplyOnExplicit = aApply; } 00142 00147 bool applyOnExplicit() const { return bApplyOnExplicit; } 00148 00149 void setStopProcessingHere( bool aStop ) { bStopProcessingHere = aStop; } 00150 bool stopProcessingHere() const { return bStopProcessingHere; } 00151 00152 void setConfigureShortcut( bool aShort ) { bConfigureShortcut = aShort; } 00153 bool configureShortcut() const { return bConfigureShortcut; } 00154 00155 void setIcon( QString icon ) { mIcon = icon; } 00156 QString icon() const { return mIcon; } 00157 00165 bool folderRemoved( KMFolder* aFolder, KMFolder* aNewFolder ); 00166 00170 #ifndef NDEBUG 00171 const QString asString() const; 00172 #endif 00174 bool isPopFilter() const { 00175 return bPopFilter; 00176 } 00177 00178 private: 00179 KMSearchPattern mPattern; 00180 QPtrList<KMFilterAction> mActions; 00181 KMPopFilterAction mAction; 00182 QString mIcon; 00183 bool bPopFilter : 1; 00184 bool bApplyOnInbound : 1; 00185 bool bApplyOnOutbound : 1; 00186 bool bApplyOnExplicit : 1; 00187 bool bStopProcessingHere : 1; 00188 bool bConfigureShortcut : 1; 00189 }; 00190 00191 #endif /*kmfilter_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:58:00 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003