KCal Library
KCal::ResourceCached Class Reference
This class provides a calendar resource using a local CalendarLocal object to cache the calendar data. More...
#include <resourcecached.h>

Public Types | |
enum | { ReloadNever, ReloadOnStartup, ReloadInterval } |
enum | { SaveNever, SaveOnExit, SaveInterval, SaveDelayed, SaveAlways } |
enum | CacheAction { DefaultCache, NoSyncCache, SyncCache } |
Public Member Functions | |
Incidence::List | addedIncidences () const |
bool | addEvent (Event *event) |
virtual bool | addJournal (Journal *) |
bool | addTodo (Todo *todo) |
Alarm::List | alarms (const KDateTime &from, const KDateTime &to) |
Alarm::List | alarmsTo (const KDateTime &to) |
Incidence::List | allChanges () const |
Incidence::List | changedIncidences () const |
void | cleanUpEventCache (const KCal::Event::List &eventList) |
void | cleanUpTodoCache (const KCal::Todo::List &todoList) |
void | clearCache () |
void | clearChange (const QString &uid) |
void | clearChange (Incidence *incidence) |
void | clearChanges () |
bool | defaultReloadInhibited () const |
void | deleteAllEvents () |
virtual void | deleteAllJournals () |
void | deleteAllTodos () |
Incidence::List | deletedIncidences () const |
bool | deleteEvent (Event *event) |
virtual bool | deleteJournal (Journal *) |
bool | deleteTodo (Todo *) |
void | disableChangeNotification () |
void | enableChangeNotification () |
Event * | event (const QString &UniqueStr) |
Event::List | events () |
bool | hasChanges () const |
KRES::IdMapper & | idMapper () |
bool | inhibitDefaultReload (bool inhibit) |
virtual Journal * | journal (const QString &uid) |
KDateTime | lastLoad () const |
KDateTime | lastSave () const |
virtual bool | load () |
bool | load (CacheAction) |
bool | loadFromCache () |
Person | owner () const |
Event::List | rawEvents (const QDate &start, const QDate &end, const KDateTime::Spec ×pec=KDateTime::Spec(), bool inclusive=false) |
Event::List | rawEvents (EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) |
Event::List | rawEventsForDate (const KDateTime &dt) |
Event::List | rawEventsForDate (const QDate &date, const KDateTime::Spec ×pec=KDateTime::Spec(), EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending) |
Journal::List | rawJournals (JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending) |
Journal::List | rawJournalsForDate (const QDate &date) |
Todo::List | rawTodos (TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending) |
Todo::List | rawTodosForDate (const QDate &date) |
void | readConfig (const KConfigGroup &group) |
bool | reloaded () const |
int | reloadInterval () const |
int | reloadPolicy () const |
ResourceCached (const KConfigGroup &group) | |
virtual bool | save (Incidence *incidence=0) |
bool | save (CacheAction, Incidence *incidence=0) |
int | saveInterval () const |
int | savePolicy () const |
void | saveToCache () |
void | setOwner (const Person &owner) |
void | setReloadInterval (int minutes) |
void | setReloadPolicy (int policy) |
void | setSaveInterval (int minutes) |
void | setSavePolicy (int policy) |
void | setTimeSpec (const KDateTime::Spec &timeSpec) |
void | setTimeZoneId (const QString &timeZoneId) |
virtual void | shiftTimes (const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec) |
KDateTime::Spec | timeSpec () const |
QString | timeZoneId () const |
Todo * | todo (const QString &uid) |
void | writeConfig (KConfigGroup &group) |
Protected Slots | |
void | setIdMapperIdentifier () |
void | slotReload () |
void | slotSave () |
Protected Member Functions | |
void | addInfoText (QString &) const |
virtual QString | cacheFile () const |
CalendarLocal * | calendar () const |
void | calendarIncidenceAdded (KCal::Incidence *incidence) |
void | calendarIncidenceChanged (KCal::Incidence *incidence) |
void | calendarIncidenceDeleted (KCal::Incidence *incidence) |
virtual QString | changesCacheFile (const QString &type) const |
void | checkForAutomaticSave () |
bool | checkForReload () |
bool | checkForSave () |
virtual void | doClose () |
virtual bool | doLoad (bool syncCache)=0 |
virtual bool | doOpen () |
virtual bool | doSave (bool syncCache, Incidence *) |
virtual bool | doSave (bool syncCache)=0 |
void | loadChangesCache () |
void | loadChangesCache (QMap< Incidence *, bool > &map, const QString &type) |
void | saveChangesCache () |
void | saveChangesCache (const QMap< Incidence *, bool > &map, const QString &type) |
void | setReloaded (bool done) |
void | setupReloadTimer () |
void | setupSaveTimer () |
Detailed Description
This class provides a calendar resource using a local CalendarLocal object to cache the calendar data.Definition at line 43 of file resourcecached.h.
Member Enumeration Documentation
anonymous enum |
Reload policy.
Whether and when to automatically reload the resource.
- See also:
- setReloadPolicy(), reloadPolicy()
- Enumerator:
-
ReloadNever never reload the resource automatically ReloadOnStartup reload when the resource is opened ReloadInterval reload at regular intervals set by setReloadInterval()
Definition at line 52 of file resourcecached.h.
anonymous enum |
Save policy.
Whether and when to automatically save the resource.
- See also:
- setSavePolicy(), savePolicy()
- Enumerator:
-
SaveNever never save the resource automatically SaveOnExit save when the resource is closed SaveInterval save at regular intervals set by setSaveInterval() SaveDelayed save after every change, after a 15 second delay SaveAlways save after every change, after a 1 second delay
Definition at line 62 of file resourcecached.h.
Whether to update the cache file when loading a resource, or whether to upload the cache file after saving the resource.
Only applicable to genuinely cached resources.
- Enumerator:
-
DefaultCache use the default action set by setReloadPolicy() or setSavePolicy() NoSyncCache perform a cache-only operation, without downloading or uploading SyncCache update the cache file before loading, or upload cache after saving
Definition at line 75 of file resourcecached.h.
Member Function Documentation
bool ResourceCached::addEvent | ( | Event * | event | ) | [virtual] |
Add event to calendar.
Implements KCal::ResourceCalendar.
Definition at line 233 of file resourcecached.cpp.
void ResourceCached::addInfoText | ( | QString & | ) | const [protected, virtual] |
Add info text for concrete resources.
Called by infoText().
Reimplemented from KCal::ResourceCalendar.
Definition at line 849 of file resourcecached.cpp.
bool ResourceCached::addJournal | ( | Journal * | journal | ) | [virtual] |
Add a Journal entry to calendar.
Implements KCal::ResourceCalendar.
Definition at line 321 of file resourcecached.cpp.
bool ResourceCached::addTodo | ( | Todo * | todo | ) | [virtual] |
Add a todo to the todolist.
Implements KCal::ResourceCalendar.
Definition at line 281 of file resourcecached.cpp.
Alarm::List ResourceCached::alarms | ( | const KDateTime & | from, | |
const KDateTime & | to | |||
) | [virtual] |
Return all alarms, which occur in the given time interval.
Implements KCal::ResourceCalendar.
Definition at line 348 of file resourcecached.cpp.
Alarm::List ResourceCached::alarmsTo | ( | const KDateTime & | to | ) | [virtual] |
Return all alarms, which occur before given date.
Implements KCal::ResourceCalendar.
Definition at line 343 of file resourcecached.cpp.
QString ResourceCached::cacheFile | ( | ) | const [protected, virtual] |
This method is used by loadFromCache() and saveToCache(), reimplement it to change the location of the cache.
Definition at line 596 of file resourcecached.cpp.
void ResourceCached::calendarIncidenceAdded | ( | KCal::Incidence * | incidence | ) | [protected, virtual] |
Notify the Observer that an Incidence has been inserted.
- Parameters:
-
incidence is a pointer to the Incidence that was inserted.
Reimplemented from KCal::Calendar::CalendarObserver.
Definition at line 660 of file resourcecached.cpp.
void ResourceCached::calendarIncidenceChanged | ( | KCal::Incidence * | incidence | ) | [protected, virtual] |
Notify the Observer that an Incidence has been modified.
- Parameters:
-
incidence is a pointer to the Incidence that was modified.
Reimplemented from KCal::Calendar::CalendarObserver.
Definition at line 673 of file resourcecached.cpp.
void ResourceCached::calendarIncidenceDeleted | ( | KCal::Incidence * | incidence | ) | [protected, virtual] |
Notify the Observer that an Incidence has been removed.
- Parameters:
-
incidence is a pointer to the Incidence that was removed.
Reimplemented from KCal::Calendar::CalendarObserver.
Definition at line 687 of file resourcecached.cpp.
QString ResourceCached::changesCacheFile | ( | const QString & | type | ) | const [protected, virtual] |
bool ResourceCached::checkForReload | ( | ) | [protected] |
Check if reload required according to reload policy.
Definition at line 830 of file resourcecached.cpp.
bool ResourceCached::checkForSave | ( | ) | [protected] |
void ResourceCached::clearCache | ( | ) |
void ResourceCached::deleteAllEvents | ( | ) | [virtual] |
Removes all Events from this calendar.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 246 of file resourcecached.cpp.
void ResourceCached::deleteAllJournals | ( | ) | [virtual] |
Removes all Journals from this calendar.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 301 of file resourcecached.cpp.
void ResourceCached::deleteAllTodos | ( | ) | [virtual] |
Removes all todos from this calendar.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 291 of file resourcecached.cpp.
bool ResourceCached::deleteEvent | ( | Event * | event | ) | [virtual] |
Deletes an event from this calendar.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 239 of file resourcecached.cpp.
bool ResourceCached::deleteJournal | ( | Journal * | journal | ) | [virtual] |
Remove a Journal from the calendar.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 296 of file resourcecached.cpp.
bool ResourceCached::deleteTodo | ( | Todo * | todo | ) | [virtual] |
Remove a todo from the todolist.
Implements KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocalDir.
Definition at line 286 of file resourcecached.cpp.
void ResourceCached::doClose | ( | ) | [protected, virtual] |
Virtual method from KRES::Resource, called when the last instace of the resource is closed.
Reimplemented from KRES::Resource.
Definition at line 863 of file resourcecached.cpp.
virtual bool KCal::ResourceCached::doLoad | ( | bool | syncCache | ) | [protected, pure virtual] |
Do the actual loading of the resource data.
Called by load(CacheAction).
Implements KCal::ResourceCalendar.
Implemented in KCal::ResourceLocal, and KCal::ResourceLocalDir.
bool ResourceCached::doOpen | ( | ) | [protected, virtual] |
Opens the resource.
Dummy implementation, so child classes don't have to reimplement this method. By default, this does not do anything, but can be reimplemented in child classes
Reimplemented from KRES::Resource.
Definition at line 874 of file resourcecached.cpp.
bool ResourceCached::doSave | ( | bool | syncCache, | |
Incidence * | incidence | |||
) | [protected, virtual] |
Do the actual saving of the resource data.
Called by save(CacheAction). Save one Incidence. The default implementation calls doSave(bool) to save everything.
- Parameters:
-
syncCache if true
, the cache will be uploaded to the remote resource. Iffalse
, only the cache will be updated
Reimplemented from KCal::ResourceCalendar.
Reimplemented in KCal::ResourceLocal, and KCal::ResourceLocalDir.
Definition at line 500 of file resourcecached.cpp.
virtual bool KCal::ResourceCached::doSave | ( | bool | syncCache | ) | [protected, pure virtual] |
Do the actual saving of the resource data.
Called by save(CacheAction). Saves the resource data to the cache and optionally uploads (if a remote resource).
- Parameters:
-
syncCache if true, the cache will be uploaded to the remote resource. If false, only the cache will be updated.
Implements KCal::ResourceCalendar.
Implemented in KCal::ResourceLocal, and KCal::ResourceLocalDir.
Event * ResourceCached::event | ( | const QString & | UniqueStr | ) | [virtual] |
Retrieves an event on the basis of the unique string ID.
Implements KCal::ResourceCalendar.
Definition at line 251 of file resourcecached.cpp.
Event::List KCal::ResourceCached::events | ( | ) |
Return filtered list of all events in calendar.
KRES::IdMapper & ResourceCached::idMapper | ( | ) |
bool ResourceCached::inhibitDefaultReload | ( | bool | inhibit | ) |
Inhibit or allow cache reloads when using load(DefaultCache).
If inhibited, this overrides the policy set by setReloadPolicy(), preventing any non-explicit reloads from being performed. If not inhibited, reloads take place according to the policy set by setReloadPolicy().
- Parameters:
-
inhibit true to inhibit reloads, false to allow them
Definition at line 152 of file resourcecached.cpp.
Journal * ResourceCached::journal | ( | const QString & | uid | ) | [virtual] |
Return Journal with given unique id.
Implements KCal::ResourceCalendar.
Definition at line 328 of file resourcecached.cpp.
KDateTime KCal::ResourceCached::lastLoad | ( | ) | const |
Return time of last load.
KDateTime KCal::ResourceCached::lastSave | ( | ) | const |
Return time of last save.
bool ResourceCached::load | ( | ) | [virtual] |
Load resource data.
Reimplemented from KCal::ResourceCalendar.
Definition at line 431 of file resourcecached.cpp.
bool ResourceCached::load | ( | CacheAction | action | ) |
Load resource data, specifying whether to refresh the cache file first.
For a non-cached resource, this method has the same effect as load().
Definition at line 385 of file resourcecached.cpp.
bool ResourceCached::loadFromCache | ( | ) |
Load the resource from the cache.
- Returns:
- true if the cache file exists, false if not
Definition at line 436 of file resourcecached.cpp.
Person KCal::ResourceCached::owner | ( | ) | const |
Event::List ResourceCached::rawEvents | ( | const QDate & | start, | |
const QDate & | end, | |||
const KDateTime::Spec & | timespec = KDateTime::Spec() , |
|||
bool | inclusive = false | |||
) | [virtual] |
Get unfiltered events in a range of dates.
If inclusive is set to true, only events are returned, which are completely included in the range.
- Parameters:
-
start date at the begin of the searching range end date at the end of the searching range timeSpec timeSpec of the searching range inclusive if true
, only match events which are completely within the specified range
Implements KCal::ResourceCalendar.
Definition at line 265 of file resourcecached.cpp.
Event::List ResourceCached::rawEvents | ( | EventSortField | sortField = EventSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [virtual] |
Return unfiltered list of all events in calendar.
Implements KCal::ResourceCalendar.
Definition at line 276 of file resourcecached.cpp.
Event::List ResourceCached::rawEventsForDate | ( | const KDateTime & | dt | ) | [virtual] |
Get unfiltered events for date dt.
Implements KCal::ResourceCalendar.
Definition at line 271 of file resourcecached.cpp.
Event::List ResourceCached::rawEventsForDate | ( | const QDate & | date, | |
const KDateTime::Spec & | timespec = KDateTime::Spec() , |
|||
EventSortField | sortField = EventSortUnsorted , |
|||
SortDirection | sortDirection = SortDirectionAscending | |||
) | [virtual] |
Builds and then returns a list of all events that match for the date specified.
useful for dayView, etc. etc.
- Parameters:
-
date date for which to get the events timespec the time specification of the date sortField field used as the sort key for the result list sortDirection direction of sorting according to sortField
Implements KCal::ResourceCalendar.
Definition at line 256 of file resourcecached.cpp.
Journal::List ResourceCached::rawJournals | ( | JournalSortField | sortField = JournalSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [virtual] |
Return list of all journals.
Implements KCal::ResourceCalendar.
Definition at line 333 of file resourcecached.cpp.
Journal::List ResourceCached::rawJournalsForDate | ( | const QDate & | date | ) | [virtual] |
Return list of journals for the given date.
Implements KCal::ResourceCalendar.
Definition at line 338 of file resourcecached.cpp.
Todo::List ResourceCached::rawTodos | ( | TodoSortField | sortField = TodoSortUnsorted , |
|
SortDirection | sortDirection = SortDirectionAscending | |||
) | [virtual] |
Return list of all todos.
Implements KCal::ResourceCalendar.
Definition at line 306 of file resourcecached.cpp.
Todo::List ResourceCached::rawTodosForDate | ( | const QDate & | date | ) | [virtual] |
Returns list of todos due on the specified date.
Implements KCal::ResourceCalendar.
Definition at line 316 of file resourcecached.cpp.
bool ResourceCached::reloaded | ( | ) | const |
Return whether the resource cache has been reloaded since startup.
Definition at line 120 of file resourcecached.cpp.
int ResourceCached::reloadInterval | ( | ) | const |
int ResourceCached::reloadPolicy | ( | ) | const |
bool ResourceCached::save | ( | Incidence * | incidence = 0 |
) | [virtual] |
Save resource data.
Reimplemented from KCal::ResourceCalendar.
Definition at line 495 of file resourcecached.cpp.
bool ResourceCached::save | ( | CacheAction | action, | |
Incidence * | incidence = 0 | |||
) |
Save the resource data to cache, and optionally upload the cache file afterwards.
For a non-cached resource, this method has the same effect as save().
- Parameters:
-
incidence if given as 0, doSave(bool) is called to save all incidences, else doSave(bool, incidence) is called to save only the given one.
Definition at line 455 of file resourcecached.cpp.
int ResourceCached::saveInterval | ( | ) | const |
int ResourceCached::savePolicy | ( | ) | const |
void ResourceCached::saveToCache | ( | ) |
void KCal::ResourceCached::setOwner | ( | const Person & | owner | ) |
Set the owner of the calendar.
Should be owner's full name.
- Parameters:
-
owner the person who owns this calendar resource
Definition at line 880 of file resourcecached.cpp.
void ResourceCached::setReloaded | ( | bool | done | ) | [protected] |
Set the cache-reloaded status.
Non-local resources must set this true once the cache has been downloaded successfully.
- Parameters:
-
done the new cache-reloaded status
Definition at line 125 of file resourcecached.cpp.
void ResourceCached::setReloadInterval | ( | int | minutes | ) |
Set reload interval in minutes which is used when reload policy is ReloadInterval.
Definition at line 142 of file resourcecached.cpp.
void ResourceCached::setReloadPolicy | ( | int | policy | ) |
Set reload policy.
This controls when the cache is refreshed.
ReloadNever never reload ReloadOnStartup reload when resource is started ReloadInterval reload regularly after given interval
Definition at line 130 of file resourcecached.cpp.
void ResourceCached::setSaveInterval | ( | int | minutes | ) |
Set save interval in minutes which is used when save policy is SaveInterval.
Definition at line 173 of file resourcecached.cpp.
void ResourceCached::setSavePolicy | ( | int | policy | ) |
Set save policy.
This controls when the cache is refreshed.
SaveNever never save SaveOnExit save when resource is exited SaveInterval save regularly after given interval SaveDelayed save on every change, after small delay SaveAlways save on every change
Definition at line 161 of file resourcecached.cpp.
void ResourceCached::setTimeSpec | ( | const KDateTime::Spec & | timeSpec | ) | [virtual] |
Set the time specification (time zone, etc.
).
- Parameters:
-
timeSpec the time specification to set
- See also:
- timeSpec()
Implements KCal::ResourceCalendar.
Definition at line 353 of file resourcecached.cpp.
void ResourceCached::setTimeZoneId | ( | const QString & | timeZoneId | ) | [virtual] |
Set id of timezone, e.g.
"Europe/Berlin"
- Parameters:
-
timeZoneId the identifier for the timezone
- See also:
- timeZoneId()
Implements KCal::ResourceCalendar.
Definition at line 363 of file resourcecached.cpp.
void ResourceCached::shiftTimes | ( | const KDateTime::Spec & | oldSpec, | |
const KDateTime::Spec & | newSpec | |||
) | [virtual] |
Shifts the times of all incidences so that they appear at the same clock time as before but in a new time zone.
The shift is done from a viewing time zone rather than from the actual incidence time zone.
For example, shifting an incidence whose start time is 09:00 America/New York, using an old viewing time zone (oldSpec
) of Europe/London, to a new time zone (newSpec
) of Europe/Paris, will result in the time being shifted from 14:00 (which is the London time of the incidence start) to 14:00 Paris time.
- Parameters:
-
oldSpec the time specification which provides the clock times newSpec the new time specification
Implements KCal::ResourceCalendar.
Definition at line 373 of file resourcecached.cpp.
KDateTime::Spec ResourceCached::timeSpec | ( | ) | const [virtual] |
Get the viewing time specification (time zone etc.
) for the calendar.
- Returns:
- time specification
Implements KCal::ResourceCalendar.
Definition at line 358 of file resourcecached.cpp.
QString ResourceCached::timeZoneId | ( | ) | const [virtual] |
Returns the viewing time zone ID for the resource.
- Returns:
- the string containing the time zone ID, or empty string if the viewing time specification is not a time zone.
Implements KCal::ResourceCalendar.
Definition at line 368 of file resourcecached.cpp.
Todo * ResourceCached::todo | ( | const QString & | uid | ) | [virtual] |
Searches todolist for an event with this unique string identifier, returns a pointer or null.
Implements KCal::ResourceCalendar.
Definition at line 311 of file resourcecached.cpp.
The documentation for this class was generated from the following files: