Entry do not drag onto other entries anymore. Improvements to the localisation for drag and drop

This commit is contained in:
Michael Starke
2018-11-11 09:31:47 +01:00
parent 24d50b4b50
commit f83e071c16
5 changed files with 17 additions and 9 deletions

View File

@@ -21,7 +21,6 @@
//
#import "MPAttachmentTableDataSource.h"
#import "KPKBinary+MPAdditions.h"
#import "MPDocument.h"
@implementation MPAttachmentTableDataSource

View File

@@ -63,13 +63,16 @@
}
- (BOOL)tableView:(NSTableView *)tableView acceptDrop:(id<NSDraggingInfo>)info row:(NSInteger)row dropOperation:(NSTableViewDropOperation)dropOperation {
/* local drag */
if(dropOperation == NSTableViewDropAbove) {
row = MAX(0, row - 1); // decrement the row
}
BOOL copyItems = info.draggingSourceOperationMask == NSDragOperationCopy;
MPDocument *document = tableView.window.windowController.document;
if(document.currentTargetGroups.count != 1) {
return NO;
}
KPKGroup *targetGroup = document.currentTargetGroups.firstObject;
/* local drag */
if(info.draggingSource == tableView) {
if(copyItems) {
for(NSUUID *entryUUID in [self _readEntryUUIDsFromPasterboard:info.draggingPasteboard].reverseObjectEnumerator) {

View File

@@ -156,7 +156,7 @@
for(KPKGroup *group in self.draggedGroups.reverseObjectEnumerator) {
[group moveToGroup:targetGroup atIndex:insertIndex];
insertIndex = group.index;
[group.undoManager setActionName:NSLocalizedString(@"MOVE_GROUP", "Action title for moving a group via drag and drop")];
[group.undoManager setActionName:NSLocalizedString(@"DRAG_GROUP", "Action title for moving a group via drag and drop")];
}
return YES;
}
@@ -174,7 +174,7 @@
for(NSUUID *entryUUID in entryUUIDs) {
KPKEntry *draggedEntry = [document findEntry:entryUUID];
[draggedEntry moveToGroup:targetGroup];
[draggedEntry.undoManager setActionName:NSLocalizedString(@"MOVE_ENTRY", "Action title for moving an entry via drag and drop")];
[draggedEntry.undoManager setActionName:NSLocalizedString(@"DRAG_ENTRY", "Action title for moving an entry via drag and drop")];
}
}
return YES;

View File

@@ -135,7 +135,8 @@
/* Context menu sub-menu to copy custom fields to clipboard */
"COPY_CUSTOM_FIELDS_MENU" = "Copy Custom Field…";
/* Action title for copying an entry via drag and drop */
/* Action name when an entry was moved
Action title for copying an entry via drag and drop */
"COPY_ENTRY" = "Copy Entry";
/* Mask for title to copy field value */
@@ -201,6 +202,14 @@
/* Empty Trash */
"DELETE_TRASHED_GROUP" = "Delete Trashed Group";
/* Action title for copying an entry via drag and drop to another database
Action title for moving an entry via drag and drop */
"DRAG_ENTRY" = "Drag Entry";
/* Action title for moving a group via drag and drop
Actiontitle for copying groups via drag and drop to antother database */
"DRAG_GROUP" = "Drag Group";
/* Action name for duplicating entries */
"DUPLICATE_ENTRIES_%ld" = "Duplicate Entries %ld";
@@ -331,12 +340,9 @@
Modification date column title */
"MODIFIED" = "Modified";
/* Action title for moving an entry via drag and drop */
/* Action name when an entry was moved */
"MOVE_ENTRY" = "Move Entry";
/* Action title for moving a group via drag and drop */
"MOVE_GROUP" = "Move Group";
/* Menu displayed as popup selection for search options when multiple items are selected */
"MULTIPLE_FILTERS_ACTIVE_WITH_DOTS" = "Multiple…";

Binary file not shown.