diff --git a/macosx/English.lproj/InfoWindow.nib/classes.nib b/macosx/English.lproj/InfoWindow.nib/classes.nib
index 5c1bd0bb7..0c096a969 100644
--- a/macosx/English.lproj/InfoWindow.nib/classes.nib
+++ b/macosx/English.lproj/InfoWindow.nib/classes.nib
@@ -9,6 +9,7 @@
revealTorrentFile = id;
setCheck = id;
setLimitSetting = id;
+ setOnlySelectedCheck = id;
setPex = id;
setPiecesView = id;
setPriority = id;
diff --git a/macosx/English.lproj/InfoWindow.nib/info.nib b/macosx/English.lproj/InfoWindow.nib/info.nib
index dfef773ac..8eb201fb5 100644
--- a/macosx/English.lproj/InfoWindow.nib/info.nib
+++ b/macosx/English.lproj/InfoWindow.nib/info.nib
@@ -21,6 +21,7 @@
IBOpenObjects
+ 549
5
IBSystem Version
diff --git a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib
index 8c4e8e79b..24dd0b328 100644
Binary files a/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib and b/macosx/English.lproj/InfoWindow.nib/keyedobjects.nib differ
diff --git a/macosx/InfoWindowController.h b/macosx/InfoWindowController.h
index 5f8f81f1b..b1add683d 100644
--- a/macosx/InfoWindowController.h
+++ b/macosx/InfoWindowController.h
@@ -79,6 +79,7 @@
- (void) revealFile: (id) sender;
- (void) setCheck: (id) sender;
+- (void) setOnlySelectedCheck: (id) sender;
- (void) setPriority: (id) sender;
- (void) setLimitSetting: (id) sender;
diff --git a/macosx/InfoWindowController.m b/macosx/InfoWindowController.m
index c2769da5a..028beaddf 100644
--- a/macosx/InfoWindowController.m
+++ b/macosx/InfoWindowController.m
@@ -600,6 +600,9 @@
- (BOOL) validateMenuItem: (NSMenuItem *) menuItem
{
+ if ([fTorrents count] != 1)
+ return NO;
+
SEL action = [menuItem action];
if (action == @selector(revealFile:))
@@ -626,6 +629,9 @@
return NO;
}
+ if (action == @selector(setOnlySelectedCheck:))
+ return [fFileOutline selectedRow] != -1;
+
if (action == @selector(setPriority:))
{
if ([fFileOutline numberOfSelectedRows] <= 0)
@@ -1022,18 +1028,30 @@
int state = sender == fFileCheckItem ? NSOnState : NSOffState;
Torrent * torrent = [fTorrents objectAtIndex: 0];
- NSIndexSet * indexSet = [fFileOutline selectedRowIndexes], * itemIndexes;
- NSMutableIndexSet * usedIndexes = [NSMutableIndexSet indexSet];
+ NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
+ NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
int i;
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
- {
- itemIndexes = [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"];
- if (![usedIndexes containsIndexes: itemIndexes])
- {
- [torrent setFileCheckState: state forIndexes: itemIndexes];
- [usedIndexes addIndexes: itemIndexes];
- }
- }
+ [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
+
+ [torrent setFileCheckState: state forIndexes: itemIndexes];
+ [fFileOutline reloadData];
+}
+
+- (void) setOnlySelectedCheck: (id) sender
+{
+ Torrent * torrent = [fTorrents objectAtIndex: 0];
+ NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
+ NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
+ int i;
+ for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
+ [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
+
+ [torrent setFileCheckState: NSOnState forIndexes: itemIndexes];
+
+ NSMutableIndexSet * remainingItemIndexes = [NSMutableIndexSet indexSetWithIndexesInRange: NSMakeRange(0, [torrent fileCount])];
+ [remainingItemIndexes removeIndexes: indexSet];
+ [torrent setFileCheckState: NSOffState forIndexes: remainingItemIndexes];
[fFileOutline reloadData];
}
@@ -1050,10 +1068,12 @@
Torrent * torrent = [fTorrents objectAtIndex: 0];
NSIndexSet * indexSet = [fFileOutline selectedRowIndexes];
+ NSMutableIndexSet * itemIndexes = [NSMutableIndexSet indexSet];
int i;
for (i = [indexSet firstIndex]; i != NSNotFound; i = [indexSet indexGreaterThanIndex: i])
- [torrent setFilePriority: priority forIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
+ [itemIndexes addIndexes: [[fFileOutline itemAtRow: i] objectForKey: @"Indexes"]];
+ [torrent setFilePriority: priority forIndexes: itemIndexes];
[fFileOutline reloadData];
}