From e57e20cbe0c60efa8119584e30f3193527d5957d Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 14 Nov 2018 17:49:37 +0100 Subject: [PATCH] Copy entries from external drop to ensure UUID uniqueness --- MacPass/MPOutlineDataSource.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/MacPass/MPOutlineDataSource.m b/MacPass/MPOutlineDataSource.m index 8f733437..a8eefc66 100644 --- a/MacPass/MPOutlineDataSource.m +++ b/MacPass/MPOutlineDataSource.m @@ -140,6 +140,7 @@ KPKGroup *targetGroup = targetItem; MPDocument *document = outlineView.window.windowController.document; + /* local drop */ if(info.draggingSource == outlineView) { if(copyItem) { NSUInteger insertIndex = index; @@ -179,13 +180,16 @@ } return YES; } + /* external drop */ for(KPKEntry *draggedEntry in [self _entriesFromPasteboard:info.draggingPasteboard]) { - [draggedEntry addToGroup:targetGroup]; - [draggedEntry.undoManager setActionName:NSLocalizedString(@"DRAG_ENTRY", "Action title for copying an entry via drag and drop to another database")]; + KPKEntry *entry = [draggedEntry copyWithTitle:nil options:kKPKCopyOptionCopyHistory]; + [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]) { - [draggedGroup addToGroup:targetGroup]; - [draggedGroup.undoManager setActionName:NSLocalizedString(@"DRAG_GROUP", "Actiontitle for copying groups via drag and drop to antother database")]; + KPKGroup *group = [draggedGroup copyWithTitle:nil options:kKPKCopyOptionCopyHistory]; + [group addToGroup:targetGroup]; + [group.undoManager setActionName:NSLocalizedString(@"DRAG_GROUP", "Actiontitle for copying groups via drag and drop to antother database")]; } return YES; }