kshowmail: kshowmail/filter.cpp Source File

- Main Page
- Namespaces
- Classes
- Files
- Directories

# filter.cpp

    00001 /***************************************************************************
    00002                           filter.cpp  -  description
    00003                              -------------------
    00004     begin                : Die Sep 23 2003
    00005     copyright            : (C) 2003 by Eggert Ehmke
    00006     email                : eggert.ehmke@berlin.de
    00007  ***************************************************************************/
    00008
    00009 /***************************************************************************
    00010  *                                                                         *
    00011  *   This program is free software; you can redistribute it and/or modify  *
    00012  *   it under the terms of the GNU General Public License as published by  *
    00013  *   the Free Software Foundation; either version 2 of the License, or     *
    00014  *   (at your option) any later version.                                   *
    00015  *                                                                         *
    00016  ***************************************************************************/
    00017
    00018 #include "filter.h"
    00019
    00020 FilterList Filter::_filter;
    00021 Filter::filterStatus Filter::_status = Filter::off;
    00022
    00023 Filter::Filter()
    00024 {
    00025 }
    00026
    00027 Filter::~Filter()
    00028 {
    00029 }
    00030
    00031 FilterElem* Filter::matches (ShowRecordElem* pElem)
    00032 {
    00033   for (FilterElem* pFilter = _filter.first(); pFilter; pFilter = _filter.next())
    00034   {
    00035     if (pFilter->matches (pElem))
    00036       return pFilter;
    00037   }
    00038   return NULL;
    00039 }
    00040
    00041 void Filter::readOptions (TDEConfig* config)
    00042 {
    00043   config->setGroup ("filter_general");
    00044   _status = (Filter::filterStatus)config->readNumEntry("status", 0);
    00045   _filter.readOptions(config);
    00046 }
    00047
    00048 void Filter::saveOptions (TDEConfig* config)
    00049 {
    00050   config->setGroup ("filter_general");
    00051   config->writeEntry ("status", _status);
    00052   _filter.saveOptions(config);
    00053   config->sync();
    00054 }