From: Steve Brokenshire Date: Mon, 6 Jun 2016 22:15:07 +0000 (+0100) Subject: Added RELATED-TO property for saving data from a CalendarTaskObject. X-Git-Tag: release-0.02~147 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=d25eb5aec4d68ee6c560d6993513fb22e9a2993d;p=xestiacalendar%2F.git Added RELATED-TO property for saving data from a CalendarTaskObject. Added the code and unit tests for the RELATED-TO property. --- diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index a16f25f..80b73a3 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -1056,6 +1056,44 @@ void CalendarTaskObject::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:VTODO\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaltasksave.h b/source/tests/xestiacalendar_icaltasksave.h index 5ce4184..1764ffb 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -110,6 +110,9 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "REQUEST-STATUS;LANGUAGE=en:3.42;Really big irrecoverable error caused by the \n" " user\n" "REQUEST-STATUS;USER=MISSING:3.7;Invalid calendar user\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:VTODO\n" "END:VCALENDAR";