kabc Library API Documentation

KABC::AddressBook Class Reference

Address Book. More...

#include <addressbook.h>

Inheritance diagram for KABC::AddressBook:

QObject KABC::StdAddressBook 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 Methods

 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.

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.


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

AddressBook::AddressBook (    ) 
 

Constructs a address book object.

Parameters:
format  File format class.

Definition at line 201 of file addressbook.cpp.


Member Function Documentation

Ticket * 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()

Definition at line 284 of file addressbook.cpp.

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

bool AddressBook::load (    ) 
 

Load address book from file.

Definition at line 217 of file addressbook.cpp.

References clear(), and error().

bool 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()

Definition at line 239 of file addressbook.cpp.

References KABC::Ticket::resource().

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

AddressBook::Iterator AddressBook::begin (    ) 
 

Returns a iterator for first entry of address book.

Definition at line 251 of file addressbook.cpp.

References KABC::AddressBook::Iterator::d.

Referenced by dump(), find(), findByCategory(), findByEmail(), findByName(), findByUid(), removeAddressee(), and KABC::BinaryFormat::saveAll().

AddressBook::ConstIterator AddressBook::begin (    ) 
 

Returns a const iterator for first entry of address book.

Definition at line 258 of file addressbook.cpp.

References KABC::AddressBook::ConstIterator::d.

AddressBook::Iterator AddressBook::end (    ) 
 

Returns a iterator for first entry of address book.

Definition at line 265 of file addressbook.cpp.

References KABC::AddressBook::Iterator::d.

Referenced by dump(), find(), findByCategory(), findByEmail(), findByName(), findByUid(), removeAddressee(), and KABC::BinaryFormat::saveAll().

AddressBook::ConstIterator AddressBook::end (    ) 
 

Returns a const iterator for first entry of address book.

Definition at line 272 of file addressbook.cpp.

References KABC::AddressBook::ConstIterator::d.

void AddressBook::clear (    ) 
 

Removes all entries from address book.

Definition at line 279 of file addressbook.cpp.

Referenced by load().

void 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.

Definition at line 301 of file addressbook.cpp.

References QDateTime::currentDateTime(), KABC::Addressee::resource(), KABC::Addressee::setChanged(), KABC::Addressee::setResource(), and KABC::Addressee::uid().

Referenced by KABC::BinaryFormat::loadAll().

void AddressBook::removeAddressee (  const Addressee &    ) 
 

Removes entry from the address book.

Definition at line 329 of file addressbook.cpp.

References begin(), end(), and KABC::Addressee::uid().

void AddressBook::removeAddressee (  const Iterator &    ) 
 

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

Definition at line 340 of file addressbook.cpp.

References KABC::AddressBook::Iterator::d.

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

Find the specified entry in address book.

Returns end(), if the entry couldn't be found.

Definition at line 346 of file addressbook.cpp.

References begin(), end(), and KABC::Addressee::uid().

Addressee 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.

Definition at line 357 of file addressbook.cpp.

References begin(), and end().

Referenced by KABC::DistributionListManager::load().

Addressee::List 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.

Definition at line 368 of file addressbook.cpp.

References QValueList< Addressee >::append(), begin(), and end().

Addressee::List 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.

Definition at line 382 of file addressbook.cpp.

References QValueList< Addressee >::append(), begin(), and end().

Addressee::List 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.

Definition at line 400 of file addressbook.cpp.

References QValueList< Addressee >::append(), begin(), and end().

QString AddressBook::identifier (    )  [virtual]
 

Return a string identifying this addressbook.

Definition at line 426 of file addressbook.cpp.

References identifier().

Referenced by identifier(), KABC::DistributionListManager::load(), and KABC::DistributionListManager::save().

void AddressBook::dump (    ) 
 

Used for debug output.

Definition at line 414 of file addressbook.cpp.

References begin(), and end().

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

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

Definition at line 438 of file addressbook.cpp.

References QValueList< Field * >::append().

bool 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.

Definition at line 455 of file addressbook.cpp.

References KGlobal::instance(), KInstance::instanceName(), QString::isNull(), KStdAccel::key(), and KStdAccel::label().

bool AddressBook::addResource (  Resource *    ) 
 

Add address book resource.

Definition at line 490 of file addressbook.cpp.

bool AddressBook::removeResource (  Resource *    ) 
 

Remove address book resource.

Definition at line 501 of file addressbook.cpp.

QPtrList< Resource > AddressBook::resources (    ) 
 

Return pointer list of all resources.

Definition at line 509 of file addressbook.cpp.

Referenced by KABC::ResourceSelectDialog::getResource(), KABC::ResourceSelectDialog::ResourceSelectDialog(), and KABC::StdAddressBook::save().

void AddressBook::setErrorHandler (  ErrorHandler *    ) 
 

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

Definition at line 514 of file addressbook.cpp.

void AddressBook::error (  const QString &    ) 
 

Shows gui independend error messages.

Definition at line 520 of file addressbook.cpp.

Referenced by load(), and KABC::StdAddressBook::save().

void AddressBook::cleanUp (    ) 
 

Query all resources to clean up their lock files.

Definition at line 553 of file addressbook.cpp.

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 files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.3.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Feb 28 02:51:53 2004 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001