Changeset 5907


Ignore:
Timestamp:
May 22, 2008, 8:00:22 PM (14 years ago)
Author:
livings124
Message:

fix errors with the new file structure code when displaying per-torrent action menu

Location:
trunk/macosx
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r5906 r5907  
    41594159        if (!torrent)
    41604160        {
    4161             NSLog(@"No torrent found matching torrent struct given in RPC callback!");
     4161            NSLog(@"No torrent found matching the given torrent struct from the RPC callback!");
    41624162            return;
    41634163        }
  • trunk/macosx/FileListNode.h

    r5905 r5907  
    2424
    2525#import <Cocoa/Cocoa.h>
    26 
    2726
    2827@interface FileListNode : NSObject <NSCopying>
  • trunk/macosx/Torrent.m

    r5904 r5907  
    16791679                }
    16801680               
     1681                [node insertIndex: i];
    16811682                [self insertPath: pathComponents forParent: node fileSize: file->length index: i];
    16821683            }
  • trunk/macosx/TorrentTableView.m

    r5898 r5907  
    2626#import "TorrentCell.h"
    2727#import "Torrent.h"
     28#import "FileListNode.h"
    2829#import "QuickLookController.h"
    2930#import "NSApplicationAdditions.h"
     
    693694       
    694695        NSMenu * supermenu = [menu supermenu];
    695         [self createFileMenu: menu forFiles: [[[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]]
    696                                                     representedObject] objectForKey: @"Children"]];
     696        [self createFileMenu: menu forFiles: [(FileListNode *)[[supermenu itemAtIndex: [supermenu indexOfItemWithSubmenu: menu]]
     697                                                representedObject] children]];
    697698    }
    698699}
     
    763764- (void) checkFile: (id) sender
    764765{
    765     NSIndexSet * indexSet = [[sender representedObject] objectForKey: @"Indexes"];
     766    NSIndexSet * indexSet = [(FileListNode *)[sender representedObject] indexes];
    766767    [fMenuTorrent setFileCheckState: [sender state] != NSOnState ? NSOnState : NSOffState forIndexes: indexSet];
    767768   
     
    856857{
    857858    NSEnumerator * enumerator = [files objectEnumerator];
    858     NSDictionary * dict;
    859     while ((dict = [enumerator nextObject]))
    860     {
    861         NSString * name = [dict objectForKey: @"Name"];
     859    FileListNode * node;
     860    while ((node = [enumerator nextObject]))
     861    {
     862        NSString * name = [node name];
    862863       
    863864        NSMenuItem * item = [[NSMenuItem alloc] initWithTitle: name action: @selector(checkFile:) keyEquivalent: @""];
    864865       
    865866        NSImage * icon;
    866         if (![[dict objectForKey: @"IsFolder"] boolValue])
     867        if (![node isFolder])
    867868            icon = [[NSWorkspace sharedWorkspace] iconForFileType: [name pathExtension]];
    868869        else
     
    877878        }
    878879       
    879         [item setRepresentedObject: dict];
     880        [item setRepresentedObject: node];
    880881       
    881882        [icon setScalesWhenResized: YES];
     
    883884        [item setImage: icon];
    884885       
    885         NSIndexSet * indexSet = [dict objectForKey: @"Indexes"];
     886        NSIndexSet * indexSet = [node indexes];
    886887        [item setState: [fMenuTorrent checkForFiles: indexSet]];
    887888        [item setEnabled: [fMenuTorrent canChangeDownloadCheckForFiles: indexSet]];
Note: See TracChangeset for help on using the changeset viewer.