From: Steve Brokenshire Date: Sat, 4 Jun 2016 21:11:31 +0000 (+0100) Subject: Added VALARM:TRIGGER property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~224 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=9c85dd5c00164b878fec27c7875cd855a18405a0;p=xestiacalendar%2F.git Added VALARM:TRIGGER property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:TRIGGER property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 4dbbebe..69dc773 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1185,7 +1185,47 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ DataLine.clear(); DataLineProcessed.clear(); + + // Process the TRIGGER VALARM value. + + if (CalendarAlarmData[CalendarAlarmDataSeek].TriggerData.size() > 0){ + + DataLine += "TRIGGER"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].TriggerRelated.size() > 0){ + + DataLine += ";RELATED="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].TriggerRelated; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].TriggerValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].TriggerValue; + + } + if (CalendarAlarmData[CalendarAlarmDataSeek].TriggerTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].TriggerTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].TriggerData; + 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 66b5c60..b365394 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -134,12 +134,15 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "RDATE;ZILCH=DATA:20160520\n" "BEGIN:VALARM\n" "ACTION;FUNKY=SOUNDS:AUDIO\n" + "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160220T160000Z\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:DISPLAY\n" + "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160230T110000Z\n" "END:VALARM\n" "BEGIN:VALARM\n" "ACTION;FLASHING=LIGHTS:EMAIL\n" + "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160230T120000Z\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD";