mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-18 03:49:22 +00:00
Renamed Categories better
Introduced Drag'n'Drop of Entries to outline view. Unfinished and fragile!
This commit is contained in:
42
MacPass/MPEntryTableDataSource.m
Normal file
42
MacPass/MPEntryTableDataSource.m
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// MPEntyTableDataSource.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 09.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPEntryTableDataSource.h"
|
||||
#import "MPEntryViewController.h"
|
||||
#import "UUID.h"
|
||||
#import "MPConstants.h"
|
||||
|
||||
@interface MPEntryTableDataSource ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation MPEntryTableDataSource
|
||||
|
||||
- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard {
|
||||
|
||||
if([rowIndexes count] != 1) {
|
||||
return NO; // No valid drag
|
||||
}
|
||||
|
||||
id entry = [self.viewController.entryArrayController arrangedObjects][[rowIndexes firstIndex]];
|
||||
|
||||
if(![entry respondsToSelector:@selector(uuid)]) {
|
||||
return NO; // Invalid item for dragging
|
||||
}
|
||||
UUID *uuid = (UUID *)[entry uuid];
|
||||
NSPasteboardItem *pBoardItem = [[NSPasteboardItem alloc] init];
|
||||
[pBoardItem setString:[uuid description] forType:MPPasteBoardType];
|
||||
[pboard writeObjects:@[pBoardItem]];
|
||||
[pBoardItem release];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
//TODO: Validation and adding
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user