Copy entries from external drop to ensure UUID uniqueness

This commit is contained in:
Michael Starke
2018-11-14 17:49:37 +01:00
parent 0525c84e21
commit e57e20cbe0

View File

@@ -140,6 +140,7 @@
KPKGroup *targetGroup = targetItem; KPKGroup *targetGroup = targetItem;
MPDocument *document = outlineView.window.windowController.document; MPDocument *document = outlineView.window.windowController.document;
/* local drop */
if(info.draggingSource == outlineView) { if(info.draggingSource == outlineView) {
if(copyItem) { if(copyItem) {
NSUInteger insertIndex = index; NSUInteger insertIndex = index;
@@ -179,13 +180,16 @@
} }
return YES; return YES;
} }
/* external drop */
for(KPKEntry *draggedEntry in [self _entriesFromPasteboard:info.draggingPasteboard]) { for(KPKEntry *draggedEntry in [self _entriesFromPasteboard:info.draggingPasteboard]) {
[draggedEntry addToGroup:targetGroup]; KPKEntry *entry = [draggedEntry copyWithTitle:nil options:kKPKCopyOptionCopyHistory];
[draggedEntry.undoManager setActionName:NSLocalizedString(@"DRAG_ENTRY", "Action title for copying an entry via drag and drop to another database")]; [entry addToGroup:targetGroup];
[entry.undoManager setActionName:NSLocalizedString(@"DRAG_ENTRY", "Action title for copying an entry via drag and drop to another database")];
} }
for(KPKGroup *draggedGroup in [self _normalizedGroupsFromPasterboard:info.draggingPasteboard]) { for(KPKGroup *draggedGroup in [self _normalizedGroupsFromPasterboard:info.draggingPasteboard]) {
[draggedGroup addToGroup:targetGroup]; KPKGroup *group = [draggedGroup copyWithTitle:nil options:kKPKCopyOptionCopyHistory];
[draggedGroup.undoManager setActionName:NSLocalizedString(@"DRAG_GROUP", "Actiontitle for copying groups via drag and drop to antother database")]; [group addToGroup:targetGroup];
[group.undoManager setActionName:NSLocalizedString(@"DRAG_GROUP", "Actiontitle for copying groups via drag and drop to antother database")];
} }
return YES; return YES;
} }