From 5e2308daf9c089b1ad5ef35d02c16765af7e0a84 Mon Sep 17 00:00:00 2001 From: Mitchell Livingston Date: Thu, 7 Feb 2008 02:15:24 +0000 Subject: [PATCH] when turning on group view, show all groups expanded --- macosx/Controller.m | 10 ++++++++-- macosx/TorrentTableView.h | 1 + macosx/TorrentTableView.m | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/macosx/Controller.m b/macosx/Controller.m index 09ef7fc9f..003ed3c5d 100644 --- a/macosx/Controller.m +++ b/macosx/Controller.m @@ -1167,7 +1167,7 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi enumerator = [torrents objectEnumerator]; while ((torrent = [enumerator nextObject])) { - //expand the group, since either the whole group is being removed or it is already expanded + //expand the group, since either the whole group is being removed, it is already expanded, or not showing groups [fTableView removeCollapsedGroup: [torrent groupValue]]; if (deleteData) @@ -1664,7 +1664,13 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi - (void) setSortByGroup: (id) sender { - [fDefaults setBool: ![fDefaults boolForKey: @"SortByGroup"] forKey: @"SortByGroup"]; + BOOL sortByGroup = ![fDefaults boolForKey: @"SortByGroup"]; + [fDefaults setBool: sortByGroup forKey: @"SortByGroup"]; + + //expand all groups + if (sortByGroup) + [fTableView removeAllCollapsedGroups]; + [self applyFilter: nil]; } diff --git a/macosx/TorrentTableView.h b/macosx/TorrentTableView.h index 92f2c6324..1268d8417 100644 --- a/macosx/TorrentTableView.h +++ b/macosx/TorrentTableView.h @@ -53,6 +53,7 @@ - (NSIndexSet *) collapsedGroupsIndexes; - (void) removeCollapsedGroup: (int) value; +- (void) removeAllCollapsedGroups; - (void) removeButtonTrackingAreas; - (void) setControlButtonHover: (int) row; diff --git a/macosx/TorrentTableView.m b/macosx/TorrentTableView.m index 403b615d5..0fc0899c4 100644 --- a/macosx/TorrentTableView.m +++ b/macosx/TorrentTableView.m @@ -103,6 +103,11 @@ [fCollapsedGroups removeIndex: value]; } +- (void) removeAllCollapsedGroups +{ + [fCollapsedGroups removeAllIndexes]; +} + - (BOOL) outlineView: (NSOutlineView *) outlineView isGroupItem: (id) item { return ![item isKindOfClass: [Torrent class]];