Fix for broken wxMSWUniv after wxLaunchDefaultBrowser introduction. Source cleaning (should not happen in new code).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2005-04-25 15:51:57 +00:00
parent 3bce55ac06
commit 657a7545e0

View File

@@ -539,7 +539,8 @@ bool wxLaunchDefaultBrowser(const wxString& url)
if(wxURI(url).IsReference()) if(wxURI(url).IsReference())
finalurl = wxString(wxT("http://")) + url; finalurl = wxString(wxT("http://")) + url;
#ifdef __WINDOWS__ #if defined(__WXMSW__) && wxUSE_CONFIG_NATIVE
wxString command; wxString command;
// ShellExecute() always opens in the same window, // ShellExecute() always opens in the same window,
@@ -560,10 +561,10 @@ bool wxLaunchDefaultBrowser(const wxString& url)
// this is a bit naive but should work as -1 can't appear // this is a bit naive but should work as -1 can't appear
// elsewhere in the DDE topic, normally // elsewhere in the DDE topic, normally
if ( ddeCmd.Replace(wxT("-1"), wxT("0"), if ( ddeCmd.Replace(wxT("-1"), wxT("0"),
FALSE /* only first occurence */) == 1 ) false /* only first occurence */) == 1 )
{ {
// and also replace the parameters // and also replace the parameters
if ( ddeCmd.Replace(wxT("%1"), url, FALSE) == 1 ) if ( ddeCmd.Replace(wxT("%1"), url, false) == 1 )
{ {
// magic incantation understood by wxMSW // magic incantation understood by wxMSW
command << wxT("WX_DDE#") command << wxT("WX_DDE#")
@@ -626,18 +627,17 @@ bool wxLaunchDefaultBrowser(const wxString& url)
if (nResult <= HINSTANCE_ERROR && nResult != SE_ERR_FNF) if (nResult <= HINSTANCE_ERROR && nResult != SE_ERR_FNF)
return false; return false;
# ifdef __WXDEBUG__ #ifdef __WXDEBUG__
// Log something if SE_ERR_FNF happens // Log something if SE_ERR_FNF happens
if(nResult == SE_ERR_FNF) if(nResult == SE_ERR_FNF)
wxLogDebug(wxT("Got SE_ERR_FNF from ShellExecute - maybe FireFox")); wxLogDebug(wxT("Got SE_ERR_FNF from ShellExecute - maybe FireFox"));
# endif #endif
} }
#else #elif wxUSE_MIMETYPE
#if wxUSE_MIMETYPE
// Non-windows way // Non-windows way
wxFileType *ft = wxFileType *ft = wxTheMimeTypesManager->GetFileTypeFromExtension (_T("html"));
wxTheMimeTypesManager->GetFileTypeFromExtension (_T("html"));
if (!ft) if (!ft)
{ {
wxLogError(_T("No default application can open .html extension")); wxLogError(_T("No default application can open .html extension"));
@@ -648,10 +648,7 @@ bool wxLaunchDefaultBrowser(const wxString& url)
ft->GetMimeType(&mt); ft->GetMimeType(&mt);
wxString cmd; wxString cmd;
bool ok = bool ok = ft->GetOpenCommand (&cmd, wxFileType::MessageParameters(finalurl));
ft->GetOpenCommand (&cmd,
wxFileType::MessageParameters (finalurl.c_str(),
_T("")));
delete ft; delete ft;
if (ok) if (ok)
@@ -664,9 +661,10 @@ bool wxLaunchDefaultBrowser(const wxString& url)
} }
else else
return false; return false;
#else
#else // !wxUSE_MIMETYPE && !(WXMSW && wxUSE_NATIVE_CONFIG)
return false; return false;
#endif //!wxUSE_MIMETYPE
#endif #endif