tvplanit: Fix display of repeated all-day events in the dayview.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8406 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-08-21 14:40:55 +00:00
parent 4d807b06a0
commit 659a480a92
4 changed files with 6 additions and 12 deletions

View File

@ -62,6 +62,7 @@ const
);
NO_DATE = 9999999;
FOREVER_DATE = 999999;
SecondsInDay = 86400; { Number of seconds in a day }
SecondsInHour = 3600; { Number of seconds in an hour }
SecondsInMinute = 60; { Number of seconds in a minute }
@ -297,8 +298,6 @@ const
LineEnding2 = LineEnding + LineEnding;
FOREVER_DATE = 999999;
implementation

View File

@ -1952,6 +1952,7 @@ begin
end;
end;
{ Determines whether the given event repeats on the specified date. }
function TVpSchedule.RepeatsOn(Event: TVpEvent; Day: TDateTime): Boolean;
var
EY, EM, ED: Word;
@ -1972,17 +1973,14 @@ begin
case Event.RepeatCode of
rtDaily:
if DayInRepeatRange then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
result := true;
rtWeekly:
if DayInRepeatRange then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
result := (Trunc(Day) - Trunc(Event.StartTime)) mod 7 = 0;
rtMonthlyByDay:
if DayInRepeatRange then
//if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
begin
// Get the year, month and day of the first event in the series
DecodeDate(Event.StartTime, EY, EM, ED);
@ -2003,7 +2001,6 @@ begin
rtMonthlyByDate:
if DayInRepeatRange then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
begin
// Get the year, month and day of the first event in the series
DecodeDate(Event.StartTime, EY, EM, ED);
@ -2015,7 +2012,6 @@ begin
rtYearlyByDay:
if DayInRepeatRange then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
begin
// Get the julian date of the first event in the series
EventJulian := GetJulianDate(Event.StartTime);
@ -2027,7 +2023,6 @@ begin
rtYearlyByDate:
if DayInRepeatRange then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
begin
// Get the year, month and day of the first event in the series.
DecodeDate(Event.StartTime, EY, EM, ED);
@ -2039,7 +2034,6 @@ begin
rtCustom:
if DayInRepeatRange and (Event.CustomInterval > 0) then
// if (Day < trunc(Event.RepeatRangeEnd) + 1) and (Day > trunc(Event.StartTime)) then
begin
// If the number of elapsed days between the "Day" parameter and
// the event start time is evenly divisible by the event's custom
@ -2049,7 +2043,6 @@ begin
end;
end;
end;
{=====}
function TVpSchedule.EventCountByDay(Value: TDateTime): Integer;
var
@ -2068,7 +2061,6 @@ begin
Inc(Result);
end;
end;
{=====}
procedure TVpSchedule.EventsByDate(Date: TDateTime; EventList: TList);
var

View File

@ -386,7 +386,8 @@ begin
// Cycle through the all day events and draw them appropriately
for I2 := 0 to pred(ADEventsList.Count) do begin
Event := ADEventsList[I2];
if DateInRange(RenderDate + I, Event.StartTime, Event.EndTime, true) then
if DateInRange(RenderDate + I, Event.StartTime, Event.EndTime, true) or
FDayView.DataStore.Resource.Schedule.RepeatsOn(Event, RenderDate + I) then
begin
// See if the event began before the start of the range
if (Event.StartTime < trunc(RenderDate)) then

View File

@ -469,6 +469,8 @@ begin
FRecurrenceFreq := L.Values['FREQ'];
FRecurrenceInterval := StrToIntDef(L.Values['INTERVAL'], 0);
FRecurrenceEndDate := iCalDateTime(L.Values['UNTIL'], isUTC);
if FRecurrenceEndDate = 0 then
FRecurrenceEndDate := FOREVER_DATE;
FRecurrenceCount := StrToIntDef(L.Values['COUNT'], 0);
FRecurrenceByXXX := '';
for j:=0 to L.Count-1 do begin