Changeset 2041


Ignore:
Timestamp:
Jun 10, 2007, 11:13:44 PM (15 years ago)
Author:
livings124
Message:

get the file priority checks working for folders

Location:
branches/file_selection/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/file_selection/macosx/InfoWindowController.m

    r2039 r2041  
    629629        BOOL current = NO, other = NO;
    630630        int i, priority;
     631        Torrent * torrent = [fTorrents objectAtIndex: 0];
    631632       
    632633        if (menuItem == fFilePriorityHigh)
     
    639640        for (i = [indexSet firstIndex]; i != NSNotFound && (!current || !other); i = [indexSet indexGreaterThanIndex: i])
    640641        {
    641             item = [fFileOutline itemAtRow: i];
    642             #warning get working with folders
    643             if ([[item objectForKey: @"IsFolder"] boolValue])
    644                 continue;
    645            
    646             if (priority == [[item objectForKey: @"Priority"] intValue])
     642            if ([torrent hasFilePriority: priority forItem: [fFileOutline itemAtRow: i]])
    647643                current = YES;
    648644            else
    649                 other = YES;
     645                other = YES; 
    650646        }
    651647       
  • branches/file_selection/macosx/Torrent.h

    r2025 r2041  
    212212- (void) setFileCheckState: (int) state forFileItem: (NSDictionary *) item;
    213213- (void) setFilePriority: (int) priority forFileItem: (NSMutableDictionary *) item;
     214- (BOOL) hasFilePriority: (int) priority forItem: (NSDictionary *) item;
    214215
    215216- (NSDate *) dateAdded;
  • branches/file_selection/macosx/Torrent.m

    r2033 r2041  
    14051405}
    14061406
     1407- (BOOL) hasFilePriority: (int) priority forItem: (NSDictionary *) item
     1408{
     1409    if (![[item objectForKey: @"IsFolder"] boolValue])
     1410        return priority == [[item objectForKey: @"Priority"] intValue];
     1411    else
     1412    {
     1413        NSEnumerator * enumerator = [[item objectForKey: @"Children"] objectEnumerator];
     1414        NSDictionary * child;
     1415        while ((child = [enumerator nextObject]))
     1416            if ([self hasFilePriority: priority forItem: child])
     1417                return YES;
     1418        return NO;
     1419    }
     1420}
     1421
    14071422- (NSDate *) dateAdded
    14081423{
Note: See TracChangeset for help on using the changeset viewer.