disabling normal inputs in history display

This commit is contained in:
michael starke
2017-04-24 11:41:15 +02:00
parent bc6f82fa7b
commit 99096740e5

View File

@@ -381,10 +381,7 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
[self.URLTextField bind:NSValueBinding
toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(url))]
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")}];
options:@{ NSNullPlaceholderBindingOption: NSLocalizedString(@"NONE", "")}];
[self.expiresCheckButton bind:NSTitleBinding
toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(timeInfo)), NSStringFromSelector(@selector(expirationDate))]
@@ -397,6 +394,17 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(tags))]
options:nil];
NSArray *inputs = @[ self.titleTextField, self.passwordTextField, self.usernameTextField, self.URLTextField, self.expiresCheckButton /*, self.tagsTokenField */];
for(NSControl *control in inputs) {
NSString *keyPath = [NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(isHistory))];
[control bind:NSEnabledBinding
toObject:self
withKeyPath:keyPath
options:@{NSConditionallySetsEditableBindingOption: @NO, NSValueTransformerNameBindingOption: NSNegateBooleanTransformerName}];
}
[self.uuidTextField bind:NSValueBinding
toObject:self
withKeyPath:[NSString stringWithFormat:@"%@.%@.%@", NSStringFromSelector(@selector(representedObject)), NSStringFromSelector(@selector(uuid)), NSStringFromSelector(@selector(UUIDString))]