From 9ba0887b4a25b948518150470a5c17c9b235703e Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 23:21:53 +0100 Subject: [PATCH] Added RDATE property for saving data from a CalendarTaskObject. Added the code and unit tests for the RDATE property. --- .../calendartask/CalendarTask-Save.cpp | 45 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 3 ++ 2 files changed, 48 insertions(+) diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index bcf0945..3eac545 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -1140,6 +1140,51 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the RDATE value. + + if (RecurranceDateData.size() > 0){ + + for (int RecurranceDateDataSeek = 0; RecurranceDateDataSeek < RecurranceDateData.size(); + RecurranceDateDataSeek++){ + + DataLine += "RDATE"; + + if (RecurranceDateDataValue[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += RecurranceDateDataValue[RecurranceDateDataSeek]; + + } + + if (RecurranceDateDataTimeZoneParam[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";TZID="; + DataLine += RecurranceDateDataTimeZoneParam[RecurranceDateDataSeek]; + + } + + if (RecurranceDateDataTokens[RecurranceDateDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += RecurranceDateDataTokens[RecurranceDateDataSeek]; + + } + + DataLine += ":"; + DataLine += RecurranceDateData[RecurranceDateDataSeek]; + 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 b00b023..54c5ea9 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -116,6 +116,9 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "RESOURCES:DMAC RECEIVER\n" "RESOURCES;LANGUAGE=en:PAL-I TELEVISION SET\n" "RESOURCES;ALTREP=\"null:nodata\";STATUS=BROKEN:PAL/SECAM VCR\n" + "RDATE:20160120\n" + "RDATE;VALUE=DATE;TZID=Europe/Truro:20160121\n" + "RDATE;ZILCH=DATA:20160520\n" "END:VTODO\n" "END:VCALENDAR"; -- 2.39.5