| # kabc Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# addressbook.h

    00001 /*
    00002     This file is part of libkabc.
    00003     Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
    00004
    00005     This library is free software; you can redistribute it and/or
    00006     modify it under the terms of the GNU Library General Public
    00007     License as published by the Free Software Foundation; either
    00008     version 2 of the License, or (at your option) any later version.
    00009
    00010     This library 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 GNU
    00013     Library General Public License for more details.
    00014
    00015     You should have received a copy of the GNU Library General Public License
    00016     along with this library; see the file COPYING.LIB.  If not, write to
    00017     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018     Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef KABC_ADDRESSBOOK_H
    00022 #define KABC_ADDRESSBOOK_H
    00023
    00024 #include <qobject.h>
    00025 #include <qptrlist.h>
    00026
    00027 #include "addressee.h"
    00028 #include "field.h"
    00029
    00030 namespace KABC {
    00031
    00032 class ErrorHandler;
    00033 class Resource;
    00034 class Ticket;
    00035
    00041 class AddressBook : public QObject
    00042 {
    00043     Q_OBJECT
    00044
    00045     friend QDataStream &operator<<( QDataStream &, const AddressBook & );
    00046     friend QDataStream &operator>>( QDataStream &, AddressBook & );
    00047     friend class StdAddressBook;
    00048
    00049   public:
    00055     class Iterator
    00056     {
    00057       public:
    00058         Iterator();
    00059         Iterator( const Iterator & );
    00060         ~Iterator();
    00061
    00062         Iterator &operator=( const Iterator & );
    00063         const Addressee &operator*() const;
    00064         Addressee &operator*();
    00065         Addressee* operator->();
    00066         Iterator &operator++();
    00067         Iterator &operator++(int);
    00068         Iterator &operator--();
    00069         Iterator &operator--(int);
    00070         bool operator==( const Iterator &it );
    00071         bool operator!=( const Iterator &it );
    00072
    00073         struct IteratorData;
    00074         IteratorData *d;
    00075     };
    00076
    00082     class ConstIterator
    00083     {
    00084       public:
    00085         ConstIterator();
    00086         ConstIterator( const ConstIterator & );
    00087         ~ConstIterator();
    00088
    00089         ConstIterator &operator=( const ConstIterator & );
    00090         const Addressee &operator*() const;
    00091         const Addressee* operator->() const;
    00092         ConstIterator &operator++();
    00093         ConstIterator &operator++(int);
    00094         ConstIterator &operator--();
    00095         ConstIterator &operator--(int);
    00096         bool operator==( const ConstIterator &it );
    00097         bool operator!=( const ConstIterator &it );
    00098
    00099         struct ConstIteratorData;
    00100         ConstIteratorData *d;
    00101     };
    00102
    00108     AddressBook();
    00109     virtual ~AddressBook();
    00110
    00119     Ticket *requestSaveTicket( Resource *resource=0 );
    00120
    00124     bool load();
    00125
    00132     bool save( Ticket *ticket );
    00133
    00137     Iterator begin();
    00138
    00142     ConstIterator begin() const;
    00143
    00147     Iterator end();
    00148
    00152     ConstIterator end() const;
    00153
    00157     void clear();
    00158
    00164     void insertAddressee( const Addressee & );
    00165
    00169     void removeAddressee( const Addressee & );
    00170
    00175     void removeAddressee( const Iterator & );
    00176
    00181     Iterator find( const Addressee & );
    00182
    00187     Addressee findByUid( const QString & );
    00188
    00193     Addressee::List findByName( const QString & );
    00194
    00199     Addressee::List findByEmail( const QString & );
    00200
    00205     Addressee::List findByCategory( const QString & );
    00206
    00210     virtual QString identifier();
    00211
    00215     void dump() const;
    00216
    00217     void emitAddressBookLocked() { emit addressBookLocked( this ); }
    00218     void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); }
    00219     void emitAddressBookChanged() { emit addressBookChanged( this ); }
    00220
    00225     Field::List fields( int category = Field::All );
    00226
    00236     bool addCustomField( const QString &label, int category = Field::All,
    00237                          const QString &key = QString::null,
    00238                          const QString &app = QString::null );
    00239
    00243     bool addResource( Resource * );
    00244
    00248     bool removeResource( Resource * );
    00249
    00253     QPtrList<Resource> resources();
    00254
    00259     void setErrorHandler( ErrorHandler * );
    00260
    00264     void error( const QString& );
    00265
    00269     void cleanUp();
    00270
    00271   signals:
    00275     void addressBookChanged( AddressBook * );
    00276
    00280     void addressBookLocked( AddressBook * );
    00281
    00285     void addressBookUnlocked( AddressBook * );
    00286
    00287   protected:
    00288     void deleteRemovedAddressees();
    00289     void setStandardResource( Resource * );
    00290     Resource *standardResource();
    00291
    00292   private:
    00293     QPtrList<Resource> mDummy; // Remove in KDE 4
    00294     struct AddressBookData;
    00295     AddressBookData *d;
    00296 };
    00297
    00298 QDataStream &operator<<( QDataStream &, const AddressBook & );
    00299 QDataStream &operator>>( QDataStream &, AddressBook & );
    00300
    00301 }
    00302
    00303 #endif

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:29:16 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001