-rw-r--r-- | libkcal/vcalformat.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libkcal/vcalformat.cpp b/libkcal/vcalformat.cpp index 59030d5..72a781a 100644 --- a/libkcal/vcalformat.cpp +++ b/libkcal/vcalformat.cpp | |||
@@ -335,35 +335,35 @@ VObject *VCalFormat::eventToVTodo(const Todo *anEvent) | |||
335 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 335 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
336 | addPropValue(a, VCRepeatCountProp, "1"); | 336 | addPropValue(a, VCRepeatCountProp, "1"); |
337 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); | 337 | addPropValue(a, VCAudioContentProp, QFile::encodeName(alarm->audioFile())); |
338 | } | 338 | } |
339 | else if (alarm->type() == Alarm::Procedure) { | 339 | else if (alarm->type() == Alarm::Procedure) { |
340 | a = addProp(vtodo, VCPAlarmProp); | 340 | a = addProp(vtodo, VCPAlarmProp); |
341 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); | 341 | addPropValue(a, VCRunTimeProp, tmpStr.local8Bit()); |
342 | addPropValue(a, VCRepeatCountProp, "1"); | 342 | addPropValue(a, VCRepeatCountProp, "1"); |
343 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); | 343 | addPropValue(a, VCProcedureNameProp, QFile::encodeName(alarm->programFile())); |
344 | } | 344 | } |
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | if (anEvent->pilotId()) { | 348 | if (anEvent->pilotId()) { |
349 | // pilot sync stuff | 349 | // pilot sync stuff |
350 | tmpStr.sprintf("%i",anEvent->pilotId()); | 350 | tmpStr.sprintf("%i",anEvent->pilotId()); |
351 | addPropValue(vtodo, KPilotIdProp, tmpStr.local8Bit()); | 351 | addPropValue(vtodo, XPilotIdProp, tmpStr.local8Bit()); |
352 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 352 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
353 | addPropValue(vtodo, KPilotStatusProp, tmpStr.local8Bit()); | 353 | addPropValue(vtodo, XPilotStatusProp, tmpStr.local8Bit()); |
354 | } | 354 | } |
355 | 355 | ||
356 | return vtodo; | 356 | return vtodo; |
357 | } | 357 | } |
358 | 358 | ||
359 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) | 359 | VObject* VCalFormat::eventToVEvent(const Event *anEvent) |
360 | { | 360 | { |
361 | VObject *vevent; | 361 | VObject *vevent; |
362 | QString tmpStr; | 362 | QString tmpStr; |
363 | QStringList tmpStrList; | 363 | QStringList tmpStrList; |
364 | 364 | ||
365 | vevent = newVObject(VCEventProp); | 365 | vevent = newVObject(VCEventProp); |
366 | 366 | ||
367 | // start and end time | 367 | // start and end time |
368 | tmpStr = qDateTimeToISO(anEvent->dtStart(), | 368 | tmpStr = qDateTimeToISO(anEvent->dtStart(), |
369 | !anEvent->doesFloat()); | 369 | !anEvent->doesFloat()); |
@@ -513,33 +513,33 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
513 | } | 513 | } |
514 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); | 514 | addPropValue(vevent,VCRRuleProp, tmpStr.local8Bit()); |
515 | 515 | ||
516 | } // event repeats | 516 | } // event repeats |
517 | 517 | ||
518 | // exceptions to recurrence | 518 | // exceptions to recurrence |
519 | DateList dateList = anEvent->exDates(); | 519 | DateList dateList = anEvent->exDates(); |
520 | DateList::ConstIterator it; | 520 | DateList::ConstIterator it; |
521 | QString tmpStr2; | 521 | QString tmpStr2; |
522 | 522 | ||
523 | for (it = dateList.begin(); it != dateList.end(); ++it) { | 523 | for (it = dateList.begin(); it != dateList.end(); ++it) { |
524 | tmpStr = qDateToISO(*it) + ";"; | 524 | tmpStr = qDateToISO(*it) + ";"; |
525 | tmpStr2 += tmpStr; | 525 | tmpStr2 += tmpStr; |
526 | } | 526 | } |
527 | if (!tmpStr2.isEmpty()) { | 527 | if (!tmpStr2.isEmpty()) { |
528 | tmpStr2.truncate(tmpStr2.length()-1); | 528 | tmpStr2.truncate(tmpStr2.length()-1); |
529 | addPropValue(vevent, VCExDateProp, tmpStr2.local8Bit()); | 529 | addPropValue(vevent, VCExpDateProp, tmpStr2.local8Bit()); |
530 | } | 530 | } |
531 | 531 | ||
532 | // description | 532 | // description |
533 | if (!anEvent->description().isEmpty()) { | 533 | if (!anEvent->description().isEmpty()) { |
534 | VObject *d = addPropValue(vevent, VCDescriptionProp, | 534 | VObject *d = addPropValue(vevent, VCDescriptionProp, |
535 | anEvent->description().local8Bit()); | 535 | anEvent->description().local8Bit()); |
536 | if (anEvent->description().find('\n') != -1) | 536 | if (anEvent->description().find('\n') != -1) |
537 | addProp(d, VCQuotedPrintableProp); | 537 | addProp(d, VCQuotedPrintableProp); |
538 | } | 538 | } |
539 | 539 | ||
540 | // summary | 540 | // summary |
541 | if (!anEvent->summary().isEmpty()) | 541 | if (!anEvent->summary().isEmpty()) |
542 | addPropValue(vevent, VCSummaryProp, anEvent->summary().local8Bit()); | 542 | addPropValue(vevent, VCSummaryProp, anEvent->summary().local8Bit()); |
543 | 543 | ||
544 | if (!anEvent->location().isEmpty()) | 544 | if (!anEvent->location().isEmpty()) |
545 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); | 545 | addPropValue(vevent, VCLocationProp, anEvent->location().local8Bit()); |
@@ -628,35 +628,35 @@ VObject* VCalFormat::eventToVEvent(const Event *anEvent) | |||
628 | tmpStr.sprintf("%i",anEvent->priority()); | 628 | tmpStr.sprintf("%i",anEvent->priority()); |
629 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); | 629 | addPropValue(vevent, VCPriorityProp, tmpStr.local8Bit()); |
630 | 630 | ||
631 | // transparency | 631 | // transparency |
632 | tmpStr.sprintf("%i",anEvent->transparency()); | 632 | tmpStr.sprintf("%i",anEvent->transparency()); |
633 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); | 633 | addPropValue(vevent, VCTranspProp, tmpStr.local8Bit()); |
634 | 634 | ||
635 | // related event | 635 | // related event |
636 | if (anEvent->relatedTo()) { | 636 | if (anEvent->relatedTo()) { |
637 | addPropValue(vevent, VCRelatedToProp, | 637 | addPropValue(vevent, VCRelatedToProp, |
638 | anEvent->relatedTo()->uid().local8Bit()); | 638 | anEvent->relatedTo()->uid().local8Bit()); |
639 | } | 639 | } |
640 | 640 | ||
641 | if (anEvent->pilotId()) { | 641 | if (anEvent->pilotId()) { |
642 | // pilot sync stuff | 642 | // pilot sync stuff |
643 | tmpStr.sprintf("%i",anEvent->pilotId()); | 643 | tmpStr.sprintf("%i",anEvent->pilotId()); |
644 | addPropValue(vevent, KPilotIdProp, tmpStr.local8Bit()); | 644 | addPropValue(vevent, XPilotIdProp, tmpStr.local8Bit()); |
645 | tmpStr.sprintf("%i",anEvent->syncStatus()); | 645 | tmpStr.sprintf("%i",anEvent->syncStatus()); |
646 | addPropValue(vevent, KPilotStatusProp, tmpStr.local8Bit()); | 646 | addPropValue(vevent, XPilotStatusProp, tmpStr.local8Bit()); |
647 | } | 647 | } |
648 | 648 | ||
649 | return vevent; | 649 | return vevent; |
650 | } | 650 | } |
651 | 651 | ||
652 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) | 652 | Todo *VCalFormat::VTodoToEvent(VObject *vtodo) |
653 | { | 653 | { |
654 | VObject *vo; | 654 | VObject *vo; |
655 | VObjectIterator voi; | 655 | VObjectIterator voi; |
656 | char *s; | 656 | char *s; |
657 | 657 | ||
658 | Todo *anEvent = new Todo; | 658 | Todo *anEvent = new Todo; |
659 | 659 | ||
660 | // creation date | 660 | // creation date |
661 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { | 661 | if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) != 0) { |
662 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); | 662 | anEvent->setCreated(ISOToQDateTime(s = fakeCString(vObjectUStringZValue(vo)))); |
@@ -836,40 +836,40 @@ Todo *VCalFormat::VTodoToEvent(VObject *vtodo) | |||
836 | deleteStr(s); | 836 | deleteStr(s); |
837 | //const char* category; | 837 | //const char* category; |
838 | QString category; | 838 | QString category; |
839 | while ((index2 = categories.find(',', index1)) != -1) { | 839 | while ((index2 = categories.find(',', index1)) != -1) { |
840 | //category = (const char *) categories.mid(index1, (index2 - index1)); | 840 | //category = (const char *) categories.mid(index1, (index2 - index1)); |
841 | category = categories.mid(index1, (index2 - index1)); | 841 | category = categories.mid(index1, (index2 - index1)); |
842 | tmpStrList.append(category); | 842 | tmpStrList.append(category); |
843 | index1 = index2+1; | 843 | index1 = index2+1; |
844 | } | 844 | } |
845 | // get last category | 845 | // get last category |
846 | category = categories.mid(index1, (categories.length()-index1)); | 846 | category = categories.mid(index1, (categories.length()-index1)); |
847 | tmpStrList.append(category); | 847 | tmpStrList.append(category); |
848 | anEvent->setCategories(tmpStrList); | 848 | anEvent->setCategories(tmpStrList); |
849 | } | 849 | } |
850 | 850 | ||
851 | /* PILOT SYNC STUFF */ | 851 | /* PILOT SYNC STUFF */ |
852 | if ((vo = isAPropertyOf(vtodo, KPilotIdProp))) { | 852 | if ((vo = isAPropertyOf(vtodo, XPilotIdProp))) { |
853 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 853 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
854 | deleteStr(s); | 854 | deleteStr(s); |
855 | } | 855 | } |
856 | else | 856 | else |
857 | anEvent->setPilotId(0); | 857 | anEvent->setPilotId(0); |
858 | 858 | ||
859 | if ((vo = isAPropertyOf(vtodo, KPilotStatusProp))) { | 859 | if ((vo = isAPropertyOf(vtodo, XPilotStatusProp))) { |
860 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 860 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
861 | deleteStr(s); | 861 | deleteStr(s); |
862 | } | 862 | } |
863 | else | 863 | else |
864 | anEvent->setSyncStatus(Event::SYNCMOD); | 864 | anEvent->setSyncStatus(Event::SYNCMOD); |
865 | 865 | ||
866 | return anEvent; | 866 | return anEvent; |
867 | } | 867 | } |
868 | 868 | ||
869 | Event* VCalFormat::VEventToEvent(VObject *vevent) | 869 | Event* VCalFormat::VEventToEvent(VObject *vevent) |
870 | { | 870 | { |
871 | VObject *vo; | 871 | VObject *vo; |
872 | VObjectIterator voi; | 872 | VObjectIterator voi; |
873 | char *s; | 873 | char *s; |
874 | 874 | ||
875 | Event *anEvent = new Event; | 875 | Event *anEvent = new Event; |
@@ -1194,33 +1194,33 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) | |||
1194 | QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); | 1194 | QDate rEndDate = (ISOToQDateTime(tmpStr.mid(index, tmpStr.length()-index))).date(); |
1195 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate); | 1195 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rEndDate); |
1196 | } else { | 1196 | } else { |
1197 | int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); | 1197 | int rDuration = tmpStr.mid(index, tmpStr.length()-index).toInt(); |
1198 | if (rDuration == 0) | 1198 | if (rDuration == 0) |
1199 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1); | 1199 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, -1); |
1200 | else | 1200 | else |
1201 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration); | 1201 | anEvent->recurrence()->setYearly(Recurrence::rYearlyDay, rFreq, rDuration); |
1202 | } | 1202 | } |
1203 | } else { | 1203 | } else { |
1204 | kdDebug(5800) << "we don't understand this type of recurrence!" << endl; | 1204 | kdDebug(5800) << "we don't understand this type of recurrence!" << endl; |
1205 | } // if | 1205 | } // if |
1206 | } // repeats | 1206 | } // repeats |
1207 | 1207 | ||
1208 | 1208 | ||
1209 | // recurrence exceptions | 1209 | // recurrence exceptions |
1210 | if ((vo = isAPropertyOf(vevent, VCExDateProp)) != 0) { | 1210 | if ((vo = isAPropertyOf(vevent, VCExpDateProp)) != 0) { |
1211 | s = fakeCString(vObjectUStringZValue(vo)); | 1211 | s = fakeCString(vObjectUStringZValue(vo)); |
1212 | QStringList exDates = QStringList::split(",",s); | 1212 | QStringList exDates = QStringList::split(",",s); |
1213 | QStringList::ConstIterator it; | 1213 | QStringList::ConstIterator it; |
1214 | for(it = exDates.begin(); it != exDates.end(); ++it ) { | 1214 | for(it = exDates.begin(); it != exDates.end(); ++it ) { |
1215 | anEvent->addExDate(ISOToQDate(*it)); | 1215 | anEvent->addExDate(ISOToQDate(*it)); |
1216 | } | 1216 | } |
1217 | deleteStr(s); | 1217 | deleteStr(s); |
1218 | } | 1218 | } |
1219 | 1219 | ||
1220 | // summary | 1220 | // summary |
1221 | if ((vo = isAPropertyOf(vevent, VCSummaryProp))) { | 1221 | if ((vo = isAPropertyOf(vevent, VCSummaryProp))) { |
1222 | s = fakeCString(vObjectUStringZValue(vo)); | 1222 | s = fakeCString(vObjectUStringZValue(vo)); |
1223 | anEvent->setSummary(QString::fromLocal8Bit(s)); | 1223 | anEvent->setSummary(QString::fromLocal8Bit(s)); |
1224 | deleteStr(s); | 1224 | deleteStr(s); |
1225 | } | 1225 | } |
1226 | if ((vo = isAPropertyOf(vevent, VCLocationProp))) { | 1226 | if ((vo = isAPropertyOf(vevent, VCLocationProp))) { |
@@ -1358,40 +1358,40 @@ Event* VCalFormat::VEventToEvent(VObject *vevent) | |||
1358 | 1358 | ||
1359 | // transparency | 1359 | // transparency |
1360 | if ((vo = isAPropertyOf(vevent, VCTranspProp)) != 0) { | 1360 | if ((vo = isAPropertyOf(vevent, VCTranspProp)) != 0) { |
1361 | int i = atoi(s = fakeCString(vObjectUStringZValue(vo))); | 1361 | int i = atoi(s = fakeCString(vObjectUStringZValue(vo))); |
1362 | anEvent->setTransparency( i == 1 ? Event::Transparent : Event::Opaque ); | 1362 | anEvent->setTransparency( i == 1 ? Event::Transparent : Event::Opaque ); |
1363 | deleteStr(s); | 1363 | deleteStr(s); |
1364 | } | 1364 | } |
1365 | 1365 | ||
1366 | // related event | 1366 | // related event |
1367 | if ((vo = isAPropertyOf(vevent, VCRelatedToProp)) != 0) { | 1367 | if ((vo = isAPropertyOf(vevent, VCRelatedToProp)) != 0) { |
1368 | anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo))); | 1368 | anEvent->setRelatedToUid(s = fakeCString(vObjectUStringZValue(vo))); |
1369 | deleteStr(s); | 1369 | deleteStr(s); |
1370 | mEventsRelate.append(anEvent); | 1370 | mEventsRelate.append(anEvent); |
1371 | } | 1371 | } |
1372 | 1372 | ||
1373 | /* PILOT SYNC STUFF */ | 1373 | /* PILOT SYNC STUFF */ |
1374 | if ((vo = isAPropertyOf(vevent, KPilotIdProp))) { | 1374 | if ((vo = isAPropertyOf(vevent, XPilotIdProp))) { |
1375 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 1375 | anEvent->setPilotId(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
1376 | deleteStr(s); | 1376 | deleteStr(s); |
1377 | } | 1377 | } |
1378 | else | 1378 | else |
1379 | anEvent->setPilotId(0); | 1379 | anEvent->setPilotId(0); |
1380 | 1380 | ||
1381 | if ((vo = isAPropertyOf(vevent, KPilotStatusProp))) { | 1381 | if ((vo = isAPropertyOf(vevent, XPilotStatusProp))) { |
1382 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); | 1382 | anEvent->setSyncStatus(atoi(s = fakeCString(vObjectUStringZValue(vo)))); |
1383 | deleteStr(s); | 1383 | deleteStr(s); |
1384 | } | 1384 | } |
1385 | else | 1385 | else |
1386 | anEvent->setSyncStatus(Event::SYNCMOD); | 1386 | anEvent->setSyncStatus(Event::SYNCMOD); |
1387 | 1387 | ||
1388 | return anEvent; | 1388 | return anEvent; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | 1391 | ||
1392 | QString VCalFormat::qDateToISO(const QDate &qd) | 1392 | QString VCalFormat::qDateToISO(const QDate &qd) |
1393 | { | 1393 | { |
1394 | QString tmpStr; | 1394 | QString tmpStr; |
1395 | 1395 | ||
1396 | ASSERT(qd.isValid()); | 1396 | ASSERT(qd.isValid()); |
1397 | 1397 | ||
@@ -1509,33 +1509,33 @@ void VCalFormat::populate(VObject *vcal) | |||
1509 | 1509 | ||
1510 | // Store all events with a relatedTo property in a list for post-processing | 1510 | // Store all events with a relatedTo property in a list for post-processing |
1511 | mEventsRelate.clear(); | 1511 | mEventsRelate.clear(); |
1512 | mTodosRelate.clear(); | 1512 | mTodosRelate.clear(); |
1513 | 1513 | ||
1514 | initPropIterator(&i, vcal); | 1514 | initPropIterator(&i, vcal); |
1515 | 1515 | ||
1516 | // go through all the vobjects in the vcal | 1516 | // go through all the vobjects in the vcal |
1517 | while (moreIteration(&i)) { | 1517 | while (moreIteration(&i)) { |
1518 | curVO = nextVObject(&i); | 1518 | curVO = nextVObject(&i); |
1519 | 1519 | ||
1520 | /************************************************************************/ | 1520 | /************************************************************************/ |
1521 | 1521 | ||
1522 | // now, check to see that the object is an event or todo. | 1522 | // now, check to see that the object is an event or todo. |
1523 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { | 1523 | if (strcmp(vObjectName(curVO), VCEventProp) == 0) { |
1524 | 1524 | ||
1525 | if ((curVOProp = isAPropertyOf(curVO, KPilotStatusProp)) != 0) { | 1525 | if ((curVOProp = isAPropertyOf(curVO, XPilotStatusProp)) != 0) { |
1526 | char *s; | 1526 | char *s; |
1527 | s = fakeCString(vObjectUStringZValue(curVOProp)); | 1527 | s = fakeCString(vObjectUStringZValue(curVOProp)); |
1528 | // check to see if event was deleted by the kpilot conduit | 1528 | // check to see if event was deleted by the kpilot conduit |
1529 | if (atoi(s) == Event::SYNCDEL) { | 1529 | if (atoi(s) == Event::SYNCDEL) { |
1530 | deleteStr(s); | 1530 | deleteStr(s); |
1531 | kdDebug(5800) << "skipping pilot-deleted event" << endl; | 1531 | kdDebug(5800) << "skipping pilot-deleted event" << endl; |
1532 | goto SKIP; | 1532 | goto SKIP; |
1533 | } | 1533 | } |
1534 | deleteStr(s); | 1534 | deleteStr(s); |
1535 | } | 1535 | } |
1536 | 1536 | ||
1537 | // this code checks to see if we are trying to read in an event | 1537 | // this code checks to see if we are trying to read in an event |
1538 | // that we already find to be in the calendar. If we find this | 1538 | // that we already find to be in the calendar. If we find this |
1539 | // to be the case, we skip the event. | 1539 | // to be the case, we skip the event. |
1540 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { | 1540 | if ((curVOProp = isAPropertyOf(curVO, VCUniqueStringProp)) != 0) { |
1541 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); | 1541 | char *s = fakeCString(vObjectUStringZValue(curVOProp)); |