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 14:32:56 -05:00
parent cd9f54163b
commit bf17eb715a
25 changed files with 439 additions and 594 deletions

View File

@@ -237,4 +237,21 @@ http://www.hardcoded.net/licenses/bsd_license
{
[HSFairwareReminder showDemoNagWithApp:[self model] prompt:prompt];
}
- (NSString *)selectDestFolderWithPrompt:(NSString *)prompt
{
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setCanChooseFiles:NO];
[op setCanChooseDirectories:YES];
[op setCanCreateDirectories:YES];
[op setAllowsMultipleSelection:NO];
[op setTitle:prompt];
if ([op runModal] == NSOKButton) {
return [[op filenames] objectAtIndex:0];
}
else {
return nil;
}
}
@end

View File

@@ -75,17 +75,6 @@ http://www.hardcoded.net/licenses/bsd_license
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted
{
NSInteger mark_count = [model getMarkCount];
if (!mark_count) {
return;
}
NSString *msg = TR(@"You are about to send %d files to Trash. Continue?");
if (hardlinkDeleted) {
msg = TR(@"You are about to send %d files to Trash (and hardlink them afterwards). Continue?");
}
if ([Dialogs askYesNo:[NSString stringWithFormat:msg,mark_count]] == NSAlertSecondButtonReturn) { // NO
return;
}
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[model setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
if (hardlinkDeleted) {
@@ -130,20 +119,10 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)copyMarked:(id)sender
{
NSInteger mark_count = [model getMarkCount];
if (!mark_count)
return;
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setCanChooseFiles:NO];
[op setCanChooseDirectories:YES];
[op setCanCreateDirectories:YES];
[op setAllowsMultipleSelection:NO];
[op setTitle:TR(@"Select a directory to copy marked files to")];
if ([op runModal] == NSOKButton) {
NSString *directory = [[op filenames] objectAtIndex:0];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[model copyOrMove:YES markedTo:directory recreatePath:n2b([ud objectForKey:@"recreatePathType"])];
}
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[model setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
[model setCopyMoveDestType:n2i([ud objectForKey:@"recreatePathType"])];
[model copyMarked];
}
- (IBAction)deleteMarked:(id)sender
@@ -201,21 +180,10 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)moveMarked:(id)sender
{
NSInteger mark_count = [model getMarkCount];
if (!mark_count)
return;
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setCanChooseFiles:NO];
[op setCanChooseDirectories:YES];
[op setCanCreateDirectories:YES];
[op setAllowsMultipleSelection:NO];
[op setTitle:TR(@"Select a directory to move marked files to")];
if ([op runModal] == NSOKButton) {
NSString *directory = [[op filenames] objectAtIndex:0];
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[model setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
[model copyOrMove:NO markedTo:directory recreatePath:n2b([ud objectForKey:@"recreatePathType"])];
}
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[model setRemoveEmptyFolders:n2b([ud objectForKey:@"removeEmptyFolders"])];
[model setCopyMoveDestType:n2i([ud objectForKey:@"recreatePathType"])];
[model moveMarked];
}
- (IBAction)openClicked:(id)sender

View File

@@ -4,16 +4,12 @@
"Select a results file to load" = "Select a results file to load";
"You have unsaved results, do you really want to quit?" = "You have unsaved results, do you really want to quit?";
"Select a directory to copy marked files to" = "Select a directory to copy marked files to";
"Select a directory to move marked files to" = "Select a directory to move marked files to";
"Select a file to save your results to" = "Select a file to save your results to";
"Select a folder to add to the scanning list" = "Select a folder to add to the scanning list";
"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.";
"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?";
"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";