From bbb79d7428a6650a0adcf2baeb53bf9b40174958 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 22:17:24 +0100 Subject: [PATCH] Added VALARM:DURATION property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:DURATION 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 69dc773..03c6687 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1226,6 +1226,32 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the DURATION VALARM value. + + if (CalendarAlarmData[CalendarAlarmDataSeek].DurationData.size() > 0){ + + DataLine += "DURATION"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].DurationTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DurationTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DurationData; + 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 b365394..fa03963 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -135,14 +135,17 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "BEGIN:VALARM\n" "ACTION;FUNKY=SOUNDS:AUDIO\n" "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160220T160000Z\n" + "DURATION;FLYING=NO:PT5H\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:DISPLAY\n" "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160230T110000Z\n" + "DURATION;FLYING=YES:PT7H\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:EMAIL\n" "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160230T120000Z\n" + "DURATION;FLYING=YES:PT7H\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5