You've already forked lazarus-ccr
tvplanit: Fix incorrect sorting of events in case of ini datastore.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4856 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -926,7 +926,7 @@ begin
|
|||||||
{ paint extra borders around the editor }
|
{ paint extra borders around the editor }
|
||||||
OKToDrawEditFrame := True;
|
OKToDrawEditFrame := True;
|
||||||
if Assigned(FDayView.ActiveEvent) then
|
if Assigned(FDayView.ActiveEvent) then
|
||||||
OKToDrawEditFrame := not (FDayView.ActiveEvent.AllDayEvent);
|
OKToDrawEditFrame := not FDayView.ActiveEvent.AllDayEvent;
|
||||||
|
|
||||||
with TVpDayViewOpener(FDayView) do
|
with TVpDayViewOpener(FDayView) do
|
||||||
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible and OKToDrawEditFrame then
|
if (dvInPlaceEditor <> nil) and dvInplaceEditor.Visible and OKToDrawEditFrame then
|
||||||
|
@@ -25,6 +25,7 @@ type
|
|||||||
|
|
||||||
procedure StrToContact(AString: String; AContact: TVpContact);
|
procedure StrToContact(AString: String; AContact: TVpContact);
|
||||||
procedure StrToEvent(AString: String; AEvent: TVpEvent);
|
procedure StrToEvent(AString: String; AEvent: TVpEvent);
|
||||||
|
procedure StrToEventTimes(AString: String; var AStartTime, AEndTime: TDateTime);
|
||||||
procedure StrToResource(AString: String; AResource: TVpResource);
|
procedure StrToResource(AString: String; AResource: TVpResource);
|
||||||
procedure StrToTask(AString: String; ATask: TVpTask);
|
procedure StrToTask(AString: String; ATask: TVpTask);
|
||||||
|
|
||||||
@@ -451,6 +452,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TVpIniDatastore.StrToEventTimes(AString: String;
|
||||||
|
var AStartTime, AEndTime: TDateTime);
|
||||||
|
var
|
||||||
|
L: TStrings;
|
||||||
|
begin
|
||||||
|
L := TStringList.Create;
|
||||||
|
try
|
||||||
|
Split(AString, L);
|
||||||
|
if L.Count < 2 then
|
||||||
|
IniError(RSIniFileStructure);
|
||||||
|
if L[0] = '' then
|
||||||
|
AStartTime := 0 else
|
||||||
|
AStartTime := StrToDateTime(L[0], FFormatSettings);
|
||||||
|
if L[1] = '' then
|
||||||
|
AEndTime := 0 else
|
||||||
|
AEndtime := StrToDateTime(L[1], FFormatSettings);
|
||||||
|
finally
|
||||||
|
L.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TVpIniDatastore.StrToEvent(AString: String; AEvent: TVpEvent);
|
procedure TVpIniDatastore.StrToEvent(AString: String; AEvent: TVpEvent);
|
||||||
var
|
var
|
||||||
L: TStrings;
|
L: TStrings;
|
||||||
@@ -573,6 +595,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
key: String;
|
key: String;
|
||||||
resID, id: Integer;
|
resID, id: Integer;
|
||||||
|
tStart, tEnd: TDateTime;
|
||||||
begin
|
begin
|
||||||
if FFileName = '' then
|
if FFileName = '' then
|
||||||
exit;
|
exit;
|
||||||
@@ -601,15 +624,15 @@ begin
|
|||||||
s := ini.ReadString(key, L[j], '');
|
s := ini.ReadString(key, L[j], '');
|
||||||
StrToContact(s, contact);
|
StrToContact(s, contact);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
key := Format('Events of resource %d', [resID]);
|
key := Format('Events of resource %d', [resID]);
|
||||||
L.Clear;
|
L.Clear;
|
||||||
ini.ReadSection(key, L);
|
ini.ReadSection(key, L);
|
||||||
for j:=0 to L.Count-1 do begin
|
for j:=0 to L.Count-1 do begin
|
||||||
id := StrToInt(L[j]);
|
id := StrToInt(L[j]);
|
||||||
event := res.Schedule.AddEvent(id, 0, 1);
|
|
||||||
s := ini.ReadString(key, L[j], '');
|
s := ini.ReadString(key, L[j], '');
|
||||||
|
StrToEventTimes(s, tStart, tEnd);
|
||||||
|
event := res.Schedule.AddEvent(id, tStart, tEnd);
|
||||||
StrToEvent(s, event);
|
StrToEvent(s, event);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@@ -622,6 +645,7 @@ begin
|
|||||||
s := ini.ReadString(key, L[j], '');
|
s := ini.ReadString(key, L[j], '');
|
||||||
StrToTask(s, task);
|
StrToTask(s, task);
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
ini.Free;
|
ini.Free;
|
||||||
|
Reference in New Issue
Block a user