1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-18 20:34:39 +01:00

Support loading multiple files or a folder from dropping on the Mac dock icon.

Fixes issue #2787
This commit is contained in:
John Maguire 2012-03-12 16:49:19 +01:00
parent 287b3fcb1f
commit 8e89838621
2 changed files with 19 additions and 0 deletions

10
dist/Info.plist.in vendored
View File

@ -44,6 +44,16 @@
<string>30</string> <string>30</string>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
<string>fold</string>
<string>disk</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
</dict>
<dict> <dict>
<key>CFBundleTypeExtensions</key> <key>CFBundleTypeExtensions</key>
<array> <array>

View File

@ -153,6 +153,7 @@ static BreakpadRef InitBreakpad() {
qLog(Warning)<<"Media key monitoring disabled"; qLog(Warning)<<"Media key monitoring disabled";
} }
- (BOOL) application: (NSApplication*)app openFile:(NSString*)filename { - (BOOL) application: (NSApplication*)app openFile:(NSString*)filename {
qDebug() << "Wants to open:" << [filename UTF8String]; qDebug() << "Wants to open:" << [filename UTF8String];
@ -163,6 +164,14 @@ static BreakpadRef InitBreakpad() {
return NO; 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 { - (void) mediaKeyTap: (SPMediaKeyTap*)keyTap receivedMediaKeyEvent:(NSEvent*)event {
NSAssert([event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys, @"Unexpected NSEvent in mediaKeyTap:receivedMediaKeyEvent:"); NSAssert([event type] == NSSystemDefined && [event subtype] == SPSystemDefinedEventMediaKeys, @"Unexpected NSEvent in mediaKeyTap:receivedMediaKeyEvent:");