]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/utilscmn.cpp
compilation fix for PCH-less build after last commit
[wxWidgets.git] / src / common / utilscmn.cpp
index 2e8c64bfe64d7ec16e945346689ee98a3eb0f290..fad395b80079a8df48bd3eb997964541ec88b14b 100644 (file)
 #endif // ! __WXPALMOS5__
 
 #ifdef __WXMAC__
-#include "wx/mac/private.h"
-#ifndef __DARWIN__
-#include "InternetConfig.h"
-#endif
+#include "wx/osx/private.h"
 #endif
 
 #ifndef __WXPALMOS5__
@@ -936,6 +933,32 @@ void wxQsort(void *const pbase, size_t total_elems,
 
 #if wxUSE_GUI
 
+// ----------------------------------------------------------------------------
+// Launch document with default app
+// ----------------------------------------------------------------------------
+
+bool wxLaunchDefaultApplication(const wxString &document, int flags)
+{
+    wxUnusedVar(flags);
+    
+#ifdef __UNIX__
+    // Our best best is to use xdg-open from freedesktop.org cross-desktop
+    // compatibility suite xdg-utils
+    // (see http://portland.freedesktop.org/wiki/) -- this is installed on
+    // most modern distributions and may be tweaked by them to handle
+    // distribution specifics.
+    wxString path, xdg_open;
+    if ( wxGetEnv("PATH", &path) &&
+         wxFindFileInPath(&xdg_open, path, "xdg-open") )
+    {
+        if ( wxExecute(xdg_open + " " + document) )
+            return true;
+    }
+#endif
+
+   return false;
+}
+
 // ----------------------------------------------------------------------------
 // Launch default browser
 // ----------------------------------------------------------------------------
@@ -1054,7 +1077,7 @@ bool wxLaunchDefaultBrowser(const wxString& urlOrig, int flags)
     // NOTE: We need to call the real implementation from src/cocoa/utils.mm
     // because the code must use Objective-C features.
     return wxCocoaLaunchDefaultBrowser(url, flags);
-#elif defined(__WXMAC__)
+#elif defined(__WXMAC__) && !defined(__WXOSX_IPHONE__)
     wxCFRef< CFURLRef > curl( CFURLCreateWithString( kCFAllocatorDefault,
             wxCFStringRef( url ), NULL ) );
     OSStatus err = LSOpenCFURLRef( curl , NULL );