From: Steve Brokenshire Date: Mon, 6 Jun 2016 21:32:08 +0000 (+0100) Subject: Added PRIORITY property for saving data from a CalendarTaskObject. X-Git-Tag: release-0.02~162 X-Git-Url: http://Server1/repobrowser/?a=commitdiff_plain;h=847f9d9759f9d5e540c4de14a507fa27252bf697;p=xestiacalendar%2F.git Added PRIORITY property for saving data from a CalendarTaskObject. Added the code and unit tests for the PRIORITY property. --- diff --git a/source/objects/calendartask/CalendarTask-Save.cpp b/source/objects/calendartask/CalendarTask-Save.cpp index c3b4f17..6c04b56 100644 --- a/source/objects/calendartask/CalendarTask-Save.cpp +++ b/source/objects/calendartask/CalendarTask-Save.cpp @@ -412,6 +412,32 @@ void CalendarTaskObject::SaveObjectData(string *SaveData){ } + // Process the PRIORITY value. + + if (PriorityData > -1 && PriorityData < 10){ + + DataLine += "PRIORITY"; + + if (PriorityTokens.size() > 0){ + + DataLine += ";"; + DataLine += PriorityTokens; + + } + + DataLine += ":"; + DataLine += to_string(PriorityData); + 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 45a8cda..f887119 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/xestiacalendar_icaltasksave.h @@ -72,6 +72,7 @@ TEST(iCalendarSaveTask, SaveTaskTests){ "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" + "PRIORITY;STATUS=DEFAULT:5\n" "END:VTODO\n" "END:VCALENDAR";