#include <resourcecalendar.h>

Inheritance diagram for KCal::ResourceCalendar:
KCal::ResourceCached KCal::ResourceLocal

Public Slots

virtual void setSubresourceActive (const TQString &, bool active)
 

Signals

void resourceChanged (ResourceCalendar *)
 
void resourceLoaded (ResourceCalendar *)
 
void resourceSaved (ResourceCalendar *)
 
void resourceLoadError (ResourceCalendar *, const TQString &error)
 
void resourceSaveError (ResourceCalendar *, const TQString &error)
 
void signalSubresourceAdded (ResourceCalendar *, const TQString &type, const TQString &subresource, const TQString &label)
 
void signalSubresourceRemoved (ResourceCalendar *, const TQString &, const TQString &)
 

Public Member Functions

 ResourceCalendar (const TDEConfig *)
 
void clearException ()
 
void setException (ErrorFormat *error)
 
ErrorFormatexception ()
 
void setResolveConflict (bool b)
 
virtual void writeConfig (TDEConfig *config)
 
virtual TQString infoText () const
 
bool load ()
 
bool save (Incidence *incidence=0)
 
virtual bool isSaving ()
 
virtual TDEABC::Lock * lock ()=0
 
virtual TDE_DEPRECATED bool addIncidence (Incidence *)
 
virtual bool addIncidence (Incidence *, const TQString &subresource)
 
virtual bool deleteIncidence (Incidence *)
 
Incidenceincidence (const TQString &uid)
 
virtual TDE_DEPRECATED bool addEvent (Event *event)=0
 
virtual bool addEvent (Event *event, const TQString &subresource)=0
 
virtual bool deleteEvent (Event *)=0
 
virtual Eventevent (const TQString &uid)=0
 
virtual Event::List rawEvents (EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
 
virtual Event::List rawEventsForDate (const TQDate &date, EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
 
virtual Event::List rawEventsForDate (const TQDateTime &qdt)=0
 
virtual Event::List rawEvents (const TQDate &start, const TQDate &end, bool inclusive=false)=0
 
virtual bool setValue (const TQString &key, const TQString &value)
 
virtual TDE_DEPRECATED bool addTodo (Todo *todo)=0
 
virtual bool addTodo (Todo *todo, const TQString &subresource)=0
 
virtual bool deleteTodo (Todo *)=0
 
virtual Todotodo (const TQString &uid)=0
 
virtual Todo::List rawTodos (TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
 
virtual Todo::List rawTodosForDate (const TQDate &date)=0
 
virtual TDE_DEPRECATED bool addJournal (Journal *)=0
 
virtual bool addJournal (Journal *journal, const TQString &subresource)=0
 
virtual bool deleteJournal (Journal *)=0
 
virtual Journaljournal (const TQString &uid)=0
 
virtual Journal::List rawJournals (JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
 
virtual Journal::List rawJournalsForDate (const TQDate &date)=0
 
virtual Alarm::List alarms (const TQDateTime &from, const TQDateTime &to)=0
 
virtual Alarm::List alarmsTo (const TQDateTime &to)=0
 
Incidence::List rawIncidences ()
 
virtual void setTimeZoneId (const TQString &timeZoneId)=0
 
virtual TQStringList subresources () const
 
virtual bool canHaveSubresources () const
 
virtual bool subresourceActive (const TQString &) const
 
virtual bool subresourceWritable (const TQString &) const
 
virtual const TQString labelForSubresource (const TQString &resource) const
 
virtual TQString subresourceIdentifier (Incidence *incidence)
 
virtual bool removeSubresource (const TQString &resource)
 
virtual bool addSubresource (const TQString &resource, const TQString &parent)
 
virtual TQString subresourceType (const TQString &resource)
 
virtual void beginAddingIncidences ()
 
virtual void endAddingIncidences ()
 

Protected Member Functions

virtual bool doLoad ()=0
 
virtual bool doSave ()=0
 
virtual bool doSave (Incidence *)
 
virtual void addInfoText (TQString &) const
 
void loadError (const TQString &errorMessage=TQString())
 
void saveError (const TQString &errorMessage=TQString())
 

Protected Attributes

bool mResolveConflict
 

Detailed Description

This class provides the interfaces for a calendar resource.

It makes use of the tderesources framework.

Warning
This code is still under heavy development. Don't expect source or binary compatibility in future versions.

Definition at line 57 of file resourcecalendar.h.

Member Function Documentation

◆ addEvent()

virtual TDE_DEPRECATED bool KCal::ResourceCalendar::addEvent ( Event event)
pure virtual

Add event to resource.

Deprecated:
use addEvent(Event *,const TQString&) instead.

Implemented in KCal::ResourceCached.

◆ addIncidence() [1/2]

bool ResourceCalendar::addIncidence ( Incidence incidence)
virtual

Add incidence to resource.

Deprecated:
use addIncidence(Incidence *,const TQString &) instead.

Definition at line 101 of file resourcecalendar.cpp.

◆ addIncidence() [2/2]

bool ResourceCalendar::addIncidence ( Incidence incidence,
const TQString &  subresource 
)
virtual

Add incidence to resource and subresource.

Definition at line 107 of file resourcecalendar.cpp.

◆ addInfoText()

virtual void KCal::ResourceCalendar::addInfoText ( TQString &  ) const
inlineprotectedvirtual

Add info text for concrete resources.

Called by infoText().

Reimplemented in KCal::ResourceCached.

Definition at line 439 of file resourcecalendar.h.

◆ addJournal()

virtual TDE_DEPRECATED bool KCal::ResourceCalendar::addJournal ( Journal )
pure virtual

Add a Journal entry to the resource.

Deprecated:
use addJournal(Journal *,const TQString &) instead.

Implemented in KCal::ResourceCached.

◆ addSubresource()

bool ResourceCalendar::addSubresource ( const TQString &  resource,
const TQString &  parent 
)
virtual

Add a subresource with the name.

Parameters
resourceand the parent id
parent.

Definition at line 128 of file resourcecalendar.cpp.

◆ addTodo()

virtual TDE_DEPRECATED bool KCal::ResourceCalendar::addTodo ( Todo todo)
pure virtual

Add a todo to the todolist.

Deprecated:
use addTodo(Todo *,const TQString &) instead.

Implemented in KCal::ResourceCached.

◆ alarms()

virtual Alarm::List KCal::ResourceCalendar::alarms ( const TQDateTime &  from,
const TQDateTime &  to 
)
pure virtual

Return all alarms which occur in the given time interval.

Implemented in KCal::ResourceCached.

◆ alarmsTo()

virtual Alarm::List KCal::ResourceCalendar::alarmsTo ( const TQDateTime &  to)
pure virtual

Return all alarms which occur before given date.

Implemented in KCal::ResourceCached.

◆ beginAddingIncidences()

void ResourceCalendar::beginAddingIncidences ( )
virtual

Called when we starting adding a batch of incidences.

So we don't show the same warnings for each incidence.

Definition at line 241 of file resourcecalendar.cpp.

◆ canHaveSubresources()

virtual bool KCal::ResourceCalendar::canHaveSubresources ( ) const
inlinevirtual

Is this subresource capable of having subresources or not?

Definition at line 351 of file resourcecalendar.h.

◆ clearException()

void ResourceCalendar::clearException ( )

Clears the exception status.

Definition at line 46 of file resourcecalendar.cpp.

◆ deleteEvent()

virtual bool KCal::ResourceCalendar::deleteEvent ( Event )
pure virtual

Delete event from this resource.

Implemented in KCal::ResourceCached.

◆ deleteIncidence()

bool ResourceCalendar::deleteIncidence ( Incidence incidence)
virtual

Delete incidence from resource.

Definition at line 113 of file resourcecalendar.cpp.

◆ deleteJournal()

virtual bool KCal::ResourceCalendar::deleteJournal ( Journal )
pure virtual

Remove a Journal entry from calendar.

Implemented in KCal::ResourceCached.

◆ deleteTodo()

virtual bool KCal::ResourceCalendar::deleteTodo ( Todo )
pure virtual

Remove a todo from the todolist.

Implemented in KCal::ResourceCached.

◆ doLoad()

virtual bool KCal::ResourceCalendar::doLoad ( )
protectedpure virtual

Do the actual loading of the resource data.

Called by load().

Implemented in KCal::ResourceLocal.

◆ doSave() [1/2]

virtual bool KCal::ResourceCalendar::doSave ( )
protectedpure virtual

Do the actual saving of the resource data.

Called by save().

Implemented in KCal::ResourceLocal.

◆ doSave() [2/2]

bool ResourceCalendar::doSave ( Incidence )
protectedvirtual

Do the actual saving of the resource data.

Called by save(). Save one Incidence. The default implementation calls doSave() to save everything

Definition at line 201 of file resourcecalendar.cpp.

◆ endAddingIncidences()

void ResourceCalendar::endAddingIncidences ( )
virtual

Called when we finish adding a batch of incidences.

See also
beginAddingIncidences()

Definition at line 245 of file resourcecalendar.cpp.

◆ event()

virtual Event* KCal::ResourceCalendar::event ( const TQString &  uid)
pure virtual

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

Implemented in KCal::ResourceCached.

◆ exception()

ErrorFormat * ResourceCalendar::exception ( )

Returns an exception, if there is any, containing information about the last error that occurred.

Definition at line 58 of file resourcecalendar.cpp.

◆ incidence()

Incidence * ResourceCalendar::incidence ( const TQString &  uid)

Return incidence with given unique id.

If there is no incidence with that uid, return 0.

Definition at line 91 of file resourcecalendar.cpp.

◆ infoText()

TQString ResourceCalendar::infoText ( ) const
virtual

Return rich text with info about the resource.

Adds standard info and then calls addInfoText() to add info about concrete resources.

Definition at line 68 of file resourcecalendar.cpp.

◆ isSaving()

virtual bool KCal::ResourceCalendar::isSaving ( )
inlinevirtual

Return true if a save operation is still in progress, otherwise return false.

Definition at line 136 of file resourcecalendar.h.

◆ journal()

virtual Journal* KCal::ResourceCalendar::journal ( const TQString &  uid)
pure virtual

Return Journal with given unique id.

Implemented in KCal::ResourceCached.

◆ labelForSubresource()

virtual const TQString KCal::ResourceCalendar::labelForSubresource ( const TQString &  resource) const
inlinevirtual

What is the label for this subresource?

Definition at line 366 of file resourcecalendar.h.

◆ load()

bool ResourceCalendar::load ( )

Load resource data.

After calling this function all data is accessible by calling the incidence/event/todo/etc. accessor functions.

Whether data is actually loaded within this function or the loading is delayed until it is accessed by another function depends on the implementation of the resource.

If loading the data takes significant time, the resource should return cached values if available, and return the results via the resourceChanged signal. When the resource has finished loading, the resourceLoaded() signal is emitted.

Calling this function multiple times should have the same effect as calling it once, given that the data isn't changed between calls.

This function calls doLoad() which has to be reimplented by the resource to do the actual loading.

Definition at line 138 of file resourcecalendar.cpp.

◆ loadError()

void ResourceCalendar::loadError ( const TQString &  errorMessage = TQString())
protected

A resource should call this function if a load error happens.

Definition at line 169 of file resourcecalendar.cpp.

◆ lock()

virtual TDEABC::Lock* KCal::ResourceCalendar::lock ( )
pure virtual

Return object for locking the resource.

Implemented in KCal::ResourceLocal.

◆ rawEvents() [1/2]

virtual Event::List KCal::ResourceCalendar::rawEvents ( const TQDate &  start,
const TQDate &  end,
bool  inclusive = false 
)
pure virtual

Get unfiltered events in a range of dates.

If inclusive is set to true, only events which are completely included in the range are returned.

Implemented in KCal::ResourceCached.

◆ rawEvents() [2/2]

virtual Event::List KCal::ResourceCalendar::rawEvents ( EventSortField  sortField = EventSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
)
pure virtual

Return unfiltered list of all events in calendar.

Use with care, this can be a bad idea for server-based calendars.

Implemented in KCal::ResourceCached.

◆ rawEventsForDate() [1/2]

virtual Event::List KCal::ResourceCalendar::rawEventsForDate ( const TQDate &  date,
EventSortField  sortField = EventSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
)
pure virtual

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

Useful for dayView, etc. etc.

Implemented in KCal::ResourceCached.

◆ rawEventsForDate() [2/2]

virtual Event::List KCal::ResourceCalendar::rawEventsForDate ( const TQDateTime &  qdt)
pure virtual

Get unfiltered events for date qdt.

Implemented in KCal::ResourceCached.

◆ rawIncidences()

Incidence::List ResourceCalendar::rawIncidences ( )

Returns a list of all incideces.

Definition at line 119 of file resourcecalendar.cpp.

◆ rawJournals()

virtual Journal::List KCal::ResourceCalendar::rawJournals ( JournalSortField  sortField = JournalSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
)
pure virtual

Return list of all journals.

Implemented in KCal::ResourceCached.

◆ rawJournalsForDate()

virtual Journal::List KCal::ResourceCalendar::rawJournalsForDate ( const TQDate &  date)
pure virtual

Returns list of journals for the given date.

Implemented in KCal::ResourceCached.

◆ rawTodos()

virtual Todo::List KCal::ResourceCalendar::rawTodos ( TodoSortField  sortField = TodoSortUnsorted,
SortDirection  sortDirection = SortDirectionAscending 
)
pure virtual

Return list of all todos.

Implemented in KCal::ResourceCached.

◆ rawTodosForDate()

virtual Todo::List KCal::ResourceCalendar::rawTodosForDate ( const TQDate &  date)
pure virtual

Returns list of todos due on the specified date.

Implemented in KCal::ResourceCached.

◆ removeSubresource()

bool ResourceCalendar::removeSubresource ( const TQString &  resource)
virtual

Remove a subresource with the id.

Parameters
resource

Definition at line 133 of file resourcecalendar.cpp.

◆ resourceChanged

void KCal::ResourceCalendar::resourceChanged ( ResourceCalendar )
signal

This signal is emitted when the data in the resource has changed.

The resource has to make sure that this signal is emitted whenever any pointers to incidences which the resource has previously given to the calling code, become invalid.

◆ resourceLoaded

void KCal::ResourceCalendar::resourceLoaded ( ResourceCalendar )
signal

This signal is emitted when loading data into the resource has been finished.

◆ resourceLoadError

void KCal::ResourceCalendar::resourceLoadError ( ResourceCalendar ,
const TQString &  error 
)
signal

This signal is emitted when an error occurs during loading.

◆ resourceSaved

void KCal::ResourceCalendar::resourceSaved ( ResourceCalendar )
signal

This signal is emitted when saving the data of the resource has been finished.

◆ resourceSaveError

void KCal::ResourceCalendar::resourceSaveError ( ResourceCalendar ,
const TQString &  error 
)
signal

This signal is emitted when an error occurs during saving.

◆ save()

bool ResourceCalendar::save ( Incidence incidence = 0)

Save resource data.

After calling this function it is safe to close the resource without losing data.

Whether data is actually saved within this function or saving is delayed depends on the implementation of the resource.

If saving the data takes significant time, the resource should return from the function, do the saving in the background and notify the end of the save by emitting the signal resourceSaved().

This function calls doSave() which has to be reimplented by the resource to do the actual saving.

Parameters
incidenceif given as 0, doSave() is called to save all incidences, else doSave(incidence) is called to save only the given one

Definition at line 182 of file resourcecalendar.cpp.

◆ saveError()

void ResourceCalendar::saveError ( const TQString &  errorMessage = TQString())
protected

A resource should call this function if a save error happens.

Definition at line 206 of file resourcecalendar.cpp.

◆ setException()

void ResourceCalendar::setException ( ErrorFormat error)

Set exception for this object.

This is used by the functions of this class to report errors.

Definition at line 52 of file resourcecalendar.cpp.

◆ setSubresourceActive

void ResourceCalendar::setSubresourceActive ( const TQString &  ,
bool  active 
)
virtualslot

(De-)activate a subresource.

Definition at line 124 of file resourcecalendar.cpp.

◆ setTimeZoneId()

virtual void KCal::ResourceCalendar::setTimeZoneId ( const TQString &  timeZoneId)
pure virtual

Set time zone id used by this resource, e.g.

"Europe/Berlin".

Implemented in KCal::ResourceCached.

◆ setValue()

bool ResourceCalendar::setValue ( const TQString &  key,
const TQString &  value 
)
virtual

Sets a particular value of the resource's configuration.

The possible keys are resource specific.

This method is provided to make it possible to set resource-type specific settings without actually linking to the resource's library. Its use is discouraged, but in some situations the only possibility to avoid unwanted compiling and linking dependencies. E.g. if you don't want to link to the remote resource, but need to create a remote resource at the URL given in yourURL, you can use code like the following: KCal::ResourceCalendar *res = manager->createResource( "remote" ); if ( res ) { res->setTimeZoneId( timezone ); res->setResourceName( i18n("Test resource") ); res->setValue( "DownloadURL", yourURL ); manager->add( res ); }

Reimplemented in KCal::ResourceLocal.

Definition at line 219 of file resourcecalendar.cpp.

◆ signalSubresourceAdded

void KCal::ResourceCalendar::signalSubresourceAdded ( ResourceCalendar ,
const TQString &  type,
const TQString &  subresource,
const TQString &  label 
)
signal

This signal is emitted when a subresource is added.

◆ signalSubresourceRemoved

void KCal::ResourceCalendar::signalSubresourceRemoved ( ResourceCalendar ,
const TQString &  ,
const TQString &   
)
signal

This signal is emitted when a subresource is removed.

◆ subresourceActive()

virtual bool KCal::ResourceCalendar::subresourceActive ( const TQString &  ) const
inlinevirtual

Is this subresource active or not?

Definition at line 356 of file resourcecalendar.h.

◆ subresourceIdentifier()

virtual TQString KCal::ResourceCalendar::subresourceIdentifier ( Incidence incidence)
inlinevirtual

Get the identifier of the subresource associated with a specified incidence.

Returns
the identifier of the subresource or an empty string.

Definition at line 378 of file resourcecalendar.h.

◆ subresources()

virtual TQStringList KCal::ResourceCalendar::subresources ( ) const
inlinevirtual

If this resource has subresources, return a TQStringList of them.

In most cases, resources do not have subresources, so this is by default just empty.

Definition at line 346 of file resourcecalendar.h.

◆ subresourceType()

TQString ResourceCalendar::subresourceType ( const TQString &  resource)
virtual

Returns the type of the subresource: "event", "todo" or "journal", TQString() if unknown/mixed.

Definition at line 226 of file resourcecalendar.cpp.

◆ subresourceWritable()

bool ResourceCalendar::subresourceWritable ( const TQString &  resource) const
virtual

Is this subresource writable or not?

Definition at line 232 of file resourcecalendar.cpp.

◆ todo()

virtual Todo* KCal::ResourceCalendar::todo ( const TQString &  uid)
pure virtual

Searches todolist for an event with this unique id.

Returns
pointer to todo or 0 if todo wasn't found

Implemented in KCal::ResourceCached.


The documentation for this class was generated from the following files: