kabc Library: KABC::AddressBook Class Reference (kabc Library)

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

# KABC::AddressBook Class Reference

Address Book. More...

`#include <addressbook.h>`

Inheritance diagram for KABC::AddressBook:

[legend]
Collaboration diagram for KABC::AddressBook:

[legend]
List of all members.

## Signals
void | addressBookChanged (AddressBook *addressBook)
void | addressBookLocked (AddressBook *addressBook)
void | addressBookUnlocked (AddressBook *addressBook)
void | loadingFinished (Resource *resource)
void | savingFinished (Resource *resource)
## Public Member Functions
| AddressBook ()
| AddressBook (const QString &config)
virtual | ~AddressBook ()
Ticket * | requestSaveTicket (Resource *resource=0)
void | releaseSaveTicket (Ticket *ticket)
bool | load ()
bool | asyncLoad ()
bool | save (Ticket *ticket)
bool | asyncSave (Ticket *ticket)
ConstIterator | begin () const
Iterator | begin ()
ConstIterator | end () const
Iterator | end ()
void | clear ()
void | insertAddressee (const Addressee &addr)
void | removeAddressee (const Addressee &addr)
void | removeAddressee (const Iterator &it)
Iterator | find (const Addressee &addr)
Addressee | findByUid (const QString &uid)
Addressee::List | allAddressees ()
Addressee::List | findByName (const QString &name)
Addressee::List | findByEmail (const QString &email)
Addressee::List | findByCategory (const QString &category)
virtual QString | identifier ()
Field::List | fields (int category=Field::All)
bool | addCustomField (const QString &label, int category=Field::All, const QString &key=QString::null, const QString &app=QString::null)
bool | addResource (Resource *resource)
bool | removeResource (Resource *resource)
QPtrList< Resource > | resources ()
void | setErrorHandler (ErrorHandler *errorHandler)
void | error (const QString &msg)
void | cleanUp () KDE_DEPRECATED
void | dump () const
void | emitAddressBookLocked ()
void | emitAddressBookUnlocked ()
void | emitAddressBookChanged ()
## Protected Slots
void | resourceLoadingFinished (Resource *)
void | resourceSavingFinished (Resource *)
void | resourceLoadingError (Resource *, const QString &)
void | resourceSavingError (Resource *, const QString &)
## Protected Member Functions
void | deleteRemovedAddressees ()
void | setStandardResource (Resource *)
Resource * | standardResource ()
KRES::Manager< Resource > * | resourceManager ()
## Friends
class | StdAddressBook
KABC_EXPORT QDataStream & | operator<< (QDataStream &, const AddressBook &)
KABC_EXPORT QDataStream & | operator>> (QDataStream &, AddressBook &)
## Classes
class | ConstIterator
| Address Book Const Iterator. More...
class | Iterator
| Address Book Iterator. More...

## Detailed Description

Address Book.

This class provides access to a collection of address book entries.

Definition at line 43 of file addressbook.h.

## Constructor & Destructor Documentation

KABC::AddressBook::AddressBook | ( |  | ) |

| Constructs an address book object. You have to add the resources manually before calling load().

KABC::AddressBook::AddressBook | ( | const QString & | config | ) |

  | Constructs an address book object. The resources are loaded automatically. Parameters:
  | config | The config file which contains the resource settings.

virtual KABC::AddressBook::~AddressBook | ( |  | ) | `[virtual]`

| Destructor.

## Member Function Documentation

Ticket* KABC::AddressBook::requestSaveTicket | ( | Resource * | resource = `0` | ) |

  | Requests a ticket for saving the addressbook. Calling this function locks the addressbook for all other processes. You need the returned ticket object for calling the save() function. Parameters:
  | resource | A pointer to the resource which shall be locked. If 0, the default resource is locked.
Returns: 0 if the resource is already locked or a valid save ticket otherwise. See also: save()

void KABC::AddressBook::releaseSaveTicket | ( | Ticket * | ticket | ) |

| Releases the ticket requested previously with requestSaveTicket(). Call this function, if you want to release a ticket without saving.

bool KABC::AddressBook::load | ( |  | ) |

| Loads all addressees synchronously. Returns: Whether the loading was successfully.

bool KABC::AddressBook::asyncLoad | ( |  | ) |

| Loads all addressees asynchronously. This function returns immediately and emits the addressBookChanged() signal as soon as the loading has finished. Returns: Whether the synchronous part of loading was successfully.

bool KABC::AddressBook::save | ( | Ticket * | ticket | ) |

  | Saves all addressees of one resource synchronously. If the save is successfull the ticket is deleted. Parameters:
  | ticket | The ticket returned by requestSaveTicket().
Returns: Whether the saving was successfully.

bool KABC::AddressBook::asyncSave | ( | Ticket * | ticket | ) |

  | Saves all addressees of one resource asynchronously. If the save is successfull the ticket is deleted. Parameters:
  | ticket | The ticket returned by requestSaveTicket().
Returns: Whether the synchronous part of saving was successfully.

ConstIterator KABC::AddressBook::begin | ( |  | ) | const

| Returns an iterator pointing to the first addressee of address book. This iterator equals end() if the address book is empty.

Iterator KABC::AddressBook::begin | ( |  | ) |

| This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

ConstIterator KABC::AddressBook::end | ( |  | ) | const

| Returns an iterator pointing to the last addressee of address book. This iterator equals begin() if the address book is empty.

Iterator KABC::AddressBook::end | ( |  | ) |

| This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

void KABC::AddressBook::clear | ( |  | ) |

| Removes all addressees from the address book.

void KABC::AddressBook::insertAddressee | ( | const Addressee & | addr | ) |

  | Insert an addressee into the address book. If an addressee with the same unique id already exists, it is replaced by the new one, otherwise it is appended. Parameters:
  | addr | The addressee which shall be insert.

void KABC::AddressBook::removeAddressee | ( | const Addressee & | addr | ) |

  | Removes an addressee from the address book. Parameters:
  | addr | The addressee which shall be removed.

void KABC::AddressBook::removeAddressee | ( | const Iterator & | it | ) |

  | This is an overloaded member function, provided for convenience. It behaves essentially like the above function. Parameters:
  | it | An iterator pointing to the addressee which shall be removed.

Iterator KABC::AddressBook::find | ( | const Addressee & | addr | ) |

  | Returns an iterator pointing to the specified addressee. It will return end() if no addressee matched. Parameters:
  | addr | The addresee you are looking for.

Addressee KABC::AddressBook::findByUid | ( | const QString & | uid | ) |

  | Searches an addressee with the specified unique identifier. Parameters:
  | uid | The unique identifier you are looking for.
Returns: The addressee with the specified unique identifier or an empty addressee. Referenced by KABC::StdAddressBook::whoAmI().

Addressee::List KABC::AddressBook::allAddressees | ( |  | ) |

| Returns a list of all addressees in the address book.

Addressee::List KABC::AddressBook::findByName | ( | const QString & | name | ) |

  | Searches all addressees which match the specified name. Parameters:
  | name | The name you are looking for.
Returns: A list of all matching addressees.

Addressee::List KABC::AddressBook::findByEmail | ( | const QString & | email | ) |

  | Searches all addressees which match the specified email address. Parameters:
  | email | The email address you are looking for.
Returns: A list of all matching addressees.

Addressee::List KABC::AddressBook::findByCategory | ( | const QString & | category | ) |

  | Searches all addressees which belongs to the specified category. Parameters:
  | category | The category you are looking for.
Returns: A list of all matching addressees.

virtual QString KABC::AddressBook::identifier | ( |  | ) | `[virtual]`

| Returns a string identifying this addressbook. The identifier is created by concatenation of the resource identifiers.

Field::List KABC::AddressBook::fields | ( | int | category = `Field::All` | ) |

| Returns a list of all Fields known to the address book which are associated with the given field category.

bool KABC::AddressBook::addCustomField | ( | const QString & | label,
|  | int | category = `Field::All`,
|  | const QString & | key = `QString::null`,
|  | const QString & | app = `QString::null`
| ) |

  | Add custom field to address book. Parameters:
  | label | User visible label of the field.
  | category | Ored list of field categories.
  | key | Identifier used as key for reading and writing the field.
  | app | String used as application key for reading and writing the field.

bool KABC::AddressBook::addResource | ( | Resource * | resource | ) |

  | Adds a resource to the address book. Parameters:
  | resource | The resource you want to add.
Returns: Whether opening the resource was successfully.

bool KABC::AddressBook::removeResource | ( | Resource * | resource | ) |

  | Removes a resource from the address book. Parameters:
  | resource | The resource you want to remove.
Returns: Whether closing the resource was successfully.

QPtrList<Resource> KABC::AddressBook::resources | ( |  | ) |

| Returns a list of all resources.

void KABC::AddressBook::setErrorHandler | ( | ErrorHandler * | errorHandler | ) |

  | Sets the `ErrorHandler`, that is used by error() to provide GUI independent error messages. Parameters:
  | errorHandler | The error handler you want to use.

void KABC::AddressBook::error | ( | const QString & | msg | ) |

  | Shows GUI independent error messages. Parameters:
  | msg | The error message that shall be displayed.

void KABC::AddressBook::cleanUp | ( |  | ) |

| Deprecated: There is no need to call this function anymore.

void KABC::AddressBook::dump | ( |  | ) | const

| Used for debug output. This function prints out the list of all addressees to kdDebug(5700).

void KABC::AddressBook::addressBookChanged | ( | AddressBook * | addressBook | ) | `[signal]`

  | Emitted when one of the resources discovered a change in its backend or the asynchronous loading of all resources has finished. You should connect to this signal to update the presentation of the contact data in your application. Parameters:
  | addressBook | The address book which emitted this signal.

void KABC::AddressBook::addressBookLocked | ( | AddressBook * | addressBook | ) | `[signal]`

  | Emitted when one of the resources has been locked for writing. Parameters:
  | addressBook | The address book which emitted this signal.

void KABC::AddressBook::addressBookUnlocked | ( | AddressBook * | addressBook | ) | `[signal]`

  | Emitted when one of the resources has been unlocked. You should connect to this signal if you want to save your changes to a resource which is currently locked, and want to get notified when saving is possible again. Parameters:
  | addressBook | The address book which emitted this signal.

void KABC::AddressBook::loadingFinished | ( | Resource * | resource | ) | `[signal]`

  | Emitted when the asynchronous loading of one resource has finished after calling asyncLoad(). Parameters:
  | resource | The resource which emitted this signal.

void KABC::AddressBook::savingFinished | ( | Resource * | resource | ) | `[signal]`

  | Emitted when the asynchronous saving of one resource has finished after calling asyncSave(). Parameters:
  | resource | The resource which emitted this signal.

The documentation for this class was generated from the following file:

- addressbook.h

This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:31:35 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003