From d96e685e29d26a6d923c1c33358e66e7ad9daeac Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 08:58:41 +0100 Subject: [PATCH] Added RECURRENCE-ID property for saving data from a CalendarEventObject. Added the code and unit tests for the RECURRENCE-ID property. --- .../calendarevent/CalendarEvent-Save.cpp | 47 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 2 + 2 files changed, 49 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index e652d7a..e7d78d8 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -574,6 +574,53 @@ void CalendarEventObject::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:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index e64e02c..8d19378 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -92,6 +92,8 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "STATUS;LANGUAGE=kw;FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN:2.0;Success\n" "TRANSP;OPAQUE=NOTYET:TRANSPARENT\n" "URL;EXTERNAL=YES:http://www.example.com/\n" + "RECURRENCE-ID;TZID=Europe/Truro;RANGE=THISANDFUTURE;VALUE=DATE;EXAMPLE=DATA:2\n" + " 0160124\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5