From 6eea1ed48e21a4ca4d5e875bedc109efcf3b645a Mon Sep 17 00:00:00 2001 From: michael starke Date: Fri, 19 May 2017 19:24:24 +0200 Subject: [PATCH] Changed layout for Autotype builder. Using new KeePassKit API --- Cartfile | 2 +- Cartfile.resolved | 2 +- MacPass/AutotypeBuilderView.xib | 72 ++++++++++++++++++----- MacPass/MPAutotypeBuilderViewController.m | 7 +-- 4 files changed, 63 insertions(+), 20 deletions(-) diff --git a/Cartfile b/Cartfile index 6fe844e6..b3db7dcf 100644 --- a/Cartfile +++ b/Cartfile @@ -1,3 +1,3 @@ github "sparkle-project/Sparkle" ~> 1.17.0 -github "mstarke/KeePassKit" "ba7e116cbe48edb3be3d82fdd9f6f72da5745d4a" +github "mstarke/KeePassKit" "ab95d3a85b2bcb86d9e3e5e74d2168c209756b8b" github "mstarke/HNHUi" ~> 1.1 diff --git a/Cartfile.resolved b/Cartfile.resolved index 78e44d10..7af78158 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,3 +1,3 @@ github "mstarke/HNHUi" "1.1" -github "mstarke/KeePassKit" "ba7e116cbe48edb3be3d82fdd9f6f72da5745d4a" +github "mstarke/KeePassKit" "ab95d3a85b2bcb86d9e3e5e74d2168c209756b8b" github "sparkle-project/Sparkle" "1.17.0" diff --git a/MacPass/AutotypeBuilderView.xib b/MacPass/AutotypeBuilderView.xib index 1e169566..611f64b8 100644 --- a/MacPass/AutotypeBuilderView.xib +++ b/MacPass/AutotypeBuilderView.xib @@ -16,29 +16,73 @@ - + - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + diff --git a/MacPass/MPAutotypeBuilderViewController.m b/MacPass/MPAutotypeBuilderViewController.m index d792e63c..e224b483 100644 --- a/MacPass/MPAutotypeBuilderViewController.m +++ b/MacPass/MPAutotypeBuilderViewController.m @@ -70,10 +70,9 @@ } if([[representedObject uppercaseString] hasPrefix:@"{S:"]) { KPKEntry *entry = self.representedObject; - NSArray *customAttributes = entry.customAttributes; - if(customAttributes.count > 0 ) { + if(entry.hasCustomAttributes ) { NSMenu *menu = [[NSMenu alloc] init]; - for(KPKAttribute *attribute in customAttributes) { + for(KPKAttribute *attribute in entry.customAttributes) { [menu addItemWithTitle:attribute.key action:@selector(addCustomKeyPlaceholder:) keyEquivalent:@""]; } return menu; @@ -86,7 +85,7 @@ if(tokenField != self.availableCommandsTokenField) { return NO; } - BOOL showMenu = ([[representedObject uppercaseString] hasPrefix:@"{S:"] && [self.representedObject customAttributes].count > 0); + BOOL showMenu = ([[representedObject uppercaseString] hasPrefix:@"{S:"] && [self.representedObject hasCustomAttributes]); return showMenu; }