Cog/Spotlight/SpotlightPlaylistController.m
Christopher Snowhill 2c2a058126 Cog now requires macOS 10.13 as a minimum version
All optional fallback code for older versions has also been removed, and
everything now assumes 10.13.0 or newer. Some cases are still included
for point releases, such as 10.13.2.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-23 23:23:07 -07:00

42 lines
1.3 KiB
Objective-C

//
// SpotlightPlaylistController.m
// Cog
//
// Created by Matthew Grinshpun on 13/02/08.
// Copyright 2008 Matthew Leon Grinshpun. All rights reserved.
//
#import "SpotlightPlaylistController.h"
#import "SpotlightWindowController.h"
@implementation SpotlightPlaylistController
// Allow drag and drop from Spotlight into main playlist
- (BOOL)tableView:(NSTableView *)tv
writeRowsWithIndexes:(NSIndexSet *)rowIndexes
toPasteboard:(NSPasteboard *)pboard {
[spotlightWindowController.query disableUpdates];
NSArray *urls = [[self selectedObjects] valueForKey:@"URL"];
NSError *error = nil;
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:urls
requiringSecureCoding:YES
error:&error];
if(error) return NO;
[pboard declareTypes:@[CogUrlsPboardType] owner:nil]; // add it to pboard
[pboard setData:data forType:CogUrlsPboardType];
[spotlightWindowController.query enableUpdates];
return YES;
}
// Do not accept drag operations, necessary as long as this class inherits from PlaylistController
- (NSDragOperation)tableView:(NSTableView *)tv
validateDrop:(id<NSDraggingInfo>)info
proposedRow:(NSInteger)row
proposedDropOperation:(NSTableViewDropOperation)op {
return NSDragOperationNone;
}
@end