/* 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;
		}
		NSString *path = [files objectAtIndex:0];
		if (isSlidesFile(path) || isQTFile(path)) {
			if (controller && [controller respondsToSelector:@selector(addPath:)]) {
				[controller performSelector:@selector(addPath:) withObject:path];
				return YES;
			}
		}
		/* If not slides or QT, then it must be an image or it is not supported */
		if (![NSImage canInitWithPasteboard:pboard])
			return NO;
	}
	return [super performDragOperation:sender];
}

