when determining selected torrents, if a group is selected, after adding all torrents from that group, skip to the object after all those torrents

This commit is contained in:
Mitchell Livingston 2008-01-23 18:41:33 +00:00
parent 381a5bf4b5
commit 320e519a43
1 changed files with 4 additions and 3 deletions

View File

@ -284,9 +284,10 @@
- (void) selectValues: (NSArray *) values - (void) selectValues: (NSArray *) values
{ {
id object; NSMutableIndexSet * indexSet = [NSMutableIndexSet indexSet];
NSEnumerator * enumerator = [values objectEnumerator]; NSEnumerator * enumerator = [values objectEnumerator];
NSMutableIndexSet * indexSet = [[NSMutableIndexSet alloc] init]; id object;
while ((object = [enumerator nextObject])) while ((object = [enumerator nextObject]))
{ {
unsigned index = [fTorrents indexOfObject: object]; //works with torrents and groups unsigned index = [fTorrents indexOfObject: object]; //works with torrents and groups
@ -295,7 +296,6 @@
} }
[self selectRowIndexes: indexSet byExtendingSelection: NO]; [self selectRowIndexes: indexSet byExtendingSelection: NO];
[indexSet release];
} }
- (NSArray *) selectedValues - (NSArray *) selectedValues
@ -319,6 +319,7 @@
{ {
int count = next != NSNotFound ? next - i - 1 : [fTorrents count] - i - 1; int count = next != NSNotFound ? next - i - 1 : [fTorrents count] - i - 1;
[indexSet addIndexesInRange: NSMakeRange(i+1, count)]; [indexSet addIndexesInRange: NSMakeRange(i+1, count)];
i += count;
} }
} }
[fTorrents objectsAtIndexes: indexSet]; [fTorrents objectsAtIndexes: indexSet];