From: Steve Brokenshire Date: Mon, 6 Jun 2016 21:31:55 +0000 (+0100) Subject: Added PERCENT-COMPLETE property for saving data from a CalendarTaskObject. X-Git-Tag: release-0.02~163 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=a3ba95fd151a53824e0f6c4c03a57a6e79191bc6;p=xestiacalendar%2F.git Added PERCENT-COMPLETE property for saving data from a CalendarTaskObject. Added the code and unit tests for the PERCENT-COMPLETE property. --- diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index 9498b85..c3b4f17 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -384,6 +384,34 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the PERCENT-COMPLETE value. + + if (PercentCompleteData.size() > 0){ + + if (PercentCompleteTokens.size() > 0){ + + DataLine += "PERCENT-COMPLETE;"; + DataLine += PercentCompleteTokens; + + } else { + + DataLine += "PERCENT-COMPLETE"; + + } + + DataLine += ":"; + DataLine += PercentCompleteData; + 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 76c359e..45a8cda 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -71,6 +71,7 @@ TEST(iCalendarSaveTask, SaveTaskTests){ " o\n" "ORGANIZER;CN=ExampleOrganiser;DIR=\"null:nodata\";SENT-BY=\"mailto:organiser.nor\n" " eply@example.com\";LANGUAGE=kw;HAPPY=WEEKS:mailto:organiser@example.com\n" + "PERCENT-COMPLETE;DEEP=THOUGHT:42\n" "END:VTODO\n" "END:VCALENDAR";