From 7fa96b9e9eeab0c67e10545fc555b65e094ea999 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 4 Jun 2016 22:44:07 +0100 Subject: [PATCH] Added VALARM:DESCRIPTION property for saving data from a CalendarEventObject. Added the code and unit tests for the VALARM:DESCRIPTION property. --- .../calendarevent/CalendarEvent-Save.cpp | 41 +++++++++++++++++++ source/tests/xestiacalendar_icaleventsave.h | 2 + 2 files changed, 43 insertions(+) diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 53ba9d1..330df3b 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -1293,6 +1293,47 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the SUMMARY VALARM value. + + if (CalendarAlarmData[CalendarAlarmDataSeek].SummaryData.size() > 0){ + + DataLine += "SUMMARY"; + + if (CalendarAlarmData[CalendarAlarmDataSeek].SummaryAltRep.size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].SummaryAltRep; + DataLine += "\""; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].SummaryLanguage.size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].SummaryLanguage; + + } + + if (CalendarAlarmData[CalendarAlarmDataSeek].SummaryTokens.size() > 0){ + + DataLine += ";"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].SummaryTokens; + + } + + DataLine += ":"; + DataLine += CalendarAlarmData[CalendarAlarmDataSeek].SummaryData; + 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 199487c..18ca4e4 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -150,6 +150,8 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "DURATION;FLYING=YES:PT7H\n" "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;TERRIBLE=TOKEN:This is the third\n" " alarm.\n" + "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=en;MEEP=MOOP:This is the summary of the\n" + " third alarm.\n" "END:VALARM\n" "END:VEVENT\n" "END:VCARD"; -- 2.39.5