Use OS4.1 Update 1 launch-handler when available. Will fall back to OpenURL.library

even if URL: is dismounted while NetSurf is running.
Installation adds the lines to configure launch-handler to open URLs in NetSurf.

svn path=/trunk/netsurf/; revision=9835
This commit is contained in:
Chris Young 2010-01-16 15:53:00 +00:00
parent a653376911
commit 8dd9aa4e21
5 changed files with 101 additions and 18 deletions

84
amiga/dist/Install vendored
View File

@ -13,6 +13,36 @@
)
)
; The below procedure is part of "fitr", see
; http://www.unsatisfactorysoftware.co.uk/fitr
(procedure p_fitr #filename #text #comment #flags
(set #comstring "")
(if #comment (set #comstring (cat "COMMENT=\"" #comment "\"")))
(set #comment "")
(set #switches "")
(if #flags (set #switches (cat " " #flags)))
(set #flags "")
(if #text
(
(transcript "Adding " @app-name " section to " #filename)
(textfile
(dest "t:fitr-installer.tmp")
(append #text)
)
(run (cat "fitr \"" #filename "\" \"" @app-name "\" t:fitr-installer.tmp " #comstring #switches))
(delete "t:fitr-installer.tmp")
)
;else
(
(transcript "Removing " @app-name " section from " #filename)
(run (cat "fitr \"" #filename "\" \"" @app-name "\" " #comstring #switches))
)
)
)
(procedure p_failedsobjs
(if #failedsobjs
(message "The following shared objects failed to copy. These will be updated on next reboot.\n\n" #failedsobjs)
@ -186,6 +216,7 @@
)
(if (= @app-name "NetSurfAutoInstall") (set #AutoInstall 1))
(set @app-name "NetSurf")
(if (<> #AutoInstall 1) (welcome))
@ -221,15 +252,6 @@
)
)
(set #cairo-version 1)
(set #netsurf-exists (exists (tackon @default-dest "NetSurf")))
(if (<> #netsurf-exists 0)
(
; Guess if the installed version is static, if it
; is bigger than 5MB then it probably is!
(set #netsurf-size (getsize (tackon @default-dest "NetSurf")))
(if (> #netsurf-size 5000000) (set #cairo-version 0))
)
)
)
; else
(
@ -287,16 +309,37 @@
)
)
(complete 19)
(if (>= osver 53)
(
(set #addlaunchhandler
(askbool
(prompt "Add NetSurf to launch-handler? (recommended)\n\n"
"Please select \"No\" if NetSurf is already added to "
"launch-handler, as this avoids duplication.")
(help "launch-handler is part of OS4.1 which opens URLs "
" by launching a web browser.\n\n"
"The installation will update the configuration of "
"OS4.1 to allow URLs to be opened by NetSurf.")
)
)
)
;else
(
(set #addlaunchhandler 0)
)
)
(complete 20)
(set #netsurf-name (select #cairo-version "NetSurf" "NetSurf_Cairo"))
(if (= #AutoInstall 0)
(
(copylib
(prompt "Please check the version of NetSurf you are copying against "
"any which might already be installed.")
(help @copylib-help)
(copyfiles
(prompt "Copying NetSurf...")
(help @copyfiles-help)
(source #netsurf-name)
(dest @default-dest)
(newname "NetSurf")
@ -419,6 +462,21 @@
(p_setmimetype "lha" "application/x-lha")
(p_setmimetype "zip" "application/x-zip")
(complete 98)
(if #addlaunchhandler
(
; We use fitr here so that the sections are only added once.
; Unfortunately saving URL prefs overwrites the markers making it
; necessary to ask whether the user wants to add NetSurf to launch-handler.
(working "Adding NetSurf to launch-handler config")
(p_fitr "ENVARC:launch-handler/URL/FILE.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"*\"file:///%s*\"\"")
(p_fitr "ENVARC:launch-handler/URL/HTTP.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"*\"http://%s*\"\"")
(p_fitr "ENVARC:launch-handler/URL/HTTPS.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"*\"https://%s*\"\"")
(p_fitr "ENVARC:launch-handler/URL/WWW.LH" "ClientName=\"NETSURF\" ClientPath=\"APPDIR:NETSURF\" CMDFORMAT=\"*\"http://www.%s*\"\"")
)
)
(complete 100)
(if (= #AutoInstall 1)

Binary file not shown.

View File

@ -13,6 +13,7 @@ http://www.netsurf-browser.org
@{"Options file " link Options}
@{"Fonts " link Fonts}
@{"ARexx port " link ARexx}
@{"OpenURL/URL Prefs " link OpenURL}
@{"Hotlist menu " link Hotlist}
@{"Local MIME types " link MIMETypes}
@ -78,9 +79,10 @@ Commands are:
@{b}VERSION VERSION/N REVISION/N RELEASE/S@{ub} Returns the current version of NetSurf in RESULT. You can also do version checking by supplying a VERSION and optional REVISION to check against. If the version of NetSurf is the same or higher 1 will be returned, if it is older 0. If RELEASE is specified, the command operates on the release version rather than the internal version number.
The ARexx menu will be populated with scripts named #?.nsrx in @{"arexx_dir" link options 9}, up to a maximum of 20 entries. The titles of these entries will be the comments field of the file (or the filename if comments field is empty).
@endnode
@{u}OpenURL configuration@{uu}
@node OpenURL
@{b}OpenURL configuration@{ub}
Click Add on the Browsers page and fill in the details as follows:
Name: NetSurf
@ -92,6 +94,12 @@ Open URL: OPEN "%u"
New window: OPEN "%u" NEW
On the Misc tab, please ensure "Send mailto: URLs to email application" is set.
@{b}URL Prefs (OS4.1)@{ub}
Under OS4.1 Update 1, launch-handler is used in preference to OpenURL. The
Installer script can add the relevant configuration to launch URLs in NetSurf.
Please ensure your email application is configured in URL Prefs for mailto:
links clicked within NetSurf.
@endnode
@node hotlist "Hotlist menu"

View File

@ -22,6 +22,8 @@
#include <string.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/utility.h>
#include <proto/openurl.h>
struct Library *OpenURLBase;
@ -51,6 +53,20 @@ void gui_launch_url(const char *url)
{
if(!strncmp("mailto:",url,7))
{
if(IOpenURL) URL_OpenA(url,NULL);
APTR procwin = SetProcWindow((APTR)-1L);
char *launchurl = NULL;
BPTR fptr = 0;
launchurl = ASPrintf("URL:%s",url);
if(launchurl && (fptr = Open(launchurl,MODE_OLDFILE)))
{
Close(fptr);
}
else if(IOpenURL)
URL_OpenA(url,NULL);
FreeVec(launchurl);
SetProcWindow(procwin);
}
}

View File

@ -17,9 +17,10 @@ copy NetSurf ram:NetSurf/NetSurf
copy NetSurf_Cairo ram:NetSurf/NetSurf_Cairo
copy amiga/dist/AutoInstall ram:
copy amiga/dist/~(.svn|AutoInstall) ram:NetSurf/
copy amiga/pkg/fitr ram:NetSurf/
makedir ram:NetSurf/Rexx
copy amiga/dist/Rexx/~(.svn) ram:NetSurf/Rexx/ COM
makedir ram:NetSurf/SObjs
copy sobjs:libjpeg.so sobjs:libexpat.so sobjs:libhubbub.so.0 sobjs:libhpdf-2.2.0.so.0.0 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so sobjs:libparserutils.so.0 sobjs:libnsgif.so.0 sobjs:libnsbmp.so.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libcurl.so sobjs:libsvgtiny.so.0 ram:NetSurf/SObjs clone
;sobjs:libssl-0.9.8.so
copy sobjs:libjpeg.so sobjs:libhubbub.so.0 sobjs:libhpdf-2.2.0.so.0.0 sobjs:libmng.so.1 sobjs:liblcms.so sobjs:libxml2.so sobjs:libparserutils.so.0 sobjs:libnsgif.so.0 sobjs:libnsbmp.so.0 sobjs:libcss.so.0 sobjs:libwapcaplet.so.0 sobjs:libcurl.so sobjs:libsvgtiny.so.0 ram:NetSurf/SObjs clone
;sobjs:libssl-0.9.8.so sobjs:libexpat.so
;sobjs:libgcc.so sobjs:libc.so sobjs:libpthread.so