Changeset 11348


Ignore:
Timestamp:
Oct 23, 2010, 8:20:31 PM (11 years ago)
Author:
livings124
Message:

#3661 sort the file list alphabetically

Location:
trunk/macosx
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/FileListNode.h

    r9844 r11348  
    5151- (NSImage *) icon;
    5252
    53 - (NSArray *) children;
     53- (NSMutableArray *) children;
    5454
    5555@end
  • trunk/macosx/FileListNode.m

    r10206 r11348  
    122122}
    123123
    124 - (NSArray *) children
     124- (NSMutableArray *) children
    125125{
    126126    NSAssert(fIsFolder, @"method can only be invoked on folders");
  • trunk/macosx/Torrent.m

    r11225 r11348  
    4545- (void) insertPath: (NSMutableArray *) components forParent: (FileListNode *) parent fileSize: (uint64_t) size
    4646    index: (NSInteger) index flatList: (NSMutableArray *) flatFileList;
     47- (void) sortFileList: (NSMutableArray *) fileNodes;
    4748
    4849- (void) completenessChange: (NSDictionary *) statusInfo;
     
    17111712        }
    17121713       
     1714        [self sortFileList: fileList];
     1715        [self sortFileList: flatFileList];
     1716       
    17131717        fFileList = [[NSArray alloc] initWithArray: fileList];
    17141718        fFlatFileList = [[NSArray alloc] initWithArray: flatFileList];
     
    17621766}
    17631767
     1768- (void) sortFileList: (NSMutableArray *) fileNodes
     1769{
     1770    NSSortDescriptor * descriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
     1771                                            selector: @selector(compareFinder:)] autorelease];
     1772    [fileNodes sortUsingDescriptors: [NSArray arrayWithObject: descriptor]];
     1773   
     1774    for (FileListNode * node in fileNodes)
     1775        if ([node isFolder])
     1776            [self sortFileList: [node children]];
     1777}
     1778
    17641779//status has been retained
    17651780- (void) completenessChange: (NSDictionary *) statusInfo
Note: See TracChangeset for help on using the changeset viewer.