From: Steve Brokenshire Date: Sun, 5 Jun 2016 22:53:21 +0000 (+0100) Subject: Added DESCRIPTION property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~181 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=2a9d429d61c6cf4599b9d52e088cde3e30838e02 Added DESCRIPTION property for saving data from a CalendarJournalObject. Added the code and unit tests for the DESCRIPTION property. --- diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index e866df6..2827bb5 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -710,6 +710,52 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the DESCRIPTION values. + + if (DescriptionList.size() > 0){ + + for (int DescriptionListSeek = 0; DescriptionListSeek < DescriptionList.size() > 0; + DescriptionListSeek++){ + + DataLine += "DESCRIPTION"; + + if (DescriptionListAltRep[DescriptionListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += DescriptionListAltRep[DescriptionListSeek]; + DataLine += "\""; + + } + + if (DescriptionListLanguage[DescriptionListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += DescriptionListLanguage[DescriptionListSeek]; + + } + + if (DescriptionListTokens[DescriptionListSeek].size() > 0){ + + DataLine += ";"; + DataLine += DescriptionListTokens[DescriptionListSeek]; + + } + + DataLine += ":"; + DataLine += DescriptionList[DescriptionListSeek]; + 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 0ddb69d..fb69016 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -100,6 +100,10 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "CONTACT:First Contact\n" "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB:Second Contact\n" "CONTACT;ZEBRAS=NO:Third Contact\n" + "DESCRIPTION:First Journal Entry Description\n" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=en-GB:This is the second journal de\n" + " scription.\n" + "DESCRIPTION;ZEBRAS=NO:This is the third journal description.\n" "END:VJOURNAL\n" "END:VCALENDAR";