kabc Library API Documentation

KABC::ResourceDir Class Reference

Inheritance diagram for KABC::ResourceDir:

KABC::Resource List of all members.

Public Member Functions

 ResourceDir (const KConfig *)
 ResourceDir (const QString &path, const QString &type="vcard")
 ~ResourceDir ()
virtual void writeConfig (KConfig *)
virtual bool doOpen ()
virtual void doClose ()
virtual TicketrequestSaveTicket ()
virtual void releaseSaveTicket (Ticket *)
virtual bool load ()
virtual bool asyncLoad ()
virtual bool save (Ticket *)
virtual bool asyncSave (Ticket *)
void setPath (const QString &)
QString path () const
void setFormat (const QString &format)
QString format () const
virtual void removeAddressee (const Addressee &addr)

Protected Slots

void pathChanged ()

Protected Member Functions

void init (const QString &path, const QString &format)

Detailed Description

Definition at line 41 of file resourcedir.h.


Member Function Documentation

void ResourceDir::writeConfig KConfig  )  [virtual]
 

Writes the resource specific config to file.

Reimplemented from KABC::Resource.

Definition at line 103 of file resourcedir.cpp.

References KConfigBase::deleteEntry(), KABC::StdAddressBook::directoryName(), KABC::Resource::writeConfig(), KConfigBase::writeEntry(), and KConfigBase::writePathEntry().

Ticket * ResourceDir::requestSaveTicket  )  [virtual]
 

Request a ticket, you have to pass through save() to allow locking.

The resource has to create its locks in this function.

Implements KABC::Resource.

Definition at line 115 of file resourcedir.cpp.

References KABC::Resource::addressBook(), KABC::AddressBook::emitAddressBookLocked(), endl(), KABC::Lock::error(), KABC::AddressBook::error(), kdDebug(), and KABC::Lock::lock().

void ResourceDir::releaseSaveTicket Ticket  )  [virtual]
 

Releases the ticket previousely requested with requestSaveTicket().

The resource has to remove its locks in this function. This function is also responsible for deleting the ticket.

Implements KABC::Resource.

Definition at line 136 of file resourcedir.cpp.

bool ResourceDir::load  )  [virtual]
 

Loads all addressees synchronously.

Returns:
Whether the loading was successfully.

Implements KABC::Resource.

Definition at line 171 of file resourcedir.cpp.

References KABC::Resource::addressBook(), QFile::close(), endl(), QDir::entryList(), KABC::AddressBook::error(), kdDebug(), KABC::FormatPlugin::loadAll(), QFile::name(), and QFile::open().

Referenced by asyncLoad(), and pathChanged().

bool ResourceDir::asyncLoad  )  [virtual]
 

Loads all addressees asyncronously.

You have to make sure that either the loadingFinished() or loadingError() signal is emitted from within this function.

The default implementation simply calls the synchronous load.

Returns:
Whether the synchronous part of loading was successfully.

Reimplemented from KABC::Resource.

Definition at line 200 of file resourcedir.cpp.

References load(), KABC::Resource::loadingError(), and KABC::Resource::loadingFinished().

Referenced by pathChanged().

bool ResourceDir::save Ticket  )  [virtual]
 

Saves all addressees synchronously.

Parameters:
ticket You have to release the ticket later with releaseSaveTicket() explicitely.
Returns:
Whether the saving was successfully.

Implements KABC::Resource.

Definition at line 214 of file resourcedir.cpp.

References KABC::Resource::addressBook(), QMap::begin(), QFile::close(), QMap::end(), endl(), KABC::AddressBook::error(), QMap< QString, Addressee >::Iterator(), kdDebug(), KABC::Resource::mAddrMap, QFile::name(), QFile::open(), and KABC::FormatPlugin::save().

Referenced by asyncSave().

bool ResourceDir::asyncSave Ticket  )  [virtual]
 

Saves all addressees asynchronously.

You have to make sure that either the savingFinished() or savingError() signal is emitted from within this function.

The default implementation simply calls the synchronous save.

Parameters:
ticket You have to release the ticket later with releaseSaveTicket() explicitely.
Returns:
Whether the saving was successfully.

Reimplemented from KABC::Resource.

Definition at line 246 of file resourcedir.cpp.

References save(), KABC::Resource::savingError(), and KABC::Resource::savingFinished().

void ResourceDir::setPath const QString  ) 
 

Set path to be used for saving.

Definition at line 258 of file resourcedir.cpp.

Referenced by init(), and KABC::ResourceDirConfig::saveSettings().

QString ResourceDir::path  )  const
 

Return path used for loading and saving the address book.

Definition at line 269 of file resourcedir.cpp.

Referenced by KABC::ResourceDirConfig::loadSettings().

void ResourceDir::setFormat const QString format  ) 
 

Set the format by name.

Definition at line 274 of file resourcedir.cpp.

References KABC::FormatFactory::format(), and KABC::FormatFactory::self().

Referenced by KABC::ResourceDirConfig::saveSettings().

QString ResourceDir::format  )  const
 

Returns the format name.

Definition at line 285 of file resourcedir.cpp.

Referenced by KABC::ResourceDirConfig::loadSettings().

void ResourceDir::removeAddressee const Addressee addr  )  [virtual]
 

Remove a addressee from its source.

This method is mainly called by KABC::AddressBook.

Reimplemented from KABC::Resource.

Definition at line 304 of file resourcedir.cpp.

References QMap::erase(), KABC::Resource::mAddrMap, and QFile::remove().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kabc Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Nov 1 10:34:54 2005 by doxygen 1.4.3 written by Dimitri van Heesch, © 1997-2003