Copy and drag between documents should work now

This commit is contained in:
michael starke
2013-09-16 21:25:55 +02:00
parent eeb6cfbe95
commit d7f82bf88f
2 changed files with 7 additions and 15 deletions

View File

@@ -23,12 +23,11 @@
@end @end
@implementation MPOutlineDataSource @implementation MPOutlineDataSource
- (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pasteboard { - (BOOL)outlineView:(NSOutlineView *)outlineView writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pasteboard {
if([items count] == 1) { if([items count] == 1) {
id item = [[items lastObject] representedObject]; self.localDraggedGroup = nil; id item = [[items lastObject] representedObject];
if(![item isKindOfClass:[KPKGroup class]]) { if(![item isKindOfClass:[KPKGroup class]]) {
return NO; return NO;
} }
@@ -90,6 +89,7 @@
validTarget &= !isAnchesor; validTarget &= !isAnchesor;
} }
else { else {
/* Copy can always work in this case */
operationMask = NSDragOperationCopy; operationMask = NSDragOperationCopy;
} }
} }
@@ -129,12 +129,8 @@
KPKGroup *targetGroup = (KPKGroup *)targetItem; KPKGroup *targetGroup = (KPKGroup *)targetItem;
if(draggedGroup) { if(draggedGroup) {
if(copyItem || (nil == self.localDraggedGroup) ) { if(copyItem || (nil == self.localDraggedGroup) ) {
/* [targetGroup addGroup:draggedGroup atIndex:index];
Scenarios: return YES;
a) Local copy
b) Drag from other document
*/
return NO;
} }
else if(self.localDraggedGroup) { else if(self.localDraggedGroup) {
/* Simple move */ /* Simple move */
@@ -147,12 +143,8 @@
} }
else if(draggedEntry) { else if(draggedEntry) {
if(copyItem || (nil == self.localDraggedEntry)) { if(copyItem || (nil == self.localDraggedEntry)) {
/* [targetGroup addEntry:draggedEntry atIndex:index];
Scenarios: return YES;
a) Local copy
b) Drag from other document
*/
return NO;
} }
else if(self.localDraggedEntry) { else if(self.localDraggedEntry) {
[self.localDraggedEntry moveToGroup:targetGroup atIndex:index]; [self.localDraggedEntry moveToGroup:targetGroup atIndex:index];