From: Steve Brokenshire Date: Mon, 6 Jun 2016 20:51:40 +0000 (+0100) Subject: Added DESCRIPTION property for saving data from a CalendarTaskObject. X-Git-Tag: release-0.02~169 X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=commitdiff_plain;h=172573eddc4add6dffa180e5412b01c1fa158c74 Added DESCRIPTION property for saving data from a CalendarTaskObject. Added the code and unit tests for the DESCRIPTION property. --- diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 80d02fc..7a1fbba 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -149,6 +149,48 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the DESCRIPTION values. Write out the + // first DESCRPITION only as per RFC5545 specifcation. + + if (DescriptionList.size() > 0){ + + DataLine += "DESCRIPTION"; + + if (DescriptionListAltRep[0].size() > 0){ + + DataLine += ";ALTREP=\""; + DataLine += DescriptionListAltRep[0]; + DataLine += "\""; + + } + + if (DescriptionListLanguage[0].size() > 0){ + + DataLine += ";LANGUAGE="; + DataLine += DescriptionListLanguage[0]; + + } + + if (DescriptionListTokens[0].size() > 0){ + + DataLine += ";"; + DataLine += DescriptionListTokens[0]; + + } + + DataLine += ":"; + DataLine += DescriptionList[0]; + 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 af26f79..9a39ea3 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -61,6 +61,8 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "CLASS;CHOCOLATE=NONE:PUBLIC\n" "COMPLETED;LYING=NEVER:20160131T110100Z\n" "CREATED;CARAMEL=PLEASE:20160131T080000Z\n" + "DESCRIPTION;ALTREP=\"null:nodata\";LANGUAGE=kw;EXAMPLE=TOKEN;MOREDATA=YES:This \n" + " is a description of the todo.\n" "END:VTODO\n" "END:VCALENDAR";