From: Steve Brokenshire Date: Sun, 5 Jun 2016 22:46:33 +0000 (+0100) Subject: Added CONTACT property for saving data from a CalendarJournalObject. X-Git-Tag: release-0.02~182 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=ed76ecd751f191a5daac5bfbb87c9834a63337aa Added CONTACT property for saving data from a CalendarJournalObject. Added the code and unit tests for the CONTACT property. --- diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index 4bd9fea..e866df6 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -664,6 +664,52 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ } + // Process the CONTACT value. + + if (ContactList.size() > 0){ + + for (int ContactListSeek = 0; ContactListSeek < ContactList.size(); + ContactListSeek++){ + + DataLine += "CONTACT"; + + if (ContactListAltRep[ContactListSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += ContactListAltRep[ContactListSeek]; + DataLine += "\""; + + } + + if (ContactListLanguage[ContactListSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += ContactListLanguage[ContactListSeek]; + + } + + if (ContactListTokens[ContactListSeek].size() > 0){ + + DataLine += ";"; + DataLine += ContactListTokens[ContactListSeek]; + + } + + DataLine += ":"; + DataLine += ContactList[ContactListSeek]; + 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 a075a41..0ddb69d 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -97,6 +97,9 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "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" + "CONTACT:First Contact\n" + "CONTACT;ALTREP=\"null:nodata\";LANGUAGE=en-GB:Second Contact\n" + "CONTACT;ZEBRAS=NO:Third Contact\n" "END:VJOURNAL\n" "END:VCALENDAR";