From: Steve Brokenshire Date: Sat, 4 Jun 2016 17:11:19 +0000 (+0100) Subject: Added CATEGORIES property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~233 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=57298ee87c00017037d019573764dfd06d97b41f;p=xestiacalendar%2F.git Added CATEGORIES property for saving data from a CalendarEventObject. Added the code and unit tests for the CATEGORIES property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index ce47518..a2139fc 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -813,6 +813,44 @@ void CalendarEventObject::SaveObjectData(string *SaveData){ } + // Process the CATEGORIES value. + + if (CategoriesList.size() > 0){ + + for (int CategoriesListSeek = 0; CategoriesListSeek < CategoriesList.size(); + CategoriesListSeek++){ + + DataLine += "CATEGORIES"; + + if (CategoriesListLanguage[CategoriesListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += CategoriesListLanguage[CategoriesListSeek]; + + } + + if (CategoriesListTokens[CategoriesListSeek].size() > 0){ + + DataLine += ";"; + DataLine += CategoriesListTokens[CategoriesListSeek]; + + } + + DataLine += ":"; + DataLine += CategoriesList[CategoriesListSeek]; + DataLine += "\n"; + + DataLineProcessed = OutputText(&DataLine); + + *SaveData += DataLineProcessed; + + DataLine.clear(); + DataLineProcessed.clear(); + + } + + } + *SaveData += "END:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 761819e..2858f3f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -106,6 +106,10 @@ TEST(iCalendarSaveEvent, SaveEventTests){ "ATTENDEE;DIR=\"null:nodata\";SENT-BY=\"mailto:sent.by@example.com\";CN=\"Attendee \n" " The Third\";CUTYPE=INDIVIDUAL;PARTSTAT=ACCEPTED;LANGUAGE=kw;EXAMPLE=DATA:Atte\n" " ndee Three\n" + "CATEGORIES:CATEGORY ONE, CATEGORY TWO\n" + "CATEGORIES;LANGUAGE=en:CATEGORY THREE, CATEGORY FOUR\n" + "CATEGORIES;LANGUAGE=en-GB;SAMPLE=TOKEN:CATEGORY FIVE, CATEGORY SIX, CATEGORY \n" + " SEVEN\n" "END:VEVENT\n" "END:VCARD";