From bf3705c2d39932dae1c642f2ad7d17b15b42d23d Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 22 Jul 2012 09:57:14 +0000 Subject: [PATCH] chmhelp: fixed subpath passing to lhelp git-svn-id: trunk@37998 - --- .../chmhelp/democontrol/ctxchmhelpunit1.lfm | 10 +++++----- components/chmhelp/packages/help/lazhelpchm.pas | 16 ++++++++++++++-- .../chmhelp/packages/help/lhelpcontrolpkg.lpk | 7 ++----- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/components/chmhelp/democontrol/ctxchmhelpunit1.lfm b/components/chmhelp/democontrol/ctxchmhelpunit1.lfm index 0a499908b6..803317a4de 100644 --- a/components/chmhelp/democontrol/ctxchmhelpunit1.lfm +++ b/components/chmhelp/democontrol/ctxchmhelpunit1.lfm @@ -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 diff --git a/components/chmhelp/packages/help/lazhelpchm.pas b/components/chmhelp/packages/help/lazhelpchm.pas index d242775ea5..81df350068 100644 --- a/components/chmhelp/packages/help/lazhelpchm.pas +++ b/components/chmhelp/packages/help/lazhelpchm.pas @@ -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); diff --git a/components/chmhelp/packages/help/lhelpcontrolpkg.lpk b/components/chmhelp/packages/help/lhelpcontrolpkg.lpk index b0cce0287a..a3ac2fc092 100644 --- a/components/chmhelp/packages/help/lhelpcontrolpkg.lpk +++ b/components/chmhelp/packages/help/lhelpcontrolpkg.lpk @@ -15,6 +15,7 @@ + @@ -33,14 +34,10 @@ - + - - - -