searchmanager.h
00001 /* 00002 This file is part of KAddressBook. 00003 Copyright (c) 2004 Tobias Koenig <tokoe@kde.org> 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00018 00019 As a special exception, permission is given to link this program 00020 with any edition of TQt, and distribute the resulting executable, 00021 without including the source code for TQt in the source distribution. 00022 */ 00023 00024 #ifndef SEARCHMANAGER_H 00025 #define SEARCHMANAGER_H 00026 00027 #include <config.h> // for KDEPIM_NEW_DISTRLISTS 00028 #include <tqobject.h> 00029 00030 #include <kabc/stdaddressbook.h> 00031 #ifdef KDEPIM_NEW_DISTRLISTS 00032 #include <libkdepim/distributionlist.h> 00033 #endif 00034 00035 namespace KAB { 00036 00037 class SearchManager : public TQObject 00038 { 00039 Q_OBJECT 00040 TQ_OBJECT 00041 00042 public: 00043 enum Type { 00044 StartsWith, 00045 EndsWith, 00046 Contains, 00047 Equals 00048 }; 00049 00050 SearchManager( KABC::AddressBook *ab, 00051 TQObject *parent, const char *name = 0 ); 00052 00062 void search( const TQString &pattern, const KABC::Field::List &fields, Type type = Contains ); 00063 00067 KABC::Addressee::List contacts() const; 00068 00069 00070 #ifdef KDEPIM_NEW_DISTRLISTS 00071 00074 void setSelectedDistributionList( const TQString &name ); 00075 00079 KPIM::DistributionList::List distributionLists() const; 00080 00084 TQStringList distributionListNames() const; 00085 #endif 00086 00087 signals: 00091 void contactsUpdated(); 00092 00093 public slots: 00094 void reload(); 00095 00096 private: 00097 KABC::Addressee::List mContacts; 00098 #ifdef KDEPIM_NEW_DISTRLISTS 00099 TQString mSelectedDistributionList; 00100 KPIM::DistributionList::List mDistributionLists; 00101 #endif 00102 KABC::AddressBook *mAddressBook; 00103 00104 TQString mPattern; 00105 KABC::Field::List mFields; 00106 Type mType; 00107 }; 00108 00109 } 00110 00111 #endif