#4902 Check all/Uncheck all buttons in the inspector

This commit is contained in:
Mitchell Livingston
2012-05-14 00:00:19 +00:00
parent 7a478b1e0e
commit 375f701203
5 changed files with 303 additions and 42 deletions

View File

@@ -83,7 +83,17 @@
[self setupInfo];
if ([fTorrents count] == 1)
{
[fFileController refresh];
Torrent * torrent = [fTorrents objectAtIndex: 0];
if ([torrent isFolder])
{
const NSInteger filesCheckState = [torrent checkForFiles: [NSIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [torrent fileCount])]];
[fCheckAllButton setEnabled: filesCheckState != NSOnState]; //if anything is unchecked
[fUncheckAllButton setEnabled: ![torrent allDownloaded]]; //if there are any checked files that aren't finished
}
}
}
- (void) saveViewSize
@@ -96,6 +106,16 @@
[fFileController setFilterText: [sender stringValue]];
}
- (IBAction) checkAll: (id) sender
{
[fFileController checkAll];
}
- (IBAction) uncheckAll: (id) sender
{
[fFileController uncheckAll];
}
- (NSArray *) quickLookURLs
{
FileOutlineView * fileOutlineView = [fFileController outlineView];
@@ -173,12 +193,24 @@
Torrent * torrent = [fTorrents objectAtIndex: 0];
[fFileController setTorrent: torrent];
[fFileFilterField setEnabled: [torrent isFolder]];
const BOOL isFolder = [torrent isFolder];
[fFileFilterField setEnabled: isFolder];
if (!isFolder)
{
[fCheckAllButton setEnabled: NO];
[fUncheckAllButton setEnabled: NO];
}
}
else
{
[fFileController setTorrent: nil];
[fFileFilterField setEnabled: NO];
[fCheckAllButton setEnabled: NO];
[fUncheckAllButton setEnabled: NO];
}
fSet = YES;