From 9beca326a10fe706ce03059a712081209a0e0d17 Mon Sep 17 00:00:00 2001 From: michael starke Date: Mon, 15 May 2017 09:58:44 +0200 Subject: [PATCH] Custom data removal. KeePassKit is not KVC-compiant so the ui does not update immmediatly --- MacPass/Base.lproj/EntryInspectorView.xib | 8 ++++---- MacPass/MPPluginDataViewController.m | 17 +++++++++++++++++ MacPass/PluginDataView.xib | 16 ++++++++-------- 3 files changed, 29 insertions(+), 12 deletions(-) diff --git a/MacPass/Base.lproj/EntryInspectorView.xib b/MacPass/Base.lproj/EntryInspectorView.xib index 347ad2c5..0e71f501 100644 --- a/MacPass/Base.lproj/EntryInspectorView.xib +++ b/MacPass/Base.lproj/EntryInspectorView.xib @@ -94,7 +94,7 @@ - + @@ -271,7 +271,7 @@ - + @@ -752,7 +752,7 @@ - + @@ -948,7 +948,7 @@ - + diff --git a/MacPass/MPPluginDataViewController.m b/MacPass/MPPluginDataViewController.m index e9db4528..161b3cc7 100644 --- a/MacPass/MPPluginDataViewController.m +++ b/MacPass/MPPluginDataViewController.m @@ -46,6 +46,17 @@ return nil; } +- (IBAction)removePluginData:(id)sender { + if(![sender isKindOfClass:NSButton.class]) { + return; // wrong sender + } + NSInteger tag = ((NSButton *)sender).tag; + if(tag >= 0 && tag < [self.pluginDataController.arrangedObjects count]) { + id keyValueStore = ((NSArray *)self.pluginDataController.arrangedObjects)[tag]; + [self.representedNode removeCustomDataValueForKey:[keyValueStore key]]; + } +} + - (IBAction)removeAllPluginData:(id)sender { // } @@ -60,7 +71,13 @@ toObject:view withKeyPath:[NSString stringWithFormat:@"%@.%@", NSStringFromSelector(@selector(objectValue)), NSStringFromSelector(@selector(key))] options:nil]; + + view.removeButton.target = self; + view.removeButton.action = @selector(removePluginData:); + view.removeButton.tag = row; + view.observer = self.observer; + return view; } diff --git a/MacPass/PluginDataView.xib b/MacPass/PluginDataView.xib index dbcccbde..4d81209d 100644 --- a/MacPass/PluginDataView.xib +++ b/MacPass/PluginDataView.xib @@ -1,8 +1,8 @@ - + - + @@ -48,24 +48,24 @@ - + - + - + - + @@ -120,7 +120,7 @@ - + @@ -150,7 +150,7 @@ - +