30 #include "kcalendarcore_debug.h" 33 #include <libical/vcc.h> 34 #include <libical/vobject.h> 39 #include <QTextDocument> 58 qCritical() <<
"There number of relatedTos for this incidence is " 59 << cnt <<
" (there must be 1 relatedTo only)";
60 Q_ASSERT_X(
false,
"removeAllVCal",
"Count is not 1.");
64 c.remove(c.indexOf(x));
88 d->mCalendar = calendar;
94 VObject *vcal = Parse_MIME_FromFileName(const_cast<char *>(
QFile::encodeName(fileName).data()));
104 auto savedTimeZoneId = d->mCalendar->timeZoneId();
106 d->mCalendar->setTimeZoneId(savedTimeZoneId);
119 qCWarning(KCALCORE_LOG) <<
"Saving VCAL is not supported";
124 bool deleted,
const QString ¬ebook)
126 return fromRawString(calendar,
string.toUtf8(), deleted, notebook);
130 bool deleted,
const QString ¬ebook)
132 d->mCalendar = calendar;
134 if (!
string.size()) {
138 VObject *vcal = Parse_MIME(
string.data(),
string.size());
144 initPropIterator(&i, vcal);
147 auto savedTimeZoneId = d->mCalendar->timeZoneId();
149 d->mCalendar->setTimeZoneId(savedTimeZoneId);
159 const QString ¬ebook,
bool deleted)
165 qCWarning(KCALCORE_LOG) <<
"Exporting into VCAL is not supported";
171 VObject *vo =
nullptr;
178 if ((vo = isAPropertyOf(vtodo, VCDCreatedProp)) !=
nullptr) {
184 vo = isAPropertyOf(vtodo, VCUniqueStringProp);
193 if ((vo = isAPropertyOf(vtodo, VCLastModifiedProp)) !=
nullptr) {
202 if ((vo = isAPropertyOf(vtodo, ICOrganizerProp)) !=
nullptr) {
203 anEvent->setOrganizer(
QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))));
206 if (d->mCalendar->owner().name() !=
QLatin1String(
"Unknown Name")) {
207 anEvent->setOrganizer(d->mCalendar->owner());
212 initPropIterator(&voi, vtodo);
213 while (moreIteration(&voi)) {
214 vo = nextVObject(&voi);
215 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) {
218 s = fakeCString(vObjectUStringZValue(vo));
226 a =
Attendee(tmpStr.
left(emailPos1 - 1), tmpStr.
mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1)));
238 if ((vp = isAPropertyOf(vo, VCRSVPProp)) !=
nullptr) {
239 a.
setRSVP(vObjectStringZValue(vp));
242 if ((vp = isAPropertyOf(vo, VCStatusProp)) !=
nullptr) {
246 anEvent->addAttendee(a);
251 if ((vo = isAPropertyOf(vtodo, VCDescriptionProp)) !=
nullptr) {
252 s = fakeCString(vObjectUStringZValue(vo));
258 if ((vo = isAPropertyOf(vtodo, VCSummaryProp))) {
259 s = fakeCString(vObjectUStringZValue(vo));
265 if ((vo = isAPropertyOf(vtodo, VCLocationProp)) !=
nullptr) {
266 s = fakeCString(vObjectUStringZValue(vo));
273 if ((vo = isAPropertyOf(vtodo, VCStatusProp)) !=
nullptr) {
274 s = fakeCString(vObjectUStringZValue(vo));
275 if (s && strcmp(s,
"COMPLETED") == 0) {
276 anEvent->setCompleted(
true);
278 anEvent->setCompleted(
false);
282 anEvent->setCompleted(
false);
286 if ((vo = isAPropertyOf(vtodo, VCCompletedProp)) !=
nullptr) {
292 if ((vo = isAPropertyOf(vtodo, VCPriorityProp))) {
293 s = fakeCString(vObjectUStringZValue(vo));
295 anEvent->setPriority(atoi(s));
300 anEvent->setAllDay(
false);
303 if ((vo = isAPropertyOf(vtodo, VCDueProp)) !=
nullptr) {
306 if (anEvent->dtDue().time().hour() == 0 &&
307 anEvent->dtDue().time().minute() == 0 &&
308 anEvent->dtDue().time().second() == 0) {
309 anEvent->setAllDay(
true);
316 if ((vo = isAPropertyOf(vtodo, VCDTstartProp)) !=
nullptr) {
319 if (anEvent->dtStart().time().hour() == 0 &&
320 anEvent->dtStart().time().minute() == 0 &&
321 anEvent->dtStart().time().second() == 0) {
322 anEvent->setAllDay(
true);
329 if ((vo = isAPropertyOf(vtodo, VCRRuleProp)) !=
nullptr) {
330 uint recurrenceType = Recurrence::rNone;
331 int recurrenceTypeAbbrLen = 0;
336 const int tmpStrLen = tmpStr.
length();
340 recurrenceTypeAbbrLen = 1;
342 recurrenceType = Recurrence::rDaily;
344 recurrenceType = Recurrence::rWeekly;
345 }
else if (tmpStrLen > 1) {
346 recurrenceTypeAbbrLen = 2;
348 recurrenceType = Recurrence::rMonthlyPos;
350 recurrenceType = Recurrence::rMonthlyDay;
352 recurrenceType = Recurrence::rYearlyMonth;
354 recurrenceType = Recurrence::rYearlyDay;
359 if (recurrenceType != Recurrence::rNone) {
363 int rFreq = tmpStr.
midRef(recurrenceTypeAbbrLen, (index - 1)).
toInt();
367 switch (recurrenceType) {
368 case Recurrence::rDaily:
369 anEvent->recurrence()->setDaily(rFreq);
372 case Recurrence::rWeekly: {
377 qba.
setBit(anEvent->dtStart().date().dayOfWeek() - 1);
380 while (index < last) {
381 dayStr = tmpStr.
mid(index, 3);
389 anEvent->recurrence()->setWeekly(rFreq, qba);
393 case Recurrence::rMonthlyPos: {
394 anEvent->recurrence()->setMonthly(rFreq);
400 tmpPos = anEvent->dtStart().date().day() / 7 + 1;
404 qba.
setBit(anEvent->dtStart().date().dayOfWeek() - 1);
405 anEvent->recurrence()->addMonthlyPos(tmpPos, qba);
408 while (index < last) {
421 anEvent->recurrence()->addMonthlyPos(tmpPos, qba);
429 case Recurrence::rMonthlyDay:
430 anEvent->recurrence()->setMonthly(rFreq);
433 short tmpDay = anEvent->dtStart().date().day();
434 anEvent->recurrence()->addMonthlyDate(tmpDay);
437 while (index < last) {
443 short tmpDay = tmpStr.
mid(index, (index2 - index)).
toShort();
449 anEvent->recurrence()->addMonthlyDate(tmpDay);
454 case Recurrence::rYearlyMonth:
455 anEvent->recurrence()->setYearly(rFreq);
459 short tmpMonth = anEvent->dtStart().date().month();
460 anEvent->recurrence()->addYearlyMonth(tmpMonth);
463 while (index < last) {
465 short tmpMonth = tmpStr.
mid(index, (index2 - index)).
toShort();
467 anEvent->recurrence()->addYearlyMonth(tmpMonth);
472 case Recurrence::rYearlyDay:
473 anEvent->recurrence()->setYearly(rFreq);
477 short tmpDay = anEvent->dtStart().date().dayOfYear();
478 anEvent->recurrence()->addYearlyDay(tmpDay);
481 while (index < last) {
483 short tmpDay = tmpStr.
mid(index, (index2 - index)).
toShort();
485 anEvent->recurrence()->addYearlyDay(tmpDay);
499 int rDuration = tmpStr.
midRef(index, tmpStr.
length() - index).toInt();
501 anEvent->recurrence()->setDuration(rDuration);
505 anEvent->recurrence()->setEndDateTime(rEndDate);
508 qCDebug(KCALCORE_LOG) <<
"we don't understand this type of recurrence!";
513 if ((vo = isAPropertyOf(vtodo, VCExpDateProp)) !=
nullptr) {
514 s = fakeCString(vObjectUStringZValue(vo));
522 anEvent->recurrence()->addExDate(
ISOToQDate(*it));
524 anEvent->recurrence()->addExDateTime(exDate);
531 if ((vo = isAPropertyOf(vtodo, VCDAlarmProp))) {
533 VObject *a = isAPropertyOf(vo, VCRunTimeProp);
534 VObject *b = isAPropertyOf(vo, VCDisplayStringProp);
537 alarm = anEvent->newAlarm();
542 alarm->setEnabled(
true);
544 s = fakeCString(vObjectUStringZValue(b));
548 alarm->setDisplayAlarm(
QString());
553 if ((vo = isAPropertyOf(vtodo, VCAAlarmProp))) {
557 a = isAPropertyOf(vo, VCRunTimeProp);
558 b = isAPropertyOf(vo, VCAudioContentProp);
561 alarm = anEvent->newAlarm();
566 alarm->setEnabled(
true);
568 s = fakeCString(vObjectUStringZValue(b));
572 alarm->setAudioAlarm(
QString());
577 if ((vo = isAPropertyOf(vtodo, VCPAlarmProp))) {
579 VObject *a = isAPropertyOf(vo, VCRunTimeProp);
580 VObject *b = isAPropertyOf(vo, VCProcedureNameProp);
583 alarm = anEvent->newAlarm();
588 alarm->setEnabled(
true);
591 s = fakeCString(vObjectUStringZValue(b));
595 alarm->setProcedureAlarm(
QString());
601 if ((vo = isAPropertyOf(vtodo, VCRelatedToProp)) !=
nullptr) {
602 anEvent->setRelatedTo(
QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))));
604 d->mTodosRelate.append(anEvent);
609 if ((vo = isAPropertyOf(vtodo, VCClassProp)) !=
nullptr) {
610 s = fakeCString(vObjectUStringZValue(vo));
611 if (s && strcmp(s,
"PRIVATE") == 0) {
613 }
else if (s && strcmp(s,
"CONFIDENTIAL") == 0) {
618 anEvent->setSecrecy(secrecy);
621 if ((vo = isAPropertyOf(vtodo, VCCategoriesProp)) !=
nullptr) {
622 s = fakeCString(vObjectUStringZValue(vo));
626 anEvent->setCategories(tmpStrList);
634 VObject *vo =
nullptr;
641 if ((vo = isAPropertyOf(vevent, VCDCreatedProp)) !=
nullptr) {
647 vo = isAPropertyOf(vevent, VCUniqueStringProp);
657 anEvent->setRevision(0);
658 if ((vo = isAPropertyOf(vevent, VCSequenceProp)) !=
nullptr) {
659 s = fakeCString(vObjectUStringZValue(vo));
661 anEvent->setRevision(atoi(s));
667 if ((vo = isAPropertyOf(vevent, VCLastModifiedProp)) !=
nullptr) {
676 if ((vo = isAPropertyOf(vevent, ICOrganizerProp)) !=
nullptr) {
678 anEvent->setOrganizer(
QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))));
681 if (d->mCalendar->owner().name() !=
QLatin1String(
"Unknown Name")) {
682 anEvent->setOrganizer(d->mCalendar->owner());
687 initPropIterator(&voi, vevent);
688 while (moreIteration(&voi)) {
689 vo = nextVObject(&voi);
690 if (strcmp(vObjectName(vo), VCAttendeeProp) == 0) {
692 VObject *vp =
nullptr;
693 s = fakeCString(vObjectUStringZValue(vo));
701 a =
Attendee(tmpStr.
left(emailPos1 - 1), tmpStr.
mid(emailPos1 + 1, emailPos2 - (emailPos1 + 1)));
712 if ((vp = isAPropertyOf(vo, VCRSVPProp)) !=
nullptr) {
713 a.
setRSVP(vObjectStringZValue(vp));
716 if ((vp = isAPropertyOf(vo, VCStatusProp)) !=
nullptr) {
720 anEvent->addAttendee(a);
733 anEvent->setAllDay(
false);
736 if ((vo = isAPropertyOf(vevent, VCDTstartProp)) !=
nullptr) {
740 if (anEvent->dtStart().time().hour() == 0 &&
741 anEvent->dtStart().time().minute() == 0 &&
742 anEvent->dtStart().time().second() == 0) {
743 anEvent->setAllDay(
true);
748 if ((vo = isAPropertyOf(vevent, VCDTendProp)) !=
nullptr) {
752 if (anEvent->dtEnd().time().hour() == 0 &&
753 anEvent->dtEnd().time().minute() == 0 &&
754 anEvent->dtEnd().time().second() == 0) {
755 anEvent->setAllDay(
true);
761 if (!isAPropertyOf(vevent, VCDTstartProp)) {
762 anEvent->setDtStart(anEvent->dtEnd());
764 if (! isAPropertyOf(vevent, VCDTendProp)) {
765 anEvent->setDtEnd(anEvent->dtStart());
771 if ((vo = isAPropertyOf(vevent, VCRRuleProp)) !=
nullptr) {
772 uint recurrenceType = Recurrence::rNone;
773 int recurrenceTypeAbbrLen = 0;
778 const int tmpStrLen = tmpStr.
length();
782 recurrenceTypeAbbrLen = 1;
784 recurrenceType = Recurrence::rDaily;
786 recurrenceType = Recurrence::rWeekly;
787 }
else if (tmpStrLen > 1){
788 recurrenceTypeAbbrLen = 2;
790 recurrenceType = Recurrence::rMonthlyPos;
792 recurrenceType = Recurrence::rMonthlyDay;
794 recurrenceType = Recurrence::rYearlyMonth;
796 recurrenceType = Recurrence::rYearlyDay;
801 if (recurrenceType != Recurrence::rNone) {
805 int rFreq = tmpStr.
midRef(recurrenceTypeAbbrLen, (index - 1)).
toInt();
809 switch (recurrenceType) {
810 case Recurrence::rDaily:
811 anEvent->recurrence()->setDaily(rFreq);
814 case Recurrence::rWeekly: {
819 qba.
setBit(anEvent->dtStart().date().dayOfWeek() - 1);
822 while (index < last) {
823 dayStr = tmpStr.
mid(index, 3);
831 anEvent->recurrence()->setWeekly(rFreq, qba);
835 case Recurrence::rMonthlyPos: {
836 anEvent->recurrence()->setMonthly(rFreq);
842 tmpPos = anEvent->dtStart().date().day() / 7 + 1;
846 qba.
setBit(anEvent->dtStart().date().dayOfWeek() - 1);
847 anEvent->recurrence()->addMonthlyPos(tmpPos, qba);
850 while (index < last) {
863 anEvent->recurrence()->addMonthlyPos(tmpPos, qba);
871 case Recurrence::rMonthlyDay:
872 anEvent->recurrence()->setMonthly(rFreq);
875 short tmpDay = anEvent->dtStart().date().day();
876 anEvent->recurrence()->addMonthlyDate(tmpDay);
879 while (index < last) {
885 short tmpDay = tmpStr.
mid(index, (index2 - index)).
toShort();
891 anEvent->recurrence()->addMonthlyDate(tmpDay);
896 case Recurrence::rYearlyMonth:
897 anEvent->recurrence()->setYearly(rFreq);
901 short tmpMonth = anEvent->dtStart().date().month();
902 anEvent->recurrence()->addYearlyMonth(tmpMonth);
905 while (index < last) {
907 short tmpMonth = tmpStr.
mid(index, (index2 - index)).
toShort();
909 anEvent->recurrence()->addYearlyMonth(tmpMonth);
914 case Recurrence::rYearlyDay:
915 anEvent->recurrence()->setYearly(rFreq);
919 const int tmpDay = anEvent->dtStart().date().dayOfYear();
920 anEvent->recurrence()->addYearlyDay(tmpDay);
923 while (index < last) {
925 short tmpDay = tmpStr.
mid(index, (index2 - index)).
toShort();
927 anEvent->recurrence()->addYearlyDay(tmpDay);
941 int rDuration = tmpStr.
midRef(index, tmpStr.
length() - index).toInt();
943 anEvent->recurrence()->setDuration(rDuration);
947 anEvent->recurrence()->setEndDateTime(rEndDate);
952 qCDebug(KCALCORE_LOG) <<
"we don't understand this type of recurrence!";
957 if ((vo = isAPropertyOf(vevent, VCExpDateProp)) !=
nullptr) {
958 s = fakeCString(vObjectUStringZValue(vo));
966 anEvent->recurrence()->addExDate(
ISOToQDate(*it));
968 anEvent->recurrence()->addExDateTime(exDate);
975 if ((vo = isAPropertyOf(vevent, VCSummaryProp))) {
976 s = fakeCString(vObjectUStringZValue(vo));
982 if ((vo = isAPropertyOf(vevent, VCDescriptionProp)) !=
nullptr) {
983 s = fakeCString(vObjectUStringZValue(vo));
985 if (!anEvent->description().isEmpty()) {
986 anEvent->setDescription(
995 if ((vo = isAPropertyOf(vevent, VCLocationProp)) !=
nullptr) {
996 s = fakeCString(vObjectUStringZValue(vo));
1003 if (anEvent->summary().isEmpty() && !(anEvent->description().isEmpty())) {
1004 QString tmpStr = anEvent->description().simplified();
1005 anEvent->setDescription(
QString());
1006 anEvent->setSummary(tmpStr);
1011 if ((vo = isAPropertyOf(vevent, VCStatusProp)) != 0) {
1012 QString tmpStr(s = fakeCString(vObjectUStringZValue(vo)));
1023 if ((vo = isAPropertyOf(vevent, VCClassProp)) !=
nullptr) {
1024 s = fakeCString(vObjectUStringZValue(vo));
1025 if (s && strcmp(s,
"PRIVATE") == 0) {
1027 }
else if (s && strcmp(s,
"CONFIDENTIAL") == 0) {
1032 anEvent->setSecrecy(secrecy);
1035 if ((vo = isAPropertyOf(vevent, VCCategoriesProp)) !=
nullptr) {
1036 s = fakeCString(vObjectUStringZValue(vo));
1040 anEvent->setCategories(tmpStrList);
1044 initPropIterator(&voi, vevent);
1045 while (moreIteration(&voi)) {
1046 vo = nextVObject(&voi);
1047 if (strcmp(vObjectName(vo), VCAttachProp) == 0) {
1048 s = fakeCString(vObjectUStringZValue(vo));
1055 if ((vo = isAPropertyOf(vevent, VCResourcesProp)) !=
nullptr) {
1059 anEvent->setResources(tmpStrList);
1063 if ((vo = isAPropertyOf(vevent, VCDAlarmProp))) {
1065 VObject *a = isAPropertyOf(vo, VCRunTimeProp);
1066 VObject *b = isAPropertyOf(vo, VCDisplayStringProp);
1069 alarm = anEvent->newAlarm();
1074 alarm->setEnabled(
true);
1077 s = fakeCString(vObjectUStringZValue(b));
1081 alarm->setDisplayAlarm(
QString());
1086 if ((vo = isAPropertyOf(vevent, VCAAlarmProp))) {
1090 a = isAPropertyOf(vo, VCRunTimeProp);
1091 b = isAPropertyOf(vo, VCAudioContentProp);
1094 alarm = anEvent->newAlarm();
1099 alarm->setEnabled(
true);
1102 s = fakeCString(vObjectUStringZValue(b));
1106 alarm->setAudioAlarm(
QString());
1111 if ((vo = isAPropertyOf(vevent, VCPAlarmProp))) {
1115 a = isAPropertyOf(vo, VCRunTimeProp);
1116 b = isAPropertyOf(vo, VCProcedureNameProp);
1119 alarm = anEvent->newAlarm();
1124 alarm->setEnabled(
true);
1127 s = fakeCString(vObjectUStringZValue(b));
1131 alarm->setProcedureAlarm(
QString());
1137 if ((vo = isAPropertyOf(vevent, VCPriorityProp))) {
1138 s = fakeCString(vObjectUStringZValue(vo));
1140 anEvent->setPriority(atoi(s));
1146 if ((vo = isAPropertyOf(vevent, VCTranspProp)) !=
nullptr) {
1147 s = fakeCString(vObjectUStringZValue(vo));
1156 if ((vo = isAPropertyOf(vevent, VCRelatedToProp)) !=
nullptr) {
1157 anEvent->setRelatedTo(
QString::fromUtf8(s = fakeCString(vObjectUStringZValue(vo))));
1159 d->mEventsRelate.append(anEvent);
1163 readCustomProperties(vevent, anEvent);
1177 if (!timezone.
contains(
"BEGIN:DAYLIGHT")) {
1181 timezone = timezone.
mid(timezone.
indexOf(
"BEGIN:DAYLIGHT"));
1182 timezone = timezone.
mid(timezone.
indexOf(
"TZNAME:") + 7);
1185 timezone = timezone.
mid(timezone.
indexOf(
"TZOFFSETTO:") + 11);
1189 timezone = timezone.
mid(timezone.
indexOf(
"TZNAME:") + 7);
1194 QStringLiteral(
"TRUE;") +
1219 tmpDT = dt.
toTimeZone(d->mCalendar->timeZone());
1236 int year, month, day, hour, minute, second;
1245 tmpDate.
setDate(year, month, day);
1246 tmpTime.
setHMS(hour, minute, second);
1253 return QDateTime(tmpDate, tmpTime, d->mCalendar->timeZone());
1262 int year, month, day;
1268 return QDate(year, month, day);
1286 if (str.
size() <= ofs) {
1295 if (str.
size() <= ofs) {
1302 if (str.
size() < (ofs + 2)) {
1312 if (str.
size() > ofs) {
1316 if (str.
size() > ofs) {
1317 if (str.
size() < (ofs + 2)) {
1326 result = v * mod * 60;
1342 bool hasTimeZone =
false;
1345 if ((curVO = isAPropertyOf(vcal, ICMethodProp)) !=
nullptr) {
1346 char *methodType = fakeCString(vObjectUStringZValue(curVO));
1348 deleteStr(methodType);
1352 if ((curVO = isAPropertyOf(vcal, VCProdIdProp)) !=
nullptr) {
1353 char *s = fakeCString(vObjectUStringZValue(curVO));
1354 if (!s || strcmp(
productId().toUtf8().constData(), s) != 0) {
1355 qCDebug(KCALCORE_LOG) <<
"This vCalendar file was not created by KOrganizer or" 1356 <<
"any other product we support. Loading anyway...";
1363 if ((curVO = isAPropertyOf(vcal, VCVersionProp)) !=
nullptr) {
1364 char *s = fakeCString(vObjectUStringZValue(curVO));
1365 if (!s || strcmp(_VCAL_VERSION, s) != 0) {
1366 qCDebug(KCALCORE_LOG) <<
"This vCalendar file has version" << s
1367 <<
"We only support" << _VCAL_VERSION;
1373 if ((curVO = isAPropertyOf(vcal, VCTimeZoneProp)) !=
nullptr) {
1374 char *s = fakeCString(vObjectUStringZValue(curVO));
1397 initPropIterator(&i, vcal);
1398 while (moreIteration(&i)) {
1399 curVO = nextVObject(&i);
1400 if (strcmp(vObjectName(curVO), VCDayLightProp) == 0) {
1401 char *s = fakeCString(vObjectUStringZValue(curVO));
1407 if (argl.
size() < 4) {
1423 QString strStartDate = argl[2];
1426 QString strRealEndDate = strEndDate;
1427 QString strRealStartDate = strStartDate;
1431 if (endDate < startDate) {
1432 strRealEndDate = strStartDate;
1433 strRealStartDate = strEndDate;
1434 realEndDate = startDate;
1435 realStartDate = endDate;
1437 tz = QStringLiteral(
"%1;%2;false;%3").
1441 tz = QStringLiteral(
"%1;%2;true;%3").
1445 qCDebug(KCALCORE_LOG) <<
"unable to parse dst" << argl[1];
1450 qCDebug(KCALCORE_LOG) <<
"zone is not valid, parsing error" << tzList;
1452 previousZone = d->mCalendar->timeZone();
1453 d->mCalendar->setTimeZoneId(name.
toUtf8());
1457 qCDebug(KCALCORE_LOG) <<
"unable to parse tzoffset" << ts;
1462 d->mEventsRelate.
clear();
1463 d->mTodosRelate.clear();
1465 initPropIterator(&i, vcal);
1468 while (moreIteration(&i)) {
1469 curVO = nextVObject(&i);
1474 if (strcmp(vObjectName(curVO), VCEventProp) == 0) {
1476 if (!isAPropertyOf(curVO, VCDTstartProp) &&
1477 !isAPropertyOf(curVO, VCDTendProp)) {
1478 qCDebug(KCALCORE_LOG) <<
"found a VEvent with no DTSTART and no DTEND! Skipping...";
1484 if (hasTimeZone && !anEvent->allDay() && anEvent->dtStart().timeZone() ==
QTimeZone::utc()) {
1489 int utcOffSet = anEvent->dtStart().offsetFromUtc();
1490 QDateTime dtStart(anEvent->dtStart().addSecs(utcOffSet));
1492 QDateTime dtEnd(anEvent->dtEnd().addSecs(utcOffSet));
1494 anEvent->setDtStart(dtStart);
1495 anEvent->setDtEnd(dtEnd);
1497 Event::Ptr old = !anEvent->hasRecurrenceId() ?
1498 d->mCalendar->event(anEvent->uid()) :
1499 d->mCalendar->event(anEvent->uid(), anEvent->recurrenceId());
1503 d->mCalendar->deleteEvent(old);
1504 removeAllVCal(d->mEventsRelate, old);
1505 }
else if (anEvent->revision() > old->revision()) {
1506 d->mCalendar->deleteEvent(old);
1507 removeAllVCal(d->mEventsRelate, old);
1508 d->mCalendar->addEvent(anEvent);
1510 }
else if (deleted) {
1511 old = !anEvent->hasRecurrenceId() ?
1512 d->mCalendar->deletedEvent(anEvent->uid()) :
1513 d->mCalendar->deletedEvent(anEvent->uid(), anEvent->recurrenceId());
1515 d->mCalendar->addEvent(anEvent);
1516 d->mCalendar->deleteEvent(anEvent);
1519 d->mCalendar->addEvent(anEvent);
1522 }
else if (strcmp(vObjectName(curVO), VCTodoProp) == 0) {
1525 if (hasTimeZone && !aTodo->allDay() && aTodo->dtStart().timeZone() ==
QTimeZone::utc()) {
1530 int utcOffSet = aTodo->dtStart().offsetFromUtc();
1531 QDateTime dtStart(aTodo->dtStart().addSecs(utcOffSet));
1533 aTodo->setDtStart(dtStart);
1534 if (aTodo->hasDueDate()) {
1535 QDateTime dtDue(aTodo->dtDue().addSecs(utcOffSet));
1537 aTodo->setDtDue(dtDue);
1540 Todo::Ptr old = !aTodo->hasRecurrenceId() ?
1541 d->mCalendar->todo(aTodo->uid()) :
1542 d->mCalendar->todo(aTodo->uid(), aTodo->recurrenceId());
1545 d->mCalendar->deleteTodo(old);
1546 removeAllVCal(d->mTodosRelate, old);
1547 }
else if (aTodo->revision() > old->revision()) {
1548 d->mCalendar->deleteTodo(old);
1549 removeAllVCal(d->mTodosRelate, old);
1550 d->mCalendar->addTodo(aTodo);
1552 }
else if (deleted) {
1553 old = d->mCalendar->deletedTodo(aTodo->uid(), aTodo->recurrenceId());
1555 d->mCalendar->addTodo(aTodo);
1556 d->mCalendar->deleteTodo(aTodo);
1559 d->mCalendar->addTodo(aTodo);
1562 }
else if ((strcmp(vObjectName(curVO), VCVersionProp) == 0) ||
1563 (strcmp(vObjectName(curVO), VCProdIdProp) == 0) ||
1564 (strcmp(vObjectName(curVO), VCTimeZoneProp) == 0)) {
1568 }
else if (strcmp(vObjectName(curVO), VCDayLightProp) == 0) {
1572 qCDebug(KCALCORE_LOG) <<
"Ignoring unknown vObject \"" << vObjectName(curVO) <<
"\"";
1580 for (eIt = d->mEventsRelate.constBegin(); eIt != d->mEventsRelate.constEnd(); ++eIt) {
1581 (*eIt)->setRelatedTo((*eIt)->relatedTo());
1584 for (tIt = d->mTodosRelate.constBegin(); tIt != d->mTodosRelate.constEnd(); ++tIt) {
1585 (*tIt)->setRelatedTo((*tIt)->relatedTo());
1590 d->mCalendar->setTimeZone(previousZone);
1646 qCDebug(KCALCORE_LOG) <<
"error setting attendee mStatus, unknown mStatus!";
1658 return "NEEDS ACTION";
1670 return "NEEDS ACTION";
1674 void VCalFormat::readCustomProperties(VObject *o,
const Incidence::Ptr &i)
1676 VObjectIterator iter;
1679 initPropIterator(&iter, o);
1680 while (moreIteration(&iter)) {
1681 VObject *cur = nextVObject(&iter);
1682 const char *curname = vObjectName(cur);
1684 if ((curname[0] ==
'X' && curname[1] ==
'-') &&
1685 strcmp(curname, ICOrganizerProp) != 0) {
1688 i->setNonKDECustomProperty(
1695 void VCalFormat::writeCustomProperties(VObject *o,
const Incidence::Ptr &i)
1699 c != custom.
end(); ++c) {
1700 if (d->mManuallyWrittenExtensionFields.contains(c.key()) ||
1701 c.key().startsWith(
"X-KDE-VOLATILE")) {
1705 addPropValue(o, c.key().constData(), c.value().toUtf8().constData());
Event or to-do tentatively accepted.
Secrecy
The different types of incidence access classifications.
QString toString(Qt::DateFormat format) const const
int toInt(bool *ok, int base) const const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
QString toUpper() const const
QDateTime toUTC() const const
short toShort(bool *ok, int base) const const
QString asprintf(const char *cformat,...)
Event does not appear in free/busy time.
Event, to-do or journal accepted.
Event, to-do or journal declined.
void setStatus(PartStat status)
Sets the PartStat of the attendee to status.
bool setHMS(int h, int m, int s, int ms)
Represents information related to an attendee of an Calendar Incidence, typically a meeting or task (...
QString simplified() const const
bool isValid() const const
bool mightBeRichText(const QString &text)
QDateTime toTimeZone(const QTimeZone &timeZone) const const
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const const
void setTimeZone(const QTimeZone &toZone)
int indexOf(char ch, int from) const const
QString number(int n, int base)
void append(const T &value)
QString fromUtf8(const char *str, int size)
QString & insert(int position, QChar ch)
PartStat
The different types of participant status.
QStringRef leftRef(int n) const const
This class provides an Event in the sense of RFC2445.
This file is part of the API for handling calendar data and defines the Todo class.
QString trimmed() const const
This file is part of the API for handling calendar data and defines the Calendar class.
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool isValid() const const
void setRSVP(bool rsvp)
Sets the RSVP flag of the attendee to rsvp.
Represents information related to an attachment for a Calendar Incidence.
This file is part of the API for handling calendar data and defines the Exception class...
Event appears in free/busy time.
Provides a To-do in the sense of RFC2445.
QByteArray mid(int pos, int len) const const
QStringRef midRef(int position, int n) const const
bool isValid() const const
bool setDate(int year, int month, int day)
QString & replace(int position, int n, QChar after)
QByteArray toLatin1() const const
QString mid(int position, int n) const const
Event or to-do delegated.
Exception base class, currently used as a fancy kind of error code and not as an C++ exception...
This file is part of the API for handling calendar data and defines the Event class.
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
const QChar at(int position) const const
bool contains(char ch) const const
Secret to the owner and some others.
QString left(int n) const const
Unknown calendar format detected.
bool fill(bool value, int size)
QList::const_iterator constEnd() const const
To-do in process of being completed.
QList::const_iterator constBegin() const const
Event, to-do or journal needs action (default)
bool isTimeZoneIdAvailable(const QByteArray &ianaId)
QDateTime currentDateTimeUtc()
QByteArray encodeName(const QString &fileName)
QString decodeName(const QByteArray &localFileName)
Namespace for all KCalendarCore types.
QTimeZone timeZone() const const
QByteArray toUtf8() const const