# kabc Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | 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 *)
| Emitted, when the address book has changed on disk.
void | addressBookLocked (AddressBook *)
| Emitted, when the address book has been locked for writing.
void | addressBookUnlocked (AddressBook *)
| Emitted, when the address book has been unlocked.

## Public Member Functions

| AddressBook ()
| Constructs a address book object.
Ticket * | requestSaveTicket (Resource *resource=0)
| Requests a ticket for saving the addressbook.
bool | load ()
| Load address book from file.
bool | save (Ticket *ticket)
| Save address book.
Iterator | begin ()
| Returns a iterator for first entry of address book.
ConstIterator | begin () const
| Returns a const iterator for first entry of address book.
Iterator | end ()
| Returns a iterator for first entry of address book.
ConstIterator | end () const
| Returns a const iterator for first entry of address book.
void | clear ()
| Removes all entries from address book.
void | insertAddressee (const Addressee &)
| Insert an Addressee object into address book.
void | removeAddressee (const Addressee &)
| Removes entry from the address book.
void | removeAddressee (const Iterator &)
| This is like removeAddressee() just above, with the difference that the first element is a iterator, returned by begin().
Iterator | find (const Addressee &)
| Find the specified entry in address book.
Addressee | findByUid (const QString &)
| Find the entry specified by an unique id.
Addressee::List | findByName (const QString &)
| Find all entries with the specified name in the address book.
Addressee::List | findByEmail (const QString &)
| Find all entries with the specified email address in the address book.
Addressee::List | findByCategory (const QString &)
| Find all entries wich have the specified category in the address book.
virtual QString | identifier ()
| Return a string identifying this addressbook.
void | dump () const
| Used for debug output.
void | emitAddressBookLocked ()
void | emitAddressBookUnlocked ()
void | emitAddressBookChanged ()
Field::List | fields (int category=Field::All)
| Return list of all Fields known to the address book which are associated with the given field category.
bool | addCustomField (const QString &label, int category=Field::All, const QString &key=QString::null, const QString &app=QString::null)
| Add custom field to address book.
bool | addResource (Resource *)
| Add address book resource.
bool | removeResource (Resource *)
| Remove address book resource.
QPtrList< Resource > | resources ()
| Return pointer list of all resources.
void | setErrorHandler (ErrorHandler *)
| Set the `ErrorHandler`, that is used by error() to provide gui-independend error messages.
void | error (const QString &)
| Shows gui independend error messages.
void | cleanUp ()
| Query all resources to clean up their lock files.

## Protected Member Functions

void | deleteRemovedAddressees ()
void | setStandardResource (Resource *)
Resource * | standardResource ()

## Friends

class | StdAddressBook
Q_OBJECT friend QDataStream & | operator<< (QDataStream &, const AddressBook &)
QDataStream & | operator>> (QDataStream &, AddressBook &)

## Detailed Description

Address Book.

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

Definition at line 41 of file addressbook.h.

## Constructor & Destructor Documentation

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

Constructs a address book object.

Parameters:

  format | File format class.

## 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. If the address book is already locked the function returns 0. You need the returned Ticket object for calling the save() function.

See also:
  save()

Referenced by KABC::StdAddressBook::save().

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

| Load address book from file.

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

Save address book.

The address book is saved to the file, the Ticket object has been requested for by requestSaveTicket().

Parameters:

  ticket | a ticket object returned by requestSaveTicket()

Referenced by KABC::StdAddressBook::save().

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

| Returns a iterator for first entry of address book. Referenced by KABC::BinaryFormat::saveAll().

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

| Returns a const iterator for first entry of address book.

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

| Returns a iterator for first entry of address book. Referenced by KABC::BinaryFormat::saveAll().

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

| Returns a const iterator for first entry of address book.

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

| Removes all entries from address book.

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

| Insert an Addressee object into address book. If an object with the same unique id already exists in the address book it it replaced by the new one. If not the new object is appended to the address book. Referenced by KABC::BinaryFormat::loadAll().

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

| Removes entry from the address book.

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

| This is like removeAddressee() just above, with the difference that the first element is a iterator, returned by begin().

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

| Find the specified entry in address book. Returns end(), if the entry couldn't be found.

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

| Find the entry specified by an unique id. Returns an empty Addressee object, if the address book does not contain an entry with this id. Referenced by KABC::DistributionListManager::load().

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

| Find all entries with the specified name in the address book. Returns an empty list, if no entries couldn't be found.

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

| Find all entries with the specified email address in the address book. Returns an empty list, if no entries couldn't be found.

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

| Find all entries wich have the specified category in the address book. Returns an empty list, if no entries couldn't be found.

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

| Return a string identifying this addressbook. Referenced by KABC::DistributionListManager::load(), and KABC::DistributionListManager::save().

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

| Used for debug output.

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

| Return 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 * |  | ) |

| Add address book resource.

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

| Remove address book resource.

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

| Return pointer list of all resources. Referenced by KABC::ResourceSelectDialog::getResource(), KABC::ResourceSelectDialog::ResourceSelectDialog(), and KABC::StdAddressBook::save().

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

| Set the `ErrorHandler`, that is used by error() to provide gui-independend error messages.

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

| Shows gui independend error messages. Referenced by KABC::StdAddressBook::save().

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

| Query all resources to clean up their lock files.

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

| Emitted, when the address book has changed on disk.

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

| Emitted, when the address book has been locked for writing.

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

| Emitted, when the address book has been unlocked.

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

- addressbook.h

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:26 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001