5 #ifndef _kmsearchpattern_h_ 6 #define _kmsearchpattern_h_ 11 #include <tqcstring.h> 12 #include "kmmsgbase.h" 21 const int FILTER_MAX_RULES=8; 41 FuncContains=0, FuncContainsNot, 42 FuncEquals, FuncNotEqual, 43 FuncRegExp, FuncNotRegExp, 44 FuncIsGreater, FuncIsLessOrEqual, 45 FuncIsLess, FuncIsGreaterOrEqual, 46 FuncIsInAddressbook, FuncIsNotInAddressbook, 47 FuncIsInCategory, FuncIsNotInCategory, 48 FuncHasAttachment, FuncHasNoAttachment}; 50 const TQString & contents=TQString() ); 59 const TQString & contents=TQString() ); 62 const char * function, 87 const DwBoyerMoore * headerField=0, 88 int headerLen=-1 ) const; 94 virtual bool isEmpty() const = 0; 106 void writeConfig( TDEConfig * config, int aIdx ) const; 125 TQCString field() const { return mField; } 135 void setContents( const TQString & aContents ) { mContents = aContents; } 141 static Function configValueToFunc( const char * str ); 142 static TQString functionToString( Function function ); 162 const TQString & contents=TQString() ); 176 const DwBoyerMoore * headerField=0, 177 int headerLen=-1 ) const; 180 bool matchesInternal( const TQString & msgContents ) const; 183 const DwBoyerMoore *mBmHeaderField; 197 const TQString & contents=TQString() ); 203 bool matchesInternal( long numericalValue, long numericalMsgContents, 204 const TQString & msgContents ) const; 210 struct MessageStatus { 211 const char * const text; 212 const char * const icon; 216 static const MessageStatus StatusValues[] = { 217 { I18N_NOOP( "Important" ), "kmmsgflag" }, 218 { I18N_NOOP( "New" ), "kmmsgnew" }, 219 { I18N_NOOP( "Unread" ), "kmmsgunseen" }, 220 { I18N_NOOP( "Read" ), "kmmsgread" }, 221 { I18N_NOOP( "Old" ), 0 }, 222 { I18N_NOOP( "Deleted" ), "kmmsgdel" }, 223 { I18N_NOOP( "Replied" ), "kmmsgreplied" }, 224 { I18N_NOOP( "Forwarded" ), "kmmsgforwarded" }, 225 { I18N_NOOP( "Queued" ), "kmmsgqueued" }, 226 { I18N_NOOP( "Sent" ), "kmmsgsent" }, 227 { I18N_NOOP( "Watched" ), "kmmsgwatched" }, 228 { I18N_NOOP( "Ignored" ), "kmmsgignored" }, 229 { I18N_NOOP( "Spam" ), "kmmsgspam" }, 230 { I18N_NOOP( "Ham" ), "kmmsgham" }, 231 { I18N_NOOP( "To Do" ), "kmmsgtodo" }, 232 { I18N_NOOP( "Invitation" ), "kmmsginvitation" }, 233 { I18N_NOOP( "Has Attachment"), "kmmsgattachment" } 236 enum StatusValueTypes { 252 StatusInvitation = 15, 253 StatusHasAttachment = 16 256 static const int StatusValueCount = 257 sizeof( StatusValues ) / sizeof( MessageStatus ); 261 static const int StatusValueCountWithoutHidden = StatusValueCount - 1; 273 const TQString & contents=TQString() ); 280 const DwBoyerMoore *, 282 static KMMsgStatus statusFromEnglishName( const TQString&); 340 bool matches( const DwString & str, bool ignoreBody = false ) const; 341 bool matches( TQ_UINT32 sernum, bool ignoreBody = false ) const; 365 void readConfig( const TDEConfig * config ); 375 TQString name() const { return mName; } 378 void setName( const TQString & newName ) { mName = newName ; } 399 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.
const TQString asString() const Returns the rule as string.
This class represents a search to be performed against the status of a messsage.
KMSearchPattern::Operator op() const Get the filter operator.
void setOp(KMSearchPattern::Operator aOp) Set the filter operator.
virtual bool requiresBody() const Returns true if the rule depends on a complete message, otherwise returns false.
Incoming mail is sent through the list of mail filter rules before it is placed in the associated mai...
TQCString field() const Return message header field name (without the trailing ':').
void setName(const TQString &newName) Set the name of the search pattern.
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 ':')
TQString name() const Get the name of the search pattern.
TQString contents() const Return the value.
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...
void writeConfig(TDEConfig *config, int aIdx) const Save the object into a given config file.
Operator Boolean operators that connect the return values of the individual rules.
static KMSearchRule * createInstanceFromConfig(const TDEConfig *config, int aIdx) Initialize the object from a given config file.
|