From 8e8983862170a1bdbde5c3810a3ec8e0c8092db6 Mon Sep 17 00:00:00 2001 From: John Maguire Date: Mon, 12 Mar 2012 16:49:19 +0100 Subject: [PATCH] Support loading multiple files or a folder from dropping on the Mac dock icon. Fixes issue #2787 --- dist/Info.plist.in | 10 ++++++++++ src/core/mac_startup.mm | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/dist/Info.plist.in b/dist/Info.plist.in index edb8bcb01..5e026dec8 100644 --- a/dist/Info.plist.in +++ b/dist/Info.plist.in @@ -44,6 +44,16 @@ 30 CFBundleDocumentTypes + + CFBundleTypeOSTypes + + **** + fold + disk + + CFBundleTypeRole + Viewer + CFBundleTypeExtensions diff --git a/src/core/mac_startup.mm b/src/core/mac_startup.mm index 7aa45d3dd..f0aac3ce0 100644 --- a/src/core/mac_startup.mm +++ b/src/core/mac_startup.mm @@ -153,6 +153,7 @@ static BreakpadRef InitBreakpad() { qLog(Warning)<<"Media key monitoring disabled"; } + - (BOOL) application: (NSApplication*)app openFile:(NSString*)filename { qDebug() << "Wants to open:" << [filename UTF8String]; @@ -163,6 +164,14 @@ static BreakpadRef InitBreakpad() { return NO; } +- (void) application: (NSApplication*)app openFiles:(NSArray*)filenames { + qLog(Debug) << "Wants to open:"; + NSLog(@"%@", filenames); + [filenames enumerateObjectsUsingBlock:^(id object, NSUInteger idx, BOOL* stop) { + [self application:app openFile:(NSString*)object]; + }]; +} + - (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event { NSAssert([event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys, @"Unexpected NSEvent in mediaKeyTap:receivedMediaKeyEvent:");