From: Steve Brokenshire Date: Sat, 4 Jun 2016 20:55:10 +0000 (+0100) Subject: Added VALARM:ACTION property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~225 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=a42369d102d8d9bd9a05fbded5690dac514c1831;p=xestiacalendar%2F.git Added VALARM:ACTION property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:ACTION property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 5236e1f..4dbbebe 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1155,6 +1155,43 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the VALARMS. + + if (CalendarAlarmData.size() > 0){ + + for (int CalendarAlarmDataSeek = 0; CalendarAlarmDataSeek < CalendarAlarmData.size(); + CalendarAlarmDataSeek++){ + + *SaveData += "BEGIN:VALARM\n"; + + // Process the ACTION VALARM value. + + DataLine += "ACTION"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].AlarmActionTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AlarmActionTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].AlarmAction; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + *SaveData += "END:VALARM\n"; + + } + + } + *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 61ca2d1..66b5c60 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -132,6 +132,15 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "RDATE:20160120\n" "RDATE;VALUE=DATE;TZID=Europe/Truro:20160121\n" "RDATE;ZILCH=DATA:20160520\n" + "BEGIN:VALARM\n" + "ACTION;FUNKY=SOUNDS:AUDIO\n" + "END:VALARM\n" + "BEGIN:VALARM\n" + "ACTION;FLASHING=LIGHTS:DISPLAY\n" + "END:VALARM\n" + "BEGIN:VALARM\n" + "ACTION;FLASHING=LIGHTS:EMAIL\n" + "END:VALARM\n" "END:VEVENT\n" "END:VCARD";