mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-14 00:59:38 +02:00
* Fixed loading of context id's from the command line
git-svn-id: trunk@30845 -
This commit is contained in:
parent
c948e3016f
commit
fa52e18965
@ -985,6 +985,9 @@ var
|
||||
fPos: Integer;
|
||||
FileIndex: Integer;
|
||||
LoadTOC: Boolean;
|
||||
CurCHM: TChmReader;
|
||||
ContextURL,
|
||||
ContextTitle: String;
|
||||
begin
|
||||
Result := False;
|
||||
fFile := Copy(AUrl,8, Length(AURL));
|
||||
@ -1003,16 +1006,27 @@ begin
|
||||
else
|
||||
Exit;
|
||||
|
||||
CurCHM := fChms.Chm[FileIndex];
|
||||
|
||||
if LoadTOC and (FileIndex = 0) then
|
||||
begin
|
||||
QueueFillToc(fChms.Chm[FileIndex]);
|
||||
QueueFillToc(CurCHM);
|
||||
end;
|
||||
|
||||
// AContext will override the url if it is found
|
||||
if AContext <> -1 then
|
||||
begin
|
||||
ContextURL := CurCHM.LookupTopicByID(AContext, ContextTitle);
|
||||
if (Length(ContextURL) > 0) and not (ContextURL[1] in ['/', '\']) then
|
||||
Insert('/', ContextURL , 1);
|
||||
if Length(ContextURL) > 0 then
|
||||
fURL := ContextURL;
|
||||
end;
|
||||
|
||||
if fURL <> '' then
|
||||
DoLoadUri(MakeURI(fURL, fChms.Chm[FileIndex]))
|
||||
DoLoadUri(MakeURI(fURL, CurCHM))
|
||||
else
|
||||
DoLoadUri(MakeURI(fChms.Chm[FileIndex].DefaultPage, fChms.Chm[FileIndex]));
|
||||
DoLoadUri(MakeURI(CurCHM.DefaultPage, CurCHM));
|
||||
Result := True;
|
||||
|
||||
fChms.OnOpenNewFile := @NewChmOpened;
|
||||
|
@ -476,11 +476,6 @@ begin
|
||||
Application.QueueAsyncCall(TDataEvent(@LateOpenURL), PtrUInt(StrItem));
|
||||
Break;
|
||||
end;
|
||||
//we reset the context because at this point the file has been loaded and the
|
||||
//context shown
|
||||
fContext := -1;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
procedure THelpForm.StartServer(ServerName: String);
|
||||
@ -589,6 +584,9 @@ procedure THelpForm.LateOpenURL ( Url: PStringItem ) ;
|
||||
begin
|
||||
if OpenURL(URL^.FString, fContext) = ord(srSuccess) then
|
||||
AddRecentFile(URL^.FString);
|
||||
//we reset the context because at this point the file has been loaded and the
|
||||
//context shown
|
||||
fContext := -1;
|
||||
|
||||
Dispose(Url);
|
||||
RefreshState;
|
||||
|
Loading…
Reference in New Issue
Block a user