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
00157
void setConfigureShortcut(
bool aShort ) { bConfigureShortcut = aShort; }
00158
bool configureShortcut()
const {
return bConfigureShortcut; }
00159
00160
void setIcon(
QString icon ) { mIcon = icon; }
00161
QString icon()
const {
return mIcon; }
00162
00170
bool folderRemoved(
KMFolder* aFolder,
KMFolder* aNewFolder );
00171
00175
#ifndef NDEBUG
00176
const QString asString() const;
00177 #endif
00179
bool isPopFilter()
const {
00180
return bPopFilter;
00181 }
00182
00183
private:
00184
KMSearchPattern mPattern;
00185
QPtrList<KMFilterAction> mActions;
00186 KMPopFilterAction mAction;
00187
QString mIcon;
00188
bool bPopFilter : 1;
00189
bool bApplyOnInbound : 1;
00190
bool bApplyOnOutbound : 1;
00191
bool bApplyOnExplicit : 1;
00192
bool bStopProcessingHere : 1;
00193
bool bConfigureShortcut : 1;
00194 };
00195
00196
#endif