From: Steve Brokenshire Date: Mon, 6 Jun 2016 22:02:44 +0000 (+0100) Subject: Added ATTACH property for saving data from a CalendarTaskObject. X-Git-Tag: release-0.02~154 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=43963b73529c69a9b0b2cb423cd579fb52c50414;p=xestiacalendar%2F.git Added ATTACH property for saving data from a CalendarTaskObject. Added the code and unit tests for the ATTACH property. --- diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index c4e6053..0126969 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -677,6 +677,58 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the ATTACH values. + + if (AttachList.size() > 0){ + + for (int AttachListSeek = 0; AttachListSeek < AttachList.size(); + AttachListSeek++){ + + DataLine += "ATTACH"; + + if (AttachListFormatType[AttachListSeek].size() > 0){ + + DataLine += ";FMTTYPE="; + DataLine += AttachListFormatType[AttachListSeek]; + + } + + if (AttachListValue[AttachListSeek].size() > 0){ + + DataLine += ";VALUE="; + DataLine += AttachListValue[AttachListSeek]; + + } + + if (AttachListEncoding[AttachListSeek].size() > 0){ + + DataLine += ";ENCODING="; + DataLine += AttachListEncoding[AttachListSeek]; + + } + + if (AttachListTokens[AttachListSeek].size() > 0){ + + DataLine += ";"; + DataLine += AttachListTokens[AttachListSeek]; + + } + + DataLine += ":"; + DataLine += AttachList[AttachListSeek]; + 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 b661b75..d437739 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -82,6 +82,11 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "URL;EXTERNAL=YES:http://www.example.com/\n" "RRULE;TEST=DATA:FREQ=DAILY;COUNT=10\n" "DUE;TZID=Europe/Truro;VALUE=DATE-TIME;TEST=YES:20160131T150000Z\n" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/\n" + "ATTACH;FMTTYPE=application/internet-shortcut:http://www.example.com/page2.htm\n" + " l\n" + "ATTACH;FMTTYPE=text/plain;VALUE=BINARY;ENCODING=BASE64;STUPID=EXAMPLE:VGhpcyB\n" + " pcyBhbiBleGFtcGxlIGZpbGU=\n" "END:VTODO\n" "END:VCALENDAR";