Launch the browser that is set in the gconf registry.
Don't blindly add "http://" to URL as this will not work with local file paths (obviously). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42591 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -727,9 +727,13 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
|
|||||||
wxUnusedVar(flags);
|
wxUnusedVar(flags);
|
||||||
|
|
||||||
// set the scheme of url to http if it does not have one
|
// set the scheme of url to http if it does not have one
|
||||||
|
// RR: This doesn't work if the url is just a local path
|
||||||
wxString url(urlOrig);
|
wxString url(urlOrig);
|
||||||
|
#if 0
|
||||||
if ( !wxURI(url).HasScheme() )
|
if ( !wxURI(url).HasScheme() )
|
||||||
url.Prepend(wxT("http://"));
|
url.Prepend(wxT("http://"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
|
|
||||||
@@ -842,8 +846,25 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
|
|||||||
wxLogDebug(wxT("ICStart error %d"), (int) err);
|
wxLogDebug(wxT("ICStart error %d"), (int) err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif wxUSE_MIMETYPE
|
#else
|
||||||
// Non-windows way
|
// (non-Mac, non-MSW)
|
||||||
|
|
||||||
|
#ifdef __UNIX__
|
||||||
|
if (wxTheApp->GetTraits()->GetDesktopEnvironment() == wxT("GNOME"))
|
||||||
|
{
|
||||||
|
wxArrayString errors;
|
||||||
|
wxArrayString output;
|
||||||
|
long res = wxExecute( wxT("gconftool-2 --get /desktop/gnome/applications/browser/exec"), output, errors, wxEXEC_NODISABLE );
|
||||||
|
if (res >= 0 && errors.GetCount() == 0)
|
||||||
|
{
|
||||||
|
wxString cmd = output[0];
|
||||||
|
cmd << _T(' ') << url;
|
||||||
|
if (wxExecute(cmd))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
wxString cmd;
|
wxString cmd;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user