kaddressbook Library API Documentation

filter.h

00001 /*                                                                      
00002     This file is part of KAddressBook.                                  
00003     Copyright (c) 2002 Mike Pilone <mpilone@slac.com>                   
00004                                                                         
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or   
00008     (at your option) any later version.                                 
00009                                                                         
00010     This program is distributed in the hope that it will be useful,     
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of      
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the        
00013     GNU General Public License for more details.                        
00014                                                                         
00015     You should have received a copy of the GNU General Public License   
00016     along with this program; if not, write to the Free Software         
00017     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           
00018                                                                         
00019     As a special exception, permission is given to link this program    
00020     with any edition of Qt, and distribute the resulting executable,    
00021     without including the source code for Qt in the source distribution.
00022 */                                                                      
00023 
00024 #ifndef FILTER_H
00025 #define FILTER_H
00026 
00027 #include <qstring.h>
00028 #include <qstringlist.h>
00029 #include <qvaluelist.h>
00030 
00031 #include <kabc/addressee.h>
00032 #include <kconfig.h>
00033 
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 QString& name );
00048     ~Filter();
00049 
00053     void setName( const QString &name );
00054 
00058     const QString &name() const;
00059 
00063     bool isInternal() const;
00064     
00072     void apply( KABC::Addressee::List &addresseeList );
00073     
00080     bool filterAddressee( const KABC::Addressee &a );
00081     
00085     void setEnabled( bool on );
00086     
00090     bool isEnabled() const;
00091     
00095     void setCategories( const QStringList &list );
00096     
00100     const QStringList &categories() const;
00101     
00105     void save( KConfig *config );
00106     
00110     void restore( KConfig *config );
00111     
00121     static void save( KConfig *config, QString baseGroup, Filter::List &list );
00122     
00131     static Filter::List restore( KConfig *config, QString baseGroup );
00132     
00139     void setMatchRule( MatchRule rule );
00140     
00143     MatchRule matchRule() const;
00144    
00145   private:
00146     QString mName;
00147     QStringList mCategoryList;
00148     MatchRule mMatchRule;
00149     bool mEnabled;
00150     bool mInternal;
00151 };
00152 
00153 #endif
KDE Logo
This file is part of the documentation for kaddressbook Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:38:51 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003