From 5f8fb1ac959aadb7946aa8bb68ff419c1fa4cc8a Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 22:44:57 +0100 Subject: [PATCH] Added SUMMARY property for saving data from a CalendarTaskObject. Added the code and unit tests for the SUMMARY property. --- .../calendartask/CalendarTask-Save.cpp | 41 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 2 + 2 files changed, 43 insertions(+) diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 278da51..935ead5 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -544,6 +544,47 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the SUMMARY. + + if (SummaryData.size() > 0){ + + DataLine += "SUMMARY"; + + if (SummaryDataAltRep.size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += SummaryDataAltRep; + DataLine += "\""; + + } + + if (SummaryDataLanguage.size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += SummaryDataLanguage; + + } + + if (SummaryDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += SummaryDataTokens; + + } + + DataLine += ":"; + DataLine += SummaryData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VTODO\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaltasksave.h b/source/tests/xestiacalendar_icaltasksave.h index c641dc4..f73e027 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -77,6 +77,8 @@ TEST(iCalendarSaveTask, SaveTaskTests){ " 0160131\n" "SEQUENCE;TEST=YAY:3\n" "STATUS;LANGUAGE=kw;FAVOURITE=BEANS;NOTLIKE=UNKNOWN:2.0;Success\n" + "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=kw;FAVOURITE=TOFU;NOTLIKE=NONE:A summar\n" + " y of the todo.\n" "END:VTODO\n" "END:VCALENDAR"; -- 2.39.5