libkcal

icalformat.cpp
1 /*
2  This file is part of libkcal.
3 
4  Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #include <tqdatetime.h>
23 #include <tqstring.h>
24 #include <tqptrlist.h>
25 #include <tqregexp.h>
26 #include <tqclipboard.h>
27 #include <tqfile.h>
28 #include <tqtextstream.h>
29 
30 #include <kdebug.h>
31 #include <tdelocale.h>
32 
33 extern "C" {
34  #include <libical/ical.h>
35  #include <libical/icalss.h>
36  #include <libical/icalparser.h>
37  #include <libical/icalrestriction.h>
38  #include <libical/icalmemory.h>
39 }
40 
41 #include "calendar.h"
42 #include "calendarlocal.h"
43 #include "journal.h"
44 
45 #include "icalformat.h"
46 #include "icalformatimpl.h"
47 #include <ksavefile.h>
48 
49 #include <stdio.h>
50 
51 #define _ICAL_VERSION "2.0"
52 
53 using namespace KCal;
54 
55 ICalFormat::ICalFormat() : mImpl(0)
56 {
57  setImplementation( new ICalFormatImpl( this ) );
58 
59  mTimeZoneId = "UTC";
60  mUtc = true;
61 }
62 
63 ICalFormat::~ICalFormat()
64 {
65  delete mImpl;
66 }
67 
68 void ICalFormat::setImplementation( ICalFormatImpl *impl )
69 {
70  if ( mImpl ) delete mImpl;
71  mImpl = impl;
72 }
73 
74 #if defined(_AIX) && defined(open)
75 #undef open
76 #endif
77 
78 bool ICalFormat::load( Calendar *calendar, const TQString &fileName)
79 {
80  kdDebug(5800) << "ICalFormat::load() " << fileName << endl;
81 
83 
84  TQFile file( fileName );
85  if (!file.open( IO_ReadOnly ) ) {
86  kdDebug(5800) << "ICalFormat::load() load error" << endl;
88  return false;
89  }
90  TQTextStream ts( &file );
91  ts.setEncoding( TQTextStream::UnicodeUTF8 );
92  TQString text = ts.read();
93  file.close();
94 
95  if ( text.stripWhiteSpace().isEmpty() ) // empty files are valid
96  return true;
97  else
98  return fromRawString( calendar, text.utf8() );
99 }
100 
101 
102 bool ICalFormat::save( Calendar *calendar, const TQString &fileName )
103 {
104  kdDebug(5800) << "ICalFormat::save(): " << fileName << endl;
105 
106  clearException();
107 
108  TQString text = toString( calendar );
109 
110  if ( text.isNull() ) return false;
111 
112  // Write backup file
113  KSaveFile::backupFile( fileName );
114 
115  KSaveFile file( fileName );
116  if ( file.status() != 0 ) {
117  kdDebug(5800) << "ICalFormat::save() errno: " << strerror( file.status() )
118  << endl;
120  i18n( "Error saving to '%1'." ).arg( fileName ) ) );
121  return false;
122  }
123 
124  // Convert to UTF8 and save
125  TQCString textUtf8 = text.utf8();
126  file.textStream()->setEncoding( TQTextStream::UnicodeUTF8 );
127  file.file()->writeBlock(textUtf8.data(),textUtf8.size()-1);
128 
129  if ( !file.close() ) {
130  kdDebug(5800) << "KSaveFile: close: status was " << file.status() << ". See errno.h." << endl;
132  i18n("Could not save '%1'").arg(fileName)));
133  return false;
134  }
135 
136  return true;
137 }
138 
139 bool ICalFormat::fromString( Calendar *cal, const TQString &text )
140 {
141  return fromRawString( cal, text.utf8() );
142 }
143 
144 bool ICalFormat::fromRawString( Calendar *cal, const TQCString &text )
145 {
146  setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
147 
148  // Get first VCALENDAR component.
149  // TODO: Handle more than one VCALENDAR or non-VCALENDAR top components
150  icalcomponent *calendar;
151 
152  // Let's defend const correctness until the very gates of hell
153  calendar = icalcomponent_new_from_string( const_cast<char*>( (const char*)text ) );
154  // kdDebug(5800) << "Error: " << icalerror_perror() << endl;
155  if (!calendar) {
156  kdDebug(5800) << "ICalFormat::load() parse error" << endl;
158  return false;
159  }
160 
161  bool success = true;
162 
163  if (icalcomponent_isa(calendar) == ICAL_XROOT_COMPONENT) {
164  icalcomponent *comp;
165  for ( comp = icalcomponent_get_first_component(calendar, ICAL_VCALENDAR_COMPONENT);
166  comp != 0; comp = icalcomponent_get_next_component(calendar, ICAL_VCALENDAR_COMPONENT) ) {
167  // put all objects into their proper places
168  if ( !mImpl->populate( cal, comp ) ) {
169  kdDebug(5800) << "ICalFormat::load(): Could not populate calendar" << endl;
170  if ( !exception() ) {
172  }
173  success = false;
174  } else {
175  mLoadedProductId = mImpl->loadedProductId();
176  }
177  icalcomponent_free( comp );
178  }
179  } else if (icalcomponent_isa(calendar) != ICAL_VCALENDAR_COMPONENT) {
180  kdDebug(5800) << "ICalFormat::load(): No VCALENDAR component found" << endl;
182  success = false;
183  } else {
184  // put all objects into their proper places
185  if ( !mImpl->populate( cal, calendar ) ) {
186  kdDebug(5800) << "ICalFormat::load(): Could not populate calendar" << endl;
187  if ( !exception() ) {
189  }
190  success = false;
191  } else
192  mLoadedProductId = mImpl->loadedProductId();
193  }
194 
195  icalcomponent_free( calendar );
196  icalmemory_free_ring();
197 
198  return success;
199 }
200 
201 Incidence *ICalFormat::fromString( const TQString &text )
202 {
203  CalendarLocal cal( mTimeZoneId );
204  fromString(&cal, text);
205 
206  Incidence *ical = 0;
207  Event::List elist = cal.events();
208  if ( elist.count() > 0 ) {
209  ical = elist.first();
210  } else {
211  Todo::List tlist = cal.todos();
212  if ( tlist.count() > 0 ) {
213  ical = tlist.first();
214  } else {
215  Journal::List jlist = cal.journals();
216  if ( jlist.count() > 0 ) {
217  ical = jlist.first();
218  }
219  }
220  }
221 
222  return ical ? ical->clone() : 0;
223 }
224 
226 {
227  setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
228 
229  icalcomponent *calendar = mImpl->createCalendarComponent(cal);
230 
231  icalcomponent *component;
232 
233  // todos
234  Todo::List todoList = cal->rawTodos();
235  Todo::List::ConstIterator it;
236  for( it = todoList.begin(); it != todoList.end(); ++it ) {
237 // kdDebug(5800) << "ICalFormat::toString() write todo "
238 // << (*it)->uid() << endl;
239  component = mImpl->writeTodo( *it );
240  icalcomponent_add_component( calendar, component );
241  }
242 
243  // events
244  Event::List events = cal->rawEvents();
245  Event::List::ConstIterator it2;
246  for( it2 = events.begin(); it2 != events.end(); ++it2 ) {
247 // kdDebug(5800) << "ICalFormat::toString() write event "
248 // << (*it2)->uid() << endl;
249  component = mImpl->writeEvent( *it2 );
250  icalcomponent_add_component( calendar, component );
251  }
252 
253  // journals
254  Journal::List journals = cal->journals();
255  Journal::List::ConstIterator it3;
256  for( it3 = journals.begin(); it3 != journals.end(); ++it3 ) {
257  kdDebug(5800) << "ICalFormat::toString() write journal "
258  << (*it3)->uid() << endl;
259  component = mImpl->writeJournal( *it3 );
260  icalcomponent_add_component( calendar, component );
261  }
262 
263  TQString text = TQString::fromUtf8( icalcomponent_as_ical_string( calendar ) );
264 
265  icalcomponent_free( calendar );
266  icalmemory_free_ring();
267 
268  if (!text) {
270  i18n("libical error")));
271  return TQString();
272  }
273 
274  return text;
275 }
276 
277 TQString ICalFormat::toICalString( Incidence *incidence )
278 {
279  CalendarLocal cal( mTimeZoneId );
280  cal.addIncidence( incidence->clone() );
281  return toString( &cal );
282 }
283 
284 TQString ICalFormat::toString( Incidence *incidence )
285 {
286  icalcomponent *component;
287 
288  component = mImpl->writeIncidence( incidence );
289 
290  TQString text = TQString::fromUtf8( icalcomponent_as_ical_string( component ) );
291 
292  icalcomponent_free( component );
293 
294  return text;
295 }
296 
297 TQString ICalFormat::toString( Incidence *incidence, Calendar *calendar )
298 {
299  icalcomponent *component;
300  TQString text = "";
301 
302  // See if there are any parent or child events that must be added to the string
303  if ( incidence->hasRecurrenceID() ) {
304  // Get the parent
305  IncidenceList il = incidence->childIncidences();
306  IncidenceListIterator it;
307  it = il.begin();
308  Incidence *parentIncidence;
309  parentIncidence = calendar->incidence(*it);
310  il = parentIncidence->childIncidences();
311  if (il.count() > 0) {
312  for ( it = il.begin(); it != il.end(); ++it ) {
313  component = mImpl->writeIncidence( calendar->incidence(*it) );
314  text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) );
315  icalcomponent_free( component );
316  }
317  }
318  component = mImpl->writeIncidence( parentIncidence );
319  text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) );
320  icalcomponent_free( component );
321  }
322  else {
323  // This incidence is a potential parent
324  IncidenceList il = incidence->childIncidences();
325  if (il.count() > 0) {
326  IncidenceListIterator it;
327  for ( it = il.begin(); it != il.end(); ++it ) {
328  component = mImpl->writeIncidence( calendar->incidence(*it) );
329  text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) );
330  icalcomponent_free( component );
331  }
332  }
333  component = mImpl->writeIncidence( incidence );
334  text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) );
335  icalcomponent_free( component );
336  }
337 
338  return text;
339 }
340 
341 TQString ICalFormat::toString( RecurrenceRule *recurrence )
342 {
343  icalproperty *property;
344  icalrecurrencetype *recur = mImpl->writeRecurrenceRule( recurrence );
345 #if ICAL_CHECK_VERSION(4,0,0)
346  property = icalproperty_new_rrule( recur );
347  icalrecurrencetype_unref(recur);
348 #else
349  property = icalproperty_new_rrule( *recur );
350  delete recur;
351 #endif
352  TQString text = TQString::fromUtf8( icalproperty_as_ical_string( property ) );
353  icalproperty_free( property );
354  return text;
355 }
356 
357 bool ICalFormat::fromString( RecurrenceRule * recurrence, const TQString& rrule )
358 {
359  if ( !recurrence ) return false;
360  bool success = true;
361  icalerror_clear_errno();
362 #if ICAL_CHECK_VERSION(4,0,0)
363  struct icalrecurrencetype *recur = icalrecurrencetype_new_from_string( rrule.latin1() );
364 #else
365  struct icalrecurrencetype _recur = icalrecurrencetype_from_string( rrule.latin1() );
366  struct icalrecurrencetype *recur = &_recur;
367 #endif
368  if ( icalerrno != ICAL_NO_ERROR ) {
369  kdDebug(5800) << "Recurrence parsing error: " << icalerror_strerror( icalerrno ) << endl;
370  success = false;
371  }
372 
373  if ( success ) {
374  mImpl->readRecurrence( recur, recurrence );
375  }
376 
377 #if ICAL_CHECK_VERSION(4,0,0)
378  if ( recur ) {
379  icalrecurrencetype_unref( recur );
380  }
381 #endif
382 
383  return success;
384 }
385 
386 
388  Scheduler::Method method)
389 {
390  icalcomponent *message = 0;
391 
392  // Handle scheduling ID being present
393  if ( incidence->type() == "Event" || incidence->type() == "Todo" ) {
394  Incidence* i = static_cast<Incidence*>( incidence );
395  if ( i->schedulingID() != i->uid() ) {
396  // We have a separation of scheduling ID and UID
397  i = i->clone();
398  i->setUid( i->schedulingID() );
399  i->setSchedulingID( TQString() );
400 
401  // Build the message with the cloned incidence
402  message = mImpl->createScheduleComponent( i, method );
403 
404  // And clean up
405  delete i;
406  }
407  }
408 
409  if ( message == 0 )
410  message = mImpl->createScheduleComponent(incidence,method);
411 
412  // FIXME TODO: Don't we have to free message? What about the ical_string? MEMLEAK
413  TQString messageText = TQString::fromUtf8( icalcomponent_as_ical_string(message) );
414 
415 #if 0
416  kdDebug(5800) << "ICalFormat::createScheduleMessage: message START\n"
417  << messageText
418  << "ICalFormat::createScheduleMessage: message END" << endl;
419 #endif
420 
421  return messageText;
422 }
423 
424 FreeBusy *ICalFormat::parseFreeBusy( const TQString &str )
425 {
426  clearException();
427 
428  icalcomponent *message;
429  message = icalparser_parse_string( str.utf8() );
430 
431  if ( !message ) return 0;
432 
433  FreeBusy *freeBusy = 0;
434 
435  icalcomponent *c;
436  for ( c = icalcomponent_get_first_component( message, ICAL_VFREEBUSY_COMPONENT );
437  c != 0; c = icalcomponent_get_next_component( message, ICAL_VFREEBUSY_COMPONENT ) ) {
438  FreeBusy *fb = mImpl->readFreeBusy( c );
439 
440  if ( freeBusy ) {
441  freeBusy->merge( fb );
442  delete fb;
443  } else {
444  freeBusy = fb;
445  }
446  }
447 
448  if ( !freeBusy )
449  kdDebug(5800) << "ICalFormat:parseFreeBusy: object is not a freebusy."
450  << endl;
451  return freeBusy;
452 }
453 
455  const TQString &messageText )
456 {
457  setTimeZone( cal->timeZoneId(), !cal->isLocalTime() );
458  clearException();
459 
460  if (messageText.isEmpty())
461  {
462  setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, TQString::fromLatin1( "messageText was empty, unable to parse into a ScheduleMessage" ) ) );
463  return 0;
464  }
465  // TODO FIXME: Don't we have to ical-free message??? MEMLEAK
466  icalcomponent *message;
467  message = icalparser_parse_string(messageText.utf8());
468 
469  if (!message)
470  {
471  setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, TQString::fromLatin1( "icalparser was unable to parse messageText into a ScheduleMessage" ) ) );
472  return 0;
473  }
474 
475  icalproperty *m = icalcomponent_get_first_property(message,
476  ICAL_METHOD_PROPERTY);
477  if (!m)
478  {
479  setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, TQString::fromLatin1( "message didn't contain an ICAL_METHOD_PROPERTY" ) ) );
480  return 0;
481  }
482 
483  icalcomponent *c;
484 
485  IncidenceBase *incidence = 0;
486  c = icalcomponent_get_first_component(message,ICAL_VEVENT_COMPONENT);
487  if (c) {
488  icalcomponent *ctz = icalcomponent_get_first_component(message,ICAL_VTIMEZONE_COMPONENT);
489  incidence = mImpl->readEvent(c, ctz);
490  }
491 
492  if (!incidence) {
493  c = icalcomponent_get_first_component(message,ICAL_VTODO_COMPONENT);
494  if (c) {
495  incidence = mImpl->readTodo(c);
496  }
497  }
498 
499  if (!incidence) {
500  c = icalcomponent_get_first_component(message,ICAL_VJOURNAL_COMPONENT);
501  if (c) {
502  incidence = mImpl->readJournal(c);
503  }
504  }
505 
506  if (!incidence) {
507  c = icalcomponent_get_first_component(message,ICAL_VFREEBUSY_COMPONENT);
508  if (c) {
509  incidence = mImpl->readFreeBusy(c);
510  }
511  }
512 
513 
514 
515  if (!incidence) {
516  kdDebug(5800) << "ICalFormat:parseScheduleMessage: object is not a freebusy, event, todo or journal" << endl;
517  setException( new ErrorFormat( ErrorFormat::ParseErrorKcal, TQString::fromLatin1( "object is not a freebusy, event, todo or journal" ) ) );
518  return 0;
519  }
520 
521  kdDebug(5800) << "ICalFormat::parseScheduleMessage() getting method..." << endl;
522 
523  icalproperty_method icalmethod = icalproperty_get_method(m);
524  Scheduler::Method method;
525 
526  switch (icalmethod) {
527  case ICAL_METHOD_PUBLISH:
528  method = Scheduler::Publish;
529  break;
530  case ICAL_METHOD_REQUEST:
531  method = Scheduler::Request;
532  break;
533  case ICAL_METHOD_REFRESH:
534  method = Scheduler::Refresh;
535  break;
536  case ICAL_METHOD_CANCEL:
537  method = Scheduler::Cancel;
538  break;
539  case ICAL_METHOD_ADD:
540  method = Scheduler::Add;
541  break;
542  case ICAL_METHOD_REPLY:
543  method = Scheduler::Reply;
544  break;
545  case ICAL_METHOD_COUNTER:
546  method = Scheduler::Counter;
547  break;
548  case ICAL_METHOD_DECLINECOUNTER:
549  method = Scheduler::Declinecounter;
550  break;
551  default:
552  method = Scheduler::NoMethod;
553  kdDebug(5800) << "ICalFormat::parseScheduleMessage(): Unknow method" << endl;
554  break;
555  }
556 
557  kdDebug(5800) << "ICalFormat::parseScheduleMessage() restriction..." << endl;
558 
559  if (!icalrestriction_check(message)) {
560  kdWarning(5800) << k_funcinfo << endl << "libkcal reported a problem while parsing:" << endl;
561  kdWarning(5800) << Scheduler::translatedMethodName(method) + ": " + mImpl->extractErrorProperty(c)<< endl;
562  /*
563  setException(new ErrorFormat(ErrorFormat::Restriction,
564  Scheduler::translatedMethodName(method) + ": " +
565  mImpl->extractErrorProperty(c)));
566  delete incidence;
567  return 0;
568  */
569  }
570  icalcomponent *calendarComponent = mImpl->createCalendarComponent(cal);
571 
572  Incidence *existingIncidence =
573  cal->incidenceFromSchedulingID(incidence->uid());
574  if (existingIncidence) {
575  // TODO: check, if cast is required, or if it can be done by virtual funcs.
576  // TODO: Use a visitor for this!
577  if (existingIncidence->type() == "Todo") {
578  Todo *todo = static_cast<Todo *>(existingIncidence);
579  icalcomponent_add_component(calendarComponent,
580  mImpl->writeTodo(todo));
581  }
582  if (existingIncidence->type() == "Event") {
583  Event *event = static_cast<Event *>(existingIncidence);
584  icalcomponent_add_component(calendarComponent,
585  mImpl->writeEvent(event));
586  }
587  } else {
588  calendarComponent = 0;
589  }
590 
591  kdDebug(5800) << "ICalFormat::parseScheduleMessage() classify..." << endl;
592 
593  icalproperty_xlicclass result = icalclassify( message, calendarComponent,
594  (char *)"" );
595 
596  kdDebug(5800) << "ICalFormat::parseScheduleMessage() returning..." << endl;
597  kdDebug(5800) << "ICalFormat::parseScheduleMessage(), result = " << result << endl;
598 
600 
601  switch (result) {
602  case ICAL_XLICCLASS_PUBLISHNEW:
603  status = ScheduleMessage::PublishNew;
604  break;
605  case ICAL_XLICCLASS_PUBLISHUPDATE:
606  status = ScheduleMessage::PublishUpdate;
607  break;
608  case ICAL_XLICCLASS_OBSOLETE:
609  status = ScheduleMessage::Obsolete;
610  break;
611  case ICAL_XLICCLASS_REQUESTNEW:
612  status = ScheduleMessage::RequestNew;
613  break;
614  case ICAL_XLICCLASS_REQUESTUPDATE:
615  status = ScheduleMessage::RequestUpdate;
616  break;
617  case ICAL_XLICCLASS_UNKNOWN:
618  default:
619  status = ScheduleMessage::Unknown;
620  break;
621  }
622 
623  kdDebug(5800) << "ICalFormat::parseScheduleMessage(), status = " << status << endl;
624 // TODO FIXME: Don't we have to free calendarComponent??? MEMLEAK
625 
626  return new ScheduleMessage(incidence,method,status);
627 }
628 
629 void ICalFormat::setTimeZone( const TQString &id, bool utc )
630 {
631  mTimeZoneId = id;
632  mUtc = utc;
633 }
634 
635 TQString ICalFormat::timeZoneId() const
636 {
637  return mTimeZoneId;
638 }
639 
640 bool ICalFormat::utc() const
641 {
642  return mUtc;
643 }
@ SaveError
Save error.
Definition: exceptions.h:72
@ ParseErrorKcal
Parse error in libkcal.
Definition: exceptions.h:74
This class provides information about free/busy time of a calendar user.
Definition: freebusy.h:40
Incidence * incidenceFromSchedulingID(const TQString &sid)
Returns the Incidence associated with the given scheduling identifier.
Definition: calendar.cpp:599
TQString toString(Calendar *)
Return calendar information as string.
Definition: icalformat.cpp:225
IncidenceList childIncidences() const
Returns an EventList of all child incidences.
Definition: incidence.cpp:934
Calendar format related error class.
Definition: exceptions.h:64
void setUid(const TQString &)
Set the unique id for the event.
virtual Incidence * clone()=0
Return copy of this object.
TQString timeZoneId() const
Get the Time Zone ID for the Calendar.
Definition: calendar.cpp:112
virtual bool addIncidence(Incidence *incidence)
Insert an Incidence into the Calendar.
Definition: calendar.cpp:466
bool save(Calendar *calendar, const TQString &fileName)
Writes out the calendar to disk in iCalendar format.
Definition: icalformat.cpp:102
bool load(Calendar *calendar, const TQString &fileName)
Loads a calendar on disk in iCalendar format into calendar.
Definition: icalformat.cpp:78
FreeBusy * parseFreeBusy(const TQString &)
Parse FREEBUSY object.
Definition: icalformat.cpp:424
ErrorFormat * exception()
Return exception, if there is any, containing information about the last error that occurred.
Definition: calformat.cpp:56
This class provides an Event in the sense of RFC2445.
Definition: event.h:32
virtual Journal::List journals(JournalSortField sortField=JournalSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Return a sorted, filtered list of all Journals for this Calendar.
Definition: calendar.cpp:823
virtual Todo::List todos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Return a sorted, filtered list of all Todos for this Calendar.
Definition: calendar.cpp:755
bool hasRecurrenceID() const
Returns true if the incidence has recurrenceID, otherwise return false.
Definition: incidence.cpp:893
This class provides an encapsulation of a scheduling message.
Definition: scheduler.h:44
Definition: alarm.h:38
@ LoadError
Load error.
Definition: exceptions.h:71
This class provides a Todo in the sense of RFC2445.
Definition: todo.h:31
@ ParseErrorIcal
Parse error in libical.
Definition: exceptions.h:73
bool utc() const
Return true if timezone used is UTC, otherwise return false.
Definition: icalformat.cpp:640
This class provides a calendar stored as a local file.
Definition: calendarlocal.h:36
virtual Event::List events(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)
Return a sorted, filtered list of all Events for this Calendar.
Definition: calendar.cpp:458
TQString createScheduleMessage(IncidenceBase *e, Scheduler::Method m)
Create a scheduling message for event e using method m.
Definition: icalformat.cpp:387
ScheduleMessage * parseScheduleMessage(Calendar *, const TQString &s)
Parse scheduling message provided as string s.
Definition: icalformat.cpp:454
virtual Todo::List rawTodos(TodoSortField sortField=TodoSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Return a sorted, unfiltered list of all Todos for this Calendar.
void setTimeZone(const TQString &id, bool utc)
Set id of used time zone and whether this time zone is UTC or not.
Definition: icalformat.cpp:629
Status
Message status.
Definition: scheduler.h:50
Method
iTIP methods.
Definition: scheduler.h:103
static TQString translatedMethodName(Method)
Return a translated human-readable name for a iTIP method.
Definition: scheduler.cpp:156
This class provides the base class common to all calendar components.
Definition: incidence.h:47
TQString toICalString(Incidence *)
Return incidence as full iCalendar formatted text.
Definition: icalformat.cpp:277
bool isLocalTime() const
Determine if Calendar Incidences are to be written without a time zone.
Definition: calendar.cpp:125
virtual Event::List rawEvents(EventSortField sortField=EventSortUnsorted, SortDirection sortDirection=SortDirectionAscending)=0
Return a sorted, unfiltered list of all Events for this Calendar.
void setException(ErrorFormat *error)
Set exception for this object.
Definition: calformat.cpp:50
TQString uid() const
Return the unique id for the event.
void clearException()
Clear exception status of this format object.
Definition: calformat.cpp:44
This class represents a recurrence rule for a calendar incidence.
This class provides the base class common to all calendar components.
Definition: incidencebase.h:45
TQString schedulingID() const
Return the event's/todo's scheduling ID.
Definition: incidence.cpp:885
TQString timeZoneId() const
Return id string of timezone used.
Definition: icalformat.cpp:635
void setSchedulingID(const TQString &sid)
Set the event's/todo's scheduling ID.
Definition: incidence.cpp:880
@ NoCalendar
No calendar component found.
Definition: exceptions.h:75
bool fromString(Calendar *calendar, const TQString &)
Parse string and populate calendar with that information.
Definition: icalformat.cpp:139
bool fromRawString(Calendar *calendar, const TQCString &)
Parse string and return first ical component of a raw byte array of a utf8 encoded string.
Definition: icalformat.cpp:144
Incidence * incidence(const TQString &uid)
Returns the Incidence associated with the given unique identifier.
Definition: calendar.cpp:576