• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.5 API Reference
  • KDE Home
  • Contact Us
 

kabc

  • KABC
  • ResourceFile
Public Member Functions | Protected Slots | Protected Member Functions
KABC::ResourceFile Class Reference

#include <resourcefile.h>

Inheritance diagram for KABC::ResourceFile:
Inheritance graph
[legend]

List of all members.

Public Member Functions

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

Protected Slots

void fileChanged (const QString &path)

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.


Constructor & Destructor Documentation

ResourceFile::ResourceFile ( )

Default constructor.

Definition at line 55 of file resourcefile.cpp.

ResourceFile::ResourceFile ( const KConfigGroup &  group) [explicit]

Constructor.

Parameters:
groupThe configuration group where custom resource settings are stored.

Definition at line 67 of file resourcefile.cpp.

ResourceFile::ResourceFile ( const QString &  fileName,
const QString &  formatName = QLatin1String( "vcard" ) 
) [explicit]

Constructs a file resource on file.

  • fileName using format
  • formatName.
Parameters:
fileNameThe file to use for this resource
formatNameThe format of the data in the given file

Definition at line 79 of file resourcefile.cpp.

ResourceFile::~ResourceFile ( )

Destructor.

Definition at line 110 of file resourcefile.cpp.


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 234 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:
ticketYou have to release the ticket later with releaseSaveTicket() explicitly.
Returns:
Whether the saving was successfully.

Reimplemented from KABC::Resource.

Definition at line 273 of file resourcefile.cpp.

void ResourceFile::doClose ( ) [virtual]

Closes the file again.

Reimplemented from Resource.

Definition at line 199 of file resourcefile.cpp.

bool ResourceFile::doOpen ( ) [virtual]

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

This method should be called before load().

Reimplemented from Resource.

Definition at line 164 of file resourcefile.cpp.

QString ResourceFile::fileName ( ) const

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

Definition at line 412 of file resourcefile.cpp.

QString ResourceFile::format ( ) const

Returns the format name.

Definition at line 426 of file resourcefile.cpp.

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 203 of file resourcefile.cpp.

void ResourceFile::releaseSaveTicket ( Ticket *  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.

Parameters:
ticketthe save ticket acquired with requestSaveTicket()

Implements KABC::Resource.

Definition at line 154 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.

Parameters:
addrThe addressee to remove
See also:
KABC::AddressBook::removeAddressee()

Reimplemented from KABC::Resource.

Definition at line 466 of file resourcefile.cpp.

Ticket * ResourceFile::requestSaveTicket ( ) [virtual]

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

Implements KABC::Resource.

Definition at line 131 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:
ticketThe ticket returned by requestSaveTicket()

Implements KABC::Resource.

Definition at line 245 of file resourcefile.cpp.

void ResourceFile::setFileName ( const QString &  fileName)

Set name of file to be used for saving.

Definition at line 399 of file resourcefile.cpp.

void ResourceFile::setFormat ( const QString &  name)

Sets a new format by name.

Definition at line 417 of file resourcefile.cpp.

void ResourceFile::writeConfig ( KConfigGroup &  group) [virtual]

Writes the config back.

Reimplemented from KABC::Resource.

Definition at line 118 of file resourcefile.cpp.


The documentation for this class was generated from the following files:
  • resourcefile.h
  • resourcefile.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Aug 27 2012 22:10:25 by doxygen 1.7.5 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kabc

Skip menu "kabc"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.8.5 API Reference

Skip menu "kdepimlibs-4.8.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal