libkcal Library API Documentation

KCal::CalendarLocal Class Reference

This class provides a calendar stored as a local file. More...

#include <calendarlocal.h>

Inheritance diagram for KCal::CalendarLocal:

KCal::Calendar QObject KCal::CustomProperties List of all members.

Public Methods

 CalendarLocal ()
 CalendarLocal (const QString &timeZoneId)
 ~CalendarLocal ()
bool load (const QString &fileName)
bool save (const QString &fileName, CalFormat *format=0)
void close ()
void save ()
bool addEvent (Event *event)
void deleteEvent (Event *event)
void deleteAllEvents ()
Eventevent (const QString &uid)
Event::List rawEvents ()
bool addTodo (Todo *todo)
void deleteTodo (Todo *)
void deleteAllTodos ()
Todotodo (const QString &uid)
Todo::List rawTodos ()
Todo::List todos (const QDate &date)
Todo::List todos ()
bool addJournal (Journal *)
void deleteJournal (Journal *)
void deleteAllJournals ()
Journaljournal (const QDate &)
Journaljournal (const QString &uid)
Journal::List journals ()
Alarm::List alarms (const QDateTime &from, const QDateTime &to)
Alarm::List alarmsTo (const QDateTime &to)
void update (IncidenceBase *incidence)
Event::List rawEventsForDate (const QDate &date, bool sorted=false)
Event::List rawEventsForDate (const QDateTime &qdt)
Event::List rawEvents (const QDate &start, const QDate &end, bool inclusive=false)

Protected Methods

void incidenceUpdated (IncidenceBase *i)
void insertEvent (Event *event)
void appendAlarms (Alarm::List &alarms, Incidence *incidence, const QDateTime &from, const QDateTime &to)
void appendRecurringAlarms (Alarm::List &alarms, Incidence *incidence, const QDateTime &from, const QDateTime &to)

Detailed Description

This class provides a calendar stored as a local file.

Definition at line 35 of file calendarlocal.h.


Constructor & Destructor Documentation

CalendarLocal::CalendarLocal  
 

Constructs a new calendar, with variables initialized to sane values.

Definition at line 41 of file calendarlocal.cpp.

CalendarLocal::CalendarLocal const QString   timeZoneId
 

Constructs a new calendar, with variables initialized to sane values.

Definition at line 47 of file calendarlocal.cpp.


Member Function Documentation

bool CalendarLocal::load const QString   fileName
 

Loads a calendar on disk in vCalendar or iCalendar format into the current calendar.

Incidences already present are preserved. If an event of the file to be loaded has the same unique id as an incidence already present the new incidence is ignored.

To load a CalendarLocal object from a file without preserving existing incidences call close() before load().

Returns:
true, if successful, false on error.
Parameters:
fileName  the name of the calendar on disk.

Definition at line 63 of file calendarlocal.cpp.

References KCal::FileStorage::load().

Referenced by KCal::ResourceRemote::load(), and KCal::ResourceLocal::load().

bool CalendarLocal::save const QString   fileName,
CalFormat   format = 0
 

Writes out the calendar to disk in the specified format.

CalendarLocal takes ownership of the CalFormat object.

Parameters:
fileName  the name of the file
format  the format to use
Returns:
true, if successful, false on error.

Definition at line 69 of file calendarlocal.cpp.

References KCal::FileStorage::save().

Referenced by KCal::ResourceRemote::save(), and KCal::ResourceLocal::save().

void CalendarLocal::close   [virtual]
 

Clears out the current calendar, freeing all used memory etc.

etc.

Implements KCal::Calendar.

Definition at line 75 of file calendarlocal.cpp.

References deleteAllEvents(), deleteAllJournals(), and deleteAllTodos().

Referenced by KCal::ResourceRemote::doClose(), KCal::ResourceLocal::doClose(), KCal::ResourceKABC::doClose(), KCal::ResourceRemote::load(), and KCal::ResourceKABC::load().

void KCal::CalendarLocal::save   [inline, virtual]
 

Sync changes in memory to persistant storage.

Implements KCal::Calendar.

Definition at line 76 of file calendarlocal.h.

bool CalendarLocal::addEvent Event   event [virtual]
 

Add Event to calendar.

Implements KCal::Calendar.

Definition at line 85 of file calendarlocal.cpp.

References insertEvent(), and KCal::IncidenceBase::registerObserver().

Referenced by KCal::ResourceIMAP::addEvent(), KCal::ResourceCached::addEvent(), KCal::DndFactory::copyEvent(), and KCal::ResourceKABC::load().

void CalendarLocal::deleteEvent Event   event [virtual]
 

Deletes an event from this calendar.

Implements KCal::Calendar.

Definition at line 96 of file calendarlocal.cpp.

References QDict< Event >::remove(), and KCal::IncidenceBase::uid().

Referenced by KCal::ResourceIMAP::deleteEvent(), and KCal::ResourceCached::deleteEvent().

void CalendarLocal::deleteAllEvents  
 

Deletes all events from this calendar.

Definition at line 107 of file calendarlocal.cpp.

References QDict< Event >::clear(), and QDict< Event >::setAutoDelete().

Referenced by close().

Event * CalendarLocal::event const QString   uid [virtual]
 

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

Implements KCal::Calendar.

Definition at line 115 of file calendarlocal.cpp.

Referenced by KCal::ResourceKABC::event(), KCal::ResourceIMAP::event(), KCal::ResourceCached::event(), rawEvents(), and rawEventsForDate().

Event::List CalendarLocal::rawEvents   [virtual]
 

Return unfiltered list of all events in calendar.

Implements KCal::Calendar.

Definition at line 425 of file calendarlocal.cpp.

References QDictIterator::current().

Referenced by KCal::ResourceKABC::rawEvents(), KCal::ResourceIMAP::rawEvents(), and KCal::ResourceCached::rawEvents().

bool CalendarLocal::addTodo Todo   todo [virtual]
 

Add a todo to the todolist.

Implements KCal::Calendar.

Definition at line 121 of file calendarlocal.cpp.

References KCal::IncidenceBase::registerObserver(), and KCal::Calendar::setupRelations().

Referenced by KCal::ResourceIMAP::addTodo(), KCal::ResourceCached::addTodo(), and KCal::DndFactory::copyTodo().

void CalendarLocal::deleteTodo Todo   [virtual]
 

Remove a todo from the todolist.

Implements KCal::Calendar.

Definition at line 135 of file calendarlocal.cpp.

References KCal::Calendar::removeRelations().

Referenced by KCal::ResourceIMAP::deleteTodo(), and KCal::ResourceCached::deleteTodo().

void CalendarLocal::deleteAllTodos  
 

Deletes all todos from this calendar.

Definition at line 145 of file calendarlocal.cpp.

Referenced by close().

Todo * CalendarLocal::todo const QString   uid [virtual]
 

Searches todolist for an event with this unique string identifier, returns a pointer or null.

Implements KCal::Calendar.

Definition at line 158 of file calendarlocal.cpp.

Referenced by KCal::ResourceKABC::todo(), KCal::ResourceIMAP::todo(), KCal::ResourceCached::todo(), and todos().

Todo::List CalendarLocal::rawTodos   [virtual]
 

Return list of all todos.

Implements KCal::Calendar.

Definition at line 153 of file calendarlocal.cpp.

Referenced by KCal::ResourceKABC::rawTodos(), KCal::ResourceIMAP::rawTodos(), and KCal::ResourceCached::rawTodos().

Todo::List CalendarLocal::todos const QDate   date [virtual]
 

Returns list of todos due on the specified date.

Implements KCal::Calendar.

Definition at line 168 of file calendarlocal.cpp.

References QDateTime::date(), KCal::Todo::dtDue(), KCal::Todo::hasDueDate(), todo(), and todos().

Referenced by KCal::DndFactory::createDropTodo(), KCal::ICalFormat::fromString(), KCal::DndFactory::pasteIncidence(), KCal::ResourceKABC::todos(), KCal::ResourceIMAP::todos(), KCal::ResourceCached::todos(), and todos().

Todo::List KCal::CalendarLocal::todos   [inline, virtual]
 

Return list of all todos.

Workaround because compiler does not recognize function of base class.

Reimplemented from KCal::Calendar.

Definition at line 130 of file calendarlocal.h.

bool CalendarLocal::addJournal Journal   [virtual]
 

Add a Journal entry to calendar.

Implements KCal::Calendar.

Definition at line 434 of file calendarlocal.cpp.

References KCal::IncidenceBase::dtStart(), QDateTime::isValid(), KCal::IncidenceBase::registerObserver(), and QDateTime::toString().

Referenced by KCal::ResourceIMAP::addJournal(), and KCal::ResourceCached::addJournal().

void CalendarLocal::deleteJournal Journal   [virtual]
 

Remove a Journal from the calendar.

Implements KCal::Calendar.

Definition at line 450 of file calendarlocal.cpp.

Referenced by KCal::ResourceIMAP::deleteJournal(), and KCal::ResourceCached::deleteJournal().

void CalendarLocal::deleteAllJournals  
 

Deletes all journals from this calendar.

Definition at line 457 of file calendarlocal.cpp.

Referenced by close().

Journal * CalendarLocal::journal const QDate   [virtual]
 

Return Journal for given date.

Implements KCal::Calendar.

Definition at line 464 of file calendarlocal.cpp.

Referenced by KCal::ResourceKABC::journal(), KCal::ResourceIMAP::journal(), and KCal::ResourceCached::journal().

Journal * CalendarLocal::journal const QString   uid [virtual]
 

Return Journal with given UID.

Implements KCal::Calendar.

Definition at line 476 of file calendarlocal.cpp.

Journal::List CalendarLocal::journals   [virtual]
 

Return list of all Journals stored in calendar.

Implements KCal::Calendar.

Definition at line 486 of file calendarlocal.cpp.

Referenced by KCal::ICalFormat::fromString(), KCal::ResourceKABC::journals(), KCal::ResourceIMAP::journals(), and KCal::ResourceCached::journals().

Alarm::List CalendarLocal::alarms const QDateTime   from,
const QDateTime   to
[virtual]
 

Return all alarms, which ocur in the given time interval.

Implements KCal::Calendar.

Definition at line 188 of file calendarlocal.cpp.

References alarms(), appendAlarms(), appendRecurringAlarms(), QDictIterator::current(), and KCal::Incidence::doesRecur().

Referenced by KCal::ResourceKABC::alarms(), KCal::ResourceIMAP::alarms(), KCal::ResourceCached::alarms(), alarms(), alarmsTo(), appendAlarms(), and appendRecurringAlarms().

Alarm::List CalendarLocal::alarmsTo const QDateTime   to
 

Return all alarms, which ocur before given date.

Definition at line 183 of file calendarlocal.cpp.

References alarms().

Referenced by KCal::ResourceKABC::alarmsTo(), KCal::ResourceIMAP::alarmsTo(), and KCal::ResourceCached::alarmsTo().

void CalendarLocal::update IncidenceBase   incidence
 

This method should be called whenever a Event is modified directly via it's pointer.

It makes sure that the calendar is internally consistent.

Definition at line 280 of file calendarlocal.cpp.

References QDateTime::currentDateTime(), KCal::IncidenceBase::setLastModified(), and KCal::IncidenceBase::setSyncStatus().

Referenced by incidenceUpdated().

Event::List CalendarLocal::rawEventsForDate const QDate   date,
bool    sorted = false
[virtual]
 

Builds and then returns a list of all events that match for the date specified.

useful for dayView, etc. etc.

Implements KCal::Calendar.

Definition at line 305 of file calendarlocal.cpp.

References QDate::addDays(), QDictIterator::current(), QDateTime::date(), KCal::Incidence::doesRecur(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), event(), KCal::Event::isMultiDay(), and KCal::Incidence::recursOn().

Referenced by KCal::ResourceKABC::rawEventsForDate(), KCal::ResourceIMAP::rawEventsForDate(), KCal::ResourceCached::rawEventsForDate(), and rawEventsForDate().

Event::List CalendarLocal::rawEventsForDate const QDateTime   qdt [virtual]
 

Get unfiltered events for date qdt.

Implements KCal::Calendar.

Definition at line 420 of file calendarlocal.cpp.

References QDateTime::date(), and rawEventsForDate().

Event::List CalendarLocal::rawEvents const QDate   start,
const QDate   end,
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. If inclusive is set to false, all events which overlap the range are returned. An event's entire time span is considered in evaluating whether it should be returned. For a non-recurring event, its span is from its start to its end date. For a recurring event, its time span is from its first to its last recurrence.

Implements KCal::Calendar.

Definition at line 355 of file calendarlocal.cpp.

References QDictIterator::current(), QDateTime::date(), KCal::Incidence::doesRecur(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), KCal::Recurrence::duration(), KCal::Recurrence::endDate(), event(), and KCal::Incidence::recurrence().

void KCal::CalendarLocal::incidenceUpdated IncidenceBase   i [inline, protected]
 

Notification function of IncidenceBase::Observer.

Definition at line 198 of file calendarlocal.h.

References update().

void CalendarLocal::insertEvent Event   event [protected]
 

inserts an event into its "proper place" in the calendar.

Definition at line 291 of file calendarlocal.cpp.

References QDict< Event >::insert(), and KCal::IncidenceBase::uid().

Referenced by addEvent().

void CalendarLocal::appendAlarms Alarm::List &    alarms,
Incidence   incidence,
const QDateTime   from,
const QDateTime   to
[protected]
 

Append alarms of incidence in interval to list of alarms.

Definition at line 210 of file calendarlocal.cpp.

References alarms(), KCal::Incidence::alarms(), KCal::Incidence::summary(), and QDateTime::time().

Referenced by alarms().

void CalendarLocal::appendRecurringAlarms Alarm::List &    alarms,
Incidence   incidence,
const QDateTime   from,
const QDateTime   to
[protected]
 

Append alarms of recurring events in interval to list of alarms.

Definition at line 229 of file calendarlocal.cpp.

References QDateTime::addSecs(), alarms(), KCal::Incidence::alarms(), KCal::Duration::asSeconds(), QDateTime::date(), KCal::Incidence::dtEnd(), KCal::IncidenceBase::dtStart(), KCal::Alarm::endOffset(), KCal::Recurrence::getNextDateTime(), KCal::Alarm::hasEndOffset(), KCal::Alarm::hasStartOffset(), KCal::Alarm::hasTime(), KCal::Incidence::isException(), QDateTime::isValid(), KCal::Incidence::recurrence(), QDateTime::secsTo(), KCal::Alarm::startOffset(), KCal::Incidence::summary(), KCal::Alarm::time(), and QDateTime::toString().

Referenced by alarms().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for libkcal Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:24 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003