kaddressbook

#include <filter.h>

Public Types

enum  MatchRule { Matching = 0 , NotMatching = 1 }
 
typedef TQValueList< FilterList
 

Public Member Functions

 Filter (const TQString &name)
 
void setName (const TQString &name)
 
const TQString & name () const
 
bool isInternal () const
 
void apply (TDEABC::Addressee::List &addresseeList)
 
bool filterAddressee (const TDEABC::Addressee &a) const
 
void setEnabled (bool on)
 
bool isEnabled () const
 
void setCategories (const TQStringList &list)
 
const TQStringList & categories () const
 
void save (TDEConfig *config)
 
void restore (TDEConfig *config)
 
void setMatchRule (MatchRule rule)
 
MatchRule matchRule () const
 
bool isEmpty () const
 

Static Public Member Functions

static void save (TDEConfig *config, const TQString &baseGroup, Filter::List &list)
 
static Filter::List restore (TDEConfig *config, const TQString &baseGroup)
 

Detailed Description

Filter for AddressBook related objects (Addressees)

Todo:
This class should be switched to use shared data.

Definition at line 39 of file filter.h.

Member Function Documentation

◆ apply()

void Filter::apply ( TDEABC::Addressee::List &  addresseeList)

Apply the filter to the addressee list.

All addressees not passing the filter criterias will be removed from the list.

If the MatchRule is NotMatch, then all the addressees matching the filter will be removed from the list.

Definition at line 64 of file filter.cpp.

◆ categories()

const TQStringList & Filter::categories ( ) const
Returns
The list of categories.

Definition at line 119 of file filter.cpp.

◆ filterAddressee()

bool Filter::filterAddressee ( const TDEABC::Addressee &  a) const

Apply the filter to the addressee.

Returns
True if the addressee passes the criteria, false otherwise. The return values are opposite if the MatchRule is NotMatch.

Definition at line 75 of file filter.cpp.

◆ isEmpty()

bool Filter::isEmpty ( ) const
Returns
true if the category list is empty.

Definition at line 216 of file filter.cpp.

◆ isEnabled()

bool Filter::isEnabled ( ) const
Returns
True if this filter is enabled, false otherwise.

Definition at line 107 of file filter.cpp.

◆ isInternal()

bool Filter::isInternal ( ) const
Returns
Whether the filter is an internal one.

Definition at line 59 of file filter.cpp.

◆ matchRule()

Filter::MatchRule Filter::matchRule ( ) const
Returns
The current match rule.

Definition at line 211 of file filter.cpp.

◆ name()

const TQString & Filter::name ( ) const
Returns
The name of the filter.

Definition at line 54 of file filter.cpp.

◆ restore() [1/2]

void Filter::restore ( TDEConfig *  config)

Loads the filter from the config file.

The group should already be set.

Definition at line 132 of file filter.cpp.

◆ restore() [2/2]

Filter::List Filter::restore ( TDEConfig *  config,
const TQString &  baseGroup 
)
static

Restores a list of filters from a config file.

Parameters
configThe config file to read from.
baseGroupThe base group name to be used to find the filters
Returns
The list of filters.

Definition at line 169 of file filter.cpp.

◆ save() [1/2]

void Filter::save ( TDEConfig *  config)

Saves the filter to the config file.

The group should already be set.

Definition at line 124 of file filter.cpp.

◆ save() [2/2]

void Filter::save ( TDEConfig *  config,
const TQString &  baseGroup,
Filter::List &  list 
)
static

Saves a list of filters to the config file.

Parameters
configThe config file to use
baseGroupThe base groupname to use. The number of filters will be written to this group, then a _1, _2, etc will be append for each filter saved.
listThe list of filters to be saved.

Definition at line 142 of file filter.cpp.

◆ setCategories()

void Filter::setCategories ( const TQStringList &  list)

Set the list of categories.

This list is used to filter addressees.

Definition at line 112 of file filter.cpp.

◆ setEnabled()

void Filter::setEnabled ( bool  on)

Enable or disable the filter.

Definition at line 100 of file filter.cpp.

◆ setMatchRule()

void Filter::setMatchRule ( MatchRule  rule)

Sets the filter rule.

If the rule is Filter::Matching (default), then the filter will return true on items that match the filter. If the rule is Filter::NotMatching, then the filter will return true on items that do not match the filter.

Definition at line 204 of file filter.cpp.

◆ setName()

void Filter::setName ( const TQString &  name)

Set the name of the filter.

Definition at line 47 of file filter.cpp.


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