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

KCal Library

KCal::ResourceCached

KCal::ResourceCached Class Reference

#include <resourcecached.h>

Inheritance diagram for KCal::ResourceCached:

Inheritance graph
[legend]

List of all members.


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.


Public Types

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

Public Member Functions

 ResourceCached (const KConfigGroup &group)
void readConfig (const KConfigGroup &group)
void writeConfig (KConfigGroup &group)
void setReloadPolicy (int policy)
int reloadPolicy () const
void setReloadInterval (int minutes)
int reloadInterval () const
bool inhibitDefaultReload (bool inhibit)
bool defaultReloadInhibited () const
bool reloaded () const
void setSavePolicy (int policy)
int savePolicy () const
void setSaveInterval (int minutes)
int saveInterval () const
KDateTime lastLoad () const
KDateTime lastSave () const
bool load (CacheAction)
virtual bool load ()
bool save (CacheAction, Incidence *incidence=0)
virtual bool save (Incidence *incidence=0)
bool addEvent (Event *event)
bool deleteEvent (Event *event)
void deleteAllEvents ()
Event * event (const QString &UniqueStr)
Event::List events ()
Event::List rawEvents (EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Event::List rawEventsForDate (const QDate &date, const KDateTime::Spec &timespec=KDateTime::Spec(), EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Event::List rawEventsForDate (const KDateTime &dt)
Event::List rawEvents (const QDate &start, const QDate &end, const KDateTime::Spec &timespec=KDateTime::Spec(), bool inclusive=false)
bool addTodo (Todo *todo)
bool deleteTodo (Todo *)
void deleteAllTodos ()
Todo * todo (const QString &uid)
Todo::List rawTodos (TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Todo::List rawTodosForDate (const QDate &date)
virtual bool addJournal (Journal *)
virtual bool deleteJournal (Journal *)
virtual void deleteAllJournals ()
virtual Journal * journal (const QString &uid)
Journal::List rawJournals (JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Journal::List rawJournalsForDate (const QDate &date)
Alarm::List alarms (const KDateTime &from, const KDateTime &to)
Alarm::List alarmsTo (const KDateTime &to)
void setTimeSpec (const KDateTime::Spec &timeSpec)
KDateTime::Spec timeSpec () const
void setTimeZoneId (const QString &timeZoneId)
QString timeZoneId () const
virtual void shiftTimes (const KDateTime::Spec &oldSpec, const KDateTime::Spec &newSpec)
Person owner () const
void setOwner (const Person &owner)
void enableChangeNotification ()
void disableChangeNotification ()
void clearChange (Incidence *incidence)
void clearChange (const QString &uid)
void clearChanges ()
bool hasChanges () const
Incidence::List allChanges () const
Incidence::List addedIncidences () const
Incidence::List changedIncidences () const
Incidence::List deletedIncidences () const
bool loadFromCache ()
void saveToCache ()
void clearCache ()
void cleanUpEventCache (const KCal::Event::List &eventList)
void cleanUpTodoCache (const KCal::Todo::List &todoList)
KRES::IdMapper & idMapper ()

Protected Slots

void slotReload ()
void slotSave ()
void setIdMapperIdentifier ()

Protected Member Functions

CalendarLocal * calendar () const
void calendarIncidenceAdded (KCal::Incidence *incidence)
void calendarIncidenceChanged (KCal::Incidence *incidence)
void calendarIncidenceDeleted (KCal::Incidence *incidence)
virtual void doClose ()
virtual bool doOpen ()
virtual bool doLoad (bool syncCache)=0
void setReloaded (bool done)
virtual bool doSave (bool syncCache)=0
virtual bool doSave (bool syncCache, Incidence *)
bool checkForReload ()
bool checkForSave ()
void checkForAutomaticSave ()
void addInfoText (QString &) const
void setupSaveTimer ()
void setupReloadTimer ()
virtual QString cacheFile () const
virtual QString changesCacheFile (const QString &type) const
void loadChangesCache (QMap< Incidence *, bool > &map, const QString &type)
void loadChangesCache ()
void saveChangesCache (const QMap< Incidence *, bool > &map, const QString &type)
void saveChangesCache ()

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

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.

int ResourceCached::reloadPolicy (  )  const

Return reload policy.

See also:
setReloadPolicy()

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

int ResourceCached::reloadInterval (  )  const

Return reload interval in minutes.

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

bool ResourceCached::reloaded (  )  const

Return whether the resource cache has been reloaded since startup.

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

int ResourceCached::savePolicy (  )  const

Return save policy.

See also:
setsavePolicy()

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

int ResourceCached::saveInterval (  )  const

Return save interval in minutes.

Definition at line 178 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 ( 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 389 of file resourcecached.cpp.

bool ResourceCached::load (  )  [virtual]

Load resource data.

Reimplemented from KCal::ResourceCalendar.

Definition at line 435 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 459 of file resourcecached.cpp.

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

Save resource data.

Reimplemented from KCal::ResourceCalendar.

Definition at line 496 of file resourcecached.cpp.

bool ResourceCached::addEvent ( Event *  event  )  [virtual]

Add event to calendar.

Implements KCal::ResourceCalendar.

Definition at line 235 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 241 of file resourcecached.cpp.

void ResourceCached::deleteAllEvents (  )  [virtual]

Removes all Events from this calendar.

Implements KCal::ResourceCalendar.

Reimplemented in KCal::ResourceLocalDir.

Definition at line 248 of file resourcecached.cpp.

Event * ResourceCached::event ( const QString &  UniqueStr  )  [virtual]

Retrieves an event on the basis of the unique string ID.

Implements KCal::ResourceCalendar.

Definition at line 253 of file resourcecached.cpp.

Event::List KCal::ResourceCached::events (  ) 

Return filtered list of all events in calendar.

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

Event::List ResourceCached::rawEventsForDate ( const KDateTime &  dt  )  [virtual]

Get unfiltered events for date dt.

Implements KCal::ResourceCalendar.

Definition at line 273 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 267 of file resourcecached.cpp.

bool ResourceCached::addTodo ( Todo *  todo  )  [virtual]

Add a todo to the todolist.

Implements KCal::ResourceCalendar.

Definition at line 283 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 288 of file resourcecached.cpp.

void ResourceCached::deleteAllTodos (  )  [virtual]

Removes all todos from this calendar.

Implements KCal::ResourceCalendar.

Reimplemented in KCal::ResourceLocalDir.

Definition at line 293 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 313 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 308 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 318 of file resourcecached.cpp.

bool ResourceCached::addJournal ( Journal *  journal  )  [virtual]

Add a Journal entry to calendar.

Implements KCal::ResourceCalendar.

Definition at line 323 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 298 of file resourcecached.cpp.

void ResourceCached::deleteAllJournals (  )  [virtual]

Removes all Journals from this calendar.

Implements KCal::ResourceCalendar.

Reimplemented in KCal::ResourceLocalDir.

Definition at line 303 of file resourcecached.cpp.

Journal * ResourceCached::journal ( const QString &  uid  )  [virtual]

Return Journal with given unique id.

Implements KCal::ResourceCalendar.

Definition at line 330 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 335 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 340 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 350 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 345 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 357 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 362 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 367 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 372 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 377 of file resourcecached.cpp.

Person KCal::ResourceCached::owner (  )  const

Return the owner of the calendar's full name.

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

void ResourceCached::saveToCache (  ) 

Save the resource back to the cache.

Definition at line 507 of file resourcecached.cpp.

void ResourceCached::clearCache (  ) 

Clear cache.

Definition at line 522 of file resourcecached.cpp.

KRES::IdMapper & ResourceCached::idMapper (  ) 

Returns a reference to the id mapper.

Definition at line 592 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 661 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 677 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.

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

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

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.

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.

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

Reimplemented from KCal::ResourceCalendar.

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

Definition at line 501 of file resourcecached.cpp.

bool ResourceCached::checkForReload (  )  [protected]

Check if reload required according to reload policy.

Definition at line 840 of file resourcecached.cpp.

bool ResourceCached::checkForSave (  )  [protected]

Check if save required according to save policy.

Definition at line 851 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 859 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 597 of file resourcecached.cpp.

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

Functions for keeping the changes persistent.

Definition at line 602 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"
  • kabc
  • kblog
  • kcal
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.5.5
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