lhelp: Fix lhelp to show popup hints (issue #31732).

git-svn-id: trunk@54872 -
This commit is contained in:
wp 2017-05-11 08:22:03 +00:00
parent 9256ee10a2
commit f9266d01ea
3 changed files with 37 additions and 12 deletions

View File

@ -640,8 +640,32 @@ begin
end;
procedure TChmContentProvider.IpHtmlPanelHotClick(Sender: TObject);
var
HelpFile: String;
aPos: integer;
lcURL: String;
begin
OpenURL(fHtml.HotURL);
// chm-links look like: mk:@MSITStore:D:\LazPortable\docs\chm\iPro.chm::/html/lh3zs3.htm
lcURL := Lowercase(fHtml.HotURL);
if (Pos('javascript:helppopup(''', lcURL) = 1) or
(Pos('javascript:popuplink(''', lcURL) = 1)
then begin
HelpFile := Copy(fHtml.HotURL, 23, Length(fHtml.HotURL) - (23-1));
HelpFile := Copy(HelpFile, 1, Pos('''', HelpFile)-1);
if (Pos('/',HelpFile)=0) and (Pos('.chm:',HelpFile)=0) then begin //looks like?: 'xyz.htm'
aPos := LastDelimiter('/', fHtml.CurURL);
if aPos>0 then HelpFile := Copy(fHtml.CurURL,1,aPos) + HelpFile;
end
else if (Pos('.chm:',HelpFile)=0) then begin //looks like?: 'folder/xyz.htm' or '/folder/xyz.htm'
if HelpFile[1]<>'/' then HelpFile:='/'+HelpFile;
aPos := LastDelimiter(':', fHtml.CurURL);
if aPos>0 then HelpFile := Copy(fHtml.CurURL,1,aPos) + HelpFile;
end;
DoLoadUri(HelpFile); //open it in current iphtmlpanel.
end
else
OpenURL(fHtml.HotURL);
end;
procedure TChmContentProvider.PopupCopyClick(Sender: TObject);

View File

@ -154,21 +154,22 @@ end;
function TIpChmDataProvider.CanHandle(const URL: string): Boolean;
var
HelpFile: String;
Reader: TChmReader = nil;
begin
Result := True;
if Pos('Java', URL) =1 then Result := False;
if (fChm.ObjectExists(StripInPageLink(url), Reader)= 0)
and (fChm.ObjectExists(StripInPageLink(BuildUrl(fCurrentPath,Url)), Reader) = 0) then Result := False;
if Pos('Java', URL) = 1 then
Result := False;
if (fChm.ObjectExists(StripInPageLink(url), Reader)= 0) and
(fChm.ObjectExists(StripInPageLink(BuildUrl(fCurrentPath,Url)), Reader) = 0)
then
Result := False;
//DebugLn('CanHandle ',Url,' = ', Result);
//if not Result then if fChm.ObjectExists(BuildURL('', URL)) > 0 Then result := true;
if Pos('javascript:helppopup(''', LowerCase(URL)) = 1 then begin
HelpFile := Copy(URL, 23, Length(URL) - (23-1));
HelpFile := Copy(HelpFile, 1, Pos('''', HelpFile)-1);
//DebugLn('HelpFile = ', HelpFile);
end;
if (not Result) and (Pos('#', URL) = 1) then Result := True;
if (not Result) and (Pos('#', URL) = 1) then
Result := True;
end;
function TIpChmDataProvider.BuildURL(const OldURL, NewURL: string): string;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<Flags>