@@ -365,35 +365,34 @@ lastSeenKeyBoardModifierDetails,dragInProgress,dragCount,windowLogic;
365
365
366
366
#pragma mark Events - Dragging
367
367
368
+ - (NSMutableArray *) filterSqueakImageFilesFromDraggedFiles: (id<NSDraggingInfo>)info include: (BOOL)doInclude {
369
+ NSPasteboard *pboard= [info draggingPasteboard];
370
+ NSMutableArray *results = [NSMutableArray arrayWithCapacity: 10 ];
371
+ if ([[pboard types] containsObject: NSPasteboardTypeFileURL]) {
372
+ NSArray *urlClasses = [NSArray arrayWithObject:[NSURL class ]];
373
+ NSDictionary *pbOptions = [NSDictionary dictionaryWithObject:
374
+ [NSNumber numberWithBool:YES] forKey:NSPasteboardURLReadingFileURLsOnlyKey];
375
+ NSArray *files = [pboard readObjectsForClasses:urlClasses options:pbOptions];
376
+ for (NSURL *fileRefURL in files) {
377
+ /*
378
+ * Although we already have an URL, it is a file-refernce-type URL
379
+ * of the form 'file:///.file/id=6571367.25595293' with numbers
380
+ * apparently identifying the file. However, this does not say
381
+ * anything about file names and such, which we rely on.
382
+ */
383
+ NSURL* fileURL = fileRefURL.filePathURL ;
384
+ if ([((sqSqueakOSXApplication*) gDelegateApp .squeakApplication ) isImageFile: [fileURL path]] == doInclude)
385
+ [results addObject: fileURL];
386
+ }
387
+ }
388
+ return results;
389
+ }
368
390
- (NSMutableArray *) filterSqueakImageFilesFromDraggedFiles: (id<NSDraggingInfo>)info {
369
- NSPasteboard *pboard= [info draggingPasteboard];
370
- NSMutableArray *results = [NSMutableArray arrayWithCapacity: 10 ];
371
- if ([[pboard types] containsObject: NSPasteboardTypeFileURL]) {
372
- NSArray *files= [pboard propertyListForType: NSPasteboardTypeFileURL];
373
- NSString *fileName;
374
- for (fileName in files) {
375
- if ([((sqSqueakOSXApplication*) gDelegateApp .squeakApplication ) isImageFile: fileName] == YES)
376
- [results addObject: fileName];
377
- }
378
- }
379
- return results;
391
+ return [self filterSqueakImageFilesFromDraggedFiles: info include: YES];
380
392
}
381
393
382
394
- (NSMutableArray *) filterOutSqueakImageFilesFromDraggedURIs: (id<NSDraggingInfo>)info {
383
- NSPasteboard *pboard= [info draggingPasteboard];
384
- NSMutableArray *results = [NSMutableArray arrayWithCapacity: 10 ];
385
- if ([[pboard types] containsObject: NSPasteboardTypeFileURL]) {
386
- NSArray *files= [pboard propertyListForType: NSPasteboardTypeFileURL];
387
- NSString *fileName;
388
- for (fileName in files) {
389
- if ([((sqSqueakOSXApplication*) gDelegateApp .squeakApplication ) isImageFile: fileName] == NO)
390
- {
391
- [results addObject: [NSURL fileURLWithPath: fileName]];
392
- }
393
- }
394
- }
395
-
396
- return results;
395
+ return [self filterSqueakImageFilesFromDraggedFiles: info include: NO];
397
396
}
398
397
399
398
- (NSUInteger) countNumberOfNoneSqueakImageFilesInDraggedFiles: (id<NSDraggingInfo>)info {
0 commit comments