tvplanit: Support UID fields in ical VEVENT and VTODO items.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8405 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-21 13:48:36 +00:00
parent c4a2f61db6
commit 4d807b06a0
2 changed files with 26 additions and 0 deletions

View File

@ -1352,8 +1352,14 @@ end;
function TVpEvent.CreateICalEvent(ACalendar: TVpICalendar): TVpICalEvent;
var
datastore: TVpCustomDatastore;
guid: TGUID;
begin
Result := TVpICalEvent.Create(ACalendar);
CreateGUID(guid);
Result.UID := GUIDToString(guid);
Result.UID := Lowercase(Copy(Result.UID, 2, Length(Result.UID)-2)); // Remove curly braces
Result.Summary := FDescription;
Result.Description := FNotes;
Result.Location := FLocation;
@ -3149,8 +3155,11 @@ begin
end;
function TVpTask.CreateICalTask(ACalendar: TVpICalendar): TVpICalToDo;
var
guid: TGUID;
begin
Result := TVpICalToDo.Create(ACalendar);
Result.Summary := FDescription;
Result.Comment := FDetails;
Result.CreatedTime[false] := FCreatedOn;
@ -3170,6 +3179,10 @@ begin
Result.Status := 'COMPLETED'
else
Result.Status := 'NEEDS-ACTION';
CreateGUID(guid);
Result.UID := GUIDToString(guid);
Result.UID := Lowercase(Copy(Result.UID, 2, Length(Result.UID)-2)); // Remove curly braces
end;

View File

@ -56,6 +56,7 @@ type
TVpICalEvent = class(TVpICalEntry)
private
FUID: String;
FSummary: String; // --> Description
FDescription: String; // --> Notes
FLocation: String;
@ -100,6 +101,7 @@ type
property RecurrenceCount: Integer read FRecurrenceCount write FRecurrenceCount;
property RecurrenceByXXX: String read FRecurrenceByXXX write FRecurrenceByXXX;
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
property UID: String read FUID write FUID;
end;
TVpICalToDo = class(TVpICalEntry)
@ -119,6 +121,7 @@ type
FPickedCategory: Integer;
FPriority: integer;
FStatus: String;
FUID: String;
function GetCategory(AIndex: integer): String;
function GetCategoryCount: Integer;
function GetCompletedTime(UTC: Boolean): TDateTime;
@ -146,6 +149,7 @@ type
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
property Priority: Integer read FPriority write FPriority; // 0=undefined, 1-highest, 9=lowest
property Status: String read FStatus write FStatus;
property UID: String read FUID write FUID;
end;
TVpICalendar = class
@ -429,6 +433,8 @@ begin
for i := 0 to FItems.Count-1 do begin
item := TVpICalItem(FItems[i]);
case item.Key of
'UID':
FUID := item.Value;
'SUMMARY':
FSummary := item.Value;
'DTSTART':
@ -550,6 +556,8 @@ var
begin
AList.Add('BEGIN:VEVENT');
if UID <> '' then
AList.Add('UID:' + UID);
if FSummary <> '' then
AList.Add('SUMMARY:' + FSummary);
if FDescription <> '' then
@ -651,6 +659,8 @@ begin
for i := 0 to FItems.Count-1 do begin
item := TVpICalItem(FItems[i]);
case item.Key of
'UID':
FUID := item.Value;
'SUMMARY':
FSummary := item.Value;
'COMMENT':
@ -752,6 +762,9 @@ var
begin
AList.Add('BEGIN:TODO');
if UID <> '' then
AList.Add('UID:' + UID);
if FCreatedTimeTZ <> '' then
key := 'DTSTAMP;TZID=' + FCreatedTimeTZ + ':'
else