From: Steve Brokenshire Date: Sat, 4 Jun 2016 21:35:29 +0000 (+0100) Subject: Added VALARM:DESCRIPTION property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~222 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=8c835762a4a55778745daf4ff9dee5b827b19e3a;p=xestiacalendar%2F.git Added VALARM:DESCRIPTION property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:DESCRIPTION property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 03c6687..53ba9d1 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1252,6 +1252,47 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the DESCRIPTION VALARM value. + + if (CalendarAlarmData[CalendarAlarmDataSeek].DescriptionData.size() > 0){ + + DataLine += "DESCRIPTION"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].DescriptionAltRep.size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DescriptionAltRep; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].DescriptionLanguage.size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DescriptionLanguage; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].DescriptionTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DescriptionTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].DescriptionData; + 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 fa03963..199487c 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -141,11 +141,15 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "ACTION;FLASHING=LIGHTS:DISPLAY\n" "TRIGGER;RELATED=END;VALUE=DATE-TIME;PUSH=BUTTON:20160230T110000Z\n" "DURATION;FLYING=YES:PT7H\n" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;TERRIBLE=TOKEN:This is the secon\n" + " d alarm.\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" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;TERRIBLE=TOKEN:This is the third\n" + " alarm.\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD";