restore history entries added

This commit is contained in:
michael starke
2017-06-07 18:19:19 +02:00
parent 379d430035
commit 68ed110c4c
11 changed files with 65 additions and 43 deletions

View File

@@ -30,7 +30,7 @@
- (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
MPCustomFieldTableCellView *view = [tableView makeViewWithIdentifier:@"SelectedCell" owner:tableView];
[view.labelTextField bind:NSValueBinding
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(key))]
@@ -39,6 +39,14 @@
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(value))]
options:nil];
// TODO: Move to public KeePassKit API!
for(NSControl *control in @[view.labelTextField, view.valueTextField, view.removeButton ]) {
[control bind:NSEnabledBinding
toObject:view
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(entry)), NSStringFromSelector(@selector(isHistory))]
options:@{NSConditionallySetsEditableBindingOption: @NO, NSValueTransformerNameBindingOption: NSNegateBooleanTransformerName}];
}
view.removeButton.target = self.viewController;
view.removeButton.action = @selector(removeCustomField:);
view.removeButton.tag = row;