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 
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 /*kmfilter_h*/
KDE Logo
This file is part of the documentation for kmail Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 22:43:45 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003