MailCommon::MailFilter

Search for usage in LXR

#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 ()
 
QVector< FilterAction * > * actions ()
 
const QVector< FilterAction * > * actions () const
 
void agentRemoved (const QString &identifier)
 
AccountType applicability () const
 
bool applyBeforeOutbound () const
 
bool applyOnAccount (const QString &id) const
 
bool applyOnAllFoldersInbound () const
 
bool applyOnExplicit () const
 
bool applyOnInbound () const
 
bool applyOnOutbound () const
 
const QString asString () const
 
void clearApplyOnAccount ()
 
bool configureShortcut () const
 
bool configureToolbar () const
 
ReturnCode execActions (ItemContext &context, bool &stopIt, bool applyOnOutbound) const
 
void folderRemoved (const Akonadi::Collection &aFolder, const Akonadi::Collection &aNewFolder)
 
void generateRandomIdentifier ()
 
void generateSieveScript (QStringList &requiresModules, QString &code)
 
QString icon () const
 
QString identifier () const
 
bool isAutoNaming () const
 
bool isEmpty () const
 
bool isEnabled () const
 
QString name () const
 
SearchPatternpattern ()
 
const SearchPatternpattern () const
 
QString purify (bool removeAction=true)
 
bool readConfig (const KConfigGroup &config, bool interactive=false)
 
SearchRule::RequiredPart requiredPart (const QString &id) const
 
void setApplicability (AccountType aApply=All)
 
void setApplyBeforeOutbound (bool aApply)
 
void setApplyOnAccount (const QString &id, bool aApply=true)
 
void setApplyOnAllFoldersInbound (bool aApply)
 
void setApplyOnExplicit (bool aApply)
 
void setApplyOnInbound (bool aApply)
 
void setApplyOnOutbound (bool aApply)
 
void setAutoNaming (bool useAutomaticNames)
 
void setConfigureShortcut (bool aShort)
 
void setConfigureToolbar (bool aTool)
 
void setEnabled (bool)
 
void setIcon (const QString &icon)
 
void setShortcut (const QKeySequence &shortcut)
 
void setStopProcessingHere (bool aStop)
 
void setToolbarName (const QString &toolbarName)
 
const QKeySequenceshortcut () const
 
bool stopProcessingHere () const
 
QString toolbarName () const
 
void writeConfig (KConfigGroup &config, bool exportFilter) const
 

Static Public Member Functions

static int filterActionsMaximumSize ()
 

Detailed Description

The MailFilter class.

Definition at line 28 of file mailfilter.h.

Member Enumeration Documentation

◆ AccountType

Account type codes used by setApplicability.

They mean:

Parameters
AllApply to all accounts
ButImapApply to all but IMAP accounts
Checkedapply to all accounts specified by setApplyOnAccount

Definition at line 56 of file mailfilter.h.

◆ ReturnCode

Result codes returned by process.

They mean:

Parameters
GoOnEverything OK. You are still the owner of the message and you should continue applying filter actions to this message.
CriticalErrorA critical error occurred (e.g. "disk full").
NoResultFor internal use only!

Definition at line 45 of file mailfilter.h.

Constructor & Destructor Documentation

◆ MailFilter() [1/3]

MailFilter::MailFilter ( )

Constructor that initializes basic settings.

Definition at line 38 of file mailfilter.cpp.

◆ MailFilter() [2/3]

MailFilter::MailFilter ( const KConfigGroup aConfig,
bool  internal,
bool &  needUpdate 
)
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 54 of file mailfilter.cpp.

◆ MailFilter() [3/3]

MailFilter::MailFilter ( const MailFilter other)

Copy constructor.

Constructs a deep copy of aFilter.

Definition at line 59 of file mailfilter.cpp.

◆ ~MailFilter()

MailFilter::~MailFilter ( )

Cleanup.

Definition at line 100 of file mailfilter.cpp.

Member Function Documentation

◆ actions() [1/2]

const QVector< 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 161 of file mailfilter.cpp.

◆ actions() [2/2]

const QVector<FilterAction *>* MailCommon::MailFilter::actions ( ) const

Provides a reference to the internal action list.

Const version.

◆ applicability()

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 236 of file mailfilter.cpp.

◆ applyBeforeOutbound()

bool MailFilter::applyBeforeOutbound ( ) const
Returns
TRUE if this filter should be applied on outbound messages before they are sent, FALSE otherwise.
See also
setApplyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 196 of file mailfilter.cpp.

◆ applyOnAccount()

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 296 of file mailfilter.cpp.

◆ applyOnAllFoldersInbound()

bool MailFilter::applyOnAllFoldersInbound ( ) const

Returns whether the filter should be applied on inbound emails in all folders, not just Inbox.

Definition at line 226 of file mailfilter.cpp.

◆ applyOnExplicit()

bool MailFilter::applyOnExplicit ( ) const
Returns
true if this filter should be applied on explicit (CTRL-J) filtering, false otherwise.
See also
setApplyOnOutbound applyOnOutbound setApplyOnInbound

Definition at line 216 of file mailfilter.cpp.

◆ applyOnInbound()

bool MailFilter::applyOnInbound ( ) const
Returns
true if this filter should be applied on inbound messages, false otherwise.
See also
setApplyOnOutbound applyOnOutbound setApplyOnInbound

Definition at line 206 of file mailfilter.cpp.

◆ applyOnOutbound()

bool MailFilter::applyOnOutbound ( ) const
Returns
true if this filter should be applied on outbound messages, false otherwise.
See also
setApplyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 191 of file mailfilter.cpp.

◆ asString()

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 615 of file mailfilter.cpp.

◆ configureShortcut()

bool MailFilter::configureShortcut ( ) const
Returns
true if this filter should be plugged into the filter menu, false otherwise.
See also
setConfigureShortcut

Definition at line 332 of file mailfilter.cpp.

◆ configureToolbar()

bool MailFilter::configureToolbar ( ) const
Returns
true if this filter should be plugged into the toolbar, false otherwise.
See also
setConfigureToolbar

Definition at line 342 of file mailfilter.cpp.

◆ execActions()

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
    contextThe context that contains the item to which the actions should be applied.
    stopItContains true if the caller may apply other filters and false if he shall stop the filtering of this message.
    applyOnOutboundDefines whether to apply the rules on the outbound.

Definition at line 125 of file mailfilter.cpp.

◆ folderRemoved()

void 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 274 of file mailfilter.cpp.

◆ icon()

QString MailFilter::icon ( ) const
Returns
The name of the icon to be used.
See also
setIcon

Definition at line 367 of file mailfilter.cpp.

◆ identifier()

QString MailFilter::identifier ( ) const

Returns the unique identifier of this filter.

Definition at line 115 of file mailfilter.cpp.

◆ isAutoNaming()

bool MailFilter::isAutoNaming ( ) const
Returns
Tells, if an automatic name is used for the filter

Definition at line 377 of file mailfilter.cpp.

◆ isEmpty()

bool MailFilter::isEmpty ( ) const

Check for empty pattern and action list.

Definition at line 601 of file mailfilter.cpp.

◆ isEnabled()

bool MailFilter::isEnabled ( ) const

Return if filter is enabled or not.

Definition at line 780 of file mailfilter.cpp.

◆ name()

QString MailFilter::name ( ) const

Equivalent to pattern()->name().

Returns
name of the filter

Definition at line 120 of file mailfilter.cpp.

◆ pattern() [1/2]

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 171 of file mailfilter.cpp.

◆ pattern() [2/2]

const SearchPattern* MailCommon::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.

◆ purify()

QString MailFilter::purify ( bool  removeAction = true)

Remove empty rules (and actions one day).

Definition at line 561 of file mailfilter.cpp.

◆ readConfig()

bool MailFilter::readConfig ( const KConfigGroup config,
bool  interactive = false 
)

Initialize from given config group.

Definition at line 383 of file mailfilter.cpp.

◆ requiredPart()

SearchRule::RequiredPart MailFilter::requiredPart ( const QString id) const

Returns the required part from the item that is needed for the filter to operate.

See SearchRule::RequiredPart

Definition at line 241 of file mailfilter.cpp.

◆ setApplicability()

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 231 of file mailfilter.cpp.

◆ setApplyBeforeOutbound()

void MailFilter::setApplyBeforeOutbound ( bool  aApply)

Set whether this filter should be applied on outbound messages before sending (aApply == TRUE) or not.

See applyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 186 of file mailfilter.cpp.

◆ setApplyOnAccount()

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 287 of file mailfilter.cpp.

◆ setApplyOnAllFoldersInbound()

void MailFilter::setApplyOnAllFoldersInbound ( bool  aApply)

Sets whether the filter should be applied on inbound emails in all folders, not just Inbox.

Definition at line 221 of file mailfilter.cpp.

◆ setApplyOnExplicit()

void MailFilter::setApplyOnExplicit ( bool  aApply)

Set whether this filter should be applied on explicit (CTRL-J) filtering (aApply == true) or not.

See also
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 211 of file mailfilter.cpp.

◆ setApplyOnInbound()

void MailFilter::setApplyOnInbound ( bool  aApply)

Set whether this filter should be applied on inbound messages (aApply == true) or not.

See also
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 201 of file mailfilter.cpp.

◆ setApplyOnOutbound()

void MailFilter::setApplyOnOutbound ( bool  aApply)

Set whether this filter should be applied on outbound messages (aApply == true) or not.

See applyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 181 of file mailfilter.cpp.

◆ setAutoNaming()

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 372 of file mailfilter.cpp.

◆ setConfigureShortcut()

void MailFilter::setConfigureShortcut ( bool  aShort)

Set whether this filter should be plugged into the filter menu.

Definition at line 326 of file mailfilter.cpp.

◆ setConfigureToolbar()

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 337 of file mailfilter.cpp.

◆ setIcon()

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.

See also
setConfigureShortcut setConfigureToolbar

Definition at line 362 of file mailfilter.cpp.

◆ setShortcut()

void MailFilter::setShortcut ( const QKeySequence shortcut)

Set the shortcut to be used if plugged into the filter menu or toolbar.

Default is no shortcut.

See also
setConfigureShortcut setConfigureToolbar

Definition at line 352 of file mailfilter.cpp.

◆ setToolbarName()

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 347 of file mailfilter.cpp.

◆ shortcut()

const QKeySequence & MailFilter::shortcut ( ) const
Returns
The shortcut assigned to the filter.
See also
setShortcut

Definition at line 357 of file mailfilter.cpp.

◆ toolbarName()

QString MailFilter::toolbarName ( ) const
Returns
The toolbar name of this filter.
See also
setToolbarName

Definition at line 606 of file mailfilter.cpp.

◆ writeConfig()

void MailFilter::writeConfig ( KConfigGroup config,
bool  exportFilter 
) const

Write contents to given config group.

Definition at line 510 of file mailfilter.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Oct 3 2022 04:00:28 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.