From 07760ba35c0ee6e949e3e21ae4e67df2817e44ea Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 23:08:15 +0100 Subject: [PATCH] Added COMMENT property for saving data from a CalendarTaskObject. Added the code and unit tests for the COMMENT property. --- .../calendartask/CalendarTask-Save.cpp | 46 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 3 ++ 2 files changed, 49 insertions(+) diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 2b34da7..a2ce377 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -881,6 +881,52 @@ void CalendarTaskObject::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:VTODO\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaltasksave.h b/source/tests/xestiacalendar_icaltasksave.h index fc4d311..fd65771 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -97,6 +97,9 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "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:VTODO\n" "END:VCALENDAR"; -- 2.39.2