• Skip to content
  • Skip to link menu
KDE 4.1 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 
00185         ConstIterator( const Iterator & );
00186         ~ConstIterator();
00187 
00193         ConstIterator &operator=( const ConstIterator & );
00194 
00203         const Addressee &operator*() const;
00204 
00211         const Addressee *operator->() const;
00212 
00218         ConstIterator &operator++();
00219 
00226         ConstIterator &operator++(int);
00227 
00233         ConstIterator &operator--();
00234 
00241         ConstIterator &operator--(int);
00242 
00250         bool operator==( const ConstIterator &it ) const;
00251 
00259         bool operator!=( const ConstIterator &it ) const;
00260 
00261       private:
00262         struct ConstIteratorData;
00263         ConstIteratorData *const d;
00264     };
00265 
00269     typedef Iterator iterator;
00270 
00274     typedef ConstIterator const_iterator;
00275 
00280     AddressBook();
00281 
00288     AddressBook( const QString &config );
00289 
00293     virtual ~AddressBook();
00294 
00306     Ticket *requestSaveTicket( Resource *resource = 0 );
00307 
00314     void releaseSaveTicket( Ticket *ticket );
00315 
00321     bool load();
00322 
00330     bool asyncLoad();
00331 
00339     bool save( Ticket *ticket );
00340 
00348     bool asyncSave( Ticket *ticket );
00349 
00354     ConstIterator begin() const;
00355 
00360     Iterator begin();
00361 
00366     ConstIterator end() const;
00367 
00372     Iterator end();
00373 
00377     void clear();
00378 
00386     void insertAddressee( const Addressee &addr );
00387 
00393     void removeAddressee( const Addressee &addr );
00394 
00401     void removeAddressee( const Iterator &it );
00402 
00409     Iterator find( const Addressee &addr );
00410 
00417     ConstIterator find( const Addressee &addr ) const;
00418 
00426     Addressee findByUid( const QString &uid ) const;
00427 
00431     Addressee::List allAddressees() const;
00432 
00439     Addressee::List findByName( const QString &name ) const;
00440 
00447     Addressee::List findByEmail( const QString &email ) const;
00448 
00455     Addressee::List findByCategory( const QString &category ) const;
00456 
00470     DistributionList *createDistributionList( const QString &name, Resource *resource = 0 );
00471 
00477     void removeDistributionList( DistributionList *list );
00478 
00484     DistributionList *findDistributionListByIdentifier( const QString &identifier );
00485 
00493     DistributionList *findDistributionListByName(
00494       const QString &name,
00495       Qt::CaseSensitivity caseSensitivity = Qt::CaseSensitive );
00496 
00501     QList<DistributionList*> allDistributionLists();
00502 
00510     QStringList allDistributionListNames() const;
00511 
00516     virtual QString identifier() const;
00517 
00522     Field::List fields( int category = Field::All ) const;
00523 
00533     bool addCustomField( const QString &label, int category = Field::All,
00534                          const QString &key = QString(),
00535                          const QString &app = QString() ) const;
00536 
00543     bool addResource( Resource *resource );
00544 
00551     bool removeResource( Resource *resource );
00552 
00556     QList<Resource*> resources() const;
00557 
00564     void setErrorHandler( ErrorHandler *errorHandler );
00565 
00571     void error( const QString &msg );
00572 
00577     void dump() const;
00578 
00582     void emitAddressBookLocked() { addressBookLocked( this ); }
00586     void emitAddressBookUnlocked() { addressBookUnlocked( this ); }
00590     void emitAddressBookChanged() { addressBookChanged( this ); }
00591 
00596     bool loadingHasFinished() const;
00597 
00598   Q_SIGNALS:
00607     void addressBookChanged( AddressBook *addressBook );
00608 
00614     void addressBookLocked( AddressBook *addressBook );
00615 
00624     void addressBookUnlocked( AddressBook *addressBook );
00625 
00632     void loadingFinished( Resource *resource );
00633 
00640     void savingFinished( Resource *resource );
00641 
00642   protected Q_SLOTS:
00653     void resourceLoadingFinished( Resource *resource );
00654 
00662     void resourceSavingFinished( Resource *resource );
00663 
00674     void resourceLoadingError( Resource *resource, const QString &errMsg );
00675 
00684     void resourceSavingError( Resource *resource, const QString &errMsg );
00685 
00686   protected:
00696     void setStandardResource( Resource *resource );
00697 
00705     Resource *standardResource();
00706 
00710     KRES::Manager<Resource> *resourceManager();
00711 
00712   private:
00713     class Private;
00714     Private *const d;
00715 };
00716 
00717 KABC_EXPORT QDataStream &operator<<( QDataStream &lhs, const AddressBook &rhs );
00718 KABC_EXPORT QDataStream &operator>>( QDataStream &lhs, AddressBook &rhs );
00719 
00720 }
00721 
00722 #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
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.4
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