mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 12:52:21 +00:00
using modern Obj-C
This commit is contained in:
@@ -27,11 +27,10 @@
|
|||||||
|
|
||||||
- (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id<NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation {
|
- (NSDragOperation)tableView:(NSTableView *)tableView validateDrop:(id<NSDraggingInfo>)info proposedRow:(NSInteger)row proposedDropOperation:(NSTableViewDropOperation)dropOperation {
|
||||||
NSPasteboard *draggingPasteBoard = [info draggingPasteboard];
|
NSPasteboard *draggingPasteBoard = [info draggingPasteboard];
|
||||||
NSArray *classArray = [NSArray arrayWithObject:[NSURL class]];
|
NSArray *arrayOfURLs = [draggingPasteBoard readObjectsForClasses:@[NSURL.class] options:nil];
|
||||||
NSArray *arrayOfURLs = [draggingPasteBoard readObjectsForClasses:classArray options:nil];
|
|
||||||
NSUInteger numberOfDirectories = 0;
|
NSUInteger numberOfDirectories = 0;
|
||||||
for(NSURL *url in arrayOfURLs) {
|
for(NSURL *url in arrayOfURLs) {
|
||||||
if([url isFileURL] || [url isFileReferenceURL]) {
|
if(url.fileURL || url.fileReferenceURL) {
|
||||||
NSError *error = nil;
|
NSError *error = nil;
|
||||||
NSDictionary *resourceKeys = [url resourceValuesForKeys:@[NSURLIsDirectoryKey] error:&error];
|
NSDictionary *resourceKeys = [url resourceValuesForKeys:@[NSURLIsDirectoryKey] error:&error];
|
||||||
if( [resourceKeys[ NSURLIsDirectoryKey ] boolValue] == YES ) {
|
if( [resourceKeys[ NSURLIsDirectoryKey ] boolValue] == YES ) {
|
||||||
@@ -41,7 +40,7 @@
|
|||||||
}
|
}
|
||||||
return NSDragOperationNone;
|
return NSDragOperationNone;
|
||||||
}
|
}
|
||||||
if(numberOfDirectories == [arrayOfURLs count]) {
|
if(numberOfDirectories == arrayOfURLs.count) {
|
||||||
return NSDragOperationNone;
|
return NSDragOperationNone;
|
||||||
}
|
}
|
||||||
return NSDragOperationCopy;
|
return NSDragOperationCopy;
|
||||||
|
|||||||
Reference in New Issue
Block a user