kabc
KABC::Resource Class Reference
#include <resource.h>

Classes | |
class | ConstIterator |
Resource Const Iterator. More... | |
Public Types | |
typedef ConstIterator | const_iterator |
typedef Iterator | iterator |
Signals | |
void | loadingError (Resource *resource, const QString &msg) |
void | loadingFinished (Resource *resource) |
void | savingError (Resource *resource, const QString &msg) |
void | savingFinished (Resource *resource) |
Public Member Functions | |
AddressBook * | addressBook () |
virtual QStringList | allDistributionListNames () const |
virtual QList< DistributionList * > | allDistributionLists () |
virtual bool | asyncLoad () |
virtual bool | asyncSave (Ticket *ticket) |
virtual Iterator | begin () |
virtual ConstIterator | begin () const |
virtual void | clear () |
virtual Iterator | end () |
virtual ConstIterator | end () const |
virtual Addressee::List | findByCategory (const QString &category) |
virtual Addressee::List | findByEmail (const QString &email) |
virtual Addressee::List | findByName (const QString &name) |
virtual Addressee | findByUid (const QString &uid) |
virtual DistributionList * | findDistributionListByIdentifier (const QString &identifier) |
virtual DistributionList * | findDistributionListByName (const QString &name, Qt::CaseSensitivity caseSensitivity=Qt::CaseSensitive) |
virtual void | insertAddressee (const Addressee &addr) |
virtual void | insertDistributionList (DistributionList *list) |
virtual bool | load ()=0 |
virtual void | releaseSaveTicket (Ticket *ticket)=0 |
virtual void | removeAddressee (const Addressee &addr) |
virtual void | removeDistributionList (DistributionList *list) |
virtual Ticket * | requestSaveTicket ()=0 |
Resource (const KConfigGroup &group) | |
Resource () | |
virtual bool | save (Ticket *ticket)=0 |
void | setAddressBook (AddressBook *addr) |
virtual void | writeConfig (KConfigGroup &group) |
virtual | ~Resource () |
Protected Member Functions | |
Ticket * | createTicket (Resource *) |
Protected Attributes | |
Addressee::Map | mAddrMap |
DistributionListMap | mDistListMap |
Detailed Description
For internal use only.
Definition at line 64 of file resource.h.
Member Typedef Documentation
typedef Iterator KABC::Resource::iterator |
Constructor & Destructor Documentation
Resource::Resource | ( | ) |
Resource::Resource | ( | const KConfigGroup & | group | ) |
Constructor.
- Parameters:
-
group The configuration group where the derived classes can read out their settings.
Definition at line 221 of file resource.cpp.
Resource::~Resource | ( | ) | [virtual] |
Member Function Documentation
AddressBook * Resource::addressBook | ( | ) |
QStringList Resource::allDistributionListNames | ( | ) | const [virtual] |
Returns a list of names of all distribution lists of this resource.
Convenience function, equal to iterate over the list returned by allDistributionLists()
Definition at line 415 of file resource.cpp.
QList< DistributionList * > Resource::allDistributionLists | ( | ) | [virtual] |
Returns a list of all distribution lists of this resource.
Definition at line 410 of file resource.cpp.
bool Resource::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 in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
Definition at line 428 of file resource.cpp.
bool Resource::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() explicitly.
- Returns:
- Whether the saving was successfully.
Reimplemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
Definition at line 440 of file resource.cpp.
Resource::Iterator Resource::begin | ( | ) | [virtual] |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Definition at line 232 of file resource.cpp.
Resource::ConstIterator Resource::begin | ( | ) | const [virtual] |
Returns an iterator pointing to the first addressee in the resource.
This iterator equals end() if the resource is empty.
Definition at line 240 of file resource.cpp.
void Resource::clear | ( | ) | [virtual] |
Removes all addressees and distribution lists from the resource.
Definition at line 349 of file resource.cpp.
Factory method, just creates and returns a new Ticket for the given resource.
Needed by subclasses since the constructor of Ticket is private and only this base class is a friend, effectively limiting "new Ticket(this)" to resource implementations.
Definition at line 277 of file resource.cpp.
Resource::Iterator Resource::end | ( | ) | [virtual] |
This is an overloaded member function, provided for convenience.
It behaves essentially like the above function.
Definition at line 247 of file resource.cpp.
Resource::ConstIterator Resource::end | ( | ) | const [virtual] |
Returns an iterator pointing to the last addressee in the resource.
This iterator equals begin() if the resource is empty.
Definition at line 255 of file resource.cpp.
Addressee::List Resource::findByCategory | ( | const QString & | category | ) | [virtual] |
Searches all addressees which belongs to the specified category.
- Parameters:
-
category The category you are looking for.
- Returns:
- A list of all matching addressees.
Definition at line 335 of file resource.cpp.
Addressee::List Resource::findByEmail | ( | const QString & | ) | [virtual] |
Searches all addressees which match the specified email address.
- Parameters:
-
email The email address you are looking for.
- Returns:
- A list of all matching addressees.
Definition at line 317 of file resource.cpp.
Addressee::List Resource::findByName | ( | const QString & | name | ) | [virtual] |
Searches all addressees which match the specified name.
- Parameters:
-
name The name you are looking for.
- Returns:
- A list of all matching addressees.
Definition at line 303 of file resource.cpp.
Searches an addressee with the specified unique identifier.
- Parameters:
-
uid The unique identifier you are looking for.
- Returns:
- The addressee with the specified unique identifier or an empty addressee.
Definition at line 292 of file resource.cpp.
DistributionList * Resource::findDistributionListByIdentifier | ( | const QString & | identifier | ) | [virtual] |
Returns a distribution list for the given identifier
or 0
.
- Parameters:
-
identifier The ID of the list for look for.
Definition at line 380 of file resource.cpp.
DistributionList * Resource::findDistributionListByName | ( | const QString & | name, | |
Qt::CaseSensitivity | caseSensitivity = Qt::CaseSensitive | |||
) | [virtual] |
Returns a distribution list with the given name
or 0
.
- Parameters:
-
name The localized name of the list for look for. caseSensitivity Whether to do string matching case sensitive or case insensitive. Default is Qt::CaseSensitive
Definition at line 385 of file resource.cpp.
void Resource::insertAddressee | ( | const Addressee & | addr | ) | [virtual] |
Insert an addressee into the resource.
- Parameters:
-
addr The addressee to add
Definition at line 282 of file resource.cpp.
void Resource::insertDistributionList | ( | DistributionList * | list | ) | [virtual] |
Adds a distribution list
into this resource.
- Parameters:
-
list The list to insert.
Definition at line 361 of file resource.cpp.
virtual bool KABC::Resource::load | ( | ) | [pure virtual] |
Loads all addressees synchronously.
- Returns:
- Whether the loading was successfully.
Implemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
This signal is emitted when an error occurred during loading the addressees from the backend to the internal cache.
- Parameters:
-
resource The pointer to the resource which emitted this signal. msg A translated error message.
void KABC::Resource::loadingFinished | ( | Resource * | resource | ) | [signal] |
This signal is emitted when the resource has finished the loading of all addressees from the backend to the internal cache.
- Parameters:
-
resource The pointer to the resource which emitted this signal.
virtual void KABC::Resource::releaseSaveTicket | ( | Ticket * | ticket | ) | [pure 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:
-
ticket the save ticket acquired with requestSaveTicket()
Implemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
void Resource::removeAddressee | ( | const Addressee & | addr | ) | [virtual] |
Removes an addressee from resource.
- Parameters:
-
addr The addressee to remove
Reimplemented in KABC::ResourceDir, and KABC::ResourceFile.
Definition at line 287 of file resource.cpp.
void Resource::removeDistributionList | ( | DistributionList * | list | ) | [virtual] |
Removes a distribution list
from this resource.
- Parameters:
-
list The list to remove.
Definition at line 368 of file resource.cpp.
virtual Ticket* KABC::Resource::requestSaveTicket | ( | ) | [pure virtual] |
Request a ticket, you have to pass through save() to allow locking.
The resource has to create its locks in this function.
Implemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
virtual bool KABC::Resource::save | ( | Ticket * | ticket | ) | [pure virtual] |
Saves all addressees synchronously.
- Parameters:
-
ticket You have to release the ticket later with releaseSaveTicket() explicitly.
- Returns:
- Whether the saving was successfully.
Implemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
This signal is emitted when an error occurred during saving the addressees from the internal cache to the backend.
- Parameters:
-
resource The pointer to the resource which emitted this signal. msg A translated error message.
void KABC::Resource::savingFinished | ( | Resource * | resource | ) | [signal] |
This signal is emitted when the resource has finished the saving of all addressees from the internal cache to the backend.
- Parameters:
-
resource The pointer to the resource which emitted this signal.
void Resource::setAddressBook | ( | AddressBook * | addr | ) |
For internal use only.
Sets the address book of the resource.
- Parameters:
-
addr The address book to use
Definition at line 267 of file resource.cpp.
void Resource::writeConfig | ( | KConfigGroup & | group | ) | [virtual] |
Writes the resource specific config to file.
- Parameters:
-
group The config section to write into
Reimplemented in KABC::ResourceDir, KABC::ResourceFile, and KABC::ResourceNet.
Definition at line 262 of file resource.cpp.
Member Data Documentation
Addressee::Map KABC::Resource::mAddrMap [protected] |
DistributionListMap KABC::Resource::mDistListMap [protected] |
A mapping from unique identifiers to the respective distribution list.
Definition at line 528 of file resource.h.
The documentation for this class was generated from the following files: