-rw-r--r-- | libkcal/icalformatimpl.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libkcal/icalformatimpl.cpp b/libkcal/icalformatimpl.cpp index 4794bc9..f349681 100644 --- a/libkcal/icalformatimpl.cpp +++ b/libkcal/icalformatimpl.cpp | |||
@@ -351,61 +351,58 @@ void ICalFormatImpl::writeIncidence(icalcomponent *parent,Incidence *incidence) | |||
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->relatedToUid().isEmpty()) { | 369 | if (!incidence->relatedToUid().isEmpty()) { |
370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( | 370 | icalcomponent_add_property(parent,icalproperty_new_relatedto( |
371 | incidence->relatedToUid().utf8())); | 371 | incidence->relatedToUid().utf8())); |
372 | } | 372 | } |
373 | 373 | ||
374 | // recurrence rule stuff | 374 | // recurrence rule stuff |
375 | Recurrence *recur = incidence->recurrence(); | 375 | if (incidence->doesRecur()) { |
376 | if (recur->doesRecur()) { | 376 | icalcomponent_add_property(parent,writeRecurrenceRule(incidence->recurrence())); |
377 | |||
378 | icalcomponent_add_property(parent,writeRecurrenceRule(recur)); | ||
379 | } | ||
380 | |||
381 | // recurrence excpetion dates | 377 | // recurrence excpetion dates |
382 | DateList dateList = incidence->exDates(); | 378 | DateList dateList = incidence->exDates(); |
383 | DateList::ConstIterator exIt; | 379 | DateList::ConstIterator exIt; |
384 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { | 380 | for(exIt = dateList.begin(); exIt != dateList.end(); ++exIt) { |
385 | icalcomponent_add_property(parent,icalproperty_new_exdate( | 381 | icalcomponent_add_property(parent,icalproperty_new_exdate( |
386 | writeICalDate(*exIt))); | 382 | writeICalDate(*exIt))); |
387 | } | 383 | } |
384 | } | ||
388 | 385 | ||
389 | // attachments | 386 | // attachments |
390 | QPtrList<Attachment> attachments = incidence->attachments(); | 387 | QPtrList<Attachment> attachments = incidence->attachments(); |
391 | for (Attachment *at = attachments.first(); at; at = attachments.next()) | 388 | for (Attachment *at = attachments.first(); at; at = attachments.next()) |
392 | icalcomponent_add_property(parent,writeAttachment(at)); | 389 | icalcomponent_add_property(parent,writeAttachment(at)); |
393 | 390 | ||
394 | // alarms | 391 | // alarms |
395 | QPtrList<Alarm> alarms = incidence->alarms(); | 392 | QPtrList<Alarm> alarms = incidence->alarms(); |
396 | Alarm* alarm; | 393 | Alarm* alarm; |
397 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { | 394 | for (alarm = alarms.first(); alarm; alarm = alarms.next()) { |
398 | if (alarm->enabled()) { | 395 | if (alarm->enabled()) { |
399 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; | 396 | kdDebug(5800) << "Write alarm for " << incidence->summary() << endl; |
400 | icalcomponent_add_component(parent,writeAlarm(alarm)); | 397 | icalcomponent_add_component(parent,writeAlarm(alarm)); |
401 | } | 398 | } |
402 | } | 399 | } |
403 | if( incidence->hasRecurrenceID() ) { | 400 | if( incidence->hasRecurrenceID() ) { |
404 | icalcomponent_add_property(parent, | 401 | icalcomponent_add_property(parent, |
405 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); | 402 | icalproperty_new_recurrenceid( writeICalDateTime( incidence->recurrenceID()))); |
406 | } | 403 | } |
407 | // duration | 404 | // duration |
408 | 405 | ||
409 | // turned off as it always is set to PTS0 (and must not occur together with DTEND | 406 | // turned off as it always is set to PTS0 (and must not occur together with DTEND |
410 | 407 | ||
411 | if (incidence->hasDuration()) { | 408 | if (incidence->hasDuration()) { |
@@ -1274,48 +1271,49 @@ void ICalFormatImpl::readIncidence(icalcomponent *parent,Incidence *incidence) | |||
1274 | 1271 | ||
1275 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); | 1272 | p = icalcomponent_get_next_property(parent,ICAL_ANY_PROPERTY); |
1276 | } | 1273 | } |
1277 | if ( readrec ) { | 1274 | if ( readrec ) { |
1278 | readRecurrenceRule(rectype,incidence); | 1275 | readRecurrenceRule(rectype,incidence); |
1279 | } | 1276 | } |
1280 | // kpilot stuff | 1277 | // kpilot stuff |
1281 | // TODO: move this application-specific code to kpilot | 1278 | // TODO: move this application-specific code to kpilot |
1282 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); | 1279 | QString kp = incidence->nonKDECustomProperty("X-PILOTID"); |
1283 | if (!kp.isNull()) { | 1280 | if (!kp.isNull()) { |
1284 | incidence->setPilotId(kp.toInt()); | 1281 | incidence->setPilotId(kp.toInt()); |
1285 | } | 1282 | } |
1286 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); | 1283 | kp = incidence->nonKDECustomProperty("X-PILOTSTAT"); |
1287 | if (!kp.isNull()) { | 1284 | if (!kp.isNull()) { |
1288 | incidence->setSyncStatus(kp.toInt()); | 1285 | incidence->setSyncStatus(kp.toInt()); |
1289 | } | 1286 | } |
1290 | 1287 | ||
1291 | 1288 | ||
1292 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); | 1289 | kp = incidence->nonKDECustomProperty("X-KOPIEXTID"); |
1293 | if (!kp.isNull()) { | 1290 | if (!kp.isNull()) { |
1294 | incidence->setIDStr(kp); | 1291 | incidence->setIDStr(kp); |
1295 | } | 1292 | } |
1296 | 1293 | ||
1297 | // Cancel backwards compatibility mode for subsequent changes by the application | 1294 | // Cancel backwards compatibility mode for subsequent changes by the application |
1295 | if ( readrec ) | ||
1298 | incidence->recurrence()->setCompatVersion(); | 1296 | incidence->recurrence()->setCompatVersion(); |
1299 | 1297 | ||
1300 | // add categories | 1298 | // add categories |
1301 | incidence->setCategories(categories); | 1299 | incidence->setCategories(categories); |
1302 | 1300 | ||
1303 | // iterate through all alarms | 1301 | // iterate through all alarms |
1304 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); | 1302 | for (icalcomponent *alarm = icalcomponent_get_first_component(parent,ICAL_VALARM_COMPONENT); |
1305 | alarm; | 1303 | alarm; |
1306 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { | 1304 | alarm = icalcomponent_get_next_component(parent,ICAL_VALARM_COMPONENT)) { |
1307 | readAlarm(alarm,incidence); | 1305 | readAlarm(alarm,incidence); |
1308 | } | 1306 | } |
1309 | } | 1307 | } |
1310 | 1308 | ||
1311 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) | 1309 | void ICalFormatImpl::readIncidenceBase(icalcomponent *parent,IncidenceBase *incidenceBase) |
1312 | { | 1310 | { |
1313 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); | 1311 | icalproperty *p = icalcomponent_get_first_property(parent,ICAL_ANY_PROPERTY); |
1314 | 1312 | ||
1315 | while (p) { | 1313 | while (p) { |
1316 | icalproperty_kind kind = icalproperty_isa(p); | 1314 | icalproperty_kind kind = icalproperty_isa(p); |
1317 | switch (kind) { | 1315 | switch (kind) { |
1318 | 1316 | ||
1319 | case ICAL_UID_PROPERTY: // unique id | 1317 | case ICAL_UID_PROPERTY: // unique id |
1320 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); | 1318 | incidenceBase->setUid(QString::fromUtf8(icalproperty_get_uid(p))); |
1321 | break; | 1319 | break; |