1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

[#105 state:fixed] Allow multiple selection in Add Directory.

This commit is contained in:
Virgil Dupras 2010-09-25 16:12:20 +02:00
parent 06462c65a5
commit a6072f608b

View File

@ -39,15 +39,15 @@ http://www.hardcoded.net/licenses/hs_license
NSOpenPanel *op = [NSOpenPanel openPanel]; NSOpenPanel *op = [NSOpenPanel openPanel];
[op setCanChooseFiles:YES]; [op setCanChooseFiles:YES];
[op setCanChooseDirectories:YES]; [op setCanChooseDirectories:YES];
[op setAllowsMultipleSelection:NO]; [op setAllowsMultipleSelection:YES];
[op setTitle:@"Select a directory to add to the scanning list"]; [op setTitle:@"Select a directory to add to the scanning list"];
[op setDelegate:self]; [op setDelegate:self];
if ([op runModalForTypes:nil] == NSOKButton) if ([op runModal] == NSOKButton) {
{ for (NSString *directory in [op filenames]) {
NSString *directory = [[op filenames] objectAtIndex:0];
[self addDirectory:directory]; [self addDirectory:directory];
} }
} }
}
- (IBAction)popupAddDirectoryMenu:(id)sender - (IBAction)popupAddDirectoryMenu:(id)sender
{ {
@ -95,18 +95,14 @@ http://www.hardcoded.net/licenses/hs_license
{ {
NSInteger r = [[_py addDirectory:directory] intValue]; NSInteger r = [[_py addDirectory:directory] intValue];
if (r) { if (r) {
NSString *m; NSString *m = @"";
switch (r) { if (r == 1) {
case 1: { m = @"'%@' already is in the list.";
m = @"This directory already is in the list.";
break;
} }
case 2: { else if (r == 2) {
m = @"This directory does not exist."; m = @"'%@' does not exist.";
break;
} }
} [Dialogs showMessage:[NSString stringWithFormat:m,directory]];
[Dialogs showMessage:m];
} }
[_recentDirectories addDirectory:directory]; [_recentDirectories addDirectory:directory];
[[self window] makeKeyAndOrderFront:nil]; [[self window] makeKeyAndOrderFront:nil];