tvplanit: Fix end date of ical event import.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8384 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-12 10:34:40 +00:00
parent f21be3532a
commit 6c53ea5417
4 changed files with 44 additions and 17 deletions

View File

@ -24,6 +24,7 @@ type
FDefaultCategory: String;
FTimeFormat: String;
function GetEventText(AEvent: TVpICalEvent): String;
procedure SetCalendar(const AValue: TVpICalendar);
protected
@ -47,7 +48,7 @@ implementation
{$R *.lfm}
uses
VpSR;
VpSR, VpConst;
constructor TVPImportPreviewICalEventForm.Create(AOwner: TComponent);
begin
@ -89,6 +90,7 @@ function TVpImportPreviewICalEventForm.GetEventText(AEvent: TVpICalEvent): Strin
var
startTime, endTime: TDateTime;
sStartTime, sEndTime: String;
nDays: Integer;
advTime: Integer;
advTimeUnits: TVpAlarmAdvType;
dingPath: String;
@ -98,10 +100,11 @@ begin
startTime := AEvent.StartTime[false];
endTime := AEvent.EndTime[false];
sStartTime := FormatDateTime(FTimeFormat, startTime);
sEndTime := FormatDateTime(FTimeFormat, endTime);
if TVpEvent.IsAllDayEvent(startTime, endTime) then
sEndTime := FormatDateTime(FTimeFormat, endTime - OneSecond);
if AEvent.IsAllDayEvent then
begin
if trunc(startTime) = trunc(endTime) then
if endTime = NO_DATE then nDays := 1 else nDays := round(endTime - startTime);
if nDays in [0, 1] then
Result := Format('%s (%s)', [sStartTime, RSAllDay])
else
Result := Format('%s - %s (%s)', [sStartTime, sEndTime, RSAllDay]);
@ -119,8 +122,6 @@ begin
begin
cat := AEvent.Categories.Text;
if cat = '' then cat := '(none)';
// cat := FDatastore.FindBestEventCategory(AEvent.Categories);
// if cat = '' then cat := FDefaultCategory;
Result := Result + cat;
end;
@ -242,6 +243,7 @@ begin
for i := 0 to FCalendar.Count-1 do
if (FCalendar.Entry[i] is TVpICalEvent) then
FItems.Add(FCalendar.Entry[i]);
inherited;
if (FCalendar <> nil) and (FDataStore <> nil) and (Grid.Columns.Count = 2) then