From 213e3584a07a581bf07e5e523e417a559b1b730f Mon Sep 17 00:00:00 2001 From: Michael Starke Date: Wed, 29 Aug 2018 17:54:07 +0200 Subject: [PATCH] Disable service menu for protected attributes --- MacPass/MPEntryInspectorViewController.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index f5bd1df3..7e9cfadc 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -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