chmhelp: fixed subpath passing to lhelp

git-svn-id: trunk@37998 -
This commit is contained in:
mattias 2012-07-22 09:57:14 +00:00
parent 68cb956920
commit bf3705c2d3
3 changed files with 21 additions and 12 deletions

View File

@ -10,7 +10,7 @@ object Form1: TForm1
LCLVersion = '1.1'
object Edit1: TEdit
Left = 71
Height = 22
Height = 25
Top = 72
Width = 225
HelpType = htKeyword
@ -20,7 +20,7 @@ object Form1: TForm1
end
object Edit2: TEdit
Left = 71
Height = 22
Height = 25
Top = 128
Width = 224
HelpType = htKeyword
@ -30,9 +30,9 @@ object Form1: TForm1
end
object ShowHelpButton: TButton
Left = 70
Height = 20
Height = 27
Top = 20
Width = 128
Width = 105
AutoSize = True
Caption = 'ShowHelpButton'
OnClick = ShowHelpButtonClick
@ -41,7 +41,7 @@ object Form1: TForm1
object CHMHelpDatabase1: TCHMHelpDatabase
AutoRegister = True
Filename = '../../../tools/chmmaker/example.chm'
KeywordPrefix = 'example/'
KeywordPrefix = 'example'
left = 80
top = 168
end

View File

@ -19,6 +19,10 @@ unit LazHelpCHM;
{$mode objfpc}{$H+}
{$IFDEF VerboseLCLHelp}
{$DEFINE VerboseChmHelp}
{$ENDIF}
interface
uses
@ -40,7 +44,7 @@ type
Put a TCHMHelpDatabase on a form.
Set AutoRegister to true.
Set KeywordPrefix to 'example/'
Set KeywordPrefix to 'example'
Set CHM file to '../../../tools/chmmaker/example.chm'
Put a TLHelpRemoteViewer on the form.
@ -52,7 +56,8 @@ type
Set HelpKeyword to 'example/MainPage.html'
Run the program.
Focus the edit field and press F1. The page 'MainPage.html' will be shown.
Focus the edit field and press F1. The page '/MainPage.html' will be shown.
Note: lhelp requires the leading slash.
}
TCHMHelpDatabase = class(THelpDatabase)
private
@ -141,7 +146,9 @@ var
Response: TLHelpResponse;
s: String;
begin
{$IFDEF VerboseChmHelp}
debugln(['TLHelpConnector.ShowNode START URL="',Node.URL,'"']);
{$ENDIF}
Result:=shrViewerError;
ErrMsg:='';
@ -162,6 +169,8 @@ begin
end;
SubPath:='';
if (URLParams<>'') and (URLParams[1]='?') then
Delete(URLParams,1,1);
if LeftStr(URLParams,length(CHMPathParam)+1)=CHMPathParam+'=' then begin
SubPath:=URLParams;
Delete(SubPath,1,length(CHMPathParam)+1);
@ -210,6 +219,9 @@ begin
Connection.StartHelpServer(IPCFile,Path);
end;
{$IFDEF VerboseChmHelp}
debugln(['TLHelpConnector.ShowNode CHMFilename="',CHMFilename,'" SubPath="',SubPath,'"']);
{$ENDIF}
Response:=Connection.OpenURL(CHMFilename,SubPath);
case Response of
srSuccess: exit(shrSuccess);

View File

@ -15,6 +15,7 @@
</SyntaxOptions>
</Parsing>
<Other>
<CustomOptions Value="$(IDEBuildOptions)"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
@ -33,14 +34,10 @@
</Item2>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="LCL"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>