1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-03-17 17:25:32 +00:00

Peer table always sorts by ip address after sorting by whatever column is selected.

This commit is contained in:
Mitchell Livingston 2006-08-14 23:18:49 +00:00
parent d232d371b5
commit 1043035ce4
2 changed files with 18 additions and 2 deletions

View file

@ -66,4 +66,6 @@
- (void) setWaitToStart: (id) sender; - (void) setWaitToStart: (id) sender;
- (NSArray *) peerSortDescriptors;
@end @end

View file

@ -265,7 +265,7 @@
if (numberSelected == 1) if (numberSelected == 1)
{ {
[fPeers setArray: [[fTorrents objectAtIndex: 0] peers]]; [fPeers setArray: [[fTorrents objectAtIndex: 0] peers]];
[fPeers sortUsingDescriptors: [fPeerTable sortDescriptors]]; [fPeers sortUsingDescriptors: [self peerSortDescriptors]];
} }
else else
[fPeers removeAllObjects]; [fPeers removeAllObjects];
@ -470,7 +470,7 @@
{ {
if (tableView == fPeerTable) if (tableView == fPeerTable)
{ {
[fPeers sortUsingDescriptors: [tableView sortDescriptors]]; [fPeers sortUsingDescriptors: [self peerSortDescriptors]];
[tableView reloadData]; [tableView reloadData];
} }
} }
@ -488,6 +488,20 @@
return tableView == fFileTable ? [fFiles objectAtIndex: row] : nil; return tableView == fFileTable ? [fFiles objectAtIndex: row] : nil;
} }
- (NSArray *) peerSortDescriptors
{
NSMutableArray * descriptors = [NSMutableArray array];
NSArray * oldDescriptors = [fPeerTable sortDescriptors];
if ([oldDescriptors count] > 0)
[descriptors addObject: [oldDescriptors objectAtIndex: 0]];
[descriptors addObject: [[[fPeerTable tableColumns] objectAtIndex: [fPeerTable columnWithIdentifier: @"IP"]]
sortDescriptorPrototype]];
return descriptors;
}
- (void) revealFile: (id) sender - (void) revealFile: (id) sender
{ {
NSIndexSet * indexSet = [fFileTable selectedRowIndexes]; NSIndexSet * indexSet = [fFileTable selectedRowIndexes];