mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
UPD: Move DirectoryHotList to localconfig.xml (#2796)
This commit is contained in:
parent
31ea6a2032
commit
092b9c716b
2 changed files with 57 additions and 7 deletions
|
|
@ -16,6 +16,7 @@ var
|
|||
//Global Configuration Filename
|
||||
const
|
||||
gcfExtensionAssociation : string = 'extassoc.xml';
|
||||
gcfLocalConfig : string = 'localconfig.xml';
|
||||
|
||||
procedure LoadPaths;
|
||||
procedure UpdateEnvironmentVariable;
|
||||
|
|
|
|||
|
|
@ -231,7 +231,8 @@ const
|
|||
// 13 - Replace Configuration/UseConfigInProgramDir by doublecmd.inf
|
||||
// 14 - Move some colors to colors.json
|
||||
// 15 - Move custom columns colors to colors.json
|
||||
ConfigVersion = 15;
|
||||
// 16 - Move DirectoryHotList to localconfig.xml
|
||||
ConfigVersion = 16;
|
||||
|
||||
COLORS_JSON = 'colors.json';
|
||||
|
||||
|
|
@ -997,6 +998,33 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
function LoadLocalConfig(var {%H-}ErrorMessage: String): Boolean;
|
||||
var
|
||||
Root: TXmlNode;
|
||||
LocalConfig: TXmlConfig;
|
||||
LocalConfigFileName: String;
|
||||
begin
|
||||
LocalConfigFileName := gpCfgDir + gcfLocalConfig;
|
||||
|
||||
if mbFileExists(LocalConfigFileName) then
|
||||
begin
|
||||
LocalConfig:= TXmlConfig.Create(LocalConfigFileName);
|
||||
try
|
||||
LocalConfig.Load;
|
||||
Root:= LocalConfig.RootNode;
|
||||
if Assigned(LocalConfig.FindNode(Root, cSectionOfHotDir)) then
|
||||
begin
|
||||
gDirectoryHotlist.LoadFromXml(LocalConfig, Root);
|
||||
Exit(True);
|
||||
end;
|
||||
finally
|
||||
LocalConfig.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
Result:= True;
|
||||
end;
|
||||
|
||||
procedure SaveHistoryConfig;
|
||||
var
|
||||
Root: TXmlNode;
|
||||
|
|
@ -1050,6 +1078,23 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure SaveLocalConfig;
|
||||
var
|
||||
Root: TXmlNode;
|
||||
LocalConfig: TXmlConfig;
|
||||
LocalConfigFileName: String;
|
||||
begin
|
||||
LocalConfigFileName := gpCfgDir + gcfLocalConfig;
|
||||
LocalConfig:= TXmlConfig.Create(LocalConfigFileName);
|
||||
try
|
||||
Root:= LocalConfig.RootNode;
|
||||
gDirectoryHotlist.SaveToXml(LocalConfig, Root, True);
|
||||
LocalConfig.Save;
|
||||
finally
|
||||
LocalConfig.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetValidDateTimeFormat(const aFormat, ADefaultFormat: string): string;
|
||||
begin
|
||||
try
|
||||
|
|
@ -2488,6 +2533,9 @@ begin
|
|||
|
||||
CopySettingsFiles;
|
||||
|
||||
{ Local machine-specific configuration }
|
||||
LoadConfigCheckErrors(@LoadLocalConfig, gpCfgDir + gcfLocalConfig, ErrorMessage);
|
||||
|
||||
{ Internal associations }
|
||||
// "LoadExtsConfig" checks itself if file is present or not
|
||||
LoadConfigCheckErrors(@LoadExtsConfig, gpCfgDir + gcfExtensionAssociation, ErrorMessage);
|
||||
|
|
@ -2565,6 +2613,7 @@ begin
|
|||
begin
|
||||
SaveWithCheck(@SaveEarlyConfig, 'early config', ErrMsg);
|
||||
SaveWithCheck(@SaveCfgIgnoreList, 'ignore list', ErrMsg);
|
||||
SaveWithCheck(@SaveLocalConfig, 'local configuration', ErrMsg);
|
||||
SaveWithCheck(@SaveCfgMainConfig, 'main configuration', ErrMsg);
|
||||
SaveWithCheck(@SaveHighlightersConfig, 'highlighters config', ErrMsg);
|
||||
SaveWithCheck(@SaveHistoryConfig, 'various history', ErrMsg);
|
||||
|
|
@ -2670,6 +2719,12 @@ begin
|
|||
DeleteNode(Root, 'Configuration/UseConfigInProgramDir');
|
||||
end;
|
||||
|
||||
if (LoadedConfigVersion < 16) then
|
||||
begin
|
||||
gDirectoryHotlist.LoadFromXML(gConfig, Root);
|
||||
DeleteNode(Root, cSectionOfHotDir);
|
||||
end;
|
||||
|
||||
{ Language page }
|
||||
gPOFileName := GetValue(Root, 'Language/POFileName', gPOFileName);
|
||||
|
||||
|
|
@ -3229,9 +3284,6 @@ begin
|
|||
gIgnoreListFile:= GetValue(Node, 'IgnoreListFile', gIgnoreListFile);
|
||||
end;
|
||||
|
||||
{ Directories HotList }
|
||||
gDirectoryHotlist.LoadFromXML(gConfig, Root);
|
||||
|
||||
{ Viewer }
|
||||
Node := Root.FindNode('Viewer');
|
||||
if Assigned(Node) then
|
||||
|
|
@ -3832,9 +3884,6 @@ begin
|
|||
SetAttr(Node, 'Enabled', gIgnoreListFileEnabled);
|
||||
SetValue(Node, 'IgnoreListFile', gIgnoreListFile);
|
||||
|
||||
{ Directories HotList }
|
||||
gDirectoryHotlist.SaveToXml(gConfig, Root, TRUE);
|
||||
|
||||
{ Viewer }
|
||||
Node := FindNode(Root, 'Viewer',True);
|
||||
SetValue(Node, 'PreviewVisible',gPreviewVisible);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue