From: Steve Brokenshire Date: Sun, 5 Jun 2016 22:45:06 +0000 (+0100) Subject: Added COMMENT property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~183 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=dad9f41a985c5e2658627fa1636f8562a6044d07 Added COMMENT property for saving data from a CalendarJournalObject. Added the code and unit tests for the COMMENT property. --- diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index f509dbd..4bd9fea 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -618,6 +618,52 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the COMMENT value. + + if (CommentList.size() > 0){ + + for (int CommentListSeek = 0; CommentListSeek < CommentList.size(); + CommentListSeek++){ + + DataLine += "COMMENT"; + + if (CommentListAltRep[CommentListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += CommentListAltRep[CommentListSeek]; + DataLine += "\""; + + } + + if (CommentListLanguage[CommentListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CommentListLanguage[CommentListSeek]; + + } + + if (CommentListTokens[CommentListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CommentListTokens[CommentListSeek]; + + } + + DataLine += ":"; + DataLine += CommentList[CommentListSeek]; + 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 60c3287..a075a41 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -94,6 +94,9 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "CATEGORIES;LANGUAGE=en:CATEGORY THREE, CATEGORY FOUR\n" "CATEGORIES;LANGUAGE=en-GB;SAMPLE=TOKEN:CATEGORY FIVE, CATEGORY SIX, CATEGORY \n" " SEVEN\n" + "COMMENT:This is the first comment.\n" + "COMMENT;ALTREP=\"null:nodata\";LANGUAGE=en:This is the second comment.\n" + "COMMENT;ZEBRAS=YES:This is the third comment.\n" "END:VJOURNAL\n" "END:VCALENDAR";