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 List of all members.

Public Member Functions

 CalendarLocal ()
 constructs a new calendar, with variables initialized to sane values.

 CalendarLocal (const QString &timeZoneId)
 constructs a new calendar, with variables initialized to sane values.

bool load (const QString &fileName)
 Loads a calendar on disk in vCalendar or iCalendar format into the current calendar.

bool save (const QString &fileName, CalFormat *format=0)
 Writes out the calendar to disk in the specified format.

void close ()
 clears out the current calendar, freeing all used memory etc.

void addEvent (Event *anEvent)
 Add Event to calendar.

void deleteEvent (Event *)
 deletes an event from this calendar.

Eventevent (const QString &UniqueStr)
 Retrieves an event on the basis of the unique string ID.

QPtrList< EventrawEvents ()
 Return unfiltered list of all events in calendar.

QString getHolidayForDate (const QDate &qd)
int numEvents (const QDate &qd)
 returns the number of events that are present on the specified date.

void addTodo (Todo *todo)
 Add a todo to the todolist.

void deleteTodo (Todo *)
 Remove a todo from the todolist.

Todotodo (const QString &uid)
 Searches todolist for an event with this unique string identifier, returns a pointer or null.

QPtrList< TodorawTodos () const
 Return list of all todos.

QPtrList< Todotodos (const QDate &date)
 Returns list of todos due on the specified date.

QPtrList< Todotodos ()
 Return list of all todos.

virtual void addJournal (Journal *)
 Add a Journal entry to calendar.

virtual void deleteJournal (Journal *)
 Remove a Journal from the calendar.

virtual Journaljournal (const QDate &)
 Return Journal for given date.

virtual Journaljournal (const QString &UID)
 Return Journal with given UID.

QPtrList< Journaljournals ()
 Return list of all Journals stored in calendar.

Alarm::List alarms (const QDateTime &from, const QDateTime &to)
 Return all alarms, which ocur in the given time interval.

Alarm::List alarmsTo (const QDateTime &to)
 Return all alarms, which ocur before given date.

void update (IncidenceBase *incidence)
 this method should be called whenever a Event is modified directly via it's pointer.

QPtrList< EventrawEventsForDate (const QDate &date, bool sorted=false)
 Builds and then returns a list of all events that match for the date specified.

QPtrList< EventrawEventsForDate (const QDateTime &qdt)
 Get unfiltered events for date qdt.

QPtrList< EventrawEvents (const QDate &start, const QDate &end, bool inclusive=false)
 Get unfiltered events in a range of dates.


Protected Member Functions

void incidenceUpdated (IncidenceBase *i)
 Notification function of IncidenceBase::Observer.

void insertEvent (const Event *anEvent)
 inserts an event into its "proper place" in the calendar.

long int makeKey (const QDateTime &dt)
 on the basis of a QDateTime, forms a hash key for the dictionary.

long int makeKey (const QDate &d)
 on the basis of a QDate, forms a hash key for the dictionary

QDate keyToDate (long int key)
 Return the date for which the specified key was made.

void appendAlarms (Alarm::List &alarms, Incidence *incidence, const QDateTime &from, const QDateTime &to)
 Append alarms of incidence in interval to list of alarms.

void appendRecurringAlarms (Alarm::List &alarms, Incidence *incidence, const QDateTime &from, const QDateTime &to)
 Append alarms of recurring events in interval to list of alarms.


Detailed Description

This class provides a calendar stored as a local file.

Definition at line 38 of file calendarlocal.h.


Constructor & Destructor Documentation

CalendarLocal::CalendarLocal  ) 
 

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

Definition at line 42 of file calendarlocal.cpp.

CalendarLocal::CalendarLocal const QString timeZoneId  ) 
 

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

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

Any information already present is lost.

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

Definition at line 78 of file calendarlocal.cpp.

References KCal::FileStorage::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.

Returns:
true, if successfull, false on error.
Parameters:
fileName the name of the file

Definition at line 84 of file calendarlocal.cpp.

References KCal::FileStorage::save().

void CalendarLocal::close  )  [virtual]
 

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

etc.

Implements KCal::Calendar.

Definition at line 90 of file calendarlocal.cpp.

References QPtrList< Todo >::clear(), QPtrList< Event >::clear(), QIntDict< QPtrList< Event > >::clear(), QIntDictIterator::current(), QIntDictIterator::currentKey(), QDateTime::date(), KCal::IncidenceBase::dtStart(), QPtrList::first(), KCal::Event::isMultiDay(), keyToDate(), QPtrList::next(), and QIntDictIterator::toFirst().

void CalendarLocal::addEvent Event anEvent  )  [virtual]
 

Add Event to calendar.

Implements KCal::Calendar.

Definition at line 134 of file calendarlocal.cpp.

References KCal::Calendar::getEmail(), insertEvent(), KCal::IncidenceBase::organizer(), KCal::IncidenceBase::registerObserver(), and KCal::Incidence::summary().

Referenced by KCal::DndFactory::copyEvent(), and KCal::DndFactory::createDrag().

void CalendarLocal::deleteEvent Event  )  [virtual]
 

deletes an event from this calendar.

Implements KCal::Calendar.

Definition at line 149 of file calendarlocal.cpp.

References QDate::addDays(), QPtrList< Event >::current(), QDateTime::date(), QDate::daysTo(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), QIntDict< QPtrList< Event > >::find(), QPtrList< Event >::first(), QPtrList::first(), KCal::Event::isMultiDay(), makeKey(), QPtrList< Event >::next(), QPtrList::next(), QPtrList< Event >::remove(), QPtrList::remove(), and QPtrList::setAutoDelete().

Event * CalendarLocal::event const QString UniqueStr  )  [virtual]
 

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

Implements KCal::Calendar.

Definition at line 247 of file calendarlocal.cpp.

References QIntDictIterator::current(), QPtrList< Event >::first(), QPtrList::first(), QPtrList< Event >::next(), QPtrList::next(), and KCal::IncidenceBase::uid().

Referenced by rawEventsForDate().

QPtrList< Event > CalendarLocal::rawEvents  )  [virtual]
 

Return unfiltered list of all events in calendar.

Implements KCal::Calendar.

Definition at line 697 of file calendarlocal.cpp.

int CalendarLocal::numEvents const QDate qd  )  [virtual]
 

returns the number of events that are present on the specified date.

Implements KCal::Calendar.

Definition at line 322 of file calendarlocal.cpp.

References QDate::addDays(), QPtrList::count(), QDateTime::date(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), QIntDict< QPtrList< Event > >::find(), QPtrList< Event >::first(), KCal::Event::isMultiDay(), makeKey(), QPtrList< Event >::next(), and KCal::Incidence::recursOn().

void CalendarLocal::addTodo Todo todo  )  [virtual]
 

Add a todo to the todolist.

Implements KCal::Calendar.

Definition at line 275 of file calendarlocal.cpp.

References QPtrList< Todo >::append(), and KCal::IncidenceBase::registerObserver().

Referenced by KCal::DndFactory::createDragTodo().

void CalendarLocal::deleteTodo Todo  )  [virtual]
 

Remove a todo from the todolist.

Implements KCal::Calendar.

Definition at line 284 of file calendarlocal.cpp.

References QPtrList< Todo >::findRef(), and QPtrList< Todo >::remove().

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 297 of file calendarlocal.cpp.

References QPtrList< Todo >::first(), QPtrList< Todo >::next(), and KCal::IncidenceBase::uid().

QPtrList< Todo > CalendarLocal::rawTodos  )  const [virtual]
 

Return list of all todos.

Implements KCal::Calendar.

Definition at line 292 of file calendarlocal.cpp.

QPtrList< Todo > CalendarLocal::todos const QDate date  )  [virtual]
 

Returns list of todos due on the specified date.

Implements KCal::Calendar.

Definition at line 308 of file calendarlocal.cpp.

References QPtrList::append(), QDateTime::date(), KCal::Todo::dtDue(), QPtrList< Todo >::first(), KCal::Todo::hasDueDate(), QPtrList< Todo >::next(), and todos().

Referenced by KCal::DndFactory::createDropTodo(), KCal::DndFactory::pasteEvent(), and todos().

QPtrList<Todo> 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 118 of file calendarlocal.h.

void CalendarLocal::addJournal Journal  )  [virtual]
 

Add a Journal entry to calendar.

Implements KCal::Calendar.

Definition at line 707 of file calendarlocal.cpp.

References QPtrList< Journal >::append(), KCal::IncidenceBase::dtStart(), QDateTime::isValid(), KCal::IncidenceBase::registerObserver(), and QDateTime::toString().

void CalendarLocal::deleteJournal Journal  )  [virtual]
 

Remove a Journal from the calendar.

Definition at line 721 of file calendarlocal.cpp.

References QPtrList< Journal >::findRef(), and QPtrList< Journal >::remove().

Journal * CalendarLocal::journal const QDate  )  [virtual]
 

Return Journal for given date.

Implements KCal::Calendar.

Definition at line 729 of file calendarlocal.cpp.

References QDateTime::date(), KCal::IncidenceBase::dtStart(), QPtrList< Journal >::first(), and QPtrList< Journal >::next().

Journal * CalendarLocal::journal const QString UID  )  [virtual]
 

Return Journal with given UID.

Implements KCal::Calendar.

Definition at line 740 of file calendarlocal.cpp.

References QPtrList< Journal >::first(), QPtrList< Journal >::next(), and KCal::IncidenceBase::uid().

QPtrList< Journal > CalendarLocal::journals  )  [virtual]
 

Return list of all Journals stored in calendar.

Implements KCal::Calendar.

Definition at line 749 of file calendarlocal.cpp.

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 362 of file calendarlocal.cpp.

References alarms(), appendAlarms(), appendRecurringAlarms(), QIntDictIterator::current(), QPtrList< Todo >::first(), QPtrList< Event >::first(), QPtrList::first(), QPtrList< Todo >::next(), QPtrList< Event >::next(), QPtrList::next(), and QDateTime::toString().

Referenced by alarms(), and alarmsTo().

Alarm::List CalendarLocal::alarmsTo const QDateTime to  ) 
 

Return all alarms, which ocur before given date.

Definition at line 354 of file calendarlocal.cpp.

References alarms().

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 438 of file calendarlocal.cpp.

References QIntDictIterator::current(), QPtrList< Event >::findRef(), insertEvent(), QPtrList::removeRef(), KCal::IncidenceBase::setLastModified(), KCal::IncidenceBase::setSyncStatus(), QPtrList< Event >::take(), QIntDictIterator::toFirst(), and KCal::IncidenceBase::type().

Referenced by incidenceUpdated().

QPtrList< Event > 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 553 of file calendarlocal.cpp.

References QDate::addDays(), QPtrList::append(), QDateTime::date(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), event(), QIntDict< QPtrList< Event > >::find(), QPtrList< Event >::first(), QPtrList::first(), QPtrList::insert(), KCal::Event::isMultiDay(), makeKey(), QPtrList< Event >::next(), QPtrList::next(), KCal::Incidence::recursOn(), and QDateTime::time().

Referenced by rawEventsForDate().

QPtrList< Event > CalendarLocal::rawEventsForDate const QDateTime qdt  )  [virtual]
 

Get unfiltered events for date qdt.

Implements KCal::Calendar.

Definition at line 692 of file calendarlocal.cpp.

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

QPtrList< Event > 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.

Implements KCal::Calendar.

Definition at line 606 of file calendarlocal.cpp.

References QPtrList::append(), QIntDictIterator::current(), QIntDictIterator::currentKey(), QDateTime::date(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), KCal::Recurrence::duration(), KCal::Recurrence::endDate(), QPtrList< Event >::first(), QPtrList::first(), KCal::Event::isMultiDay(), keyToDate(), QPtrList< Event >::next(), QPtrList::next(), KCal::Incidence::recurrence(), and QIntDictIterator::toFirst().

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

Notification function of IncidenceBase::Observer.

Definition at line 163 of file calendarlocal.h.

References update().

void CalendarLocal::insertEvent const Event anEvent  )  [protected]
 

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

Definition at line 474 of file calendarlocal.cpp.

References QDateTime::addDays(), QPtrList::append(), QPtrList< Event >::append(), QDateTime::date(), KCal::Recurrence::doesRecur(), KCal::Event::dtEnd(), KCal::IncidenceBase::dtStart(), QIntDict< QPtrList< Event > >::find(), QIntDict< QPtrList< Event > >::insert(), makeKey(), and KCal::Incidence::recurrence().

Referenced by addEvent(), and update().

long int CalendarLocal::makeKey const QDateTime dt  )  [protected]
 

on the basis of a QDateTime, forms a hash key for the dictionary.

Definition at line 518 of file calendarlocal.cpp.

References QDateTime::date(), QDate::day(), QDate::month(), QString::sprintf(), QString::toLong(), and QDate::year().

Referenced by deleteEvent(), insertEvent(), numEvents(), and rawEventsForDate().

long int CalendarLocal::makeKey const QDate d  )  [protected]
 

on the basis of a QDate, forms a hash key for the dictionary

Definition at line 530 of file calendarlocal.cpp.

References QDate::day(), QDate::month(), QString::sprintf(), QString::toLong(), and QDate::year().

QDate CalendarLocal::keyToDate long int  key  )  [protected]
 

Return the date for which the specified key was made.

Definition at line 538 of file calendarlocal.cpp.

References QString::mid(), and QString::number().

Referenced by close(), and rawEvents().

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 392 of file calendarlocal.cpp.

References KCal::Incidence::alarms(), QValueList::append(), KCal::Alarm::enabled(), QPtrList::first(), QPtrList::next(), KCal::Incidence::summary(), KCal::Alarm::time(), and QDateTime::toString().

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 410 of file calendarlocal.cpp.

References KCal::Incidence::alarms(), QValueList::append(), QDateTime::date(), KCal::Alarm::enabled(), QPtrList::first(), QPtrList::next(), KCal::Incidence::recursOn(), QDateTime::setDate(), QDateTime::setTime(), KCal::Incidence::summary(), QDateTime::time(), 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 kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:28 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001