Changeset 1874


Ignore:
Timestamp:
May 17, 2007, 11:14:53 PM (15 years ago)
Author:
livings124
Message:

allow torrent files not ending in .torrent to be opened by dragging to the window

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Badger.m

    r1873 r1874  
    125125   
    126126    NSImage * dockIcon = nil;
    127     BOOL speedBadge;
    128     if (speedBadge = (uploadRateString || downloadRateString))
     127    BOOL speedChange;
     128    if (speedChange = (uploadRateString || downloadRateString))
    129129    {
    130130        dockIcon = [fDockIcon copy];
     
    172172   
    173173    //update dock badge
    174     if (baseChange || fSpeedBadge || speedBadge)
     174    if (baseChange || fSpeedBadge || speedChange)
    175175    {
    176176        if (!dockIcon)
     
    178178        [NSApp setApplicationIconImage: dockIcon];
    179179        [dockIcon release];
    180     }
    181     fSpeedBadge = speedBadge;
     180       
     181        fSpeedBadge = speedChange;
     182    }
    182183   
    183184    [fLock unlock];
  • trunk/macosx/Controller.m

    r1873 r1874  
    20082008    if ([[pasteboard types] containsObject: NSFilenamesPboardType])
    20092009    {
    2010         //check if any files to add have "torrent" as an extension
     2010        //check if any files can be added
    20112011        NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
    20122012        NSString * file;
    20132013        while ((file = [enumerator nextObject]))
    2014             if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     2014        {
     2015            tr_torrent_t * tempTor;
     2016            int error;
     2017            if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
    20152018            {
     2019                tr_torrentClose(fLib, tempTor);
     2020               
    20162021                [fTableView setDropRow: -1 dropOperation: NSTableViewDropOn];
    20172022                return NSDragOperationGeneric;
    20182023            }
     2024        }
    20192025    }
    20202026    else if ([[pasteboard types] containsObject: NSURLPboardType])
     
    20392045    if ([[pasteboard types] containsObject: NSFilenamesPboardType])
    20402046    {
    2041         //create an array of files with the "torrent" extension
     2047        //create an array of files that can be opened
    20422048        NSMutableArray * filesToOpen = [[NSMutableArray alloc] init];
    20432049        NSEnumerator * enumerator = [[pasteboard propertyListForType: NSFilenamesPboardType] objectEnumerator];
    20442050        NSString * file;
    20452051        while ((file = [enumerator nextObject]))
    2046             if ([[file pathExtension] caseInsensitiveCompare: @"torrent"] == NSOrderedSame)
     2052        {
     2053            tr_torrent_t * tempTor;
     2054            int error;
     2055            if ((tempTor = tr_torrentInit(fLib, [file UTF8String], NULL, 0, &error)))
     2056            {
     2057                tr_torrentClose(fLib, tempTor);
    20472058                [filesToOpen addObject: file];
     2059            }
     2060        }
    20482061   
    20492062        [self application: NSApp openFiles: filesToOpen];
Note: See TracChangeset for help on using the changeset viewer.