From f6dd990d1d57a9c9c8af0a0d52d316e0cc142c23 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:24:11 +0100 Subject: [PATCH] Added RECURRENCE-ID property for saving data from a CalendarJournalObject. Added the code and unit tests for the RECURRENCE-ID property. --- .../calendarjournal/CalendarJournal-Save.cpp | 47 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 2 + 2 files changed, 49 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index a3b729e..2b357fa 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -256,6 +256,53 @@ void CalendarJournalObject::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:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index 4c0bf60..f60bf8e 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -73,6 +73,8 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "LAST-MODIFIED;FUTURE=YES:20160131T143700Z\n" "ORGANIZER;CN=ExampleOrganiser;DIR=\"null:nodata\";SENT-BY=\"mailto:organiser.nor\n" " eply@example.com\";LANGUAGE=kw;HAPPY=DAYS:mailto:organiser@example.com\n" + "RECURRENCE-ID;TZID=Europe/Truro;RANGE=THISANDFUTURE;VALUE=DATE;EXAMPLE=DATA:2\n" + " 0160131\n" "END:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5