• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

kabc

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., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef KABC_ADDRESSBOOK_H
00022 #define KABC_ADDRESSBOOK_H
00023 
00024 #include "addressee.h"
00025 #include "field.h"
00026 
00027 #include "kresources/manager.h"
00028 
00029 #include <QtCore/QObject>
00030 #include <QtCore/QList>
00031 
00032 namespace KABC {
00033 
00034 class DistributionList;
00035 class ErrorHandler;
00036 class Resource;
00037 class Ticket;
00038 
00044 class KABC_EXPORT AddressBook : public QObject
00045 {
00046   Q_OBJECT
00047 
00048   friend KABC_EXPORT QDataStream &operator<<( QDataStream &lhs,
00049                                               const AddressBook &rhs );
00050   friend KABC_EXPORT QDataStream &operator>>( QDataStream &lhs,
00051                                               AddressBook &rhs );
00052   friend class StdAddressBook;
00053 
00054   public:
00055     class ConstIterator;
00056 
00062     class KABC_EXPORT Iterator  //krazy:exclude=dpointer
00063     {
00064       friend class AddressBook;
00065       friend class ConstIterator;
00066       public:
00070         Iterator();
00071 
00075         Iterator( const Iterator & );
00076         ~Iterator();
00077 
00083         Iterator &operator=( const Iterator & );
00084 
00091         const Addressee &operator*() const;
00092 
00099         Addressee &operator*();
00100 
00107         Addressee *operator->();
00108 
00114         Iterator &operator++();
00115 
00122         Iterator &operator++(int);
00123 
00129         Iterator &operator--();
00130 
00137         Iterator &operator--(int);
00138 
00146         bool operator==( const Iterator &it ) const;
00147 
00155         bool operator!=( const Iterator &it ) const;
00156 
00157       private:
00158         struct IteratorData;
00159         IteratorData *const d;
00160     };
00161 
00167     class KABC_EXPORT ConstIterator //krazy:exclude=dpointer
00168     {
00169       friend class AddressBook;
00170       public:
00174         ConstIterator();
00175 
00179         ConstIterator( const ConstIterator & );
00180 
00181 #ifndef QT_STRICT_ITERATORS
00182 
00186         ConstIterator( const Iterator & );
00187 #endif
00188 
00189         ~ConstIterator();
00190 
00196         ConstIterator &operator=( const ConstIterator & );
00197 
00206         const Addressee &operator*() const;
00207 
00214         const Addressee *operator->() const;
00215 
00221         ConstIterator &operator++();
00222 
00229         ConstIterator &operator++(int);
00230 
00236         ConstIterator &operator--();
00237 
00244         ConstIterator &operator--(int);
00245 
00253         bool operator==( const ConstIterator &it ) const;
00254 
00262         bool operator!=( const ConstIterator &it ) const;
00263 
00264       private:
00265         struct ConstIteratorData;
00266         ConstIteratorData *const d;
00267     };
00268 
00272     typedef Iterator iterator;
00273 
00277     typedef ConstIterator const_iterator;
00278 
00283     AddressBook();
00284 
00291     AddressBook( const QString &config );
00292 
00296     virtual ~AddressBook();
00297 
00309     Ticket *requestSaveTicket( Resource *resource = 0 );
00310 
00317     void releaseSaveTicket( Ticket *ticket );
00318 
00324     bool load();
00325 
00333     bool asyncLoad();
00334 
00342     bool save( Ticket *ticket );
00343 
00351     bool asyncSave( Ticket *ticket );
00352 
00357     ConstIterator begin() const;
00358     ConstIterator constBegin() const { return begin(); }
00359 
00364     Iterator begin();
00365 
00370     ConstIterator end() const;
00371     ConstIterator constEnd() const { return end(); }
00372 
00377     Iterator end();
00378 
00382     void clear();
00383 
00391     void insertAddressee( const Addressee &addr );
00392 
00398     void removeAddressee( const Addressee &addr );
00399 
00406     void removeAddressee( const Iterator &it );
00407 
00414     Iterator find( const Addressee &addr );
00415 
00422     ConstIterator find( const Addressee &addr ) const;
00423 
00431     Addressee findByUid( const QString &uid ) const;
00432 
00436     Addressee::List allAddressees() const;
00437 
00444     Addressee::List findByName( const QString &name ) const;
00445 
00452     Addressee::List findByEmail( const QString &email ) const;
00453 
00460     Addressee::List findByCategory( const QString &category ) const;
00461 
00475     DistributionList *createDistributionList( const QString &name, Resource *resource = 0 );
00476 
00482     void removeDistributionList( DistributionList *list );
00483 
00489     DistributionList *findDistributionListByIdentifier( const QString &identifier );
00490 
00498     DistributionList *findDistributionListByName(
00499       const QString &name,
00500       Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive );
00501 
00506     QList<DistributionList*> allDistributionLists();
00507 
00515     QStringList allDistributionListNames() const;
00516 
00521     virtual QString identifier() const;
00522 
00527     Field::List fields( int category = Field::All ) const;
00528 
00538     bool addCustomField( const QString &label, int category = Field::All,
00539                          const QString &key = QString(),
00540                          const QString &app = QString() ) const;
00541 
00548     bool addResource( Resource *resource );
00549 
00556     bool removeResource( Resource *resource );
00557 
00561     QList<Resource*> resources() const;
00562 
00569     void setErrorHandler( ErrorHandler *errorHandler );
00570 
00576     void error( const QString &msg );
00577 
00582     void dump() const;
00583 
00587     void emitAddressBookLocked() { addressBookLocked( this ); }
00591     void emitAddressBookUnlocked() { addressBookUnlocked( this ); }
00595     void emitAddressBookChanged() { addressBookChanged( this ); }
00596 
00601     bool loadingHasFinished() const;
00602 
00603   Q_SIGNALS:
00612     void addressBookChanged( AddressBook *addressBook );
00613 
00619     void addressBookLocked( AddressBook *addressBook );
00620 
00629     void addressBookUnlocked( AddressBook *addressBook );
00630 
00637     void loadingFinished( Resource *resource );
00638 
00645     void savingFinished( Resource *resource );
00646 
00647   protected Q_SLOTS:
00658     void resourceLoadingFinished( Resource *resource );
00659 
00667     void resourceSavingFinished( Resource *resource );
00668 
00679     void resourceLoadingError( Resource *resource, const QString &errMsg );
00680 
00689     void resourceSavingError( Resource *resource, const QString &errMsg );
00690 
00691   protected:
00701     void setStandardResource( Resource *resource );
00702 
00710     Resource *standardResource();
00711 
00715     KRES::Manager<Resource> *resourceManager();
00716 
00717   private:
00718     class Private;
00719     Private *const d;
00720 };
00721 
00722 KABC_EXPORT QDataStream &operator<<( QDataStream &lhs, const AddressBook &rhs );
00723 KABC_EXPORT QDataStream &operator>>( QDataStream &lhs, AddressBook &rhs );
00724 
00725 }
00726 
00727 #endif

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal