]> git.lyx.org Git - lyx.git/commitdiff
* support/os_unix.C (canAutoOpen, autoOpenFile): on Mac OS X, use
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 8 Jan 2007 13:20:19 +0000 (13:20 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 8 Jan 2007 13:20:19 +0000 (13:20 +0000)
the role kLSRolesAll for both edito and viewer, since it is what
the finder does.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16602 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/os_unix.C

index fb266089fc9bb87a0688127842e14ca14a2d41eb..03efbdd3b037ed239d1defaecb415e56e2a5f834 100644 (file)
@@ -126,7 +126,11 @@ bool canAutoOpenFile(string const & ext, auto_open_mode const mode)
        CFStringRef cfs_ext = CFStringCreateWithBytes(kCFAllocatorDefault,
                                        (UInt8 *) ext.c_str(), ext.length(),
                                        kCFStringEncodingISOLatin1, false);
-       LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
+       // this is what we would like to do but it seems that the
+       // viewer for PDF is often quicktime...
+       //LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
+       (void)mode;
+       LSRolesMask role = kLSRolesAll;
        FSRef outAppRef;
        OSStatus status = 
                LSGetApplicationForInfo(kLSUnknownType, kLSUnknownCreator,
@@ -150,13 +154,17 @@ bool autoOpenFile(string const & filename, auto_open_mode const mode)
 {
 #ifdef __APPLE__
 // Reference: http://developer.apple.com/documentation/Carbon/Reference/LaunchServicesReference/
-    FSRef fileref;
-    OSStatus status = 
-        FSPathMakeRef((UInt8 *) filename.c_str(), &fileref, NULL);
-    if (status != 0)
-        return false;
+       FSRef fileref;
+       OSStatus status = 
+               FSPathMakeRef((UInt8 *) filename.c_str(), &fileref, NULL);
+       if (status != 0)
+               return false;
         
-       LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
+       // this is what we would like to do but it seems that the
+       // viewer for PDF is often quicktime...
+       //LSRolesMask role = (mode == VIEW) ? kLSRolesViewer :  kLSRolesEditor;
+       (void)mode;
+       LSRolesMask role = kLSRolesAll;
        FSRef outAppRef;
 
        status = LSGetApplicationForItem(&fileref, role, &outAppRef, NULL);