kaddressbook Library API Documentation

filter.h

00001 #ifndef FILTER_H
00002 #define FILTER_H
00003 
00004 /*                                                                      
00005     This file is part of KAddressBook.                                  
00006     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>                   
00007                                                                         
00008     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or   
00011     (at your option) any later version.                                 
00012                                                                         
00013     This program is distributed in the hope that it will be useful,     
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of      
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        
00016     GNU General Public License for more details.                        
00017                                                                         
00018     You should have received a copy of the GNU General Public License   
00019     along with this program; if not, write to the Free Software         
00020     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.           
00021                                                                         
00022     As a special exception, permission is given to link this program    
00023     with any edition of Qt, and distribute the resulting executable,    
00024     without including the source code for Qt in the source distribution.
00025 */                                                                      
00026 
00027 #include <qvaluelist.h>
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030 
00031 #include <kconfig.h>
00032 
00033 #include <kabc/addressee.h>
00034 
00039 class Filter
00040 {
00041   public:
00042     typedef QValueList<Filter> List;
00043     
00044     enum MatchRule { Matching = 0, NotMatching = 1 };
00045     
00046     Filter();
00047     Filter(const Filter &);
00048     Filter(const QString &name);
00049     ~Filter();
00050     
00051     Filter &operator=(const Filter &);
00052     
00055     void setName(const QString &name) { mName = name; }
00056     
00059     const QString &name() const { return mName; }
00060     
00067     void apply(KABC::Addressee::List &addresseeList);
00068     
00074     bool filterAddressee(const KABC::Addressee &a);
00075     
00078     void setEnabled(bool on) { mEnabled = on; }
00079     
00082     bool isEnabled() const { return mEnabled; }
00083     
00086     void setCategories(const QStringList &list) { mCategoryList = list; }
00087     
00090     const QStringList &categories() const { return mCategoryList; }
00091     
00094     void save(KConfig *config);
00095     
00099     void restore(KConfig *config);
00100     
00109     static void save(KConfig *config, QString baseGroup, 
00110                      Filter::List &list);
00111     
00119     static Filter::List restore(KConfig *config, QString baseGroup);
00120     
00126     void setMatchRule(MatchRule rule) { mMatchRule = rule; }
00127     
00130     MatchRule matchRule() const { return mMatchRule; } 
00131    
00132   private:
00133     QStringList mCategoryList;
00134     bool mEnabled;
00135     QString mName;
00136     MatchRule mMatchRule;
00137 };
00138 
00139 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:37 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001