kabc Library API Documentation

KABC::ResourceFile Class Reference

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

#include <resourcefile.h>

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

ResourceFile::ResourceFile const KConfig cfg  ) 
 

Constructor.

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

Definition at line 49 of file resourcefile.cpp.

References KABC::StdAddressBook::fileName(), fileName(), KConfigBase::readEntry(), and KConfigBase::readPathEntry().

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

Construct file resource on file

  • fileName using format
  • formatName.

Definition at line 66 of file resourcefile.cpp.

ResourceFile::~ResourceFile  ) 
 

Destructor.

Definition at line 95 of file resourcefile.cpp.


Member Function Documentation

void ResourceFile::writeConfig KConfig cfg  )  [virtual]
 

Writes the config back.

Definition at line 101 of file resourcefile.cpp.

References KConfigBase::writeEntry(), and KConfigBase::writePathEntry().

bool ResourceFile::doOpen  )  [virtual]
 

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

This method should be called before load().

Definition at line 140 of file resourcefile.cpp.

References KABC::FormatPlugin::checkFormat().

void ResourceFile::doClose  )  [virtual]
 

Closes the file again.

Definition at line 167 of file resourcefile.cpp.

Ticket * ResourceFile::requestSaveTicket  )  [virtual]
 

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

Definition at line 109 of file resourcefile.cpp.

References endl(), KABC::Lock::error(), kdDebug(), and KABC::Lock::lock().

bool ResourceFile::load  )  [virtual]
 

Loads all addressees from file to the address book.

Returns true if all addressees could be loaded otherwise false.

Definition at line 171 of file resourcefile.cpp.

References endl(), kdDebug(), and KABC::FormatPlugin::loadAll().

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

Definition at line 211 of file resourcefile.cpp.

References KSaveFile::close(), endl(), KSaveFile::file(), kdDebug(), KABC::FormatPlugin::saveAll(), and KSaveFile::status().

void ResourceFile::setFileName const QString  ) 
 

Set name of file to be used for saving.

Definition at line 258 of file resourcefile.cpp.

QString ResourceFile::fileName  )  const
 

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

Definition at line 270 of file resourcefile.cpp.

Referenced by ResourceFile().

void ResourceFile::setFormat const QString name  ) 
 

Sets a new format by name.

Definition at line 275 of file resourcefile.cpp.

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

QString ResourceFile::format  )  const
 

Returns the format name.

Definition at line 284 of file resourcefile.cpp.

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

Remove a addressee from its source.

This method is mainly called by KABC::AddressBook.

Definition at line 303 of file resourcefile.cpp.

References locateLocal(), and KABC::Addressee::uid().


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.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sun Oct 10 18:56:02 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003