KMSearchRule Class Reference
Incoming mail is sent through the list of mail filter rules before it is placed in the associated mail folder (usually "inbox"). This class represents one search pattern rule. More...
#include <kmsearchpattern.h>
Inheritance diagram for KMSearchRule:

Public Types | |
enum | Function { FuncContains = 0, FuncContainsNot, FuncEquals, FuncNotEqual, FuncRegExp, FuncNotRegExp, FuncIsGreater, FuncIsLessOrEqual, FuncIsLess, FuncIsGreaterOrEqual } |
Public Methods | |
KMSearchRule (const QCString &field=0, Function=FuncContains, const QString &contents=QString::null) | |
KMSearchRule (const KMSearchRule &other) | |
const KMSearchRule & | operator= (const KMSearchRule &other) |
virtual | ~KMSearchRule () |
virtual bool | matches (const KMMessage *msg) const=0 |
virtual bool | matches (const DwString &str, KMMessage &msg, const DwBoyerMoore *headerField=0, int headerLen=-1) const |
virtual bool | isEmpty () const=0 |
virtual bool | requiresBody () const |
void | writeConfig (KConfig *config, int aIdx) const |
Function | function () const |
void | setFunction (Function aFunction) |
QCString | field () const |
void | setField (const QCString &field) |
QString | contents () const |
void | setContents (const QString &aContents) |
const QString | asString () const |
Static Public Methods | |
KMSearchRule * | createInstance (const QCString &field=0, Function function=FuncContains, const QString &contents=QString::null) |
KMSearchRule * | createInstance (const QCString &field, const char *function, const QString &contents) |
KMSearchRule * | createInstance (const KMSearchRule &other) |
KMSearchRule * | createInstanceFromConfig (const KConfig *config, int aIdx) |
Detailed Description
Incoming mail is sent through the list of mail filter rules before it is placed in the associated mail folder (usually "inbox"). This class represents one search pattern rule.This class represents one mail filter rule. It is also used to represent a search rule as used by the search dialog and folders.
Definition at line 29 of file kmsearchpattern.h.
Member Enumeration Documentation
|
Operators for comparison of field and contents. If you change the order or contents of the enum: do not forget to change funcConfNames[], sFilterFuncList and matches() in KMSearchRule, too. Also, it is assumed that these functions come in pairs of logical opposites (ie. "=" <-> "!=", ">" <-> "<=", etc.). Definition at line 39 of file kmsearchpattern.h. Referenced by createInstanceFromConfig(), function(), KMSearchRuleWidget::rule(), and setFunction(). |
Member Function Documentation
|
Create a search rule of a certain type by instantiating the appro- priate subclass depending on the
Definition at line 61 of file kmsearchpattern.cpp. Referenced by KMFilterListBox::createFilter(), createInstanceFromConfig(), KMSearchPattern::operator=(), and KMSearchRuleWidget::rule(). |
|
Initialize the object from a given config file.
The group must be preset. Definition at line 88 of file kmsearchpattern.cpp. References createInstance(), and Function. Referenced by KMSearchPattern::readConfig(). |
|
Tries to match the rule against the given KMMessage.
Implemented in KMSearchRuleString, KMSearchRuleNumerical, and KMSearchRuleStatus. Referenced by KMSearchRuleString::matches(), and matches(). |
|
Optimized version tries to match the rule against the given DwString.
Reimplemented in KMSearchRuleString, and KMSearchRuleStatus. Definition at line 126 of file kmsearchpattern.cpp. References matches(). |
|
Determine whether the rule is worth considering. It isn't if either the field is not set or the contents is empty. KFilter should make sure that it's rule list contains only non-empty rules, as matches doesn't check this. Implemented in KMSearchRuleString, KMSearchRuleNumerical, and KMSearchRuleStatus. Referenced by KMSearchPattern::readConfig(). |
|
Returns true if the rule depends on a complete message, otherwise returns false.
Reimplemented in KMSearchRuleString. Definition at line 93 of file kmsearchpattern.h. |
|
Save the object into a given config file.
The group must be preset. Definition at line 115 of file kmsearchpattern.cpp. |
|
Return filter function. This can be any of the operators defined in Function. Definition at line 105 of file kmsearchpattern.h. References Function. Referenced by KMSearchRuleStatus::matches(), KMSearchRuleString::matches(), KMSearchRuleNumerical::matchesInternal(), KMSearchRuleString::matchesInternal(), and KMSearchRuleWidget::setRule(). |
|
Set filter function.
Definition at line 108 of file kmsearchpattern.h. References Function. |
|
Return message header field name (without the trailing ':'). There are also six pseudo-headers:
Definition at line 120 of file kmsearchpattern.h. Referenced by KMSearchRuleStatus::isEmpty(), KMSearchRuleString::isEmpty(), KMSearchRuleNumerical::matches(), KMSearchRuleString::matches(), KMSearchRuleString::requiresBody(), and KMSearchRuleWidget::setRule(). |
|
Set message header field name (make sure there's no trailing colon ':').
Definition at line 124 of file kmsearchpattern.h. |
|
Return the value. This can be either a substring to search for in or a regexp pattern to match against the header. Definition at line 128 of file kmsearchpattern.h. Referenced by KMSearchRuleStatus::isEmpty(), KMSearchRuleNumerical::isEmpty(), KMSearchRuleString::isEmpty(), KMSearchRuleNumerical::matches(), KMSearchRuleNumerical::matchesInternal(), KMSearchRuleString::matchesInternal(), and KMSearchRuleWidget::setRule(). |
|
Set the value.
Definition at line 130 of file kmsearchpattern.h. |
|
Returns the rule as string. For debugging. Definition at line 137 of file kmsearchpattern.cpp. |
The documentation for this class was generated from the following files: