From cfa6b4114cea52b167caaaeb417f98f83edd690f Mon Sep 17 00:00:00 2001 From: tpearson Date: Fri, 27 Aug 2010 23:01:53 +0000 Subject: Initial (i.e. read only) support for RECURRENCE-ID modified incidence series. Write support requires further debugging and/or compliance checks with respect to Zimbra; there is no obvious reason why it should not be working but Zimbra fails with 409 when saving. User interface support is mostly complete, with event links being tracked across deletes. git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1168937 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libkcal/icalformat.cpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'libkcal/icalformat.cpp') diff --git a/libkcal/icalformat.cpp b/libkcal/icalformat.cpp index 4fae0eaf2..c6a245c80 100644 --- a/libkcal/icalformat.cpp +++ b/libkcal/icalformat.cpp @@ -293,6 +293,50 @@ TQString ICalFormat::toString( Incidence *incidence ) return text; } +TQString ICalFormat::toString( Incidence *incidence, Calendar *calendar ) +{ + icalcomponent *component; + TQString text = ""; + + // See if there are any parent or child events that must be added to the string + if ( incidence->hasRecurrenceID() ) { + // Get the parent + IncidenceList il = incidence->childIncidences(); + IncidenceListIterator it; + it = il.begin(); + Incidence *parentIncidence; + parentIncidence = calendar->incidence(*it); + il = parentIncidence->childIncidences(); + if (il.count() > 0) { + for ( it = il.begin(); it != il.end(); ++it ) { + component = mImpl->writeIncidence( calendar->incidence(*it) ); + text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) ); + icalcomponent_free( component ); + } + } + component = mImpl->writeIncidence( parentIncidence ); + text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) ); + icalcomponent_free( component ); + } + else { + // This incidence is a potential parent + IncidenceList il = incidence->childIncidences(); + if (il.count() > 0) { + IncidenceListIterator it; + for ( it = il.begin(); it != il.end(); ++it ) { + component = mImpl->writeIncidence( calendar->incidence(*it) ); + text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) ); + icalcomponent_free( component ); + } + } + component = mImpl->writeIncidence( incidence ); + text = text + TQString::fromUtf8( icalcomponent_as_ical_string( component ) ); + icalcomponent_free( component ); + } + + return text; +} + TQString ICalFormat::toString( RecurrenceRule *recurrence ) { icalproperty *property; -- cgit v1.2.1