mailcommon
#include <mailfilter.h>
Public Types | |
enum | AccountType { All, ButImap, Checked } |
enum | ReturnCode { NoResult, GoOn, CriticalError } |
Public Member Functions | |
MailFilter () | |
MailFilter (const KConfigGroup &aConfig, bool internal, bool &needUpdate) | |
MailFilter (const MailFilter &other) | |
~MailFilter () | |
QList< FilterAction * > * | actions () |
const QList< FilterAction * > * | actions () const |
AccountType | applicability () const |
bool | applyBeforeOutbound () const |
bool | applyOnAccount (const QString &id) const |
bool | applyOnExplicit () const |
bool | applyOnInbound () const |
bool | applyOnOutbound () const |
const QString | asString () const |
bool | configureShortcut () const |
bool | configureToolbar () const |
ReturnCode | execActions (ItemContext &context, bool &stopIt, bool applyOnOutbound) const |
bool | folderRemoved (const Akonadi::Collection &aFolder, const Akonadi::Collection &aNewFolder) |
void | generateSieveScript (QStringList &requires, QString &code) |
QString | icon () const |
QString | identifier () const |
bool | isAutoNaming () const |
bool | isEmpty () const |
bool | isEnabled () const |
QString | name () const |
SearchPattern * | pattern () |
const SearchPattern * | pattern () const |
void | purify () |
bool | readConfig (const KConfigGroup &config, bool interactive=false) |
SearchRule::RequiredPart | requiredPart (const QString &id) const |
void | setApplicability (AccountType aApply=All) |
void | setApplyBeforeOutbound (bool aApply=true) |
void | setApplyOnAccount (const QString &id, bool aApply=true) |
void | setApplyOnExplicit (bool aApply=true) |
void | setApplyOnInbound (bool aApply=true) |
void | setApplyOnOutbound (bool aApply=true) |
void | setAutoNaming (bool useAutomaticNames) |
void | setConfigureShortcut (bool aShort) |
void | setConfigureToolbar (bool aTool) |
void | setEnabled (bool) |
void | setIcon (const QString &icon) |
void | setShortcut (const KShortcut &shortcut) |
void | setStopProcessingHere (bool aStop) |
void | setToolbarName (const QString &toolbarName) |
const KShortcut & | shortcut () const |
bool | stopProcessingHere () const |
QString | toolbarName () const |
void | writeConfig (KConfigGroup &config, bool exportFilter) const |
Friends | |
MAILCOMMON_EXPORT QDataStream & | operator<< (QDataStream &stream, const MailFilter &filter) |
MAILCOMMON_EXPORT QDataStream & | operator>> (QDataStream &stream, MailFilter &filter) |
Detailed Description
Definition at line 42 of file mailfilter.h.
Member Enumeration Documentation
Account type codes used by setApplicability.
They mean:
- Parameters
-
All Apply to all accounts ButImap Apply to all but IMAP accounts Checked apply to all accounts specified by setApplyOnAccount
Enumerator | |
---|---|
All | |
ButImap | |
Checked |
Definition at line 70 of file mailfilter.h.
Result codes returned by process.
They mean:
- Parameters
-
GoOn Everything OK. You are still the owner of the message and you should continue applying filter actions to this message. CriticalError A critical error occurred (e.g. "disk full"). NoResult For internal use only!
Enumerator | |
---|---|
NoResult | |
GoOn | |
CriticalError |
Definition at line 59 of file mailfilter.h.
Constructor & Destructor Documentation
MailFilter::MailFilter | ( | ) |
Constructor that initializes basic settings.
Definition at line 52 of file mailfilter.cpp.
|
explicit |
Constructor that initializes from given config group.
Filters are stored one by one in config groups, i.e. one filter, one group.
Definition at line 68 of file mailfilter.cpp.
MailFilter::MailFilter | ( | const MailFilter & | other | ) |
MailFilter::~MailFilter | ( | ) |
Cleanup.
Definition at line 113 of file mailfilter.cpp.
Member Function Documentation
QList< FilterAction * > * MailFilter::actions | ( | ) |
Provides a reference to the internal action list.
If your used the setAction()
and action()
functions before, please convert to using myFilter->actions()->at() and friends now.
Definition at line 172 of file mailfilter.cpp.
const QList< FilterAction * > * MailFilter::actions | ( | ) | const |
Provides a reference to the internal action list.
Const version.
Definition at line 177 of file mailfilter.cpp.
MailFilter::AccountType MailFilter::applicability | ( | ) | const |
- Returns
- true if this filter should be applied on inbound messages for all accounts, or false if this filter is to be applied on a specified set of accounts only. Only applicable to filters that are applied on inbound messages.
- See also
- setApplicability
Definition at line 237 of file mailfilter.cpp.
bool MailFilter::applyBeforeOutbound | ( | ) | const |
- Returns
- TRUE if this filter should be applied on outbound messages before they are sent, FALSE otherwise.
Definition at line 207 of file mailfilter.cpp.
bool MailFilter::applyOnAccount | ( | const QString & | id | ) | const |
- Returns
- true if this filter should be applied on inbound messages from the account with id (
id
), false otherwise.
- See also
- setApplicability
Definition at line 289 of file mailfilter.cpp.
bool MailFilter::applyOnExplicit | ( | ) | const |
- Returns
- true if this filter should be applied on explicit (CTRL-J) filtering, false otherwise.
Definition at line 227 of file mailfilter.cpp.
bool MailFilter::applyOnInbound | ( | ) | const |
- Returns
- true if this filter should be applied on inbound messages, false otherwise.
Definition at line 217 of file mailfilter.cpp.
bool MailFilter::applyOnOutbound | ( | ) | const |
- Returns
- true if this filter should be applied on outbound messages, false otherwise.
Definition at line 202 of file mailfilter.cpp.
const QString MailFilter::asString | ( | ) | const |
Returns the filter in a human-readable form.
useful for debugging but not much else. Don't use, as it may well go away in the future...
Definition at line 578 of file mailfilter.cpp.
bool MailFilter::configureShortcut | ( | ) | const |
- Returns
- true if this filter should be plugged into the filter menu, false otherwise.
- See also
- setConfigureShortcut
Definition at line 323 of file mailfilter.cpp.
bool MailFilter::configureToolbar | ( | ) | const |
- Returns
- true if this filter should be plugged into the toolbar, false otherwise.
- See also
- setConfigureToolbar
Definition at line 333 of file mailfilter.cpp.
MailFilter::ReturnCode MailFilter::execActions | ( | ItemContext & | context, |
bool & | stopIt, | ||
bool | applyOnOutbound | ||
) | const |
Execute the filter action(s) on the given message.
Returns:
- 2 if a critical error occurred,
- 1 if the caller is still the owner of the message,
- 0 if processed successfully.
- Parameters
-
context The context that contains the item to which the actions should be applied. stopIt Contains true if the caller may apply other filters and false if he shall stop the filtering of this message.
Definition at line 128 of file mailfilter.cpp.
bool MailFilter::folderRemoved | ( | const Akonadi::Collection & | aFolder, |
const Akonadi::Collection & | aNewFolder | ||
) |
Called from the filter manager when a folder is moved.
Tests if the folder aFolder is used in any action. Changes it to aNewFolder folder in this case.
- Returns
- true if a change in some action occurred, false if no action was affected.
Definition at line 268 of file mailfilter.cpp.
void MailFilter::generateSieveScript | ( | QStringList & | requires, |
QString & | code | ||
) |
Definition at line 468 of file mailfilter.cpp.
QString MailFilter::icon | ( | ) | const |
- Returns
- The name of the icon to be used.
- See also
- setIcon
Definition at line 358 of file mailfilter.cpp.
QString MailFilter::identifier | ( | ) | const |
Returns the unique identifier of this filter.
Definition at line 118 of file mailfilter.cpp.
bool MailFilter::isAutoNaming | ( | ) | const |
- Returns
- Tells, if an automatic name is used for the filter
Definition at line 368 of file mailfilter.cpp.
bool MailFilter::isEmpty | ( | ) | const |
Check for empty pattern and action list.
Definition at line 563 of file mailfilter.cpp.
bool MailFilter::isEnabled | ( | ) | const |
Return if filter is enabled or not.
Definition at line 734 of file mailfilter.cpp.
QString MailFilter::name | ( | ) | const |
SearchPattern * MailFilter::pattern | ( | ) |
Provides a reference to the internal pattern.
If you used the matches()
function before, please convert to using myFilter->pattern()->matches() now.
Definition at line 182 of file mailfilter.cpp.
const SearchPattern * MailFilter::pattern | ( | ) | const |
Provides a reference to the internal pattern.
If you used the matches()
function before, please convert to using myFilter->pattern()->matches() now.
Definition at line 187 of file mailfilter.cpp.
void MailFilter::purify | ( | ) |
Remove empty rules (and actions one day).
Definition at line 538 of file mailfilter.cpp.
bool MailFilter::readConfig | ( | const KConfigGroup & | config, |
bool | interactive = false |
||
) |
Initialize from given config group.
Definition at line 374 of file mailfilter.cpp.
SearchRule::RequiredPart MailFilter::requiredPart | ( | const QString & | id | ) | const |
Returns the required part from the item that is needed for the filter to operate.
Definition at line 242 of file mailfilter.cpp.
void MailFilter::setApplicability | ( | AccountType | aApply = All | ) |
Set whether this filter should be applied on inbound messages for all accounts (aApply
== All) or inbound messages for all but IMAP accounts (aApply
== ButImap) or for a specified set of accounts only.
Only applicable to filters that are applied on inbound messages.
- See also
- setApplyOnInbound setApplyOnAccount
Definition at line 232 of file mailfilter.cpp.
void MailFilter::setApplyBeforeOutbound | ( | bool | aApply = true | ) |
Set whether this filter should be applied on outbound messages before sending (aApply
== TRUE) or not.
See applyOnOutbound applyOnInbound setApplyOnInbound
Definition at line 197 of file mailfilter.cpp.
void MailFilter::setApplyOnAccount | ( | const QString & | id, |
bool | aApply = true |
||
) |
Set whether this filter should be applied on inbound messages for the account with id (id
).
Only applicable to filters that are only applied to a specified set of accounts.
- See also
- setApplicability applyOnAccount
Definition at line 280 of file mailfilter.cpp.
void MailFilter::setApplyOnExplicit | ( | bool | aApply = true | ) |
Set whether this filter should be applied on explicit (CTRL-J) filtering (aApply
== true) or not.
Definition at line 222 of file mailfilter.cpp.
void MailFilter::setApplyOnInbound | ( | bool | aApply = true | ) |
Set whether this filter should be applied on inbound messages (aApply
== true) or not.
Definition at line 212 of file mailfilter.cpp.
void MailFilter::setApplyOnOutbound | ( | bool | aApply = true | ) |
Set whether this filter should be applied on outbound messages (aApply
== true) or not.
See applyOnOutbound applyOnInbound setApplyOnInbound
Definition at line 192 of file mailfilter.cpp.
void MailFilter::setAutoNaming | ( | bool | useAutomaticNames | ) |
Set the mode for using automatic naming for the filter.
If the feature is enabled, the name is derived from the first filter rule.
Definition at line 363 of file mailfilter.cpp.
void MailFilter::setConfigureShortcut | ( | bool | aShort | ) |
Set whether this filter should be plugged into the filter menu.
Definition at line 317 of file mailfilter.cpp.
void MailFilter::setConfigureToolbar | ( | bool | aTool | ) |
Set whether this filter should be plugged into the toolbar.
This can be done only if a shortcut is defined.
- See also
- setConfigureShortcut
Definition at line 328 of file mailfilter.cpp.
void MailFilter::setEnabled | ( | bool | enabled | ) |
Definition at line 739 of file mailfilter.cpp.
void MailFilter::setIcon | ( | const QString & | icon | ) |
Set the icon to be used if plugged into the filter menu or toolbar.
Default is the gear icon.
Definition at line 353 of file mailfilter.cpp.
void MailFilter::setShortcut | ( | const KShortcut & | shortcut | ) |
Set the shortcut to be used if plugged into the filter menu or toolbar.
Default is no shortcut.
Definition at line 343 of file mailfilter.cpp.
void MailFilter::setStopProcessingHere | ( | bool | aStop | ) |
Definition at line 307 of file mailfilter.cpp.
void MailFilter::setToolbarName | ( | const QString & | toolbarName | ) |
This sets the toolbar name for this filter.
The toolbar name is the text to be displayed underneath the toolbar icon for this filter. This is usually the same as name(), expect when explicitly set by this function. This is useful if the normal filter mame is too long for the toolbar.
- See also
- toolbarName, name
Definition at line 338 of file mailfilter.cpp.
const KShortcut & MailFilter::shortcut | ( | ) | const |
- Returns
- The shortcut assigned to the filter.
- See also
- setShortcut
Definition at line 348 of file mailfilter.cpp.
bool MailFilter::stopProcessingHere | ( | ) | const |
Definition at line 312 of file mailfilter.cpp.
QString MailFilter::toolbarName | ( | ) | const |
- Returns
- The toolbar name of this filter.
- See also
- setToolbarName
Definition at line 569 of file mailfilter.cpp.
void MailFilter::writeConfig | ( | KConfigGroup & | config, |
bool | exportFilter | ||
) | const |
Write contents to given config group.
Definition at line 494 of file mailfilter.cpp.
Friends And Related Function Documentation
|
friend |
|
friend |
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:55:15 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.