/* MAYBE - add support for some of (or all of) the other 3 file related pasteboard types
   Though I do no currently see a need to do so. These types are:
   NSURLPboardType
   NSFileContentsPboardType
   NSFilePromisePboardType
*/
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender {
	NSPasteboard *pboard;
	NSDragOperation sourceDragMask;
	
	sourceDragMask = [sender draggingSourceOperationMask];
	pboard = [sender draggingPasteboard];
	if ([[pboard types] containsObject:NSFilenamesPboardType]) {
		if (sourceDragMask & NSDragOperationCopy) {
			return NSDragOperationCopy;
		}
	}
	return [super draggingEntered:sender];
}

- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender {
	NSPasteboard *pboard;
	NSDragOperation sourceDragMask;
	
	sourceDragMask = [sender draggingSourceOperationMask];
	pboard = [sender draggingPasteboard];
	if ([[pboard types] containsObject:NSFilenamesPboardType]) {
		NSArray *files = [pboard propertyListForType:NSFilenamesPboardType];
		if ([files count] != 1) {
			NSAlert *alert = [[NSAlert alloc] init];
			NSString *msg;
			if ([files count] < 1)
				msg = @"Error - no files found";
			else
				msg = [NSString stringWithFormat:@"Error - Pear Note can only accept 1 slides or media file, but received %d files", [files count]];
			[alert setMessageText:msg];
			[alert addButtonWithTitle:@"OK"];
			[alert runModal];
			[alert release];
			return NO;
		}
		if (controller && [controller respondsToSelector:@selector(addPath:)]) {
			[controller performSelector:@selector(addPath:) withObject:[files objectAtIndex:0]];
			return YES;
		}		
	}	
	return [super performDragOperation:sender];
}

