Disable service menu for protected attributes

This commit is contained in:
Michael Starke
2018-08-29 17:54:07 +02:00
parent 2acff0702d
commit 213e3584a0

View File

@@ -568,6 +568,19 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) {
#pragma mark -
#pragma mark HNHUITextFieldDelegate
- (BOOL)textField:(NSTextField *)textField allowServicesForTextView:(NSTextView *)textView {
/* disallow servies for password fields */
if(textField == self.passwordTextField) {
return NO;
}
NSInteger index = MPCustomFieldIndexFromTag(textField.tag);
if(index > -1) {
KPKAttribute *attribute = _customFieldsController.arrangedObjects[index];
return !attribute.protect;
}
return YES;
}
- (NSMenu *)textField:(NSTextField *)textField textView:(NSTextView *)view menu:(NSMenu *)menu {
for(NSMenuItem *item in menu.itemArray) {
#pragma clang diagnostic push