kaddressbook

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 Qt, and distribute the resulting executable,
00021     without including the source code for Qt 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 <qobject.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 QObject
00038 {
00039   Q_OBJECT
00040 
00041   public:
00042     enum Type {
00043       StartsWith,
00044       EndsWith,
00045       Contains,
00046       Equals
00047     };
00048 
00049     SearchManager( KABC::AddressBook *ab,
00050                    QObject *parent, const char *name = 0 );
00051 
00061     void search( const QString &pattern, const KABC::Field::List &fields, Type type = Contains );
00062 
00066     KABC::Addressee::List contacts() const;
00067 
00068 
00069 #ifdef KDEPIM_NEW_DISTRLISTS
00070 
00073     KPIM::DistributionList::List distributionLists() const;
00074 
00078     QStringList distributionListNames() const;
00079 #endif
00080 
00081   signals:
00085     void contactsUpdated();
00086 
00087   public slots:
00088     void reload();
00089 
00090   private:
00091     KABC::Addressee::List mContacts;
00092 #ifdef KDEPIM_NEW_DISTRLISTS
00093     KPIM::DistributionList::List mDistributionLists;
00094 #endif
00095     KABC::AddressBook *mAddressBook;
00096 
00097     QString mPattern;
00098     KABC::Field::List mFields;
00099     Type mType;
00100 };
00101 
00102 }
00103 
00104 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys