5 // Created by Pieter de Bie on 6/17/08.
6 // Copyright 2008 __MyCompanyName__. All rights reserved.
9 #import "PBQLOutlineView.h"
12 @implementation PBQLOutlineView
14 - initWithCoder: (NSCoder *) coder
16 id a = [super initWithCoder:coder];
18 [a registerForDraggedTypes: [NSArray arrayWithObject:NSFilesPromisePboardType]];
22 /* Needed to drag outside application */
23 - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL) local
25 return NSDragOperationCopy;
28 - (void) keyDown: (NSEvent *) event
30 if ([[event characters] isEqualToString:@" "]) {
31 [controller toggleQuickView:self];
35 [super keyDown:event];
38 - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *) pb
40 NSMutableArray* fileNames = [NSMutableArray array];
41 for (id tree in items)
42 [fileNames addObject: [[[tree representedObject] path] pathExtension]];
44 [pb declareTypes:[NSArray arrayWithObject:NSFilesPromisePboardType] owner:self];
45 [pb setPropertyList:fileNames forType:NSFilesPromisePboardType];
50 - (NSArray *)outlineView:(NSOutlineView *)outlineView namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedItems:(NSArray *)items
52 NSMutableArray* fileNames = [NSMutableArray array];
53 for (id obj in items) {
54 PBGitTree* tree = [obj representedObject];
55 [fileNames addObject: [tree path]];
56 [tree saveToFolder:[dropDestination path]];
61 /* Implemented to satisfy datasourcee protocol */
62 - (BOOL) outlineView: (NSOutlineView *)ov
63 isItemExpandable: (id)item { return NO; }
65 - (int) outlineView: (NSOutlineView *)ov
66 numberOfChildrenOfItem:(id)item { return 0; }
68 - (id) outlineView: (NSOutlineView *)ov
70 ofItem:(id)item { return nil; }
72 - (id) outlineView: (NSOutlineView *)ov
73 objectValueForTableColumn:(NSTableColumn*)col
74 byItem:(id)item { return nil; }