diff --git a/macosx/Controller.m b/macosx/Controller.m index be5d04a0b..d60fac2e7 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1686,18 +1686,22 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi int total = [fDisplayedTorrents count]; if (group && total > 0 && [NSApp isOnLeopardOrBetter]) { - int i, groupValue = [[fDisplayedTorrents objectAtIndex: total-1] groupValue], newGroupValue; + int i, groupValue = [[fDisplayedTorrents objectAtIndex: total-1] groupValue], newGroupValue, count = 1; for (i = total-1; i >= 0; i--) { if (i > 0) newGroupValue = [[fDisplayedTorrents objectAtIndex: i-1] groupValue]; if (groupValue != newGroupValue || i == 0) { - NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group", nil]; + NSDictionary * dict = [NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithInt: groupValue], @"Group", + [NSNumber numberWithInt: count], @"Count", nil]; [fDisplayedTorrents insertObject: dict atIndex: i]; groupValue = newGroupValue; + count = 1; } + else + count++; } } diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 3097eec4a..b106ec6b7 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -295,13 +295,10 @@ for (i = 0; i < [fTorrents count]; i++) { id currentObject = [fTorrents objectAtIndex: i]; - if ((![currentObject isKindOfClass: [Torrent class]])) + if (![currentObject isKindOfClass: [Torrent class]] && value == [[currentObject objectForKey: @"Group"] intValue]) { - if (value == [[currentObject objectForKey: @"Group"] intValue]) - { - index = i; - break; - } + index = i; + break; } } } @@ -327,8 +324,15 @@ NSUInteger i; for (i = [selectedIndexes firstIndex]; i != NSNotFound; i = [selectedIndexes indexGreaterThanIndex: i]) { - if ([[fTorrents objectAtIndex: i] isKindOfClass: [Torrent class]]) + id object = [fTorrents objectAtIndex: i]; + if ([object isKindOfClass: [Torrent class]]) [indexSet addIndex: i]; + else + { + int count = [[object objectForKey: @"Count"] intValue]; + [indexSet addIndexesInRange: NSMakeRange(i+1, count)]; + i += count; + } } [fTorrents objectsAtIndexes: indexSet];