You've already forked lazarus-ccr
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:
@@ -1352,8 +1352,14 @@ end;
|
|||||||
function TVpEvent.CreateICalEvent(ACalendar: TVpICalendar): TVpICalEvent;
|
function TVpEvent.CreateICalEvent(ACalendar: TVpICalendar): TVpICalEvent;
|
||||||
var
|
var
|
||||||
datastore: TVpCustomDatastore;
|
datastore: TVpCustomDatastore;
|
||||||
|
guid: TGUID;
|
||||||
begin
|
begin
|
||||||
Result := TVpICalEvent.Create(ACalendar);
|
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.Summary := FDescription;
|
||||||
Result.Description := FNotes;
|
Result.Description := FNotes;
|
||||||
Result.Location := FLocation;
|
Result.Location := FLocation;
|
||||||
@@ -3149,8 +3155,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TVpTask.CreateICalTask(ACalendar: TVpICalendar): TVpICalToDo;
|
function TVpTask.CreateICalTask(ACalendar: TVpICalendar): TVpICalToDo;
|
||||||
|
var
|
||||||
|
guid: TGUID;
|
||||||
begin
|
begin
|
||||||
Result := TVpICalToDo.Create(ACalendar);
|
Result := TVpICalToDo.Create(ACalendar);
|
||||||
|
|
||||||
Result.Summary := FDescription;
|
Result.Summary := FDescription;
|
||||||
Result.Comment := FDetails;
|
Result.Comment := FDetails;
|
||||||
Result.CreatedTime[false] := FCreatedOn;
|
Result.CreatedTime[false] := FCreatedOn;
|
||||||
@@ -3170,6 +3179,10 @@ begin
|
|||||||
Result.Status := 'COMPLETED'
|
Result.Status := 'COMPLETED'
|
||||||
else
|
else
|
||||||
Result.Status := 'NEEDS-ACTION';
|
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;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@@ -56,6 +56,7 @@ type
|
|||||||
|
|
||||||
TVpICalEvent = class(TVpICalEntry)
|
TVpICalEvent = class(TVpICalEntry)
|
||||||
private
|
private
|
||||||
|
FUID: String;
|
||||||
FSummary: String; // --> Description
|
FSummary: String; // --> Description
|
||||||
FDescription: String; // --> Notes
|
FDescription: String; // --> Notes
|
||||||
FLocation: String;
|
FLocation: String;
|
||||||
@@ -100,6 +101,7 @@ type
|
|||||||
property RecurrenceCount: Integer read FRecurrenceCount write FRecurrenceCount;
|
property RecurrenceCount: Integer read FRecurrenceCount write FRecurrenceCount;
|
||||||
property RecurrenceByXXX: String read FRecurrenceByXXX write FRecurrenceByXXX;
|
property RecurrenceByXXX: String read FRecurrenceByXXX write FRecurrenceByXXX;
|
||||||
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
|
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
|
||||||
|
property UID: String read FUID write FUID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TVpICalToDo = class(TVpICalEntry)
|
TVpICalToDo = class(TVpICalEntry)
|
||||||
@@ -119,6 +121,7 @@ type
|
|||||||
FPickedCategory: Integer;
|
FPickedCategory: Integer;
|
||||||
FPriority: integer;
|
FPriority: integer;
|
||||||
FStatus: String;
|
FStatus: String;
|
||||||
|
FUID: String;
|
||||||
function GetCategory(AIndex: integer): String;
|
function GetCategory(AIndex: integer): String;
|
||||||
function GetCategoryCount: Integer;
|
function GetCategoryCount: Integer;
|
||||||
function GetCompletedTime(UTC: Boolean): TDateTime;
|
function GetCompletedTime(UTC: Boolean): TDateTime;
|
||||||
@@ -146,6 +149,7 @@ type
|
|||||||
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
|
property PickedCategory: Integer read FPickedCategory write FPickedCategory;
|
||||||
property Priority: Integer read FPriority write FPriority; // 0=undefined, 1-highest, 9=lowest
|
property Priority: Integer read FPriority write FPriority; // 0=undefined, 1-highest, 9=lowest
|
||||||
property Status: String read FStatus write FStatus;
|
property Status: String read FStatus write FStatus;
|
||||||
|
property UID: String read FUID write FUID;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TVpICalendar = class
|
TVpICalendar = class
|
||||||
@@ -429,6 +433,8 @@ begin
|
|||||||
for i := 0 to FItems.Count-1 do begin
|
for i := 0 to FItems.Count-1 do begin
|
||||||
item := TVpICalItem(FItems[i]);
|
item := TVpICalItem(FItems[i]);
|
||||||
case item.Key of
|
case item.Key of
|
||||||
|
'UID':
|
||||||
|
FUID := item.Value;
|
||||||
'SUMMARY':
|
'SUMMARY':
|
||||||
FSummary := item.Value;
|
FSummary := item.Value;
|
||||||
'DTSTART':
|
'DTSTART':
|
||||||
@@ -550,6 +556,8 @@ var
|
|||||||
begin
|
begin
|
||||||
AList.Add('BEGIN:VEVENT');
|
AList.Add('BEGIN:VEVENT');
|
||||||
|
|
||||||
|
if UID <> '' then
|
||||||
|
AList.Add('UID:' + UID);
|
||||||
if FSummary <> '' then
|
if FSummary <> '' then
|
||||||
AList.Add('SUMMARY:' + FSummary);
|
AList.Add('SUMMARY:' + FSummary);
|
||||||
if FDescription <> '' then
|
if FDescription <> '' then
|
||||||
@@ -651,6 +659,8 @@ begin
|
|||||||
for i := 0 to FItems.Count-1 do begin
|
for i := 0 to FItems.Count-1 do begin
|
||||||
item := TVpICalItem(FItems[i]);
|
item := TVpICalItem(FItems[i]);
|
||||||
case item.Key of
|
case item.Key of
|
||||||
|
'UID':
|
||||||
|
FUID := item.Value;
|
||||||
'SUMMARY':
|
'SUMMARY':
|
||||||
FSummary := item.Value;
|
FSummary := item.Value;
|
||||||
'COMMENT':
|
'COMMENT':
|
||||||
@@ -752,6 +762,9 @@ var
|
|||||||
begin
|
begin
|
||||||
AList.Add('BEGIN:TODO');
|
AList.Add('BEGIN:TODO');
|
||||||
|
|
||||||
|
if UID <> '' then
|
||||||
|
AList.Add('UID:' + UID);
|
||||||
|
|
||||||
if FCreatedTimeTZ <> '' then
|
if FCreatedTimeTZ <> '' then
|
||||||
key := 'DTSTAMP;TZID=' + FCreatedTimeTZ + ':'
|
key := 'DTSTAMP;TZID=' + FCreatedTimeTZ + ':'
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user