mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-19 13:19:31 +00:00
Started Move to KeePassKit - Project compiles but does NOT work properly
Removed MiniKeePass Categories. Moved Random streams form MiniKeePass to KeePassKit Changed MacPass to use KeePassKit
This commit is contained in:
@@ -10,28 +10,31 @@
|
||||
#import "MPDocument.h"
|
||||
#import "MPCustomFieldTableCellView.h"
|
||||
|
||||
#import "Kdb4Node.h"
|
||||
#import "StringField+Undo.h"
|
||||
#import "KPKEntry.h"
|
||||
#import "KPKAttribute.h"
|
||||
|
||||
@implementation MPCustomFieldTableViewDelegate
|
||||
|
||||
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
|
||||
MPDocument *document = [[[tableView window] windowController] document];
|
||||
if(![document.selectedEntry isKindOfClass:[Kdb4Entry class]]) {
|
||||
return nil;
|
||||
}
|
||||
Kdb4Entry *entry = (Kdb4Entry *)document.selectedEntry;
|
||||
|
||||
KPKEntry *entry = document.selectedEntry;
|
||||
MPCustomFieldTableCellView *view = [tableView makeViewWithIdentifier:@"SelectedCell" owner:tableView];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_customFieldFrameChanged:) name:NSViewFrameDidChangeNotification object:view];
|
||||
if([document.selectedEntry isKindOfClass:[Kdb4Entry class]]) {
|
||||
StringField *stringField = entry.stringFields[row];
|
||||
NSDictionary *validateOptions = @{ NSValidatesImmediatelyBindingOption: @YES };
|
||||
[view.labelTextField bind:NSValueBinding toObject:stringField withKeyPath:MPStringFieldKeyUndoableKey options:validateOptions];
|
||||
[view.valueTextField bind:NSValueBinding toObject:stringField withKeyPath:MPStringFieldValueUndoableKey options:nil];
|
||||
[view.removeButton setTarget:self.viewController];
|
||||
[view.removeButton setAction:@selector(removeCustomField:)];
|
||||
[view.removeButton setTag:row];
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_customFieldFrameChanged:)
|
||||
name:NSViewFrameDidChangeNotification
|
||||
object:view];
|
||||
|
||||
NSAssert([entry.customAttributes count] > row, @"Count of custom attributes must match row");
|
||||
KPKAttribute *attribute = entry.customAttributes[row];
|
||||
NSDictionary *validateOptions = @{ NSValidatesImmediatelyBindingOption: @YES };
|
||||
[view.labelTextField bind:NSValueBinding toObject:attribute withKeyPath:@"key" options:validateOptions];
|
||||
[view.valueTextField bind:NSValueBinding toObject:attribute withKeyPath:@"value" options:nil];
|
||||
[view.removeButton setTarget:self.viewController];
|
||||
[view.removeButton setAction:@selector(removeCustomField:)];
|
||||
[view.removeButton setTag:row];
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user