// this check is useful to avoid that wxURI recognizes as scheme parts of
// the filename, in case urlOrig is a local filename
// (e.g. "C:\\test.txt" when parsed by wxURI reports a scheme == "C")
- bool hasValidScheme = uri.HasScheme() &&
- (uri.GetScheme() == "http" || uri.GetScheme() == "file");
+ bool hasValidScheme = uri.HasScheme() && uri.GetScheme().length() > 1;
#if defined(__WXMSW__)
//
// for (int i=0; i<2; i++)
// {
+ // // test arguments without a valid URL scheme:
// wxLaunchDefaultBrowser("C:\\test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW);
// wxLaunchDefaultBrowser("wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW);
+ //
+ // // test arguments with different valid schemes:
// wxLaunchDefaultBrowser("file:/C%3A/test.txt", i==0 ? 0 : wxBROWSER_NEW_WINDOW);
// wxLaunchDefaultBrowser("http://wxwidgets.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW);
+ // wxLaunchDefaultBrowser("mailto:user@host.org", i==0 ? 0 : wxBROWSER_NEW_WINDOW);
// }
// (assuming you have a C:\test.txt file)
if ( uri.GetScheme() == "file" )
{
- // ShellExecuteEx() doesn't like the "file" scheme when opening local files;
+ // TODO: extract URLToFileName() to some always compiled in
+ // function
+#if wxUSE_FILESYSTEM
+ // ShellExecuteEx() doesn't like the "file" scheme when opening local files;
// remove it
url = wxFileSystem::URLToFileName(url).GetFullPath();
+#endif // wxUSE_FILESYSTEM
}
}
int wxMessageBox(const wxString& message, const wxString& caption, long style,
wxWindow *parent, int WXUNUSED(x), int WXUNUSED(y) )
{
- long decorated_style = style;
-
- if ( ( style & ( wxICON_EXCLAMATION | wxICON_HAND | wxICON_INFORMATION | wxICON_QUESTION ) ) == 0 )
+ // add the appropriate icon unless this was explicitly disabled by use of
+ // wxICON_NONE
+ if ( !(style & wxICON_NONE) && !(style & wxICON_MASK) )
{
- decorated_style |= ( style & wxYES ) ? wxICON_QUESTION : wxICON_INFORMATION ;
+ style |= style & wxYES ? wxICON_QUESTION : wxICON_INFORMATION;
}
- wxMessageDialog dialog(parent, message, caption, decorated_style);
+ wxMessageDialog dialog(parent, message, caption, style);
int ans = dialog.ShowModal();
switch ( ans )