From: Steve Brokenshire Date: Sun, 5 Jun 2016 22:41:23 +0000 (+0100) Subject: Added CATEGORIES property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~184 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=63a6d3fc5d5af7b72b0b89522bce13aabfa82407;p=xestiacalendar%2F.git Added CATEGORIES property for saving data from a CalendarJournalObject. Added the code and unit tests for the CATEGORIES property. --- diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index 269f97b..f509dbd 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -580,6 +580,44 @@ void CalendarJournalObject::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:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index a0d00ae..60c3287 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -90,6 +90,10 @@ TEST(iCalendarSaveJournal, 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:VJOURNAL\n" "END:VCALENDAR";