1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-02-04 13:32:19 +00:00

dragging onto the window will now work for files with the extension "torrent" regardless of its case

This commit is contained in:
Mitchell Livingston 2006-07-07 22:31:30 +00:00
parent 8c8993ce97
commit dcef8bbc31

View file

@ -1216,8 +1216,11 @@ static void sleepCallBack(void * controller, io_service_t y,
NSPasteboard * pasteboard = [info draggingPasteboard];
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
{
if ([[[pasteboard propertyListForType: NSFilenamesPboardType]
pathsMatchingExtensions: [NSArray arrayWithObject: @"torrent"]] count] > 0)
//check if any files to add have "torrent" as an extension
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
NSString * file;
while ((file = [enumerator nextObject]))
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
{
[fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
return NSDragOperationGeneric;
@ -1238,8 +1241,18 @@ static void sleepCallBack(void * controller, io_service_t y,
{
NSPasteboard * pasteboard = [info draggingPasteboard];
if ([[pasteboard types] containsObject: NSFilenamesPboardType])
[self application: NSApp openFiles: [[[info draggingPasteboard] propertyListForType: NSFilenamesPboardType]
pathsMatchingExtensions: [NSArray arrayWithObject: @"torrent"]]];
{
//create an array of files with the "torrent" extension
NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
NSString * file;
while ((file = [enumerator nextObject]))
if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
[filesToOpen addObject: file];
[self application: NSApp openFiles: filesToOpen];
[filesToOpen release];
}
else
{
//remember selected rows if needed