From 50a13e0f5ee4ac33c9565b97cd7f28547284c322 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 23:17:34 +0100 Subject: [PATCH] Added RESOURCES property for saving data from a CalendarTaskObject. Added the code and unit tests for the RESOURCES property. --- .../calendartask/CalendarTask-Save.cpp | 46 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 3 ++ 2 files changed, 49 insertions(+) diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 80b73a3..bcf0945 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -1094,6 +1094,52 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the RESOURCES value. + + if (ResourcesData.size() > 0){ + + for (int ResourcesDataSeek = 0; ResourcesDataSeek < ResourcesData.size(); + ResourcesDataSeek++){ + + DataLine += "RESOURCES"; + + if (ResourcesDataAltRep[ResourcesDataSeek].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += ResourcesDataAltRep[ResourcesDataSeek]; + DataLine += "\""; + + } + + if (ResourcesDataLanguage[ResourcesDataSeek].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += ResourcesDataLanguage[ResourcesDataSeek]; + + } + + if (ResourcesDataTokens[ResourcesDataSeek].size() > 0){ + + DataLine += ";"; + DataLine += ResourcesDataTokens[ResourcesDataSeek]; + + } + + DataLine += ":"; + DataLine += ResourcesData[ResourcesDataSeek]; + 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 1764ffb..b00b023 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -113,6 +113,9 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "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" + "RESOURCES:DMAC RECEIVER\n" + "RESOURCES;LANGUAGE=en:PAL-I TELEVISION SET\n" + "RESOURCES;ALTREP=\"null:nodata\";STATUS=BROKEN:PAL/SECAM VCR\n" "END:VTODO\n" "END:VCALENDAR"; -- 2.39.5