From 6d7be43cb7f06433dec345270880e440ab7829f6 Mon Sep 17 00:00:00 2001 From: graemeg Date: Tue, 25 Mar 2008 08:41:03 +0000 Subject: * Added Antonio Sanguigni new TfpgHyperLabel component to fpGUI. I converted his gui_browser class to a fpgOpenURL function. --- src/corelib/x11/gfx_utils_impl.inc | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/corelib/x11') diff --git a/src/corelib/x11/gfx_utils_impl.inc b/src/corelib/x11/gfx_utils_impl.inc index 0f341df4..41e5233d 100644 --- a/src/corelib/x11/gfx_utils_impl.inc +++ b/src/corelib/x11/gfx_utils_impl.inc @@ -1,5 +1,8 @@ {%mainunit gfx_utils.pas} +uses + Unix; + // X11 specific filesystem implementations of encoding functions function fpgToOSEncoding(aString: TfpgString): string; @@ -12,4 +15,26 @@ begin Result := aString; end; +procedure fpgOpenURL(const aURL: TfpgString); +var + Helper: string; +begin +//TODO: Catch "which" command output to run the browser from there + Helper := ''; + if FileExists('/etc/alternatives/x-www-browser') then + Helper := '/etc/alternatives/x-www-browser' + else + begin + if fpsystem('which opera') = 0 then + Helper := 'opera'; + if fpsystem('which mozilla') = 0 then + Helper := 'mozilla'; + if fpsystem('which konqueror') = 0 then + Helper := 'konqueror'; + if fpsystem('which firefox') = 0 then + Helper := 'firefox'; + end; + + fpSystem(Helper + ' ' + aURL + '&'); +end; -- cgit v1.2.3-70-g09d2