mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
[#136 state:fixed] Add dropped folders to recent added folders list in the folder selection window.
This commit is contained in:
@@ -10,6 +10,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
#import "HSOutline.h"
|
||||
#import "PyDirectoryOutline.h"
|
||||
|
||||
#define DGAddedFoldersNotification @"DGAddedFoldersNotification"
|
||||
|
||||
@interface DirectoryOutline : HSOutline {}
|
||||
- (id)initWithPyParent:(id)aPyParent view:(HSOutlineView *)aOutlineView;
|
||||
- (PyDirectoryOutline *)py;
|
||||
|
||||
@@ -49,12 +49,15 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
sourceDragMask = [info draggingSourceOperationMask];
|
||||
pboard = [info draggingPasteboard];
|
||||
if ([[pboard types] containsObject:NSFilenamesPboardType]) {
|
||||
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
|
||||
NSArray *foldernames = [pboard propertyListForType:NSFilenamesPboardType];
|
||||
if (!(sourceDragMask & NSDragOperationLink))
|
||||
return NO;
|
||||
for (NSString *filename in filenames) {
|
||||
[[self py] addDirectory:filename];
|
||||
for (NSString *foldername in foldernames) {
|
||||
[[self py] addDirectory:foldername];
|
||||
}
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObject:foldernames forKey:@"foldernames"];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:DGAddedFoldersNotification
|
||||
object:self userInfo:userInfo];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
[self refreshRemoveButtonText];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(directorySelectionChanged:)
|
||||
name:NSOutlineViewSelectionDidChangeNotification object:outlineView];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(outlineAddedFolders:)
|
||||
name:DGAddedFoldersNotification object:outline];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -162,4 +164,12 @@ http://www.hardcoded.net/licenses/bsd_license
|
||||
[self refreshRemoveButtonText];
|
||||
}
|
||||
|
||||
- (void)outlineAddedFolders:(NSNotification *)aNotification
|
||||
{
|
||||
NSArray *foldernames = [[aNotification userInfo] objectForKey:@"foldernames"];
|
||||
for (NSString *foldername in foldernames) {
|
||||
[_recentDirectories addFile:foldername];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user