1{%MainUnit ../lclintf.pas} 2 3{$I ../../components/lazutils/lazutils_defines.inc} //LCL depends on LazUtils, so this is OK 4 5 6function IsLaunchWinApp(ABrowser: WideString): Boolean; 7begin 8 Result := False; 9end; 10 11//not every AppUserModelID we retrieve using GetDefaultBrowserWideByAppID 12//accepts paramters (e.g. the URL) 13function LaunchWinAppBrowserCanHandleParams(ABrowser: WideString): Boolean; 14begin 15 Result := False; 16end; 17 18function GetDefaultBrowserWideByAppID: WideString; 19begin 20 Result := ''; 21end; 22 23function GetDefaultBrowserWideByCmd: WideString; 24begin 25 Result := ''; 26end; 27 28 29procedure ExtractBrowserAndParamsWide(const S: WideString; out ABrowser, AParams: WideString); 30begin 31 ABrowser := S; 32 AParams := '%s'; 33end; 34 35 36function FindDefaultBrowserWide(out ABrowser, AParams: WideString): Boolean; 37begin 38 ABrowser := ''; 39 AParams := '"%s"'; 40 Result := False; 41end; 42 43function FindDefaultBrowserUtf8(out ABrowser, AParams: String): Boolean; 44var 45 QueryRes: String; 46 WideBrowser, WideParams: WideString; 47begin 48 Result := FindDefaultBrowserWide(WideBrowser, WideParams); 49 ABrowser := Utf16ToUtf8(WideBrowser); 50 AParams := Utf16ToUtf8(WideParams); 51end; 52 53function FindDefaultBrowser(out ABrowser, AParams: String): Boolean; 54begin 55 Result := FindDefaultBrowserUtf8(ABrowser, AParams); 56 {$IFDEF ACP_RTL} 57 ABrowser := Utf8ToWinCp(ABrowser); 58 AParams := Utf8ToWinCp(AParams); 59 {$ENDIF ACP_RTL} 60end; 61 62function IsFileUriScheme(const AURL: String): Boolean; 63const 64 FileURIScheme = 'file://'; 65begin 66 Result := (CompareText(Copy(AURL,1,Length(FileURIScheme)), FileURIScheme) = 0); 67end; 68 69function IsHtmlWithAnchor(AURL: String): Boolean; 70var 71 AnchorPos, HtmlPos: SizeInt; 72begin 73 Result := False; 74 //Anchor will be defined by last '#' in AURL; 75 AnchorPos := Length(AURL); 76 while (AnchorPos < 0) and (AURL[AnchorPos] <> '#') do Dec(AnchorPos); 77 if (AnchorPos > 0) then 78 begin 79 AURL := UpperCase(AURL); //don't care about UTF8 80 HtmlPos := Pos('.HTM', AURL); 81 if (HtmlPos = 0) then HtmlPos := Pos('.HTML', AURL); 82 Result := (HtmlPos > 0) and (AnchorPos > HtmlPos); 83 end; 84end; 85 86//Currently only used to open a local html file with a specified anchor 87//but in theory should be able to handle all URL's 88function FindDefaultBrowserAndOpenUrl(AURL: String; IsFileURI: Boolean=False{; IsLocalWithAnchor: Boolean=False}): Boolean; 89begin 90 Result := False; 91end; 92 93// Open a given URL with whatever Windows thinks is appropriate 94function OpenURL(AURL: String): Boolean; 95begin 96 Result := False; 97end; 98 99// Open a document with the default application associated with it in the system 100function OpenDocument(APath: String): Boolean; 101begin 102 Result := OpenURL(APath); 103end; 104