Multiple selections are now handled correctly

This commit is contained in:
michael starke
2016-02-26 14:26:09 +01:00
parent c4eb499cf6
commit cbb98ff50f
8 changed files with 125 additions and 140 deletions

View File

@@ -32,17 +32,13 @@
@implementation MPEntryTableDataSource
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard {
if([rowIndexes count] != 1) {
return NO; // No valid drag
NSArray *entries = self.viewController.entryArrayController.selectedObjects;
for(KPKEntry *entry in entries) {
if(![entry isKindOfClass:[KPKEntry class]]) {
return NO;
}
}
id item = [self.viewController.entryArrayController arrangedObjects][[rowIndexes firstIndex]];
if(![item isKindOfClass:[KPKEntry class]]) {
return NO;
}
KPKEntry *draggedEntry = (KPKEntry *)item;
[pboard writeObjects:@[draggedEntry]];
[pboard writeObjects:entries];
return YES;
}