From: Steve Brokenshire Date: Sun, 5 Jun 2016 22:57:22 +0000 (+0100) Subject: Added RELATED-TO property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~179 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=df279c38958891a168b8e9245d5818d47dc6c397;p=xestiacalendar%2F.git Added RELATED-TO property for saving data from a CalendarJournalObject. Added the code and unit tests for the RELATED-TO property. --- diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index 0d1a172..05025de 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -801,6 +801,44 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the RELATED-TO value. + + if (RelatedToData.size() > 0){ + + for (int RequestToDataSeek = 0; RequestToDataSeek < RelatedToData.size(); + RequestToDataSeek++){ + + DataLine += "RELATED-TO"; + + if (RelatedToDataRelationType[RequestToDataSeek].size() > 0){ + + DataLine += ";RELTYPE="; + DataLine += RelatedToDataRelationType[RequestToDataSeek]; + + } + + if (RelatedToDataTokens[RequestToDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += RelatedToDataTokens[RequestToDataSeek]; + + } + + DataLine += ":"; + DataLine += RelatedToData[RequestToDataSeek]; + 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 8ea3eb0..ccf7008 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -107,6 +107,9 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "EXDATE:20160125T120000Z\n" "EXDATE;TZID=Europe/Truro;VALUE=DATE-TIME:20160125T130000Z\n" "EXDATE;ZOOP=ZIPPO:20160125T133000Z\n" + "RELATED-TO:person.1@example.com\n" + "RELATED-TO;RELTYPE=PARENT:person.2@example.com\n" + "RELATED-TO;SCHOOL=MEETING:person.3@example.com\n" "END:VJOURNAL\n" "END:VCALENDAR";