kabc Library API Documentation

KABC::ResourceFile Class Reference

This resource allows access to a local file. More...

#include <resourcefile.h>

Inheritance diagram for KABC::ResourceFile:

KABC::Resource List of all members.

Public Member Functions

 ResourceFile (const KConfig *cfg)
 ResourceFile (const QString &fileName, const QString &formatName="vcard")
 ~ResourceFile ()
virtual void writeConfig (KConfig *cfg)
virtual bool doOpen ()
virtual void doClose ()
virtual TicketrequestSaveTicket ()
virtual void releaseSaveTicket (Ticket *)
virtual bool load ()
virtual bool asyncLoad ()
virtual bool save (Ticket *ticket)
virtual bool asyncSave (Ticket *ticket)
void setFileName (const QString &)
QString fileName () const
void setFormat (const QString &name)
QString format () const
virtual void removeAddressee (const Addressee &addr)

Protected Slots

void fileChanged ()

Protected Member Functions

void init (const QString &fileName, const QString &format)
bool lock (const QString &fileName)
void unlock (const QString &fileName)

Detailed Description

This resource allows access to a local file.

Definition at line 48 of file resourcefile.h.


Constructor & Destructor Documentation

KABC::ResourceFile::ResourceFile const KConfig cfg  ) 
 

Constructor.

Parameters:
cfg The config object where custom resource settings are stored.

KABC::ResourceFile::ResourceFile const QString fileName,
const QString formatName = "vcard"
 

Construct file resource on file.

  • fileName using format
  • formatName.

KABC::ResourceFile::~ResourceFile  ) 
 

Destructor.


Member Function Documentation

virtual void KABC::ResourceFile::writeConfig KConfig cfg  )  [virtual]
 

Writes the config back.

Reimplemented from KABC::Resource.

virtual bool KABC::ResourceFile::doOpen  )  [virtual]
 

Tries to open the file and checks for the proper format.

This method should be called before load().

virtual void KABC::ResourceFile::doClose  )  [virtual]
 

Closes the file again.

virtual Ticket* KABC::ResourceFile::requestSaveTicket  )  [virtual]
 

Requests a save ticket, that is used by save().

Implements KABC::Resource.

virtual void KABC::ResourceFile::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.

virtual bool KABC::ResourceFile::load  )  [virtual]
 

Loads all addressees from file to the address book.

Returns true if all addressees could be loaded otherwise false.

Implements KABC::Resource.

virtual bool KABC::ResourceFile::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.

virtual bool KABC::ResourceFile::save Ticket ticket  )  [virtual]
 

Saves all addresses from address book to file.

Returns true if all addressees could be saved otherwise false.

Parameters:
ticket The ticket returned by requestSaveTicket()

Implements KABC::Resource.

virtual bool KABC::ResourceFile::asyncSave Ticket 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.

void KABC::ResourceFile::setFileName const QString  ) 
 

Set name of file to be used for saving.

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

QString KABC::ResourceFile::fileName  )  const
 

Return name of file used for loading and saving the address book.

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

void KABC::ResourceFile::setFormat const QString name  ) 
 

Sets a new format by name.

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

QString KABC::ResourceFile::format  )  const
 

Returns the format name.

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

virtual void KABC::ResourceFile::removeAddressee const Addressee addr  )  [virtual]
 

Remove a addressee from its source.

This method is mainly called by KABC::AddressBook.

Reimplemented from KABC::Resource.


The documentation for this class was generated from the following file:
KDE Logo
This file is part of the documentation for kabc Library Version 3.4.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Jun 12 11:42:59 2006 by doxygen 1.4.4 written by Dimitri van Heesch, © 1997-2003