Some work to get Drag and Drop back up again. Might be useful to postpone it until KeePassKit is ready to replace MiniKeePassLib

This commit is contained in:
michael starke
2013-08-04 23:16:41 +02:00
parent 450bc3d4dd
commit f87e60442e
12 changed files with 113 additions and 39 deletions

View File

@@ -8,7 +8,10 @@
#import "MPEntryTableDataSource.h"
#import "MPEntryViewController.h"
#import "UUID.h"
#import "Kdb.h"
#import "UUID+Pasterboard.h"
#import "MPConstants.h"
@interface MPEntryTableDataSource ()
@@ -23,19 +26,13 @@
return NO; // No valid drag
}
id entry = [self.viewController.entryArrayController arrangedObjects][[rowIndexes firstIndex]];
if(![entry respondsToSelector:@selector(uuid)]) {
return NO; // Invalid item for dragging
id item = [self.viewController.entryArrayController arrangedObjects][[rowIndexes firstIndex]];
if(![item isKindOfClass:[KdbEntry class]]) {
return NO;
}
UUID *uuid = (UUID *)[entry uuid];
NSPasteboardItem *pBoardItem = [[NSPasteboardItem alloc] init];
[pBoardItem setString:[uuid description] forType:MPPasteBoardType];
[pboard writeObjects:@[pBoardItem]];
KdbEntry *entry = (KdbEntry *)item;
[pboard writeObjects:@[entry.uuid]];
return YES;
}
//TODO: Validation and adding
@end