Changeset 682


Ignore:
Timestamp:
Jul 23, 2006, 9:29:24 PM (16 years ago)
Author:
livings124
Message:

Ignore case when sorting.

Location:
trunk/macosx
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/macosx/Controller.m

    r678 r682  
    946946- (void) sortTorrentsIgnoreSelected
    947947{
    948     NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey:
    949                                             @"name" ascending: YES] autorelease],
    950                     * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey:
    951                                             @"orderValue" ascending: YES] autorelease];
     948    NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name"
     949                            ascending: YES selector: @selector(caseInsensitiveCompare:)] autorelease],
     950                    * orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue"
     951                                            ascending: YES] autorelease];
    952952
    953953    NSArray * descriptors;
     
    973973    else if ([fSortType isEqualToString: @"Date"])
    974974    {
    975         NSSortDescriptor * dateDescriptor = [[[NSSortDescriptor alloc] initWithKey:
    976                                             @"date" ascending: YES] autorelease];
     975        NSSortDescriptor * dateDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"date" ascending: YES] autorelease];
    977976   
    978977        descriptors = [[NSArray alloc] initWithObjects: dateDescriptor, orderDescriptor, nil];
  • trunk/macosx/TorrentTableView.m

    r680 r682  
    155155{
    156156    unichar newChar = [[event characters] characterAtIndex: 0];
    157     if (newChar == ' ' || [[NSCharacterSet alphanumericCharacterSet] characterIsMember: newChar])
     157    if (newChar == ' ' || [[NSCharacterSet alphanumericCharacterSet] characterIsMember: newChar]
     158        || [[NSCharacterSet symbolCharacterSet] characterIsMember: newChar]
     159        || [[NSCharacterSet punctuationCharacterSet] characterIsMember: newChar])
    158160    {
    159161        if ([fKeyStrokes count] > 0 && [event timestamp] - [[fKeyStrokes lastObject] timestamp] > 1.0)
     
    174176- (void) insertText: (NSString *) text
    175177{
    176     NSLog(text);
    177    
    178178    //sort torrents by name before finding closest match
    179     NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES] autorelease];
     179    NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
     180                                            selector: @selector(caseInsensitiveCompare:)] autorelease];
    180181    NSArray * descriptors = [[NSArray alloc] initWithObjects: nameDescriptor, nil];
    181182
     
    187188    Torrent * torrent;
    188189    while ((torrent = [enumerator nextObject]))
    189     {
     190    {NSLog([[torrent name] lowercaseString]);
    190191        if ([[torrent name] caseInsensitiveCompare: text] != NSOrderedAscending)
    191192        {
Note: See TracChangeset for help on using the changeset viewer.