KABC::ResourceFile Class Reference
#include <resourcefile.h>
Inheritance diagram for KABC::ResourceFile:

Detailed Description
This resource allows access to a local file.
Definition at line 40 of file resourcefile.h.
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 Ticket * | requestSaveTicket () |
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) |
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.
Construct file resource on file.
- fileName using format
- formatName.
Definition at line 66 of file resourcefile.cpp.
ResourceFile::~ResourceFile | ( | ) |
Member Function Documentation
bool 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.
Definition at line 229 of file resourcefile.cpp.
bool 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.
Definition at line 311 of file resourcefile.cpp.
void ResourceFile::doClose | ( | ) | [virtual] |
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 144 of file resourcefile.cpp.
QString ResourceFile::fileName | ( | ) | const |
Return name of file used for loading and saving the address book.
Definition at line 337 of file resourcefile.cpp.
QString ResourceFile::format | ( | ) | const |
bool 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.
Definition at line 212 of file resourcefile.cpp.
void 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.
Definition at line 134 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.
Reimplemented from KABC::Resource.
Definition at line 372 of file resourcefile.cpp.
Ticket * ResourceFile::requestSaveTicket | ( | ) | [virtual] |
Requests a save ticket, that is used by save().
Implements KABC::Resource.
Definition at line 113 of file resourcefile.cpp.
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()
Implements KABC::Resource.
Definition at line 245 of file resourcefile.cpp.
void ResourceFile::setFileName | ( | const QString & | ) |
void ResourceFile::setFormat | ( | const QString & | name | ) |
void ResourceFile::writeConfig | ( | KConfig * | cfg | ) | [virtual] |
Writes the config back.
Reimplemented from KABC::Resource.
Definition at line 101 of file resourcefile.cpp.
The documentation for this class was generated from the following files: