• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

mailcommon

  • MailCommon
  • MailFilter
Public Types | Public Member Functions | Friends | List of all members
MailCommon::MailFilter Class Reference

#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
 
void folderRemoved (const Akonadi::Collection &aFolder, const Akonadi::Collection &aNewFolder)
 
void generateRandomIdentifier ()
 
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
 
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=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

enum MailCommon::MailFilter::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
Enumerator
All 
ButImap 
Checked 

Definition at line 70 of file mailfilter.h.

enum MailCommon::MailFilter::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!
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 54 of file mailfilter.cpp.

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

MailFilter::MailFilter ( const MailFilter &  other)

Copy constructor.

Constructs a deep copy of aFilter.

Definition at line 76 of file mailfilter.cpp.

MailFilter::~MailFilter ( )

Cleanup.

Definition at line 115 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 179 of file mailfilter.cpp.

const QList< FilterAction * > * MailFilter::actions ( ) const

Provides a reference to the internal action list.

Const version.

Definition at line 184 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 244 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.
See also
setApplyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 214 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 291 of file mailfilter.cpp.

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

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

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 209 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 585 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 325 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 335 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
    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.

Definition at line 135 of file mailfilter.cpp.

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

void MailFilter::generateRandomIdentifier ( )

Definition at line 120 of file mailfilter.cpp.

void MailFilter::generateSieveScript ( QStringList &  requires,
QString &  code 
)

Definition at line 470 of file mailfilter.cpp.

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

Definition at line 360 of file mailfilter.cpp.

QString MailFilter::identifier ( ) const

Returns the unique identifier of this filter.

Definition at line 125 of file mailfilter.cpp.

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

Definition at line 370 of file mailfilter.cpp.

bool MailFilter::isEmpty ( ) const

Check for empty pattern and action list.

Definition at line 571 of file mailfilter.cpp.

bool MailFilter::isEnabled ( ) const

Return if filter is enabled or not.

Definition at line 740 of file mailfilter.cpp.

QString MailFilter::name ( ) const

Equivalent to ()->name().

Returns
name of the filter

Definition at line 130 of file mailfilter.cpp.

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

QString MailFilter::purify ( bool  removeAction = true)

Remove empty rules (and actions one day).

Definition at line 540 of file mailfilter.cpp.

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

Initialize from given config group.

Definition at line 376 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.

See SearchRule::RequiredPart

Definition at line 249 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 239 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 204 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 282 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.

See also
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 229 of file mailfilter.cpp.

void MailFilter::setApplyOnInbound ( bool  aApply = true)

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

See also
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 219 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 199 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 365 of file mailfilter.cpp.

void MailFilter::setConfigureShortcut ( bool  aShort)

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

Definition at line 319 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 330 of file mailfilter.cpp.

void MailFilter::setEnabled ( bool  enabled)

Definition at line 745 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.

See also
setConfigureShortcut setConfigureToolbar

Definition at line 355 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.

See also
setConfigureShortcut setConfigureToolbar

Definition at line 345 of file mailfilter.cpp.

void MailFilter::setStopProcessingHere ( bool  aStop)

Definition at line 309 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 340 of file mailfilter.cpp.

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

Definition at line 350 of file mailfilter.cpp.

bool MailFilter::stopProcessingHere ( ) const

Definition at line 314 of file mailfilter.cpp.

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

Definition at line 577 of file mailfilter.cpp.

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

Write contents to given config group.

Definition at line 496 of file mailfilter.cpp.

Friends And Related Function Documentation

MAILCOMMON_EXPORT QDataStream& operator<< ( QDataStream &  stream,
const MailFilter &  filter 
)
friend
MAILCOMMON_EXPORT QDataStream& operator>> ( QDataStream &  stream,
MailFilter &  filter 
)
friend

The documentation for this class was generated from the following files:
  • mailfilter.h
  • mailfilter.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:31:41 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

mailcommon

Skip menu "mailcommon"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal