mirror of https://gitlab.com/basile.b/dexed.git
use openURL from LCLIntf, close #295
This commit is contained in:
parent
e0368618f0
commit
feec564a35
|
@ -312,12 +312,6 @@ type
|
||||||
*)
|
*)
|
||||||
procedure deleteDups(strings: TStrings);
|
procedure deleteDups(strings: TStrings);
|
||||||
|
|
||||||
(**
|
|
||||||
* like LCLIntf eponymous function but includes a woraround that's gonna
|
|
||||||
* be in Lazarus from version 1.8 (anchor + file:/// protocol under win).
|
|
||||||
*)
|
|
||||||
function openUrl(const value: string): boolean;
|
|
||||||
|
|
||||||
procedure tryRaiseFromStdErr(proc: TProcess);
|
procedure tryRaiseFromStdErr(proc: TProcess);
|
||||||
|
|
||||||
// Converts all leading whites to spaces. Tabs takes width * spaces.
|
// Converts all leading whites to spaces. Tabs takes width * spaces.
|
||||||
|
@ -1323,58 +1317,6 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function openUrl(const value: string): boolean;
|
|
||||||
{$IFDEF WINDOWS}
|
|
||||||
function GetDefaultBrowserForCurrentUser: String;
|
|
||||||
begin
|
|
||||||
result := '';
|
|
||||||
with TRegistry.Create do
|
|
||||||
try
|
|
||||||
RootKey := HKEY_CURRENT_USER;
|
|
||||||
if OpenKeyReadOnly('Software\Classes\http\shell\open\command') then
|
|
||||||
begin
|
|
||||||
result := ReadString('');
|
|
||||||
CloseKey;
|
|
||||||
end;
|
|
||||||
finally
|
|
||||||
Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
var
|
|
||||||
browser: string;
|
|
||||||
i: integer = 2;
|
|
||||||
{$ENDIF}
|
|
||||||
begin
|
|
||||||
{$IFNDEF WINDOWS}
|
|
||||||
result := LCLIntf.OpenURL(value);
|
|
||||||
{$ELSE}
|
|
||||||
if pos('file://', value) = 0 then
|
|
||||||
result := LCLIntf.OpenURL(value)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
browser := GetDefaultBrowserForCurrentUser;
|
|
||||||
if browser.isEmpty then
|
|
||||||
result := LCLIntf.OpenURL(value)
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if browser[1] = '"' then
|
|
||||||
begin
|
|
||||||
while browser[i] <> '"' do
|
|
||||||
begin
|
|
||||||
if i > browser.length then
|
|
||||||
break;
|
|
||||||
i += 1;
|
|
||||||
end;
|
|
||||||
if i <= browser.length then
|
|
||||||
browser := browser[1..i];
|
|
||||||
end;
|
|
||||||
result := ShellExecuteW(0, 'open', PWideChar(WideString(browser)),
|
|
||||||
PWideChar(WideString(value)), nil, SW_SHOWNORMAL) > 32;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure tryRaiseFromStdErr(proc: TProcess);
|
procedure tryRaiseFromStdErr(proc: TProcess);
|
||||||
var
|
var
|
||||||
str: string = '';
|
str: string = '';
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
StdCtrls, AnchorDocking, AnchorDockStorage, AnchorDockOptionsDlg, Controls,
|
StdCtrls, AnchorDocking, AnchorDockStorage, AnchorDockOptionsDlg, Controls,
|
||||||
Graphics, strutils, Dialogs, Menus, ActnList, ExtCtrls, process,
|
Graphics, strutils, Dialogs, Menus, ActnList, ExtCtrls, process,
|
||||||
{$IFDEF WINDOWS}Windows, {$ENDIF} XMLPropStorage, SynExportHTML, fphttpclient,
|
{$IFDEF WINDOWS}Windows, {$ENDIF} XMLPropStorage, SynExportHTML, fphttpclient,
|
||||||
fpjson, jsonparser, jsonscanner,
|
fpjson, jsonparser, jsonscanner, LCLIntf,
|
||||||
ce_common, ce_ceproject, ce_synmemo, ce_writableComponent,
|
ce_common, ce_ceproject, ce_synmemo, ce_writableComponent,
|
||||||
ce_widget, ce_messages, ce_interfaces, ce_editor, ce_projinspect, ce_ceprojeditor,
|
ce_widget, ce_messages, ce_interfaces, ce_editor, ce_projinspect, ce_ceprojeditor,
|
||||||
ce_search, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist, ce_observer,
|
ce_search, ce_miniexplorer, ce_libman, ce_libmaneditor, ce_todolist, ce_observer,
|
||||||
|
@ -2007,7 +2007,7 @@ begin
|
||||||
begin
|
begin
|
||||||
if dlgYesNo('An new release is available, do you wish to visit the release page ?' +
|
if dlgYesNo('An new release is available, do you wish to visit the release page ?' +
|
||||||
lineEnding + '(' + url +')') = mrYes then
|
lineEnding + '(' + url +')') = mrYes then
|
||||||
openUrl(url);
|
OpenURL(url);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -9,7 +9,7 @@ uses
|
||||||
SynEdit, SynPluginSyncroEdit, SynCompletion, SynEditKeyCmds, LazSynEditText,
|
SynEdit, SynPluginSyncroEdit, SynCompletion, SynEditKeyCmds, LazSynEditText,
|
||||||
SynHighlighterLFM, SynEditHighlighter, SynEditMouseCmds, SynEditFoldedView,
|
SynHighlighterLFM, SynEditHighlighter, SynEditMouseCmds, SynEditFoldedView,
|
||||||
SynEditMarks, SynEditTypes, SynHighlighterJScript, SynBeautifier, dialogs,
|
SynEditMarks, SynEditTypes, SynHighlighterJScript, SynBeautifier, dialogs,
|
||||||
md5, Spin,
|
md5, Spin, LCLIntf,
|
||||||
//SynEditMarkupFoldColoring,
|
//SynEditMarkupFoldColoring,
|
||||||
Clipbrd, fpjson, jsonparser, LazUTF8, LazUTF8Classes, Buttons, StdCtrls,
|
Clipbrd, fpjson, jsonparser, LazUTF8, LazUTF8Classes, Buttons, StdCtrls,
|
||||||
ce_common, ce_writableComponent, ce_d2syn, ce_txtsyn, ce_dialogs, ce_dastworx,
|
ce_common, ce_writableComponent, ce_d2syn, ce_txtsyn, ce_dialogs, ce_dastworx,
|
||||||
|
|
Loading…
Reference in New Issue