libkcal

KCal::CalendarResources Class Reference

#include <calendarresources.h>

Inheritance diagram for KCal::CalendarResources:

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

Detailed Description

This class provides a Calendar which is composed of other Calendars known as "Resources".

Examples of Calendar Resources are:

  • Calendars stored as local ICS formatted files
  • a set of incidences (one-per-file) within a local directory
  • birthdays and anniversaries contained in an addressbook

Definition at line 64 of file calendarresources.h.


Signals

void signalResourceModified (ResourceCalendar *resource)
void signalResourceAdded (ResourceCalendar *resource)
void signalResourceDeleted (ResourceCalendar *resource)
void signalErrorMessage (const QString &err)

Public Member Functions

 CalendarResources (const QString &timeZoneId, const QString &family=QString::fromLatin1("calendar"))
 ~CalendarResources ()
void load ()
bool reload (const QString &tz)
void close ()
virtual bool save (Ticket *ticket, Incidence *incidence=0)
void save ()
bool isSaving ()
CalendarResourceManagerresourceManager () const
ResourceCalendarresource (Incidence *incidence)
void readConfig (KConfig *config=0)
void setStandardDestinationPolicy ()
void setAskDestinationPolicy ()
QWidget * dialogParentWidget ()
void setDialogParentWidget (QWidget *parent)
TicketrequestSaveTicket (ResourceCalendar *resource)
virtual void releaseSaveTicket (Ticket *ticket)
void resourceAdded (ResourceCalendar *resource)
bool addIncidence (Incidence *incidence)
bool addIncidence (Incidence *incidence, ResourceCalendar *resource)
bool beginChange (Incidence *incidence)
bool endChange (Incidence *incidence)
bool addEvent (Event *event)
bool addEvent (Event *event, ResourceCalendar *resource)
bool deleteEvent (Event *event)
Event::List rawEvents (EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Event::List rawEventsForDate (const QDateTime &qdt)
Event::List rawEvents (const QDate &start, const QDate &end, bool inclusive=false)
Event::List rawEventsForDate (const QDate &date, EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Eventevent (const QString &uid)
bool addTodo (Todo *todo)
bool addTodo (Todo *todo, ResourceCalendar *resource)
bool deleteTodo (Todo *todo)
Todo::List rawTodos (TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Todo::List rawTodosForDate (const QDate &date)
Todotodo (const QString &uid)
bool addJournal (Journal *journal)
bool addJournal (Journal *journal, ResourceCalendar *resource)
bool deleteJournal (Journal *journal)
Journal::List rawJournals (JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Journal::List rawJournalsForDate (const QDate &date)
Journaljournal (const QString &uid)
Alarm::List alarms (const QDateTime &from, const QDateTime &to)
Alarm::List alarmsTo (const QDateTime &to)
void setTimeZoneIdViewOnly (const QString &tz)
bool hasCalendarResources ()

Protected Slots

void slotLoadError (ResourceCalendar *resource, const QString &err)
void slotSaveError (ResourceCalendar *resource, const QString &err)

Protected Member Functions

void connectResource (ResourceCalendar *resource)
void resourceModified (ResourceCalendar *resource)
void resourceDeleted (ResourceCalendar *resource)
virtual void doSetTimeZoneId (const QString &timeZoneId)
int incrementChangeCount (ResourceCalendar *resource)
int decrementChangeCount (ResourceCalendar *resource)

Classes

class  AskDestinationPolicy
class  DestinationPolicy
class  StandardDestinationPolicy
class  Ticket

Constructor & Destructor Documentation

CalendarResources::CalendarResources ( const QString &  timeZoneId,
const QString &  family = QString::fromLatin1("calendar") 
)

Construct CalendarResource object using a Time Zone and a Family name.

Parameters:
timeZoneId is a string containing a Time Zone ID, which is assumed to be valid. The Time Zone Id is used to set the time zone for viewing Incidence dates.
On some systems, /usr/share/zoneinfo/zone.tab may be available for reference.
Example: "Europe/Berlin"
Warning:
Do Not pass an empty timeZoneId string as this may cause unintended consequences when storing Incidences into the Calendar.
Parameters:
family is any QString representing a unique name.

Definition at line 103 of file calendarresources.cpp.

CalendarResources::~CalendarResources (  ) 

Destructor.

Definition at line 122 of file calendarresources.cpp.


Member Function Documentation

void CalendarResources::load (  ) 

Loads all Incidences from the Resources.

The Resources must be added first using either readConfig(KConfig *config), which adds the system Resources, or manually using resourceAdded(ResourceCalendar *resource).

Definition at line 140 of file calendarresources.cpp.

bool CalendarResources::reload ( const QString &  tz  )  [virtual]

Reloads all incidences from all resources.

tz The timezone to set.
Returns:
success or failure

Implements KCal::Calendar.

Definition at line 180 of file calendarresources.cpp.

void CalendarResources::close (  )  [virtual]

Clear out the current Calendar, freeing all used memory etc.

Implements KCal::Calendar.

Definition at line 209 of file calendarresources.cpp.

bool CalendarResources::save ( Ticket ticket,
Incidence incidence = 0 
) [virtual]

Save this Calendar.

If the save is successfull, the Ticket is deleted. Otherwise, the caller must release the Ticket with releaseSaveTicket() to abandon the save operation or call save() to try the save again.

Parameters:
ticket is a pointer to the Ticket object.
incidence is a pointer to the Incidence object. If incidence is null, save the entire Calendar (all Resources) else only the specified Incidence is saved.
Returns:
true if the save was successful; false otherwise.

Definition at line 716 of file calendarresources.cpp.

void CalendarResources::save (  )  [virtual]

Sync changes in memory to persistant storage.

Implements KCal::Calendar.

Definition at line 224 of file calendarresources.cpp.

bool CalendarResources::isSaving (  )  [virtual]

Determine if the Calendar is currently being saved.

Returns:
true if the Calendar is currently being saved; false otherwise.

Reimplemented from KCal::Calendar.

Definition at line 238 of file calendarresources.cpp.

CalendarResourceManager* KCal::CalendarResources::resourceManager (  )  const [inline]

Get the CalendarResourceManager used by this calendar.

Returns:
a pointer to the CalendarResourceManage.

Definition at line 222 of file calendarresources.h.

ResourceCalendar * CalendarResources::resource ( Incidence incidence  ) 

Get the Resource associated with a specified Incidence.

Parameters:
incidence is a pointer to an Incidence whose Resource is to be located.
Returns:
a pointer to the Resource containing the Incidence.

Definition at line 649 of file calendarresources.cpp.

void CalendarResources::readConfig ( KConfig *  config = 0  ) 

Read the Resources settings from a config file.

Parameters:
config The KConfig object which points to the config file. If no object is given (null pointer) the standard config file is used.
Note:
Call this method before load().

Definition at line 130 of file calendarresources.cpp.

void CalendarResources::setStandardDestinationPolicy (  ) 

Set the destination policy such that Incidences are always added to the standard Resource.

Definition at line 189 of file calendarresources.cpp.

void CalendarResources::setAskDestinationPolicy (  ) 

Set the destination policy such that Incidences are added to a Resource which is queried.

Definition at line 194 of file calendarresources.cpp.

QWidget * CalendarResources::dialogParentWidget (  ) 

Returns the current parent for new dialogs.

This is a bad hack, but we need to properly set the parent for the resource selection dialog. Otherwise the dialog will not be modal to the editor dialog in korganizer and the user can still work in the editor dialog (and thus crash korganizer). Afterwards we need to reset it (to avoid pointers to widgets that are already deleted) so we also need the accessor

Definition at line 199 of file calendarresources.cpp.

void CalendarResources::setDialogParentWidget ( QWidget *  parent  ) 

Set the widget parent for new dialogs.

This is a bad hack, but we need to properly set the parent for the resource selection dialog. Otherwise the dialog will not be modal to the editor dialog in korganizer and the user can still work in the editor dialog (and thus crash korganizer).

Definition at line 204 of file calendarresources.cpp.

CalendarResources::Ticket * CalendarResources::requestSaveTicket ( ResourceCalendar resource  ) 

Request ticket for saving the Calendar.

If a ticket is returned the Calendar is locked for write access until save() or releaseSaveTicket() is called.

Parameters:
resource is a pointer to the ResourceCalendar object.
Returns:
a pointer to a Ticket object indicating that the Calendar is locked for write access; otherwise a null pointer.

Definition at line 703 of file calendarresources.cpp.

void CalendarResources::releaseSaveTicket ( Ticket ticket  )  [virtual]

Release the save Ticket.

The Calendar is unlocked without saving.

Parameters:
ticket is a pointer to a Ticket object.

Definition at line 734 of file calendarresources.cpp.

void CalendarResources::resourceAdded ( ResourceCalendar resource  ) 

Add a Resource to the Calendar.

This method must be public, because in-process added Resources do not emit the corresponding signal, so this methodd has to be called manually!

Parameters:
resource is a pointer to the ResourceCalendar to add.

Definition at line 657 of file calendarresources.cpp.

bool CalendarResources::addIncidence ( Incidence incidence  )  [virtual]

Insert an Incidence into the Calendar.

Parameters:
incidence is a pointer to the Incidence to insert.
Returns:
true if the Incidence was successfully inserted; false otherwise.

Reimplemented from KCal::Calendar.

Definition at line 283 of file calendarresources.cpp.

bool CalendarResources::addIncidence ( Incidence incidence,
ResourceCalendar resource 
)

Insert an Incidence into a Calendar Resource.

Parameters:
incidence is a pointer to the Incidence to insert.
resource is a pointer to the ResourceCalendar to be added to.
Returns:
true if the Incidence was successfully inserted; false otherwise.

Definition at line 250 of file calendarresources.cpp.

bool CalendarResources::beginChange ( Incidence incidence  )  [virtual]

Flag that a change to a Calendar Incidence is starting.

Parameters:
incidence is a pointer to the Incidence that will be changing.

Reimplemented from KCal::Calendar.

Definition at line 740 of file calendarresources.cpp.

bool CalendarResources::endChange ( Incidence incidence  )  [virtual]

Flag that a change to a Calendar Incidence has completed.

Parameters:
incidence is a pointer to the Incidence that was changed.

Reimplemented from KCal::Calendar.

Definition at line 770 of file calendarresources.cpp.

bool CalendarResources::addEvent ( Event event  )  [virtual]

Insert an Event into the Calendar.

Parameters:
event is a pointer to the Event to insert.
Returns:
true if the Event was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence ) instead.

Implements KCal::Calendar.

Definition at line 310 of file calendarresources.cpp.

bool CalendarResources::addEvent ( Event event,
ResourceCalendar resource 
)

Insert an Event into a Calendar Resource.

Parameters:
event is a pointer to the Event to insert.
resource is a pointer to the ResourceCalendar to be added to.
Returns:
true if the Event was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence, ResourceCalendar *resource ) instead.

Definition at line 316 of file calendarresources.cpp.

bool CalendarResources::deleteEvent ( Event event  )  [virtual]

Remove an Event from the Calendar.

Parameters:
event is a pointer to the Event to remove.
Returns:
true if the Event was successfully removed; false otherwise.
Note:
In most cases use deleteIncidence( Incidence *incidence) instead.

Implements KCal::Calendar.

Definition at line 321 of file calendarresources.cpp.

Event::List CalendarResources::rawEvents ( EventSortField  sortField = EventSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
) [virtual]

Return a sorted, unfiltered list of all Events.

Parameters:
sortField specifies the EventSortField.
sortDirection specifies the SortDirection.
Returns:
the list of all unfiltered Events sorted as specified.

Implements KCal::Calendar.

Definition at line 529 of file calendarresources.cpp.

Event::List CalendarResources::rawEventsForDate ( const QDateTime &  qdt  )  [virtual]

Return an unfiltered list of all Events which occur on the given timestamp.

Parameters:
qdt request unfiltered Event list for this QDateTime only.
Returns:
the list of unfiltered Events occurring on the specified timestamp.

Implements KCal::Calendar.

Definition at line 511 of file calendarresources.cpp.

Event::List CalendarResources::rawEvents ( const QDate &  start,
const QDate &  end,
bool  inclusive = false 
) [virtual]

Return an unfiltered list of all Events occurring within a date range.

Parameters:
start is the starting date.
end is the ending date.
inclusive if true only Events which are completely included within the date range are returned.
Returns:
the list of unfiltered Events occurring within the specified date range.

Implements KCal::Calendar.

Definition at line 493 of file calendarresources.cpp.

Event::List CalendarResources::rawEventsForDate ( const QDate &  date,
EventSortField  sortField = EventSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
) [virtual]

Return a sorted, unfiltered list of all Events which occur on the given date.

The Events are sorted according to sortField and sortDirection.

Parameters:
date request unfiltered Event list for this QDate only.
sortField specifies the EventSortField.
sortDirection specifies the SortDirection.
Returns:
the list of sorted, unfiltered Events occurring on date.

Implements KCal::Calendar.

Definition at line 476 of file calendarresources.cpp.

Event * CalendarResources::event ( const QString &  uid  )  [virtual]

Returns the Event associated with the given unique identifier.

Parameters:
uid is a unique identifier string.
Returns:
a pointer to the Event. A null pointer is returned if no such Event exists.

Implements KCal::Calendar.

Definition at line 342 of file calendarresources.cpp.

bool CalendarResources::addTodo ( Todo todo  )  [virtual]

Insert a Todo into a Calendar Resource.

Parameters:
todo is a pointer to the Todo to insert.
Returns:
true if the Todo was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence ) instead.

Implements KCal::Calendar.

Definition at line 357 of file calendarresources.cpp.

bool CalendarResources::addTodo ( Todo todo,
ResourceCalendar resource 
)

Insert an Todo into a Calendar Resource.

Parameters:
todo is a pointer to the Todo to insert.
resource is a pointer to the ResourceCalendar to be added to.
Returns:
true if the Todo was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence, ResourceCalendar *resource ) instead.

Definition at line 363 of file calendarresources.cpp.

bool CalendarResources::deleteTodo ( Todo todo  )  [virtual]

Remove an Todo from the Calendar.

Parameters:
todo is a pointer to the Todo to remove.
Returns:
true if the Todo was successfully removed; false otherwise.
Note:
In most cases use deleteIncidence( Incidence *incidence ) instead.

Implements KCal::Calendar.

Definition at line 368 of file calendarresources.cpp.

Todo::List CalendarResources::rawTodos ( TodoSortField  sortField = TodoSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
) [virtual]

Return a sorted, unfiltered list of all Todos for this Calendar.

Parameters:
sortField specifies the TodoSortField.
sortDirection specifies the SortDirection.
Returns:
the list of all unfiltered Todos sorted as specified.

Implements KCal::Calendar.

Definition at line 389 of file calendarresources.cpp.

Todo::List CalendarResources::rawTodosForDate ( const QDate &  date  )  [virtual]

Return an unfiltered list of all Todos which are due on the specified date.

Parameters:
date request unfiltered Todos due on this QDate.
Returns:
the list of unfiltered Todos due on the specified date.

Implements KCal::Calendar.

Definition at line 423 of file calendarresources.cpp.

Todo * CalendarResources::todo ( const QString &  uid  )  [virtual]

Returns the Todo associated with the given unique identifier.

Parameters:
uid is a unique identifier string.
Returns:
a pointer to the Todo. A null pointer is returned if no such Todo exists.

Implements KCal::Calendar.

Definition at line 406 of file calendarresources.cpp.

bool CalendarResources::addJournal ( Journal journal  )  [virtual]

Insert a Journal into the Calendar.

Parameters:
journal is a pointer to the Journal to insert.
Returns:
true if the Journal was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence ) instead.

Implements KCal::Calendar.

Definition at line 548 of file calendarresources.cpp.

bool CalendarResources::addJournal ( Journal journal,
ResourceCalendar resource 
)

Insert a Journal into a Calendar Resource.

Parameters:
journal is a pointer to the Journal to insert.
resource is a pointer to the ResourceCalendar to be added to.
Returns:
true if the Journal was successfully inserted; false otherwise.
Note:
In most cases use addIncidence( Incidence *incidence, ResourceCalendar *resource ) instead.

Definition at line 575 of file calendarresources.cpp.

bool CalendarResources::deleteJournal ( Journal journal  )  [virtual]

Remove a Journal from the Calendar.

Parameters:
journal is a pointer to the Journal to remove.
Returns:
true if the Journal was successfully removed; false otherwise.
Note:
In most cases use deleteIncidence( Incidence *incidence ) instead.

Implements KCal::Calendar.

Definition at line 554 of file calendarresources.cpp.

Journal::List CalendarResources::rawJournals ( JournalSortField  sortField = JournalSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
) [virtual]

Return a sorted, unfiltered list of all Journals for this Calendar.

Parameters:
sortField specifies the JournalSortField.
sortDirection specifies the SortDirection.
Returns:
the list of all unfiltered Journals sorted as specified.

Implements KCal::Calendar.

Definition at line 599 of file calendarresources.cpp.

Journal::List CalendarResources::rawJournalsForDate ( const QDate &  date  )  [virtual]

Return an unfiltered list of all Journals for on the specifed date.

Parameters:
date request unfiltered Journals for this QDate only.
Returns:
the list of unfiltered Journals for the specified date.

Implements KCal::Calendar.

Definition at line 617 of file calendarresources.cpp.

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

Returns the Journal associated with the given unique identifier.

Parameters:
uid is a unique identifier string.
Returns:
a pointer to the Journal. A null pointer is returned if no such Journal exists.

Implements KCal::Calendar.

Definition at line 582 of file calendarresources.cpp.

Alarm::List CalendarResources::alarms ( const QDateTime &  from,
const QDateTime &  to 
) [virtual]

Return a list of Alarms within a time range for this Calendar.

Parameters:
from is the starting timestamp.
to is the ending timestamp.
Returns:
the list of Alarms for the for the specified time range.

Implements KCal::Calendar.

Definition at line 455 of file calendarresources.cpp.

Alarm::List CalendarResources::alarmsTo ( const QDateTime &  to  ) 

Return a list of Alarms that occur before the specified timestamp.

Parameters:
to is the ending timestamp.
Returns:
the list of Alarms occurring before the specified QDateTime.

Definition at line 440 of file calendarresources.cpp.

void CalendarResources::setTimeZoneIdViewOnly ( const QString &  tz  )  [virtual]

Set the viewing time zone, which requires that all resources are saved, and then reloaded such that the event times are re-interpreted in the new timezone.

Note that the absolute times of events do not change with this. If you want to change the times of the contents of the resources, use setTimeZoneId

Implements KCal::Calendar.

Definition at line 697 of file calendarresources.cpp.

void KCal::CalendarResources::signalResourceModified ( ResourceCalendar resource  )  [signal]

Signal that the Resource has been modified.

void KCal::CalendarResources::signalResourceAdded ( ResourceCalendar resource  )  [signal]

Signal that an Incidence has been inserted to the Resource.

void KCal::CalendarResources::signalResourceDeleted ( ResourceCalendar resource  )  [signal]

Signal that an Incidence has been removed from the Resource.

void KCal::CalendarResources::signalErrorMessage ( const QString &  err  )  [signal]

Signal an error message.

void CalendarResources::doSetTimeZoneId ( const QString &  timeZoneId  )  [protected, virtual]

Let CalendarResource subclasses set the Time Zone ID.

First parameter is a string containing a Time Zone ID, which is assumed to be valid. On some systems, /usr/share/zoneinfo/zone.tab may be available for reference.
Example: "Europe/Berlin"

Warning:
Do Not pass an empty timeZoneId string as this may cause unintended consequences when storing Incidences into the Calendar.

Reimplemented from KCal::Calendar.

Definition at line 687 of file calendarresources.cpp.

int CalendarResources::incrementChangeCount ( ResourceCalendar resource  )  [protected]

Increment the number of times this Resource has been changed by 1.

Parameters:
resource is a pointer to the ResourceCalendar to be counted.
Returns:
the new number of times this Resource has been changed.

Definition at line 792 of file calendarresources.cpp.

int CalendarResources::decrementChangeCount ( ResourceCalendar resource  )  [protected]

Decrement the number of times this Resource has been changed by 1.

Parameters:
resource is a pointer to the ResourceCalendar to be counted.
Returns:
the new number of times this Resource has been changed.

Definition at line 805 of file calendarresources.cpp.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys