From 2c92c8ae0adaa91ed35b6fd8a57f74a4c0c99830 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 22:50:41 +0100 Subject: [PATCH] Added VALARM:REPEAT property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:REPEAT property. --- .../calendarevent/CalendarEvent-Save.cpp | 26 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 330df3b..9e143ce 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1334,6 +1334,32 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the REPEAT VALARM value. + + if (CalendarAlarmData[CalendarAlarmDataSeek].RepeatData.size() > 0){ + + DataLine += "REPEAT"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].RepeatTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].RepeatTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].RepeatData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VALARM\n"; } diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 18ca4e4..b98907f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -136,6 +136,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "ACTION;FUNKY=SOUNDS:AUDIO\n" "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160220T160000Z\n" "DURATION;FLYING=NO:PT5H\n" + "REPEAT;NEVER=SLEEP:PT5M\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:DISPLAY\n" @@ -143,6 +144,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "DURATION;FLYING=YES:PT7H\n" "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;TERRIBLE=TOKEN:This is the secon\n" " d alarm.\n" + "REPEAT;SLEEP=ALWAYS:PT3M\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:EMAIL\n" @@ -152,6 +154,7 @@ TEST(iCalendarSaveEvent, SaveEventTests){ " alarm.\n" "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=en;MEEP=MOOP:This is the summary of the\n" " third alarm.\n" + "REPEAT;SLEEP=ALWAYS:PT3M\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5