From a3ba95fd151a53824e0f6c4c03a57a6e79191bc6 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 22:31:55 +0100 Subject: [PATCH] Added PERCENT-COMPLETE property for saving data from a CalendarTaskObject. Added the code and unit tests for the PERCENT-COMPLETE property. --- .../calendartask/CalendarTask-Save.cpp | 28 +++++++++++++++++++ source/tests/xestiacalendar_icaltasksave.h | 1 + 2 files changed, 29 insertions(+) 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"; -- 2.39.5