kabc Library API Documentation

resource.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_RESOURCE_H 00022 #define KABC_RESOURCE_H 00023 00024 #include <kresources/resource.h> 00025 00026 #include "addressbook.h" 00027 #include "plugin.h" 00028 00029 namespace KABC { 00030 00037 class Ticket 00038 { 00039 friend class Resource; 00040 00041 public: 00042 ~Ticket(); 00043 00044 Resource *resource(); 00045 00046 private: 00047 Ticket( Resource *resource ); 00048 00049 Resource *mResource; 00050 }; 00051 00055 class Resource : public KRES::Resource 00056 { 00057 Q_OBJECT 00058 00059 public: 00060 00068 class Iterator 00069 { 00070 public: 00071 Iterator(); 00072 Iterator( const Iterator & ); 00073 virtual ~Iterator(); 00074 00075 virtual Iterator &operator=( const Iterator & ); 00076 virtual const Addressee &operator*() const; 00077 virtual Addressee &operator*(); 00078 virtual Iterator &operator++(); 00079 virtual Iterator &operator++( int ); 00080 virtual Iterator &operator--(); 00081 virtual Iterator &operator--( int ); 00082 virtual bool operator==( const Iterator &it ); 00083 virtual bool operator!=( const Iterator &it ); 00084 00085 struct IteratorData; 00086 IteratorData *d; 00087 }; 00088 00094 class ConstIterator 00095 { 00096 public: 00097 ConstIterator(); 00098 ConstIterator( const ConstIterator & ); 00099 ConstIterator( const Iterator & ); 00100 virtual ~ConstIterator(); 00101 00102 virtual ConstIterator &operator=( const ConstIterator & ); 00103 virtual const Addressee &operator*() const ; 00104 virtual ConstIterator &operator++(); 00105 virtual ConstIterator &operator++( int ); 00106 virtual ConstIterator &operator--(); 00107 virtual ConstIterator &operator--( int ); 00108 virtual bool operator==( const ConstIterator &it ); 00109 virtual bool operator!=( const ConstIterator &it ); 00110 00111 struct ConstIteratorData; 00112 ConstIteratorData *d; 00113 }; 00114 00121 Resource( const KConfig *config ); 00122 00126 virtual ~Resource(); 00127 00132 virtual ConstIterator begin() const; 00133 00138 virtual Iterator begin(); 00139 00144 virtual ConstIterator end() const; 00145 00150 virtual Iterator end(); 00151 00155 AddressBook *addressBook(); 00156 00160 virtual void writeConfig( KConfig *config ); 00161 00167 virtual Ticket *requestSaveTicket() = 0; 00168 00174 virtual void releaseSaveTicket( Ticket* ) = 0; 00175 00181 virtual bool load() = 0; 00182 00192 virtual bool asyncLoad(); 00193 00197 virtual void insertAddressee( const Addressee& ); 00198 00202 virtual void removeAddressee( const Addressee& addr ); 00203 00211 virtual bool save( Ticket *ticket ) = 0; 00212 00224 virtual bool asyncSave( Ticket *ticket ); 00225 00233 virtual Addressee findByUid( const QString &uid ); 00234 00241 virtual Addressee::List findByName( const QString &name ); 00242 00249 virtual Addressee::List findByEmail( const QString &email ); 00250 00257 virtual Addressee::List findByCategory( const QString &category ); 00258 00262 virtual void clear(); 00263 00269 void setAddressBook( AddressBook* ); 00270 00271 signals: 00278 void loadingFinished( Resource *resource ); 00279 00287 void loadingError( Resource *resource, const QString &msg ); 00288 00295 void savingFinished( Resource *resource ); 00296 00304 void savingError( Resource *resource, const QString &msg ); 00305 00306 protected: 00307 Ticket *createTicket( Resource * ); 00308 Addressee::Map mAddrMap; 00309 00310 private: 00311 AddressBook *mAddressBook; 00312 00313 class ResourcePrivate; 00314 ResourcePrivate *d; 00315 }; 00316 00317 } 00318 00319 #endif
KDE Logo
This file is part of the documentation for kabc Library Version 3.3.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 17 11:33:00 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003