From a4929f789a18519945192408d8141ba9fc6a1e33 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:13:47 +0100 Subject: [PATCH] Added DTSTART property for saving data from a CalendarJournalObject. Added the code and unit tests for the DTSTART property. --- .../calendarjournal/CalendarJournal-Save.cpp | 40 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 2 + 2 files changed, 42 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index e9651e8..a2124e0 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -132,6 +132,46 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the DTSTART. + + if (DateTimeStartData.size() > 0){ + + DataLine += "DTSTART"; + + if (DateTimeStartDataValue.size() > 0){ + + DataLine += ";VALUE="; + DataLine += DateTimeStartDataValue; + + } + + if (DateTimeStartDataTimeZoneID.size() > 0){ + + DataLine += ";TZID="; + DataLine += DateTimeStartDataTimeZoneID; + + } + + if (DateTimeStartDataTokens.size() > 0){ + + DataLine += ";"; + DataLine += DateTimeStartDataTokens; + + } + + DataLine += ":"; + DataLine += DateTimeStartData; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + *SaveData += "END:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index 69fcb2e..19ed01b 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -68,6 +68,8 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "SUMMARY;ALTREP=\"null:nodata\";LANGUAGE=kw;FAVOURITE=TOFU;NOTLIKE=NONE:A summar\n" " y of the journal entry.\n" "CLASS;CHOCOLATE=BAR:PUBLIC\n" + "DTSTART;VALUE=DATE-TIME;TZID=Europe/Truro;PARAMONE=YES;PARAMTWO=NO:20160131T1\n" + " 43500Z\n" "END:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5