Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Cleaning up the dragging methods.

  • Loading branch information...
commit 7af0bcf79209e92d37eb28dafc669b0c5559c69d 1 parent 5ac192f
@bryanveloso authored
Showing with 6 additions and 8 deletions.
  1. +6 −8 Classes/Views/DropHandlerView.m
View
14 Classes/Views/DropHandlerView.m
@@ -31,12 +31,11 @@ - (id)initWithFrame:(NSRect)frame
#pragma Drag Operation Methods
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
- NSPasteboard *pasteboard = [sender draggingPasteboard];
- NSArray *files = [pasteboard propertyListForType:NSFilenamesPboardType];
- if ([files count] == 1) {
- NSString *filepath = [files lastObject];
- if ([[filepath pathExtension] isEqualToString:@"m4a"] || [[filepath pathExtension] isEqualToString:@"mp3"]) {
- return NSDragOperationCopy;
+ for (NSPasteboardItem *item in [[sender draggingPasteboard] pasteboardItems]) {
+ for (NSString *type in self.pasteboardTypes) {
+ if ([[item types] containsObject:type]) {
+ return NSDragOperationCopy;
+ }
}
}
return NSDragOperationNone;
@@ -49,8 +48,7 @@ - (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
- NSPasteboard *pasteboard = [sender draggingPasteboard];
- for (NSPasteboardItem *item in [pasteboard pasteboardItems]) {
+ for (NSPasteboardItem *item in [[sender draggingPasteboard] pasteboardItems]) {
NSString *fileString = nil;
for (NSString *type in self.pasteboardTypes) {
if ([[item types] containsObject:type]) {
Please sign in to comment.
Something went wrong with that request. Please try again.