Commit f9266d01 authored by wp's avatar wp
Browse files

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

git-svn-id: trunk@54872 -
parent 9256ee10
......@@ -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);
......
......@@ -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;
......
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
<Version Value="10"/>
<PathDelim Value="\"/>
<General>
<Flags>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment