From b61ebde9b6b48e326d6693b0be86e9cc810e11db Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 22:34:55 +0100 Subject: [PATCH] Added RECURRENCE-ID property for saving data from a CalendarTaskObject. Added the code and unit tests for the RECURRENCE-ID property. --- .../calendartask/CalendarTask-Save.cpp | 47 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 2 + 2 files changed, 49 insertions(+) diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 6c04b56..410fc56 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -438,6 +438,53 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the RECURRENCE-ID value. + + if (RecurranceIDData.size() > 0){ + + DataLine += "RECURRENCE-ID"; + + if (RecurranceIDDataTimeZoneParam.size() > 0){ + + DataLine += ";TZID="; + DataLine += RecurranceIDDataTimeZoneParam; + + } + + if (RecurranceIDDataRangeParam.size() > 0){ + + DataLine += ";RANGE="; + DataLine += RecurranceIDDataRangeParam; + + } + + if (RecurranceIDDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += RecurranceIDDataValue; + + } + + if (RecurranceIDDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += RecurranceIDDataTokens; + + } + + DataLine += ":"; + DataLine += RecurranceIDData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VTODO\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaltasksave.h b/source/tests/xestiacalendar_icaltasksave.h index f887119..aa3b88b 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -73,6 +73,8 @@ TEST(iCalendarSaveTask, SaveTaskTests){ " eply@example.com\";LANGUAGE=kw;HAPPY=WEEKS:mailto:organiser@example.com\n" "PERCENT-COMPLETE;DEEP=THOUGHT:42\n" "PRIORITY;STATUS=DEFAULT:5\n" + "RECURRENCE-ID;TZID=Europe/Truro;RANGE=THISANDFUTURE;VALUE=DATE;EXAMPLE=DATA:2\n" + " 0160131\n" "END:VTODO\n" "END:VCALENDAR"; -- 2.39.5