Removed getSelectedPaths() from ResultsWindow.

This commit is contained in:
Virgil Dupras 2010-02-12 16:30:32 +01:00
parent 64c1087856
commit 310951bfa8
4 changed files with 25 additions and 23 deletions

View File

@ -21,6 +21,7 @@ http://www.hardcoded.net/licenses/hs_license
- (BOOL)deltaValuesMode;
- (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode;
- (void)setDeltaColumns:(NSIndexSet *)aDeltaColumns;
- (NSInteger)selectedDupeCount;
- (IBAction)markSelected:(id)sender;
@end;

View File

@ -59,6 +59,23 @@ http://www.hardcoded.net/licenses/hs_license
_deltaColumns = [aDeltaColumns retain];
}
- (NSInteger)selectedDupeCount
{
NSArray *selected = [self selectedIndexPaths];
if ([self powerMarkerMode]) {
return [selected count];
}
else {
NSInteger r = 0;
for (NSArray *path in selected) {
if ([path count] == 1) {
r++;
}
}
return r;
}
}
- (IBAction)markSelected:(id)sender
{
[[self py] markSelected];

View File

@ -38,7 +38,6 @@ http://www.hardcoded.net/licenses/hs_license
- (NSTableColumn *)getColumnForIdentifier:(NSInteger)aIdentifier title:(NSString *)aTitle width:(NSInteger)aWidth refCol:(NSTableColumn *)aColumn;
- (NSArray *)getColumnsOrder;
- (NSDictionary *)getColumnsWidth;
- (NSArray *)getSelectedPaths:(BOOL)aDupesOnly;
- (void)initResultColumns;
- (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth;

View File

@ -109,22 +109,6 @@ http://www.hardcoded.net/licenses/hs_license
return result;
}
- (NSArray *)getSelectedPaths:(BOOL)aDupesOnly
{
if ([outline powerMarkerMode])
aDupesOnly = NO;
NSIndexSet *indexes = [matches selectedRowIndexes];
NSMutableArray *nodeList = [NSMutableArray array];
NSInteger i = [indexes firstIndex];
while (i != NSNotFound) {
NSIndexPath *path = [matches itemAtRow:i];
if (!aDupesOnly || ([path length] > 1))
[nodeList addObject:p2a(path)];
i = [indexes indexGreaterThanIndex:i];
}
return nodeList;
}
- (void)initResultColumns
{
// Virtual
@ -220,10 +204,10 @@ http://www.hardcoded.net/licenses/hs_license
- (IBAction)ignoreSelected:(id)sender
{
NSArray *pathList = [self getSelectedPaths:YES];
if (![pathList count])
NSInteger selectedDupeCount = [outline selectedDupeCount];
if (!selectedDupeCount)
return;
NSString *msg = [NSString stringWithFormat:@"All selected %d matches are going to be ignored in all subsequent scans. Continue?",[pathList count]];
NSString *msg = [NSString stringWithFormat:@"All selected %d matches are going to be ignored in all subsequent scans. Continue?",selectedDupeCount];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[py addSelectedToIgnoreList];
@ -295,10 +279,11 @@ http://www.hardcoded.net/licenses/hs_license
- (IBAction)removeSelected:(id)sender
{
NSArray *pathList = [self getSelectedPaths:YES];
if (![pathList count])
NSInteger selectedDupeCount = [outline selectedDupeCount];
if (!selectedDupeCount)
return;
if ([Dialogs askYesNo:[NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",[pathList count]]] == NSAlertSecondButtonReturn) // NO
NSString *msg = [NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",selectedDupeCount];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[py removeSelected];
}