IDE: package links: store LastUsed with seconds to know which one was reently used aftwr a restart

git-svn-id: trunk@47643 -
This commit is contained in:
mattias 2015-02-07 12:33:27 +00:00
parent 5772aff233
commit b00992bb32

View File

@ -44,7 +44,9 @@ uses
PackageIntf, IDEProcs, EnvironmentOpts, PackageDefs, LazConf;
const
PkgLinksFileVersion = 2;
PkgLinksFileVersion = 3;
{ 3: changed "LastUsed" from day to seconds, so that last used lpk is loaded
after IDE restart }
type
@ -549,6 +551,7 @@ var
NewPkgLink: TPackageLink;
ItemPath: String;
FileVersion: LongInt;
LastUsedFormat: String;
begin
if fUpdateLock>0 then begin
Include(FStates,plsUserLinksNeedUpdate);
@ -576,6 +579,10 @@ begin
Path:='UserPkgLinks/';
FileVersion:=XMLConfig.GetValue(Path+'Version',0);
LinkCount:=XMLConfig.GetValue(Path+'Count',0);
if FileVersion<3 then
LastUsedFormat:=DateAsCfgStrFormat
else
LastUsedFormat:=DateTimeAsCfgStrFormat;
for i:=1 to LinkCount do begin
ItemPath:=Path+'Item'+IntToStr(i)+'/';
NewPkgLink:=TPackageLink.Create;
@ -607,7 +614,7 @@ begin
NewPkgLink.NotFoundCount:=
XMLConfig.GetValue(ItemPath+'NotFoundCount/Value',0);
if not CfgStrToDate(XMLConfig.GetValue(ItemPath+'LastUsed/Value',''),
NewPkgLink.FLastUsed)
NewPkgLink.FLastUsed,LastUsedFormat)
then
NewPkgLink.FLastUsed := 0;
@ -738,7 +745,7 @@ begin
XMLConfig.SetDeleteValue(ItemPath+'NotFoundCount/Value',
CurPkgLink.NotFoundCount,0);
XMLConfig.SetDeleteValue(ItemPath+'LastUsed/Value',
DateToCfgStr(CurPkgLink.LastUsed),'');
DateToCfgStr(CurPkgLink.LastUsed,DateTimeAsCfgStrFormat),'');
ANode:=FUserLinksSortID.FindSuccessor(ANode);
end;