From f8f59e97fb06149528a180c5964c9abb27e079a1 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Mon, 8 Jan 2007 13:20:19 +0000 Subject: [PATCH] * support/os_unix.C (canAutoOpen, autoOpenFile): on Mac OS X, use 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 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/support/os_unix.C b/src/support/os_unix.C index fb266089fc..03efbdd3b0 100644 --- a/src/support/os_unix.C +++ b/src/support/os_unix.C @@ -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); -- 2.39.2