6 #ifndef _kmsearchpattern_h_ 7 #define _kmsearchpattern_h_ 10 #include <tqptrlist.h> 12 #include <tqcstring.h> 13 #include "kmmsgbase.h" 22 const int FILTER_MAX_RULES=8; 42 FuncContains=0, FuncContainsNot, 43 FuncEquals, FuncNotEqual, 44 FuncRegExp, FuncNotRegExp, 45 FuncIsGreater, FuncIsLessOrEqual, 46 FuncIsLess, FuncIsGreaterOrEqual, 47 FuncIsInAddressbook, FuncIsNotInAddressbook, 48 FuncIsInCategory, FuncIsNotInCategory, 49 FuncHasAttachment, FuncHasNoAttachment}; 51 const TQString & contents=TQString() ); 60 const TQString & contents=TQString() ); 63 const char * function, 88 const DwBoyerMoore * headerField=0, 89 int headerLen=-1 ) const; 95 virtual bool isEmpty() const = 0; 107 void writeConfig( TDEConfig * config, int aIdx ) const; 126 TQCString field() const { return mField; } 136 void setContents( const TQString & aContents ) { mContents = aContents; } 142 static Function configValueToFunc( const char * str ); 143 static TQString functionToString( Function function ); 163 const TQString & contents=TQString() ); 177 const DwBoyerMoore * headerField=0, 178 int headerLen=-1 ) const; 181 bool matchesInternal( const TQString & msgContents ) const; 184 const DwBoyerMoore *mBmHeaderField; 198 const TQString & contents=TQString() ); 204 bool matchesInternal( long numericalValue, long numericalMsgContents, 205 const TQString & msgContents ) const; 211 struct MessageStatus { 212 const char * const text; 213 const char * const icon; 217 static const MessageStatus StatusValues[] = { 218 { I18N_NOOP( "Important" ), "kmmsgflag" }, 219 { I18N_NOOP( "New" ), "kmmsgnew" }, 220 { I18N_NOOP( "Unread" ), "kmmsgunseen" }, 221 { I18N_NOOP( "Read" ), "kmmsgread" }, 222 { I18N_NOOP( "Old" ), 0 }, 223 { I18N_NOOP( "Deleted" ), "kmmsgdel" }, 224 { I18N_NOOP( "Replied" ), "kmmsgreplied" }, 225 { I18N_NOOP( "Forwarded" ), "kmmsgforwarded" }, 226 { I18N_NOOP( "Queued" ), "kmmsgqueued" }, 227 { I18N_NOOP( "Sent" ), "kmmsgsent" }, 228 { I18N_NOOP( "Watched" ), "kmmsgwatched" }, 229 { I18N_NOOP( "Ignored" ), "kmmsgignored" }, 230 { I18N_NOOP( "Spam" ), "kmmsgspam" }, 231 { I18N_NOOP( "Ham" ), "kmmsgham" }, 232 { I18N_NOOP( "To Do" ), "kmmsgtodo" }, 233 { I18N_NOOP( "Invitation" ), "kmmsginvitation" }, 234 { I18N_NOOP( "Has Attachment"), "kmmsgattachment" } 237 enum StatusValueTypes { 253 StatusInvitation = 15, 254 StatusHasAttachment = 16 257 static const int StatusValueCount = 258 sizeof( StatusValues ) / sizeof( MessageStatus ); 262 static const int StatusValueCountWithoutHidden = StatusValueCount - 1; 274 const TQString & contents=TQString() ); 281 const DwBoyerMoore *, 283 static KMMsgStatus statusFromEnglishName( const TQString&); 341 bool matches( const DwString & str, bool ignoreBody = false ) const; 342 bool matches( TQ_UINT32 sernum, bool ignoreBody = false ) const; 366 void readConfig( const TDEConfig * config ); 376 TQString name() const { return mName; } 379 void setName( const TQString & newName ) { mName = newName ; } 400 void importLegacyConfig( const TDEConfig * config ); This class is an abstraction of a search over messages.
Function Operators for comparison of field and contents.
static KMSearchRule * createInstance(const TQCString &field=0, Function function=FuncContains, const TQString &contents=TQString()) Create a search rule of a certain type by instantiating the appro- priate subclass depending on the f...
This class represents a search to be performed against a string.
This class represents a search to be performed against the status of a messsage.
TQString name() const Get the name of the search pattern.
TQCString field() const Return message header field name (without the trailing ':').
void setOp(KMSearchPattern::Operator aOp) Set the filter operator.
Incoming mail is sent through the list of mail filter rules before it is placed in the associated mai...
void setName(const TQString &newName) Set the name of the search pattern.
TQString contents() const Return the value.
virtual bool matches(const KMMessage *msg) const =0 Tries to match the rule against the given KMMessage.
void setContents(const TQString &aContents) Set the value.
void setField(const TQCString &field) Set message header field name (make sure there's no trailing colon ':')
KMSearchPattern::Operator op() const Get the filter operator.
virtual bool isEmpty() const =0 Determine whether the rule is worth considering.
void setFunction(Function aFunction) Set filter function.
This class represents a search to be performed against a numerical value, such as the age of the mess...
const TQString asString() const Returns the rule as string.
Operator Boolean operators that connect the return values of the individual rules.
virtual bool requiresBody() const Returns true if the rule depends on a complete message, otherwise returns false.
void writeConfig(TDEConfig *config, int aIdx) const Save the object into a given config file.
static KMSearchRule * createInstanceFromConfig(const TDEConfig *config, int aIdx) Initialize the object from a given config file.
|