summaryrefslogtreecommitdiffabout
path: root/libkcal/icalformatimpl.cpp
Unidiff
Diffstat (limited to 'libkcal/icalformatimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkcal/icalformatimpl.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp
index eae41aa..fe7413f 100644
--- a/libkcal/icalformatimpl.cpp
+++ b/libkcal/icalformatimpl.cpp
@@ -345,51 +345,51 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence)
345 tmpStrList = incidence->getCategories(); 345 tmpStrList = incidence->getCategories();
346 tmpStr = ""; 346 tmpStr = "";
347 QString catStr; 347 QString catStr;
348 for ( QStringList::Iterator it = tmpStrList.begin(); 348 for ( QStringList::Iterator it = tmpStrList.begin();
349 it != tmpStrList.end(); 349 it != tmpStrList.end();
350 ++it ) { 350 ++it ) {
351 catStr = *it; 351 catStr = *it;
352 if (catStr[0] == ' ') 352 if (catStr[0] == ' ')
353 tmpStr += catStr.mid(1); 353 tmpStr += catStr.mid(1);
354 else 354 else
355 tmpStr += catStr; 355 tmpStr += catStr;
356 // this must be a ';' character as the vCalendar specification requires! 356 // this must be a ';' character as the vCalendar specification requires!
357 // vcc.y has been hacked to translate the ';' to a ',' when the vcal is 357 // vcc.y has been hacked to translate the ';' to a ',' when the vcal is
358 // read in. 358 // read in.
359 tmpStr += ";"; 359 tmpStr += ";";
360 } 360 }
361 if (!tmpStr.isEmpty()) { 361 if (!tmpStr.isEmpty()) {
362 tmpStr.truncate(tmpStr.length()-1); 362 tmpStr.truncate(tmpStr.length()-1);
363 icalcomponent_add_property(parent,icalproperty_new_categories( 363 icalcomponent_add_property(parent,icalproperty_new_categories(
364 writeText(incidence->getCategories().join(";")))); 364 writeText(incidence->getCategories().join(";"))));
365 } 365 }
366*/ 366*/
367 367
368 // related event 368 // related event
369 if (incidence->relatedTo()) { 369 if (!incidence->relatedToUid().isEmpty()) {
370 icalcomponent_add_property(parent,icalproperty_new_relatedto( 370 icalcomponent_add_property(parent,icalproperty_new_relatedto(
371 incidence->relatedTo()->uid().utf8())); 371 incidence->relatedToUid().utf8()));
372 } 372 }
373 373
374 // recurrence rule stuff 374 // recurrence rule stuff
375 Recurrence *recur = incidence->recurrence(); 375 Recurrence *recur = incidence->recurrence();
376 if (recur->doesRecur()) { 376 if (recur->doesRecur()) {
377 377
378 icalcomponent_add_property(parent,writeRecurrenceRule(recur)); 378 icalcomponent_add_property(parent,writeRecurrenceRule(recur));
379 } 379 }
380 380
381 // recurrence excpetion dates 381 // recurrence excpetion dates
382 DateList dateList = incidence->exDates(); 382 DateList dateList = incidence->exDates();
383 DateList::ConstIterator exIt; 383 DateList::ConstIterator exIt;
384 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { 384 for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) {
385 icalcomponent_add_property(parent,icalproperty_new_exdate( 385 icalcomponent_add_property(parent,icalproperty_new_exdate(
386 writeICalDate(*exIt))); 386 writeICalDate(*exIt)));
387 } 387 }
388 388
389 // attachments 389 // attachments
390 QPtrList<Attachment> attachments = incidence->attachments(); 390 QPtrList<Attachment> attachments = incidence->attachments();
391 for (Attachment *at = attachments.first(); at; at = attachments.next()) 391 for (Attachment *at = attachments.first(); at; at = attachments.next())
392 icalcomponent_add_property(parent,writeAttachment(at)); 392 icalcomponent_add_property(parent,writeAttachment(at));
393 393
394 // alarms 394 // alarms
395 QPtrList<Alarm> alarms = incidence->alarms(); 395 QPtrList<Alarm> alarms = incidence->alarms();
@@ -2015,53 +2015,57 @@ bool ICalFormatImpl::populate( Calendar *cal, icalcomponent *calendar)
2015 else { 2015 else {
2016 // some sort of error must have occurred while in translation. 2016 // some sort of error must have occurred while in translation.
2017 goto SKIP; 2017 goto SKIP;
2018 } 2018 }
2019 } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) { 2019 } else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) {
2020 anEvent = VTodoToEvent(curVO); 2020 anEvent = VTodoToEvent(curVO);
2021 cal->addTodo(anEvent); 2021 cal->addTodo(anEvent);
2022 } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) || 2022 } else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) ||
2023 (strcmp(vObjectName(curVO), VCProdIdProp) == 0) || 2023 (strcmp(vObjectName(curVO), VCProdIdProp) == 0) ||
2024 (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) { 2024 (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) {
2025 // do nothing, we know these properties and we want to skip them. 2025 // do nothing, we know these properties and we want to skip them.
2026 // we have either already processed them or are ignoring them. 2026 // we have either already processed them or are ignoring them.
2027 ; 2027 ;
2028 } else { 2028 } else {
2029 ; 2029 ;
2030 } 2030 }
2031 SKIP: 2031 SKIP:
2032 ; 2032 ;
2033 } // while 2033 } // while
2034#endif 2034#endif
2035 2035
2036 // Post-Process list of events with relations, put Event objects in relation 2036 // Post-Process list of events with relations, put Event objects in relation
2037 Event *ev; 2037 Event *ev;
2038 for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) { 2038 for ( ev=mEventsRelate.first(); ev != 0; ev=mEventsRelate.next() ) {
2039 ev->setRelatedTo(cal->event(ev->relatedToUid())); 2039 Incidence * inc = cal->event(ev->relatedToUid());
2040 if ( inc )
2041 ev->setRelatedTo( inc );
2040 } 2042 }
2041 Todo *todo; 2043 Todo *todo;
2042 for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) { 2044 for ( todo=mTodosRelate.first(); todo != 0; todo=mTodosRelate.next() ) {
2043 todo->setRelatedTo(cal->todo(todo->relatedToUid())); 2045 Incidence * inc = cal->todo(todo->relatedToUid());
2046 if ( inc )
2047 todo->setRelatedTo( inc );
2044 } 2048 }
2045 2049
2046 return true; 2050 return true;
2047} 2051}
2048 2052
2049QString ICalFormatImpl::extractErrorProperty(icalcomponent *c) 2053QString ICalFormatImpl::extractErrorProperty(icalcomponent *c)
2050{ 2054{
2051// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " 2055// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: "
2052// << icalcomponent_as_ical_string(c) << endl; 2056// << icalcomponent_as_ical_string(c) << endl;
2053 2057
2054 QString errorMessage; 2058 QString errorMessage;
2055 2059
2056 icalproperty *error; 2060 icalproperty *error;
2057 error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY); 2061 error = icalcomponent_get_first_property(c,ICAL_XLICERROR_PROPERTY);
2058 while(error) { 2062 while(error) {
2059 errorMessage += icalproperty_get_xlicerror(error); 2063 errorMessage += icalproperty_get_xlicerror(error);
2060 errorMessage += "\n"; 2064 errorMessage += "\n";
2061 error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY); 2065 error = icalcomponent_get_next_property(c,ICAL_XLICERROR_PROPERTY);
2062 } 2066 }
2063 2067
2064// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl; 2068// kdDebug(5800) << "ICalFormatImpl:extractErrorProperty: " << errorMessage << endl;
2065 2069
2066 return errorMessage; 2070 return errorMessage;
2067} 2071}