libkcal
KCal::ResourceCalendar Class Reference
#include <resourcecalendar.h>

Detailed Description
This class provides the interfaces for a calendar resource.It makes use of the kresources framework.
- Warning:
- This code is still under heavy development. Don't expect source or binary compatibility in future versions.
Definition at line 57 of file resourcecalendar.h.
Public Slots | |
virtual void | setSubresourceActive (const QString &, bool active) |
Signals | |
void | resourceChanged (ResourceCalendar *) |
void | resourceLoaded (ResourceCalendar *) |
void | resourceSaved (ResourceCalendar *) |
void | resourceLoadError (ResourceCalendar *, const QString &error) |
void | resourceSaveError (ResourceCalendar *, const QString &error) |
void | signalSubresourceAdded (ResourceCalendar *, const QString &type, const QString &subresource, const QString &label) |
void | signalSubresourceRemoved (ResourceCalendar *, const QString &, const QString &) |
Public Member Functions | |
ResourceCalendar (const KConfig *) | |
void | clearException () |
void | setException (ErrorFormat *error) |
ErrorFormat * | exception () |
void | setResolveConflict (bool b) |
virtual void | writeConfig (KConfig *config) |
virtual QString | infoText () const |
bool | load () |
bool | save (Incidence *incidence=0) |
virtual bool | isSaving () |
virtual KABC::Lock * | lock ()=0 |
virtual KDE_DEPRECATED bool | addIncidence (Incidence *) |
virtual bool | addIncidence (Incidence *, const QString &subresource) |
virtual bool | deleteIncidence (Incidence *) |
Incidence * | incidence (const QString &uid) |
virtual KDE_DEPRECATED bool | addEvent (Event *event)=0 |
virtual bool | addEvent (Event *event, const QString &subresource)=0 |
virtual bool | deleteEvent (Event *)=0 |
virtual Event * | event (const QString &uid)=0 |
virtual Event::List | rawEvents (EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0 |
virtual Event::List | rawEventsForDate (const QDate &date, EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0 |
virtual Event::List | rawEventsForDate (const QDateTime &qdt)=0 |
virtual Event::List | rawEvents (const QDate &start, const QDate &end, bool inclusive=false)=0 |
virtual bool | setValue (const QString &key, const QString &value) |
virtual KDE_DEPRECATED bool | addTodo (Todo *todo)=0 |
virtual bool | addTodo (Todo *todo, const QString &subresource)=0 |
virtual bool | deleteTodo (Todo *)=0 |
virtual Todo * | todo (const QString &uid)=0 |
virtual Todo::List | rawTodos (TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0 |
virtual Todo::List | rawTodosForDate (const QDate &date)=0 |
virtual KDE_DEPRECATED bool | addJournal (Journal *)=0 |
virtual bool | addJournal (Journal *journal, const QString &subresource)=0 |
virtual bool | deleteJournal (Journal *)=0 |
virtual Journal * | journal (const QString &uid)=0 |
virtual Journal::List | rawJournals (JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0 |
virtual Journal::List | rawJournalsForDate (const QDate &date)=0 |
virtual Alarm::List | alarms (const QDateTime &from, const QDateTime &to)=0 |
virtual Alarm::List | alarmsTo (const QDateTime &to)=0 |
Incidence::List | rawIncidences () |
virtual void | setTimeZoneId (const QString &timeZoneId)=0 |
virtual QStringList | subresources () const |
virtual bool | canHaveSubresources () const |
virtual bool | subresourceActive (const QString &) const |
virtual bool | subresourceWritable (const QString &) const |
virtual const QString | labelForSubresource (const QString &resource) const |
virtual QString | subresourceIdentifier (Incidence *incidence) |
virtual bool | removeSubresource (const QString &resource) |
virtual bool | addSubresource (const QString &resource, const QString &parent) |
virtual QString | subresourceType (const QString &resource) |
virtual void | beginAddingIncidences () |
virtual void | endAddingIncidences () |
Protected Member Functions | |
virtual bool | doLoad ()=0 |
virtual bool | doSave ()=0 |
virtual bool | doSave (Incidence *) |
virtual void | addInfoText (QString &) const |
void | loadError (const QString &errorMessage=QString::null) |
void | saveError (const QString &errorMessage=QString::null) |
Protected Attributes | |
bool | mResolveConflict |
Member Function Documentation
void ResourceCalendar::clearException | ( | ) |
void ResourceCalendar::setException | ( | ErrorFormat * | error | ) |
Set exception for this object.
This is used by the functions of this class to report errors.
Definition at line 52 of file resourcecalendar.cpp.
ErrorFormat * ResourceCalendar::exception | ( | ) |
Returns an exception, if there is any, containing information about the last error that occurred.
Definition at line 58 of file resourcecalendar.cpp.
QString ResourceCalendar::infoText | ( | ) | const [virtual] |
Return rich text with info about the resource.
Adds standard info and then calls addInfoText() to add info about concrete resources.
Definition at line 68 of file resourcecalendar.cpp.
bool ResourceCalendar::load | ( | ) |
Load resource data.
After calling this function all data is accessible by calling the incidence/event/todo/etc. accessor functions.
Whether data is actually loaded within this function or the loading is delayed until it is accessed by another function depends on the implementation of the resource.
If loading the data takes significant time, the resource should return cached values if available, and return the results via the resourceChanged signal. When the resource has finished loading, the resourceLoaded() signal is emitted.
Calling this function multiple times should have the same effect as calling it once, given that the data isn't changed between calls.
This function calls doLoad() which has to be reimplented by the resource to do the actual loading.
Definition at line 138 of file resourcecalendar.cpp.
bool ResourceCalendar::save | ( | Incidence * | incidence = 0 |
) |
Save resource data.
After calling this function it is safe to close the resource without losing data.
Whether data is actually saved within this function or saving is delayed depends on the implementation of the resource.
If saving the data takes significant time, the resource should return from the function, do the saving in the background and notify the end of the save by emitting the signal resourceSaved().
This function calls doSave() which has to be reimplented by the resource to do the actual saving.
- Parameters:
-
incidence if given as 0, doSave() is called to save all incidences, else doSave(incidence) is called to save only the given one
Definition at line 182 of file resourcecalendar.cpp.
virtual bool KCal::ResourceCalendar::isSaving | ( | ) | [inline, virtual] |
Return true if a save operation is still in progress, otherwise return false.
Definition at line 135 of file resourcecalendar.h.
virtual KABC::Lock* KCal::ResourceCalendar::lock | ( | ) | [pure virtual] |
bool ResourceCalendar::addIncidence | ( | Incidence * | incidence | ) | [virtual] |
Add incidence to resource.
- Deprecated:
- use addIncidence(Incidence *,const QString &) instead.
Definition at line 101 of file resourcecalendar.cpp.
bool ResourceCalendar::addIncidence | ( | Incidence * | incidence, | |
const QString & | subresource | |||
) | [virtual] |
bool ResourceCalendar::deleteIncidence | ( | Incidence * | incidence | ) | [virtual] |
Incidence * ResourceCalendar::incidence | ( | const QString & | uid | ) |
Return incidence with given unique id.
If there is no incidence with that uid, return 0.
Definition at line 91 of file resourcecalendar.cpp.
virtual KDE_DEPRECATED bool KCal::ResourceCalendar::addEvent | ( | Event * | event | ) | [pure virtual] |
Add event to resource.
- Deprecated:
- use addEvent(Event *,const QString&) instead.
Implemented in KCal::ResourceCached.
virtual bool KCal::ResourceCalendar::deleteEvent | ( | Event * | ) | [pure virtual] |
virtual Event* KCal::ResourceCalendar::event | ( | const QString & | uid | ) | [pure virtual] |
virtual Event::List KCal::ResourceCalendar::rawEvents | ( | EventSortField | sortField = EventSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [pure virtual] |
Return unfiltered list of all events in calendar.
Use with care, this can be a bad idea for server-based calendars.
Implemented in KCal::ResourceCached.
virtual Event::List KCal::ResourceCalendar::rawEventsForDate | ( | const QDate & | date, | |
EventSortField | sortField = EventSortUnsorted , |
|||
SortDirection | sortDirection = SortDirectionAscending | |||
) | [pure virtual] |
Builds and then returns a list of all events that match the date specified.
Useful for dayView, etc. etc.
Implemented in KCal::ResourceCached.
virtual Event::List KCal::ResourceCalendar::rawEventsForDate | ( | const QDateTime & | qdt | ) | [pure virtual] |
virtual Event::List KCal::ResourceCalendar::rawEvents | ( | const QDate & | start, | |
const QDate & | end, | |||
bool | inclusive = false | |||
) | [pure virtual] |
Get unfiltered events in a range of dates.
If inclusive is set to true, only events which are completely included in the range are returned.
Implemented in KCal::ResourceCached.
bool ResourceCalendar::setValue | ( | const QString & | key, | |
const QString & | value | |||
) | [virtual] |
Sets a particular value of the resource's configuration.
The possible keys are resource specific.
This method is provided to make it possible to set resource-type specific settings without actually linking to the resource's library. Its use is discouraged, but in some situations the only possibility to avoid unwanted compiling and linking dependencies. E.g. if you don't want to link to the remote resource, but need to create a remote resource at the URL given in yourURL, you can use code like the following: KCal::ResourceCalendar *res = manager->createResource( "remote" ); if ( res ) { res->setTimeZoneId( timezone ); res->setResourceName( i18n("Test resource") ); res->setValue( "DownloadURL", yourURL ); manager->add( res ); }
Reimplemented in KCal::ResourceLocal.
Definition at line 219 of file resourcecalendar.cpp.
void KCal::ResourceCalendar::resourceChanged | ( | ResourceCalendar * | ) | [signal] |
This signal is emitted when the data in the resource has changed.
The resource has to make sure that this signal is emitted whenever any pointers to incidences which the resource has previously given to the calling code, become invalid.
void KCal::ResourceCalendar::resourceLoaded | ( | ResourceCalendar * | ) | [signal] |
This signal is emitted when loading data into the resource has been finished.
void KCal::ResourceCalendar::resourceSaved | ( | ResourceCalendar * | ) | [signal] |
This signal is emitted when saving the data of the resource has been finished.
void KCal::ResourceCalendar::resourceLoadError | ( | ResourceCalendar * | , | |
const QString & | error | |||
) | [signal] |
This signal is emitted when an error occurs during loading.
void KCal::ResourceCalendar::resourceSaveError | ( | ResourceCalendar * | , | |
const QString & | error | |||
) | [signal] |
This signal is emitted when an error occurs during saving.
void KCal::ResourceCalendar::signalSubresourceAdded | ( | ResourceCalendar * | , | |
const QString & | type, | |||
const QString & | subresource, | |||
const QString & | label | |||
) | [signal] |
This signal is emitted when a subresource is added.
void KCal::ResourceCalendar::signalSubresourceRemoved | ( | ResourceCalendar * | , | |
const QString & | , | |||
const QString & | ||||
) | [signal] |
This signal is emitted when a subresource is removed.
virtual KDE_DEPRECATED bool KCal::ResourceCalendar::addTodo | ( | Todo * | todo | ) | [pure virtual] |
Add a todo to the todolist.
- Deprecated:
- use addTodo(Todo *,const QString &) instead.
Implemented in KCal::ResourceCached.
virtual bool KCal::ResourceCalendar::deleteTodo | ( | Todo * | ) | [pure virtual] |
virtual Todo* KCal::ResourceCalendar::todo | ( | const QString & | uid | ) | [pure virtual] |
Searches todolist for an event with this unique id.
- Returns:
- pointer to todo or 0 if todo wasn't found
Implemented in KCal::ResourceCached.
virtual Todo::List KCal::ResourceCalendar::rawTodos | ( | TodoSortField | sortField = TodoSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [pure virtual] |
virtual Todo::List KCal::ResourceCalendar::rawTodosForDate | ( | const QDate & | date | ) | [pure virtual] |
virtual KDE_DEPRECATED bool KCal::ResourceCalendar::addJournal | ( | Journal * | ) | [pure virtual] |
Add a Journal entry to the resource.
- Deprecated:
- use addJournal(Journal *,const QString &) instead.
Implemented in KCal::ResourceCached.
virtual bool KCal::ResourceCalendar::deleteJournal | ( | Journal * | ) | [pure virtual] |
virtual Journal* KCal::ResourceCalendar::journal | ( | const QString & | uid | ) | [pure virtual] |
virtual Journal::List KCal::ResourceCalendar::rawJournals | ( | JournalSortField | sortField = JournalSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [pure virtual] |
virtual Journal::List KCal::ResourceCalendar::rawJournalsForDate | ( | const QDate & | date | ) | [pure virtual] |
virtual Alarm::List KCal::ResourceCalendar::alarms | ( | const QDateTime & | from, | |
const QDateTime & | to | |||
) | [pure virtual] |
virtual Alarm::List KCal::ResourceCalendar::alarmsTo | ( | const QDateTime & | to | ) | [pure virtual] |
Incidence::List ResourceCalendar::rawIncidences | ( | ) |
virtual void KCal::ResourceCalendar::setTimeZoneId | ( | const QString & | timeZoneId | ) | [pure virtual] |
virtual QStringList KCal::ResourceCalendar::subresources | ( | ) | const [inline, virtual] |
If this resource has subresources, return a QStringList of them.
In most cases, resources do not have subresources, so this is by default just empty.
Definition at line 345 of file resourcecalendar.h.
virtual bool KCal::ResourceCalendar::canHaveSubresources | ( | ) | const [inline, virtual] |
Is this subresource capable of having subresources or not?
Definition at line 350 of file resourcecalendar.h.
virtual bool KCal::ResourceCalendar::subresourceActive | ( | const QString & | ) | const [inline, virtual] |
bool ResourceCalendar::subresourceWritable | ( | const QString & | resource | ) | const [virtual] |
virtual const QString KCal::ResourceCalendar::labelForSubresource | ( | const QString & | resource | ) | const [inline, virtual] |
virtual QString KCal::ResourceCalendar::subresourceIdentifier | ( | Incidence * | incidence | ) | [inline, virtual] |
Get the identifier of the subresource associated with a specified incidence.
- Returns:
- the identifier of the subresource or an empty string.
Definition at line 377 of file resourcecalendar.h.
bool ResourceCalendar::removeSubresource | ( | const QString & | resource | ) | [virtual] |
Remove a subresource with the id.
- Parameters:
-
resource
Definition at line 133 of file resourcecalendar.cpp.
bool ResourceCalendar::addSubresource | ( | const QString & | resource, | |
const QString & | parent | |||
) | [virtual] |
Add a subresource with the name.
- Parameters:
-
resource and the parent id parent.
Definition at line 128 of file resourcecalendar.cpp.
QString ResourceCalendar::subresourceType | ( | const QString & | resource | ) | [virtual] |
Returns the type of the subresource: "event", "todo" or "journal", QString() if unknown/mixed.
Definition at line 226 of file resourcecalendar.cpp.
void ResourceCalendar::beginAddingIncidences | ( | ) | [virtual] |
Called when we starting adding a batch of incidences.
So we don't show the same warnings for each incidence.
Definition at line 241 of file resourcecalendar.cpp.
void ResourceCalendar::endAddingIncidences | ( | ) | [virtual] |
Called when we finish adding a batch of incidences.
- See also:
- beginAddingIncidences()
Definition at line 245 of file resourcecalendar.cpp.
void ResourceCalendar::setSubresourceActive | ( | const QString & | , | |
bool | active | |||
) | [virtual, slot] |
virtual bool KCal::ResourceCalendar::doLoad | ( | ) | [protected, pure virtual] |
virtual bool KCal::ResourceCalendar::doSave | ( | ) | [protected, pure virtual] |
bool ResourceCalendar::doSave | ( | Incidence * | ) | [protected, virtual] |
Do the actual saving of the resource data.
Called by save(). Save one Incidence. The default implementation calls doSave() to save everything
Definition at line 201 of file resourcecalendar.cpp.
virtual void KCal::ResourceCalendar::addInfoText | ( | QString & | ) | const [inline, protected, virtual] |
Add info text for concrete resources.
Called by infoText().
Reimplemented in KCal::ResourceCached.
Definition at line 438 of file resourcecalendar.h.
void ResourceCalendar::loadError | ( | const QString & | errorMessage = QString::null |
) | [protected] |
A resource should call this function if a load error happens.
Definition at line 169 of file resourcecalendar.cpp.
void ResourceCalendar::saveError | ( | const QString & | errorMessage = QString::null |
) | [protected] |
A resource should call this function if a save error happens.
Definition at line 206 of file resourcecalendar.cpp.
The documentation for this class was generated from the following files: