• Skip to content
  • Skip to link menu
KDE 4.4 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KCal Library

KCal::ResourceCached

KCal::ResourceCached Class Reference

This class provides a calendar resource using a local CalendarLocal object to cache the calendar data. More...

#include <resourcecached.h>

Inheritance diagram for KCal::ResourceCached:
Inheritance graph
[legend]

List of all members.

Public Types

enum  { ReloadNever, ReloadOnStartup, ReloadInterval }
enum  {
  SaveNever, SaveOnExit, SaveInterval, SaveDelayed,
  SaveAlways
}
enum  CacheAction { DefaultCache, NoSyncCache, SyncCache }

Public Member Functions

 ResourceCached (const KConfigGroup &group)
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 action)
bool loadFromCache ()
Person owner () const
Event::List rawEvents (const QDate &start, const QDate &end, const KDateTime::Spec &timeSpec=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 &timeSpec=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
virtual bool save (Incidence *incidence=0)
bool save (CacheAction action, 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 *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.

enum KCal::ResourceCached::CacheAction

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 856 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 603 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 667 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 680 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 694 of file resourcecached.cpp.

QString ResourceCached::changesCacheFile ( const QString &  type  )  const [protected, virtual]

Functions for keeping the changes persistent.

Definition at line 608 of file resourcecached.cpp.

bool ResourceCached::checkForReload (  )  [protected]

Check if reload required according to reload policy.

Definition at line 837 of file resourcecached.cpp.

bool ResourceCached::checkForSave (  )  [protected]

Check if save required according to save policy.

Definition at line 848 of file resourcecached.cpp.

void ResourceCached::clearCache (  ) 

Clear cache.

Definition at line 527 of file resourcecached.cpp.

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 870 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.

Reimplemented in KCal::ResourceLocalDir.

Definition at line 881 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. If false, only the cache will be updated
incidence The incidence to be saved.

Reimplemented from KCal::ResourceCalendar.

Reimplemented in KCal::ResourceLocal, and KCal::ResourceLocalDir.

Definition at line 506 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 (  ) 

Returns a reference to the id mapper.

Definition at line 598 of file resourcecached.cpp.

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 435 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().

Parameters:
action is the type of CacheAction for this data loading.

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 440 of file resourcecached.cpp.

Person KCal::ResourceCached::owner (  )  const

Return the owner of the calendar's full name.

Definition at line 892 of file resourcecached.cpp.

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

Return reload interval in minutes.

Definition at line 147 of file resourcecached.cpp.

int ResourceCached::reloadPolicy (  )  const

Return reload policy.

See also:
setReloadPolicy()

Definition at line 137 of file resourcecached.cpp.

bool ResourceCached::save ( Incidence *  incidence = 0  )  [virtual]

Save resource data.

Reimplemented from KCal::ResourceCalendar.

Definition at line 501 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:
action is the type of CacheAction for this data saving.
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 459 of file resourcecached.cpp.

int ResourceCached::saveInterval (  )  const

Return save interval in minutes.

Definition at line 178 of file resourcecached.cpp.

int ResourceCached::savePolicy (  )  const

Return save policy.

See also:
setsavePolicy()

Definition at line 168 of file resourcecached.cpp.

void ResourceCached::saveToCache (  ) 

Save the resource back to the cache.

Definition at line 512 of file resourcecached.cpp.

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 887 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:
  • resourcecached.h
  • resourcecached.cpp

KCal Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal