From f791b31da6053df8294cca777f5eb4e7ec298c6c Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 6 Jun 2016 21:42:44 +0100 Subject: [PATCH] Added COMPLETED property for saving data from a CalendarTaskObject. Added the code and unit tests for the COMPLETED 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 5e64ecc..222e9a4 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -93,6 +93,34 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the COMPLETED value. + + if (CompletedData.size() > 0){ + + if (CompletedDataTokens.size() > 0){ + + DataLine += "COMPLETED;"; + DataLine += CompletedDataTokens; + + } else { + + DataLine += "COMPLETED"; + + } + + DataLine += ":"; + DataLine += CompletedData; + 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 8ea88e4..5e10bec 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -59,6 +59,7 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "UID;UNIQUEPARAM=CERTAINLY;OKAY=MAYBENOT:b3a16392-ad86-4061-be53-c215af2306e1\n" "DTSTAMP;OTHER=PARAM:20160131T104500Z\n" "CLASS;CHOCOLATE=NONE:PUBLIC\n" + "COMPLETED;LYING=NEVER:20160131T110100Z\n" "END:VTODO\n" "END:VCALENDAR"; -- 2.39.5