diff --git a/components/tvplanit/source/vpdata.pas b/components/tvplanit/source/vpdata.pas index 0f307a5b1..a1c626539 100644 --- a/components/tvplanit/source/vpdata.pas +++ b/components/tvplanit/source/vpdata.pas @@ -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; diff --git a/components/tvplanit/source/vpical.pas b/components/tvplanit/source/vpical.pas index ed8beaea8..03ae3ae04 100644 --- a/components/tvplanit/source/vpical.pas +++ b/components/tvplanit/source/vpical.pas @@ -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