* IDEHelp: harden (don't accept empty HelpLabel); cosmetic/cleanup

git-svn-id: trunk@46569 -
This commit is contained in:
reiniero 2014-10-16 08:04:28 +00:00
parent 615719c46f
commit 5af82b4bad

View File

@ -85,10 +85,15 @@ type
function GetHelpEXE: String; // macros resolved, see property HelpEXE function GetHelpEXE: String; // macros resolved, see property HelpEXE
function GetHelpFilesPath: String; // macros resolved, see property HelpFilesPath function GetHelpFilesPath: String; // macros resolved, see property HelpFilesPath
published published
property HelpEXE: String read fHelpEXE write SetHelpEXE; // with macros, see GetHelpEXE // Path and filename of help executable
// With macros, see GetHelpEXE
property HelpEXE: String read fHelpEXE write SetHelpEXE;
// ID used for SimpleIPC communication with the help viewer // ID used for SimpleIPC communication with the help viewer
property HelpLabel: String read GetHelpLabel write SetHelpLabel; property HelpLabel: String read GetHelpLabel write SetHelpLabel;
property HelpFilesPath: String read fCHMSearchPath write SetChmsFilePath; // directories separated with semicolon, with macros, see GetHelpFilesPath // Where to look for help files.
// Directories separated with semicolon, with macros, see GetHelpFilesPath
property HelpFilesPath: String read fCHMSearchPath write SetChmsFilePath;
// Additional parameters to pass to help executable
property HelpExeParams: String read fHelpExeParams write fHelpExeParams; property HelpExeParams: String read fHelpExeParams write fHelpExeParams;
end; end;
@ -254,12 +259,13 @@ procedure TChmHelpViewer.SetHelpLabel(AValue: String);
var var
i: Integer; i: Integer;
begin begin
fHelpLabel := AValue; fHelpLabel := AValue;
for i := 1 to Length(fHelpLabel) do // Strip out difficult characters
begin for i := 1 to Length(fHelpLabel) do
if not (fHelpLabel[i] in ['a'..'z', '0'..'9', 'A'..'Z']) then begin
fHelpLabel[i] := '_'; if not (fHelpLabel[i] in ['a'..'z', '0'..'9', 'A'..'Z']) then
end; fHelpLabel[i] := '_';
end;
end; end;
function TChmHelpViewer.CheckBuildLHelp: Integer; function TChmHelpViewer.CheckBuildLHelp: Integer;
@ -599,7 +605,8 @@ begin
begin begin
Viewer:=TChmHelpViewer(Source); Viewer:=TChmHelpViewer(Source);
HelpEXE:=Viewer.HelpEXE; HelpEXE:=Viewer.HelpEXE;
HelpLabel:=Viewer.HelpLabel; if Viewer.HelpLabel<>'' then
HelpLabel:=Viewer.HelpLabel;
HelpFilesPath:=Viewer.HelpFilesPath; HelpFilesPath:=Viewer.HelpFilesPath;
end; end;
inherited Assign(Source); inherited Assign(Source);
@ -609,7 +616,8 @@ procedure TChmHelpViewer.Load(Storage: TConfigStorage);
begin begin
HelpEXE:=Storage.GetValue('CHMHelp/Exe',''); HelpEXE:=Storage.GetValue('CHMHelp/Exe','');
HelpExeParams := Storage.GetValue('CHMHelp/ExeParams',''); HelpExeParams := Storage.GetValue('CHMHelp/ExeParams','');
HelpLabel:=Storage.GetValue('CHMHelp/Name','lazhelp')+inttostr(GetProcessID); // Precalculate label:
HelpLabel:=Storage.GetValue('CHMHelp/Name',CHMHelpName)+inttostr(GetProcessID);
HelpFilesPath := Storage.GetValue('CHMHelp/FilesPath',''); HelpFilesPath := Storage.GetValue('CHMHelp/FilesPath','');
end; end;