Changeset 546


Ignore:
Timestamp:
Jul 7, 2006, 10:31:30 PM (16 years ago)
Author:
livings124
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r545 r546  
    12171217    if ([[pasteboard types] containsObject: NSFilenamesPboardType])
    12181218    {
    1219         if ([[[pasteboard propertyListForType: NSFilenamesPboardType]
    1220             pathsMatchingExtensions: [NSArray arrayWithObject: @"torrent"]] count] > 0)
    1221         {
    1222             [fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
    1223             return NSDragOperationGeneric;
    1224         }
     1219        //check if any files to add have "torrent" as an extension
     1220        NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
     1221        NSString * file;
     1222        while ((file = [enumerator nextObject]))
     1223            if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     1224            {
     1225                [fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
     1226                return NSDragOperationGeneric;
     1227            }
    12251228    }
    12261229    else if ([[pasteboard types] containsObject: TORRENT_TABLE_VIEW_DATA_TYPE])
     
    12391242    NSPasteboard * pasteboard = [info draggingPasteboard];
    12401243    if ([[pasteboard types] containsObject: NSFilenamesPboardType])
    1241         [self application: NSApp openFiles: [[[info draggingPasteboard] propertyListForType: NSFilenamesPboardType]
    1242             pathsMatchingExtensions: [NSArray arrayWithObject: @"torrent"]]];
     1244    {
     1245        //create an array of files with the "torrent" extension
     1246        NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
     1247        NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
     1248        NSString * file;
     1249        while ((file = [enumerator nextObject]))
     1250            if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     1251                [filesToOpen addObject: file];
     1252   
     1253        [self application: NSApp openFiles: filesToOpen];
     1254        [filesToOpen release];
     1255    }
    12431256    else
    12441257    {
Note: See TracChangeset for help on using the changeset viewer.