From: Steve Brokenshire Date: Sat, 4 Jun 2016 19:37:29 +0000 (+0100) Subject: Added CONTACT property for saving data from a CalendarEventObject. X-Git-Tag: release-0.02~231 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=31e8fea4021ed5f03b1266ff87d188c463619b90;p=xestiacalendar%2F.git Added CONTACT property for saving data from a CalendarEventObject. Added the code and unit tests for the CONTACT property. --- diff --git a/source/objects/calendarevent/CalendarEvent-Save.cpp b/source/objects/calendarevent/CalendarEvent-Save.cpp index 940c557..5290574 100644 --- a/source/objects/calendarevent/CalendarEvent-Save.cpp +++ b/source/objects/calendarevent/CalendarEvent-Save.cpp @@ -897,6 +897,52 @@ void CalendarEventObject::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:VEVENT\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/xestiacalendar_icaleventsave.h index 06dd2a4..2824a5f 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/xestiacalendar_icaleventsave.h @@ -113,6 +113,9 @@ TEST(iCalendarSaveEvent, 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:VEVENT\n" "END:VCARD";