From 19628c5ce30314bbe8ddb5d8a51432b397f086ac Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sun, 5 Jun 2016 23:36:07 +0100 Subject: [PATCH] Added ATTACH property for saving data from a CalendarJournalObject. Added the code and unit tests for the ATTACH property. --- .../calendarjournal/CalendarJournal-Save.cpp | 53 +++++++++++++++++++ source/tests/xestiacalendar_icaljournalsave.h | 5 ++ 2 files changed, 58 insertions(+) diff --git a/source/objects/calendarjournal/CalendarJournal-Save.cpp b/source/objects/calendarjournal/CalendarJournal-Save.cpp index a5704e1..39789b4 100644 --- a/source/objects/calendarjournal/CalendarJournal-Save.cpp +++ b/source/objects/calendarjournal/CalendarJournal-Save.cpp @@ -413,6 +413,59 @@ void CalendarJournalObject::SaveObjectData(string *SaveData){ DataLineProcessed.clear(); } + + // 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:VJOURNAL\n"; } \ No newline at end of file diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/xestiacalendar_icaljournalsave.h index 18ff886..69a7986 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/xestiacalendar_icaljournalsave.h @@ -79,6 +79,11 @@ TEST(iCalendarSaveJournal, SaveEventTests){ "STATUS;LANGUAGE=kw;FAVOURITE=RICHTEA;NOTLIKE=UNKNOWN:2.0;Success\n" "URL;EXTERNAL=YES:http://www.example.com/\n" "RRULE;TEST=DATA:FREQ=DAILY;COUNT=10\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:VJOURNAL\n" "END:VCALENDAR"; -- 2.39.5