1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-23 07:01:39 +00:00

Pushed some action confirmation logic down from GUI layers to the core.

This commit is contained in:
Virgil Dupras
2012-03-10 10:58:08 -05:00
parent ef0a66f794
commit cd9f54163b
27 changed files with 1178 additions and 1329 deletions

View File

@@ -21,6 +21,4 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode;
- (BOOL)deltaValuesMode;
- (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode;
- (NSInteger)selectedDupeCount;
- (void)removeSelected;
@end;

View File

@@ -77,23 +77,6 @@ http://www.hardcoded.net/licenses/bsd_license
[[self model] setDeltaValuesMode:aDeltaValuesMode];
}
- (NSInteger)selectedDupeCount
{
return [[self model] selectedDupeCount];
}
- (void)removeSelected
{
NSInteger selectedDupeCount = [self selectedDupeCount];
if (!selectedDupeCount)
return;
NSString *msgFmt = TR(@"You are about to remove %d files from results. Continue?");
NSString *msg = [NSString stringWithFormat:msgFmt,selectedDupeCount];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[[self model] removeSelected];
}
/* Datasource */
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)column row:(NSInteger)row
{
@@ -165,7 +148,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (BOOL)tableViewHadDeletePressed:(NSTableView *)tableView
{
[self removeSelected];
[[self model] removeSelected];
return YES;
}

View File

@@ -111,12 +111,6 @@ http://www.hardcoded.net/licenses/bsd_license
/* Actions */
- (IBAction)clearIgnoreList:(id)sender
{
NSInteger i = [model getIgnoreListCount];
if (!i)
return;
NSString *msg = [NSString stringWithFormat:TR(@"Do you really want to remove all %d items from the ignore list?"),i];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[model clearIgnoreList];
}
@@ -177,25 +171,12 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)ignoreSelected:(id)sender
{
NSInteger selectedDupeCount = [table selectedDupeCount];
if (!selectedDupeCount)
return;
NSString *msg = [NSString stringWithFormat:TR(@"All selected %d matches are going to be ignored in all subsequent scans. Continue?"),selectedDupeCount];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[model addSelectedToIgnoreList];
}
- (IBAction)invokeCustomCommand:(id)sender
{
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
NSString *cmd = [ud stringForKey:@"CustomCommand"];
if ((cmd != nil) && ([cmd length] > 0)) {
[model invokeCommand:cmd];
}
else {
[Dialogs showMessage:TR(@"You have no custom command set up. Set it up in your preferences.")];
}
[model invokeCustomCommand];
}
- (IBAction)markAll:(id)sender
@@ -253,18 +234,12 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)removeMarked:(id)sender
{
int mark_count = [model getMarkCount];
if (!mark_count)
return;
NSString *msg = [NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",mark_count];
if ([Dialogs askYesNo:msg] == NSAlertSecondButtonReturn) // NO
return;
[model removeMarked];
}
- (IBAction)removeSelected:(id)sender
{
[table removeSelected];
[model removeSelected];
}
- (IBAction)renameSelected:(id)sender

View File

@@ -11,17 +11,9 @@
"You have unsaved results, do you really want to continue?" = "You have unsaved results, do you really want to continue?";
"'%@' already is in the list." = "'%@' already is in the list.";
"'%@' does not exist." = "'%@' does not exist.";
"You are about to remove %d files from results. Continue?" = "You are about to remove %d files from results. Continue?";
"The name '%@' already exists." = "The name '%@' already exists.";
"You are about to send %d files to Trash. Continue?" = "You are about to send %d files to Trash. Continue?";
"You are about to send %d files to Trash (and hardlink them afterwards). Continue?" = "You are about to send %d files to Trash (and hardlink them afterwards). Continue?";
"Do you really want to remove all %d items from the ignore list?" = "Do you really want to remove all %d items from the ignore list?";
"All selected %d matches are going to be ignored in all subsequent scans. Continue?" = "All selected %d matches are going to be ignored in all subsequent scans. Continue?";
"You have no custom command set up. Set it up in your preferences." = "You have no custom command set up. Set it up in your preferences.";
"All marked files were copied sucessfully." = "All marked files were copied sucessfully.";
"All marked files were moved sucessfully." = "All marked files were moved sucessfully.";
"All marked files were sucessfully sent to Trash." = "All marked files were sucessfully sent to Trash.";
"No duplicates found." = "No duplicates found.";
"A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again." = "A previous action is still hanging in there. You can't start a new one yet. Wait a few seconds, then try again.";
"Your iTunes Library contains %d dead tracks ready to be removed. Continue?" = "Your iTunes Library contains %d dead tracks ready to be removed. Continue?";
"You have no dead tracks in your iTunes Library" = "You have no dead tracks in your iTunes Library";