mirror of
				https://gitlab.com/freepascal.org/lazarus/lazarus.git
				synced 2025-10-31 22:49:30 +01:00 
			
		
		
		
	Revert r45857 #c2a0094609, "ChmHelp: close lhelp that laz started when laz is closed..." because Reinier requested it.
git-svn-id: trunk@45864 -
This commit is contained in:
		
							parent
							
								
									6ff6f62e77
								
							
						
					
					
						commit
						cace204583
					
				| @ -5,7 +5,7 @@ unit chmcontentprovider; | |||||||
| {$Note Compiling lhelp with search support} | {$Note Compiling lhelp with search support} | ||||||
| {$DEFINE CHM_SEARCH} | {$DEFINE CHM_SEARCH} | ||||||
| 
 | 
 | ||||||
| {$IF FPC_FULLVERSION>=20400} | {$if (fpc_version=2) and (fpc_release>4)} | ||||||
| {$Note Compiling lhelp *with* binary index and toc support} | {$Note Compiling lhelp *with* binary index and toc support} | ||||||
| {$DEFINE CHM_BINARY_INDEX_TOC} | {$DEFINE CHM_BINARY_INDEX_TOC} | ||||||
| {$endif} | {$endif} | ||||||
|  | |||||||
| @ -47,6 +47,12 @@ | |||||||
|               </Win32> |               </Win32> | ||||||
|             </Options> |             </Options> | ||||||
|           </Linking> |           </Linking> | ||||||
|  |           <Other> | ||||||
|  |             <CompilerMessages> | ||||||
|  |               <UseMsgFile Value="True"/> | ||||||
|  |             </CompilerMessages> | ||||||
|  |             <CompilerPath Value="$(CompPath)"/> | ||||||
|  |           </Other> | ||||||
|         </CompilerOptions> |         </CompilerOptions> | ||||||
|       </Item2> |       </Item2> | ||||||
|     </BuildModes> |     </BuildModes> | ||||||
| @ -78,6 +84,7 @@ | |||||||
|       <Unit0> |       <Unit0> | ||||||
|         <Filename Value="lhelp.lpr"/> |         <Filename Value="lhelp.lpr"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|  |         <UnitName Value="lhelp"/> | ||||||
|       </Unit0> |       </Unit0> | ||||||
|       <Unit1> |       <Unit1> | ||||||
|         <Filename Value="chmdataprovider.pas"/> |         <Filename Value="chmdataprovider.pas"/> | ||||||
| @ -87,12 +94,14 @@ | |||||||
|       <Unit2> |       <Unit2> | ||||||
|         <Filename Value="chmspecialparser.pas"/> |         <Filename Value="chmspecialparser.pas"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|  |         <UnitName Value="ChmSpecialParser"/> | ||||||
|       </Unit2> |       </Unit2> | ||||||
|       <Unit3> |       <Unit3> | ||||||
|         <Filename Value="chmpopup.pas"/> |         <Filename Value="chmpopup.pas"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|         <ComponentName Value="HelpPopupForm"/> |         <ComponentName Value="HelpPopupForm"/> | ||||||
|         <ResourceBaseClass Value="Form"/> |         <ResourceBaseClass Value="Form"/> | ||||||
|  |         <UnitName Value="ChmPopup"/> | ||||||
|       </Unit3> |       </Unit3> | ||||||
|       <Unit4> |       <Unit4> | ||||||
|         <Filename Value="lhelpcore.pas"/> |         <Filename Value="lhelpcore.pas"/> | ||||||
| @ -105,10 +114,12 @@ | |||||||
|       <Unit5> |       <Unit5> | ||||||
|         <Filename Value="lnethttpdataprovider.pas"/> |         <Filename Value="lnethttpdataprovider.pas"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|  |         <UnitName Value="LNetHTTPDataProvider"/> | ||||||
|       </Unit5> |       </Unit5> | ||||||
|       <Unit6> |       <Unit6> | ||||||
|         <Filename Value="basecontentprovider.pas"/> |         <Filename Value="basecontentprovider.pas"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|  |         <UnitName Value="BaseContentProvider"/> | ||||||
|       </Unit6> |       </Unit6> | ||||||
|       <Unit7> |       <Unit7> | ||||||
|         <Filename Value="chmcontentprovider.pas"/> |         <Filename Value="chmcontentprovider.pas"/> | ||||||
| @ -118,6 +129,7 @@ | |||||||
|       <Unit8> |       <Unit8> | ||||||
|         <Filename Value="httpcontentprovider.pas"/> |         <Filename Value="httpcontentprovider.pas"/> | ||||||
|         <IsPartOfProject Value="True"/> |         <IsPartOfProject Value="True"/> | ||||||
|  |         <UnitName Value="HTTPContentProvider"/> | ||||||
|       </Unit8> |       </Unit8> | ||||||
|     </Units> |     </Units> | ||||||
|   </ProjectOptions> |   </ProjectOptions> | ||||||
| @ -147,5 +159,11 @@ | |||||||
|         </Win32> |         </Win32> | ||||||
|       </Options> |       </Options> | ||||||
|     </Linking> |     </Linking> | ||||||
|  |     <Other> | ||||||
|  |       <CompilerMessages> | ||||||
|  |         <UseMsgFile Value="True"/> | ||||||
|  |       </CompilerMessages> | ||||||
|  |       <CompilerPath Value="$(CompPath)"/> | ||||||
|  |     </Other> | ||||||
|   </CompilerOptions> |   </CompilerOptions> | ||||||
| </CONFIG> | </CONFIG> | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| { Copyright (C) <2005-2014> <Andrew Haines>, Lazarus contributors lhelp.lpr | { Copyright (C) <2005> <Andrew Haines> lhelp.lpr | ||||||
| 
 | 
 | ||||||
|   Lhelp CHM help viewer application |   Lhelp CHM help viewer application | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ object HelpForm: THelpForm | |||||||
|   Width = 758 |   Width = 758 | ||||||
|   ActiveControl = Panel1 |   ActiveControl = Panel1 | ||||||
|   Caption = 'LHelp' |   Caption = 'LHelp' | ||||||
|   ClientHeight = 516 |   ClientHeight = 510 | ||||||
|   ClientWidth = 758 |   ClientWidth = 758 | ||||||
|   Icon.Data = { |   Icon.Data = { | ||||||
|     7E04000000000100010010100000010020006804000016000000280000001000 |     7E04000000000100010010100000010020006804000016000000280000001000 | ||||||
| @ -238,7 +238,7 @@ object HelpForm: THelpForm | |||||||
|   end |   end | ||||||
|   object PageControl: TPageControl |   object PageControl: TPageControl | ||||||
|     Left = 0 |     Left = 0 | ||||||
|     Height = 484 |     Height = 478 | ||||||
|     Top = 32 |     Top = 32 | ||||||
|     Width = 758 |     Width = 758 | ||||||
|     Align = alClient |     Align = alClient | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| { Copyright (C) 2005-2014  Andrew Haines, Lazarus contributors | { Copyright (C) 2005-2013  Andrew Haines, Lazarus contributors | ||||||
| 
 | 
 | ||||||
|   Main form for lhelp. Includes processing/data communication. |   Main form for lhelp. Includes processing/data communication. | ||||||
| 
 | 
 | ||||||
| @ -150,7 +150,7 @@ var | |||||||
| 
 | 
 | ||||||
| const | const | ||||||
|   INVALID_FILE_TYPE = 1; |   INVALID_FILE_TYPE = 1; | ||||||
|   VERSION_STAMP = '2013-07-31'; //used in displaying version in about form etc |   VERSION_STAMP = '2013-07-31'; //used in displaying about form etc | ||||||
| 
 | 
 | ||||||
| implementation | implementation | ||||||
| 
 | 
 | ||||||
| @ -244,22 +244,20 @@ procedure THelpForm.FileMenuOpenURLItemClick(Sender: TObject); | |||||||
| var | var | ||||||
|   fRes: String; |   fRes: String; | ||||||
|   URLSAllowed: String; |   URLSAllowed: String; | ||||||
|   Protocol: TStrings; |   Protocall: TStrings; | ||||||
|   i: Integer; |   i: Integer; | ||||||
| begin | begin | ||||||
|   Protocol := GetContentProviderList; |   Protocall := GetContentProviderList; | ||||||
|   try | 
 | ||||||
|   URLSAllowed:=''; |   URLSAllowed:=''; | ||||||
|     for i := 0 to Protocol.Count-1 do |   for i := 0 to Protocall.Count-1 do | ||||||
|   begin |   begin | ||||||
|     if i < 1 then |     if i < 1 then | ||||||
|         URLSAllowed := URLSAllowed + Protocol[i] |       URLSAllowed := URLSAllowed + Protocall[i] | ||||||
|     else |     else | ||||||
|         URLSAllowed := URLSAllowed + ', ' +Protocol[i] |       URLSAllowed := URLSAllowed + ', ' +Protocall[i] | ||||||
|     end; |  | ||||||
|   finally |  | ||||||
|     Protocol.Free; |  | ||||||
|   end; |   end; | ||||||
|  |   Protocall.Free; | ||||||
| 
 | 
 | ||||||
|   URLSAllowed := Trim(URLSALLowed); |   URLSAllowed := Trim(URLSALLowed); | ||||||
| 
 | 
 | ||||||
| @ -354,7 +352,7 @@ begin | |||||||
|   PrefFile := GetAppConfigDirUTF8(False); |   PrefFile := GetAppConfigDirUTF8(False); | ||||||
|   ForceDirectoriesUTF8(PrefFile); |   ForceDirectoriesUTF8(PrefFile); | ||||||
|   // --ipcname passes a server ID that consists of a |   // --ipcname passes a server ID that consists of a | ||||||
|   // server-dependent constant together with a process ID. |   // a server-dependent constant together with a process ID. | ||||||
|   // Strip out the process ID to get fixed config file names for one server |   // Strip out the process ID to get fixed config file names for one server | ||||||
|   ServerPart := Copy(AIPCName, 1, length(AIPCName)-5); //strip out PID |   ServerPart := Copy(AIPCName, 1, length(AIPCName)-5); //strip out PID | ||||||
|   PrefFile:=Format('%slhelp-%s.conf',[IncludeTrailingPathDelimiter(PrefFile), ServerPart]); |   PrefFile:=Format('%slhelp-%s.conf',[IncludeTrailingPathDelimiter(PrefFile), ServerPart]); | ||||||
| @ -477,7 +475,6 @@ begin | |||||||
|     Stream.Position := 0; |     Stream.Position := 0; | ||||||
|     FillByte(FileReq{%H-},SizeOf(FileReq),0); |     FillByte(FileReq{%H-},SizeOf(FileReq),0); | ||||||
|     Stream.Read(FileReq, SizeOf(FileReq)); |     Stream.Read(FileReq, SizeOf(FileReq)); | ||||||
|     Res := Ord(srError); //fail by default |  | ||||||
|     case FileReq.RequestType of |     case FileReq.RequestType of | ||||||
|       rtFile    : begin |       rtFile    : begin | ||||||
|                     Url := 'file://'+FileReq.FileName; |                     Url := 'file://'+FileReq.FileName; | ||||||
| @ -539,14 +536,8 @@ begin | |||||||
|       AddRecentFile(Url); |       AddRecentFile(Url); | ||||||
|     SendResponse(Res); |     SendResponse(Res); | ||||||
|     if MustClose then |     if MustClose then | ||||||
|     begin |  | ||||||
|       // Wait some time for the response message to go out before shutting down |  | ||||||
|       Application.ProcessMessages; |  | ||||||
|       Sleep(10); |  | ||||||
|       Application.Terminate; |       Application.Terminate; | ||||||
|     end; |  | ||||||
| 
 | 
 | ||||||
|     // We received mrShow: |  | ||||||
|     if (MustClose=false) and (fHide=false) then |     if (MustClose=false) and (fHide=false) then | ||||||
|     begin |     begin | ||||||
|       Self.SendToBack; |       Self.SendToBack; | ||||||
| @ -684,20 +675,20 @@ var | |||||||
|  fPage: TContentTab = nil; |  fPage: TContentTab = nil; | ||||||
|  I: Integer; |  I: Integer; | ||||||
| begin | begin | ||||||
|  Result := Ord(srInvalidURL); |  Result := Ord(srUnknown); | ||||||
|  fURLPrefix := GetURLPrefix; |  fURLPrefix := GetURLPrefix; | ||||||
|  fContentProvider := GetContentProvider(fURLPrefix); |  fContentProvider := GetContentProvider(fURLPrefix); | ||||||
|   |   | ||||||
|  if fContentProvider = nil then begin |  if fContentProvider = nil then begin | ||||||
|    ShowError('Cannot handle this type of content. "' + fURLPrefix + '" for url:'+LineEnding+AURL); |    ShowError('Cannot handle this type of content. "' + fURLPrefix + '" for url:'+LineEnding+AURL); | ||||||
|    Result := Ord(srInvalidURL); |    Result := Ord(srInvalidFile); | ||||||
|    Exit; |    Exit; | ||||||
|  end; |  end; | ||||||
|  fRealContentProvider := fContentProvider.GetProperContentProvider(AURL); |  fRealContentProvider := fContentProvider.GetProperContentProvider(AURL); | ||||||
|   |   | ||||||
|  if fRealContentProvider = nil then begin |  if fRealContentProvider = nil then begin | ||||||
|    ShowError('Cannot handle this type of subcontent. "' + fURLPrefix + '" for url:'+LineEnding+AURL); |    ShowError('Cannot handle this type of subcontent. "' + fURLPrefix + '" for url:'+LineEnding+AURL); | ||||||
|    Result := Ord(srInvalidURL); |    Result := Ord(srInvalidFile); | ||||||
|    Exit; |    Exit; | ||||||
|  end; |  end; | ||||||
| 
 | 
 | ||||||
| @ -726,6 +717,7 @@ begin | |||||||
|    fPage.ContentProvider.LoadPreferences(fConfig); |    fPage.ContentProvider.LoadPreferences(fConfig); | ||||||
|  end; |  end; | ||||||
| 
 | 
 | ||||||
|  |   | ||||||
|  if fPage.ContentProvider.LoadURL(AURL, AContext) then |  if fPage.ContentProvider.LoadURL(AURL, AContext) then | ||||||
|  begin |  begin | ||||||
|    PageControl.ActivePage := fPage; |    PageControl.ActivePage := fPage; | ||||||
| @ -733,7 +725,7 @@ begin | |||||||
|    Result := Ord(srSuccess); |    Result := Ord(srSuccess); | ||||||
|  end |  end | ||||||
|  else |  else | ||||||
|    Result := Ord(srInvalidURL); |    Result := Ord(srInvalidFile); | ||||||
| 
 | 
 | ||||||
|  if not fHide then |  if not fHide then | ||||||
|    ShowOnTop; |    ShowOnTop; | ||||||
|  | |||||||
| @ -25,12 +25,7 @@ uses | |||||||
|   Classes, SysUtils, FileUtil, LazLogger, SimpleIPC, process, UTF8Process; |   Classes, SysUtils, FileUtil, LazLogger, SimpleIPC, process, UTF8Process; | ||||||
| 
 | 
 | ||||||
| const | const | ||||||
|   PROTOCOL_VERSION='2'; //IDE<>LHelp communication protocol version. Please update when breaking compatibility |   PROTOCOL_VERSION='1'; //IDE<>LHelp communication protocol version. Please update when breaking compatibility | ||||||
|   // Version 1: original version |  | ||||||
|   // Version 2: |  | ||||||
|   // - support for Proposed extensions in bug 24743: |  | ||||||
|   // - openurl: if applicable return error instead of unknown |  | ||||||
|   // - openurl: if applicable return invalid url instead of invalid file for openurl |  | ||||||
| type | type | ||||||
|   TRequestType = (rtFile, rtUrl, rtContext, rtMisc {window handling etc}); |   TRequestType = (rtFile, rtUrl, rtContext, rtMisc {window handling etc}); | ||||||
|   TMiscRequests = (mrShow, mrVersion, mrClose); |   TMiscRequests = (mrShow, mrVersion, mrClose); | ||||||
| @ -118,9 +113,12 @@ end; | |||||||
| 
 | 
 | ||||||
| function TLHelpConnection.SendMessage(Stream: TStream): TLHelpResponse; | function TLHelpConnection.SendMessage(Stream: TStream): TLHelpResponse; | ||||||
| begin | begin | ||||||
|   Result := srNoAnswer; |   //try | ||||||
|     fServerOut.SendMessage(mtUnknown, Stream); |     fServerOut.SendMessage(mtUnknown, Stream); | ||||||
|     Result := WaitForMsgResponse; |     Result := WaitForMsgResponse; | ||||||
|  |   //except | ||||||
|  |   //  on EIPCError do Result := srNoAnswer; | ||||||
|  |   //end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| constructor TLHelpConnection.Create; | constructor TLHelpConnection.Create; | ||||||
| @ -227,9 +225,6 @@ begin | |||||||
|   if fServerOut.ServerRunning then begin |   if fServerOut.ServerRunning then begin | ||||||
|     fServerOut.Active := True; |     fServerOut.Active := True; | ||||||
|     Result := True; |     Result := True; | ||||||
|   end |  | ||||||
|   else begin |  | ||||||
|     debugln('Could not get lhelp running with command '+Cmd); |  | ||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| 
 | 
 | ||||||
| @ -243,17 +238,8 @@ begin | |||||||
|     UrlRequest.FileRequest.FileName := HelpFileName+#0; |     UrlRequest.FileRequest.FileName := HelpFileName+#0; | ||||||
|     UrlRequest.FileRequest.RequestType := rtURL; |     UrlRequest.FileRequest.RequestType := rtURL; | ||||||
|     UrlRequest.Url := Url+#0; |     UrlRequest.Url := Url+#0; | ||||||
|     Result:=srNoAnswer; |  | ||||||
|     try |  | ||||||
|     Stream.Write(UrlRequest,SizeOf(UrlRequest)); |     Stream.Write(UrlRequest,SizeOf(UrlRequest)); | ||||||
|     Result := SendMessage(Stream); |     Result := SendMessage(Stream); | ||||||
|     except |  | ||||||
|       // Catch stream read errors etc |  | ||||||
|       on E: Exception do |  | ||||||
|       begin |  | ||||||
|         debugln('Help connection: error '+E.Message+' running UrlRequest command'); |  | ||||||
|       end; |  | ||||||
|     end; |  | ||||||
|   finally |   finally | ||||||
|     Stream.Free; |     Stream.Free; | ||||||
|   end; |   end; | ||||||
| @ -266,22 +252,12 @@ var | |||||||
|   Stream: TMemoryStream; |   Stream: TMemoryStream; | ||||||
| begin | begin | ||||||
|   Stream := TMemoryStream.Create; |   Stream := TMemoryStream.Create; | ||||||
|   Result := srNoAnswer; |  | ||||||
|   try |   try | ||||||
|     ContextRequest.FileRequest.FileName := HelpFileName+#0; |     ContextRequest.FileRequest.FileName := HelpFileName+#0; | ||||||
|     ContextRequest.FileRequest.RequestType := rtContext; |     ContextRequest.FileRequest.RequestType := rtContext; | ||||||
|     ContextRequest.HelpContext := Context; |     ContextRequest.HelpContext := Context; | ||||||
|     Result := srNoAnswer; |  | ||||||
|     try |  | ||||||
|     Stream.Write(ContextRequest, SizeOf(ContextRequest)); |     Stream.Write(ContextRequest, SizeOf(ContextRequest)); | ||||||
|     Result := SendMessage(Stream); |     Result := SendMessage(Stream); | ||||||
|     except |  | ||||||
|       // Catch stream read errors etc |  | ||||||
|       on E: Exception do |  | ||||||
|       begin |  | ||||||
|         debugln('Help connection: error '+E.Message+' running ContextRequest command'); |  | ||||||
|       end; |  | ||||||
|     end; |  | ||||||
|   finally |   finally | ||||||
|     Stream.Free; |     Stream.Free; | ||||||
|   end; |   end; | ||||||
| @ -296,17 +272,8 @@ begin | |||||||
|   try |   try | ||||||
|     FileRequest.RequestType := rtFile; |     FileRequest.RequestType := rtFile; | ||||||
|     FileRequest.FileName := HelpFileName+#0; |     FileRequest.FileName := HelpFileName+#0; | ||||||
|     Result := srNoAnswer; |  | ||||||
|     try |  | ||||||
|     Stream.Write(FileRequest, SizeOf(FileRequest)); |     Stream.Write(FileRequest, SizeOf(FileRequest)); | ||||||
|     Result := SendMessage(Stream); |     Result := SendMessage(Stream); | ||||||
|     except |  | ||||||
|       // Catch stream read errors etc |  | ||||||
|       on E: Exception do |  | ||||||
|       begin |  | ||||||
|         debugln('Help connection: error '+E.Message+' running FileRequest command'); |  | ||||||
|       end; |  | ||||||
|     end; |  | ||||||
|   finally |   finally | ||||||
|     Stream.Free; |     Stream.Free; | ||||||
|   end; |   end; | ||||||
| @ -320,27 +287,17 @@ begin | |||||||
|   Stream := TMemoryStream.Create; |   Stream := TMemoryStream.Create; | ||||||
|   try |   try | ||||||
|     MiscRequest.FileRequest.RequestType := rtMisc; |     MiscRequest.FileRequest.RequestType := rtMisc; | ||||||
|     MiscRequest.FileRequest.FileName := ''+#0; |     MiscRequest.FileRequest.FileName := ''+#0; //i | ||||||
|     //CommandID is ord(TMiscRequests) |     //CommandID is ord(TMiscRequests) | ||||||
|     MiscRequest.RequestID:=CommandID; |     MiscRequest.RequestID:=CommandID; | ||||||
|     case CommandID of |     case CommandID of | ||||||
|       mrClose: ; //no arguments required |       mrClose: ; //do nothing | ||||||
|       mrShow: ;  //no arguments required |       mrShow: ;  //do nothing | ||||||
|       mrVersion: |       mrVersion: | ||||||
|         MiscRequest.FileRequest.FileName := PROTOCOL_VERSION+#0; |         MiscRequest.FileRequest.FileName := PROTOCOL_VERSION+#0; | ||||||
|     end; |     end; | ||||||
|     try |  | ||||||
|     Stream.Write(MiscRequest, SizeOf(MiscRequest)); |     Stream.Write(MiscRequest, SizeOf(MiscRequest)); | ||||||
|     Result := SendMessage(Stream); |     Result := SendMessage(Stream); | ||||||
|     except |  | ||||||
|       // Catch stream read errors etc |  | ||||||
|       on E: Exception do |  | ||||||
|       begin |  | ||||||
|         // When closing, the viewer may not respond in time, which is expected. |  | ||||||
|         if CommandID<>mrClose then |  | ||||||
|           debugln('Help connection: error '+E.Message+' running MiscRequest command'); |  | ||||||
|       end; |  | ||||||
|     end; |  | ||||||
|   finally |   finally | ||||||
|     Stream.Free; |     Stream.Free; | ||||||
|   end; |   end; | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| { Copyright (C) <2005-2014> <Andrew Haines>, Lazarus contributors | { Copyright (C) <2005-2013> <Andrew Haines>, Lazarus contributors | ||||||
| 
 | 
 | ||||||
|   lazchmhelp.pas |   lazchmhelp.pas | ||||||
| 
 | 
 | ||||||
| @ -437,16 +437,6 @@ end; | |||||||
| 
 | 
 | ||||||
| destructor TChmHelpViewer.Destroy; | destructor TChmHelpViewer.Destroy; | ||||||
| begin | begin | ||||||
|   // Try to close lhelp if we had opened it before; ignore response |  | ||||||
|   try |  | ||||||
|     fHelpConnection.RunMiscCommand(LHelpControl.mrClose); |  | ||||||
|   except |  | ||||||
|     // ignore errors; let user close it himself |  | ||||||
|     on E: Exception do begin |  | ||||||
|       debugln('TChmHelpViewer.Destroy: exception '+E.Message+' when trying to send mrClose on viewer'); |  | ||||||
|     end; |  | ||||||
|   end; |  | ||||||
| 
 |  | ||||||
|   fHelpConnection.Free; |   fHelpConnection.Free; | ||||||
|   inherited Destroy; |   inherited Destroy; | ||||||
| end; | end; | ||||||
| @ -491,7 +481,9 @@ begin | |||||||
|     fHelpConnection.StartHelpServer(HelpLabel, HelpExeFileName, true); |     fHelpConnection.StartHelpServer(HelpLabel, HelpExeFileName, true); | ||||||
|     Response:=fHelpConnection.RunMiscCommand(mrVersion); |     Response:=fHelpConnection.RunMiscCommand(mrVersion); | ||||||
|     if Response<>srSuccess then |     if Response<>srSuccess then | ||||||
|       debugln('Help viewer does not support our protocol version ('+PROTOCOL_VERSION +'). Response was: ord: '+inttostr(ord(Response))) |     begin | ||||||
|  |       debugln('Help viewer does not support our protocol version.'); | ||||||
|  |     end | ||||||
|     else |     else | ||||||
|     begin |     begin | ||||||
|       // Open all chm files after it has started, while still hidden |       // Open all chm files after it has started, while still hidden | ||||||
| @ -499,7 +491,9 @@ begin | |||||||
|       // Instruct viewer to show its GUI |       // Instruct viewer to show its GUI | ||||||
|       Response:=fHelpConnection.RunMiscCommand(mrShow); |       Response:=fHelpConnection.RunMiscCommand(mrShow); | ||||||
|       if Response<>srSuccess then |       if Response<>srSuccess then | ||||||
|         debugln('Help viewer gave error response to mrShow command. Response was: ord: '+inttostr(ord(Response))); |       begin | ||||||
|  |         debugln('Help viewer failed to respond to mrShow command.'); | ||||||
|  |       end; | ||||||
|     end; |     end; | ||||||
|   end; |   end; | ||||||
| end; | end; | ||||||
| @ -606,19 +600,7 @@ begin | |||||||
|   case Res of |   case Res of | ||||||
|     srSuccess: Result := shrSuccess; |     srSuccess: Result := shrSuccess; | ||||||
|     srNoAnswer: Result := shrSuccess; |     srNoAnswer: Result := shrSuccess; | ||||||
|     srInvalidContext: begin |   else | ||||||
|       Result := shrNone; |  | ||||||
|       ErrMsg := 'Invalid context showing '+URL; |  | ||||||
|     end; |  | ||||||
|     srInvalidFile: begin |  | ||||||
|       Result := shrNone; |  | ||||||
|       ErrMsg := 'Invalid file showing '+URL; |  | ||||||
|     end; |  | ||||||
|     srInvalidURL: begin |  | ||||||
|       Result := shrNone; |  | ||||||
|       ErrMsg := 'Invalid URL showing '+URL; |  | ||||||
|     end; |  | ||||||
|   else //srUnknown, srError |  | ||||||
|     Result := shrNone; |     Result := shrNone; | ||||||
|     ErrMsg := 'Unknown error showing '+URL; |     ErrMsg := 'Unknown error showing '+URL; | ||||||
|   end; |   end; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 juha
						juha