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