kmail

KMFilter Class Reference

#include <kmfilter.h>

List of all members.


Public Types

enum  AccountType { All, ButImap, Checked }
enum  ReturnCode { NoResult, GoOn, CriticalError }

Public Member Functions

KMPopFilterAction action ()
const QPtrList< KMFilterAction > * actions () const
QPtrList< KMFilterAction > * actions ()
AccountType applicability () const
bool applyOnAccount (uint id) const
bool applyOnExplicit () const
bool applyOnInbound () const
bool applyOnOutbound () const
const QString asString () const
bool configureShortcut () const
bool configureToolbar () const
ReturnCode execActions (KMMessage *msg, bool &stopIt) const
bool folderRemoved (KMFolder *aFolder, KMFolder *aNewFolder)
QString icon () const
bool isAutoNaming () const
bool isEmpty () const
bool isPopFilter () const
 KMFilter (const KMFilter &other)
 KMFilter (KConfig *aConfig=0, bool popFilter=false)
QString name () const
const KMSearchPatternpattern () const
KMSearchPatternpattern ()
void purify ()
void readConfig (KConfig *config)
bool requiresBody (KMMsgBase *msgBase)
void setAction (const KMPopFilterAction aAction)
void setApplicability (AccountType aApply=All)
void setApplyOnAccount (uint 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 setIcon (QString icon)
void setShortcut (const KShortcut &shortcut)
void setStopProcessingHere (bool aStop)
const KShortcut & shortcut () const
bool stopProcessingHere () const
void writeConfig (KConfig *config) const
 ~KMFilter ()

Detailed Description

Definition at line 40 of file kmfilter.h.


Member Enumeration Documentation

Account type codes used by setApplicability.

They mean:

Parameters:
All Apply to all accounts
ButImap Apply to all but online-IMAP accounts
Checked apply to all accounts specified by setApplyOnAccount
Enumerator:
All 
ButImap 
Checked 

Definition at line 65 of file kmfilter.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 54 of file kmfilter.h.


Constructor & Destructor Documentation

KMFilter::KMFilter ( KConfig *  aConfig = 0,
bool  popFilter = false 
)

Constructor that initializes from given config file, if given.

Filters are stored one by one in config groups, i.e. one filter, one group. The config group has to be preset if config is not 0.

Definition at line 42 of file kmfilter.cpp.

KMFilter::KMFilter ( const KMFilter other  ) 

Copy constructor.

Constructs a deep copy of aFilter.

Definition at line 65 of file kmfilter.cpp.

KMFilter::~KMFilter (  )  [inline]

Cleanup.

Definition at line 76 of file kmfilter.h.


Member Function Documentation

KMPopFilterAction KMFilter::action (  ) 

No descriptions.

Definition at line 169 of file kmfilter.cpp.

const QPtrList<KMFilterAction>* KMFilter::actions (  )  const [inline]

Provides a reference to the internal action list.

Const version.

Definition at line 130 of file kmfilter.h.

QPtrList<KMFilterAction>* KMFilter::actions (  )  [inline]

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 127 of file kmfilter.h.

AccountType KMFilter::applicability (  )  const [inline]

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 193 of file kmfilter.h.

bool KMFilter::applyOnAccount ( uint  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 196 of file kmfilter.cpp.

bool KMFilter::applyOnExplicit (  )  const [inline]

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

Definition at line 176 of file kmfilter.h.

bool KMFilter::applyOnInbound (  )  const [inline]

Returns:
true if this filter should be applied on inbound messages, false otherwise.
See also:
setApplyOnOutbound applyOnOutbound setApplyOnInbound

Definition at line 164 of file kmfilter.h.

bool KMFilter::applyOnOutbound (  )  const [inline]

Returns:
true if this filter should be applied on outbound messages, false otherwise.
See also:
setApplyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 152 of file kmfilter.h.

const QString KMFilter::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 383 of file kmfilter.cpp.

bool KMFilter::configureShortcut (  )  const [inline]

Returns:
true if this filter should be plugged into the filter menu, false otherwise.
See also:
setConfigureShortcut

Definition at line 223 of file kmfilter.h.

bool KMFilter::configureToolbar (  )  const [inline]

Returns:
true if this filter should be plugged into the toolbar, false otherwise.
See also:
setConfigureToolbar

Definition at line 237 of file kmfilter.h.

KMFilter::ReturnCode KMFilter::execActions ( KMMessage msg,
bool &  stopIt 
) 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:
    msg The message 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 107 of file kmfilter.cpp.

bool KMFilter::folderRemoved ( KMFolder aFolder,
KMFolder 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 175 of file kmfilter.cpp.

QString KMFilter::icon (  )  const [inline]

Returns:
The name of the icon to be used.
See also:
setIcon

Definition at line 259 of file kmfilter.h.

bool KMFilter::isAutoNaming (  )  const [inline]

Returns:
Tells, if an automatic name is used for the filter

Definition at line 292 of file kmfilter.h.

bool KMFilter::isEmpty (  )  const

Check for empty pattern and action list.

Definition at line 374 of file kmfilter.cpp.

bool KMFilter::isPopFilter (  )  const [inline]

No descriptions.

Definition at line 278 of file kmfilter.h.

QString KMFilter::name (  )  const [inline]

Equivalent to ()->name().

Returns:
name of the filter

Definition at line 79 of file kmfilter.h.

const KMSearchPattern* KMFilter::pattern (  )  const [inline]

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 140 of file kmfilter.h.

KMSearchPattern* KMFilter::pattern (  )  [inline]

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 135 of file kmfilter.h.

void KMFilter::purify (  ) 

Remove empty rules (and actions one day).

Definition at line 350 of file kmfilter.cpp.

void KMFilter::readConfig ( KConfig *  config  ) 

Initialize from given config file.

The config group (see constructor above) has to be preset. The config object will be deleted by higher levels, so it is not allowed to store a pointer to it anywhere inside this function.

Definition at line 213 of file kmfilter.cpp.

bool KMFilter::requiresBody ( KMMsgBase msgBase  ) 

Determines if the filter depends on the body of the message.

Definition at line 150 of file kmfilter.cpp.

void KMFilter::setAction ( const KMPopFilterAction  aAction  ) 

No descriptions.

Definition at line 163 of file kmfilter.cpp.

void KMFilter::setApplicability ( AccountType  aApply = All  )  [inline]

Set whether this filter should be applied on inbound messages for all accounts (aApply == All) or inbound messages for all but nline 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 185 of file kmfilter.h.

void KMFilter::setApplyOnAccount ( uint  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 187 of file kmfilter.cpp.

void KMFilter::setApplyOnExplicit ( bool  aApply = true  )  [inline]

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

See also:
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 170 of file kmfilter.h.

void KMFilter::setApplyOnInbound ( bool  aApply = true  )  [inline]

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

See also:
setApplyOnOutbound applyOnInbound applyOnOutbound

Definition at line 158 of file kmfilter.h.

void KMFilter::setApplyOnOutbound ( bool  aApply = true  )  [inline]

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

See applyOnOutbound applyOnInbound setApplyOnInbound

Definition at line 146 of file kmfilter.h.

void KMFilter::setAutoNaming ( bool  useAutomaticNames  )  [inline]

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 286 of file kmfilter.h.

void KMFilter::setConfigureShortcut ( bool  aShort  )  [inline]

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

Definition at line 214 of file kmfilter.h.

void KMFilter::setConfigureToolbar ( bool  aTool  )  [inline]

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 229 of file kmfilter.h.

void KMFilter::setIcon ( QString  icon  )  [inline]

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 254 of file kmfilter.h.

void KMFilter::setShortcut ( const KShortcut &  shortcut  )  [inline]

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 243 of file kmfilter.h.

void KMFilter::setStopProcessingHere ( bool  aStop  )  [inline]

Definition at line 209 of file kmfilter.h.

const KShortcut& KMFilter::shortcut (  )  const [inline]

Returns:
The shortcut assigned to the filter.
See also:
setShortcut

Definition at line 248 of file kmfilter.h.

bool KMFilter::stopProcessingHere (  )  const [inline]

Definition at line 210 of file kmfilter.h.

void KMFilter::writeConfig ( KConfig *  config  )  const

Write contents to given config file.

The config group (see the constructor above) has to be preset. The config object will be deleted by higher levels, so it is not allowed to store a pointer to it anywhere inside this function.

Definition at line 298 of file kmfilter.cpp.


The documentation for this class was generated from the following files: