mirror of
https://github.com/transmission/transmission
synced 2025-03-09 05:14:09 +00:00
have the secondary sort alternate ascending/descending when the primary does
This commit is contained in:
parent
e7687c676d
commit
02710f8092
1 changed files with 17 additions and 2 deletions
|
@ -869,10 +869,25 @@
|
|||
NSMutableArray * descriptors = [NSMutableArray array];
|
||||
|
||||
NSArray * oldDescriptors = [fPeerTable sortDescriptors];
|
||||
BOOL useSecond = YES, asc = YES;
|
||||
if ([oldDescriptors count] > 0)
|
||||
[descriptors addObject: [oldDescriptors objectAtIndex: 0]];
|
||||
{
|
||||
NSSortDescriptor * descriptor = [oldDescriptors objectAtIndex: 0];
|
||||
[descriptors addObject: descriptor];
|
||||
|
||||
useSecond = ![[descriptor key] isEqualToString: @"IP"];
|
||||
asc = [descriptor ascending];
|
||||
}
|
||||
|
||||
[descriptors addObject: [[fPeerTable tableColumnWithIdentifier: @"IP"] sortDescriptorPrototype]];
|
||||
//sort by IP after primary sort
|
||||
if (useSecond)
|
||||
{
|
||||
#warning different for different sorts
|
||||
NSSortDescriptor * secondDescriptor = [[NSSortDescriptor alloc] initWithKey: @"IP" ascending: asc
|
||||
selector: @selector(compareIP:)];
|
||||
[descriptors addObject: secondDescriptor];
|
||||
[secondDescriptor release];
|
||||
}
|
||||
|
||||
return descriptors;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue