mirror of
https://github.com/transmission/transmission
synced 2025-03-04 10:38:13 +00:00
Ignore case when sorting.
This commit is contained in:
parent
802345f5ed
commit
e5fc3b555e
2 changed files with 11 additions and 11 deletions
|
@ -945,10 +945,10 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
//doesn't remember selected rows
|
||||
- (void) sortTorrentsIgnoreSelected
|
||||
{
|
||||
NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey:
|
||||
@"name" ascending: YES] autorelease],
|
||||
* orderDescriptor = [[[NSSortDescriptor alloc] initWithKey:
|
||||
@"orderValue" ascending: YES] autorelease];
|
||||
NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name"
|
||||
ascending: YES selector: @selector(caseInsensitiveCompare:)] autorelease],
|
||||
* orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue"
|
||||
ascending: YES] autorelease];
|
||||
|
||||
NSArray * descriptors;
|
||||
if ([fSortType isEqualToString: @"Name"])
|
||||
|
@ -972,8 +972,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
}
|
||||
else if ([fSortType isEqualToString: @"Date"])
|
||||
{
|
||||
NSSortDescriptor * dateDescriptor = [[[NSSortDescriptor alloc] initWithKey:
|
||||
@"date" ascending: YES] autorelease];
|
||||
NSSortDescriptor * dateDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"date" ascending: YES] autorelease];
|
||||
|
||||
descriptors = [[NSArray alloc] initWithObjects: dateDescriptor, orderDescriptor, nil];
|
||||
}
|
||||
|
|
|
@ -154,7 +154,9 @@
|
|||
- (void) keyDown: (NSEvent *) event
|
||||
{
|
||||
unichar newChar = [[event characters] characterAtIndex: 0];
|
||||
if (newChar == ' ' || [[NSCharacterSet alphanumericCharacterSet] characterIsMember: newChar])
|
||||
if (newChar == ' ' || [[NSCharacterSet alphanumericCharacterSet] characterIsMember: newChar]
|
||||
|| [[NSCharacterSet symbolCharacterSet] characterIsMember: newChar]
|
||||
|| [[NSCharacterSet punctuationCharacterSet] characterIsMember: newChar])
|
||||
{
|
||||
if ([fKeyStrokes count] > 0 && [event timestamp] - [[fKeyStrokes lastObject] timestamp] > 1.0)
|
||||
[fKeyStrokes removeAllObjects];
|
||||
|
@ -173,10 +175,9 @@
|
|||
|
||||
- (void) insertText: (NSString *) text
|
||||
{
|
||||
NSLog(text);
|
||||
|
||||
//sort torrents by name before finding closest match
|
||||
NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES] autorelease];
|
||||
NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name" ascending: YES
|
||||
selector: @selector(caseInsensitiveCompare:)] autorelease];
|
||||
NSArray * descriptors = [[NSArray alloc] initWithObjects: nameDescriptor, nil];
|
||||
|
||||
NSArray * tempTorrents = [fTorrents sortedArrayUsingDescriptors: descriptors];
|
||||
|
@ -186,7 +187,7 @@
|
|||
NSEnumerator * enumerator = [tempTorrents objectEnumerator];
|
||||
Torrent * torrent;
|
||||
while ((torrent = [enumerator nextObject]))
|
||||
{
|
||||
{NSLog([[torrent name] lowercaseString]);
|
||||
if ([[torrent name] caseInsensitiveCompare: text] != NSOrderedAscending)
|
||||
{
|
||||
[self selectRow: [fTorrents indexOfObject: torrent] byExtendingSelection: NO];
|
||||
|
|
Loading…
Add table
Reference in a new issue