diff --git a/PBFileChangesTableView.m b/PBFileChangesTableView.m index 60c28a7..4f489e1 100644 --- a/PBFileChangesTableView.m +++ b/PBFileChangesTableView.m @@ -18,4 +18,10 @@ return nil; } + +- (NSDragOperation) draggingSourceOperationMaskForLocal:(BOOL) local +{ + return NSDragOperationEvery; +} + @end diff --git a/PBGitIndexController.m b/PBGitIndexController.m index a754b43..750bef2 100644 --- a/PBGitIndexController.m +++ b/PBGitIndexController.m @@ -206,9 +206,22 @@ writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard*)pboard { // Copy the row numbers to the pasteboard. - NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes]; - [pboard declareTypes:[NSArray arrayWithObject:FileChangesTableViewType] owner:self]; + [pboard declareTypes:[NSArray arrayWithObjects:FileChangesTableViewType, NSFilenamesPboardType, nil] owner:self]; + + // Internal, for dragging from one tableview to the other + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:rowIndexes]; [pboard setData:data forType:FileChangesTableViewType]; + + // External, to drag them to for example XCode or Textmate + NSArrayController *controller = [tv tag] == 0 ? unstagedFilesController : stagedFilesController; + NSArray *files = [[controller arrangedObjects] objectsAtIndexes:rowIndexes]; + NSString *workingDirectory = [commitController.repository workingDirectory]; + + NSMutableArray *filenames = [NSMutableArray arrayWithCapacity:[rowIndexes count]]; + for (PBChangedFile *file in files) + [filenames addObject:[workingDirectory stringByAppendingPathComponent:[file path]]]; + + [pboard setPropertyList:filenames forType:NSFilenamesPboardType]; return YES; }