From: Steve Brokenshire Date: Sat, 4 Jun 2016 21:17:24 +0000 (+0100) Subject: Added VALARM:DURATION property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~223 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=bbb79d7428a6650a0adcf2baeb53bf9b40174958;p=xestiacalendar%2F.git Added VALARM:DURATION property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:DURATION property. --- 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";