]> git.saurik.com Git - wxWidgets.git/commitdiff
try http scheme if we can't find the default browser for the URL scheme (this is...
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Oct 2006 01:01:13 +0000 (01:01 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Oct 2006 01:01:13 +0000 (01:01 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/utilscmn.cpp

index 6a37b6ec9ba1a293f5b3103ce51ba0052353ffce..d06002274f5ad5773def5fa334183ab621cbb3dc 100644 (file)
@@ -729,7 +729,8 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
     // 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);
-    if ( !wxURI(url).HasScheme() )
+    wxURI uri(url);
+    if ( !uri.HasScheme() )
         url.Prepend(wxT("http://"));
 
 
@@ -740,7 +741,13 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
     {
         // ShellExecuteEx() opens the URL in an existing window by default so
         // we can't use it if we need a new window
-        wxRegKey key(wxRegKey::HKCR, url.BeforeFirst(':') + _T("\\shell\\open"));
+        wxRegKey key(wxRegKey::HKCR, uri.GetScheme() + _T("\\shell\\open"));
+        if ( !key.Exists() )
+        {
+            // try default browser, it must be registered at least for http URLs
+            key.SetName(wxRegKey::HKCR, _T("http\\shell\\open"));
+        }
+
         if ( key.Exists() )
         {
             wxRegKey keyDDE(key, wxT("DDEExec"));