From 6ddb2476891f5450a054423b1f9e1c863fec15af Mon Sep 17 00:00:00 2001 From: Eric Petit Date: Fri, 10 Feb 2006 20:46:44 +0000 Subject: [PATCH] Reject dropped files which aren't .torrent files. "Retarget" the drop at the bottom of the list. --- macosx/Controller.m | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index e0e28ad53..394c4c268 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -650,17 +650,8 @@ static void sleepCallBack( void * controller, io_service_t y, (id ) info row: (int) row dropOperation: (NSTableViewDropOperation) operation { - NSPasteboard * pasteboard; - - pasteboard = [info draggingPasteboard]; - if( ![[pasteboard types] containsObject: NSFilenamesPboardType] ) - { - return NO; - } - - [self application: NSApp openFiles: - [pasteboard propertyListForType: NSFilenamesPboardType]]; - + [self application: NSApp openFiles: [[info draggingPasteboard] + propertyListForType: NSFilenamesPboardType]]; return YES; } @@ -668,6 +659,15 @@ static void sleepCallBack( void * controller, io_service_t y, (id ) info proposedRow: (int) row proposedDropOperation: (NSTableViewDropOperation) operation { + NSPasteboard * pasteboard = [info draggingPasteboard]; + + if (![[pasteboard types] containsObject: NSFilenamesPboardType] + || [[[pasteboard propertyListForType: NSFilenamesPboardType] + pathsMatchingExtensions: [NSArray arrayWithObject: @"torrent"]] + count] == 0) + return NSDragOperationNone; + + [fTableView setDropRow: fCount dropOperation: NSTableViewDropAbove]; return NSDragOperationGeneric; }