From 56af1da2dde48a42d94a61934abf82a11fd4836f Mon Sep 17 00:00:00 2001 From: michael starke Date: Tue, 18 Apr 2017 17:55:18 +0200 Subject: [PATCH] renamed history actions --- MacPass/ContextBar.xib | 3 --- MacPass/MPContextBarViewController.m | 4 ++-- MacPass/MPDocument+HistoryBrowsing.m | 12 ++++++------ MacPass/MPDocument.h | 7 +++++-- MacPass/MPDocumentWindowController.m | 11 +++++------ MacPass/MPEntryViewController.m | 8 ++++---- MacPass/MPPluginDataViewController.m | 2 +- 7 files changed, 23 insertions(+), 24 deletions(-) diff --git a/MacPass/ContextBar.xib b/MacPass/ContextBar.xib index 09263704..3cc98f05 100644 --- a/MacPass/ContextBar.xib +++ b/MacPass/ContextBar.xib @@ -198,9 +198,6 @@ - - - diff --git a/MacPass/MPContextBarViewController.m b/MacPass/MPContextBarViewController.m index 955e91a3..ead3e971 100644 --- a/MacPass/MPContextBarViewController.m +++ b/MacPass/MPContextBarViewController.m @@ -98,7 +98,7 @@ typedef NS_ENUM(NSUInteger, MPContextTab) { - (void)registerNotificationsForDocument:(MPDocument *)document { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_updateFilterButtons) name:MPDocumentDidChangeSearchFlags object:document]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterSearch:) name:MPDocumentDidEnterSearchNotification object:document]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterHistory:) name:MPDocumentDidEnterHistoryNotification object:document]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_showEntryHistory:) name:MPDocumentShowEntryHistoryNotification object:document]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didChangeCurrentItem:) name:MPDocumentCurrentItemChangedNotification object:document]; } @@ -108,7 +108,7 @@ typedef NS_ENUM(NSUInteger, MPContextTab) { [self _updateFilterButtons]; } -- (void)_didEnterHistory:(NSNotification *)notification { +- (void)_showEntryHistory:(NSNotification *)notification { self.activeTab = MPContextTabHistory; [self _updateBindings]; } diff --git a/MacPass/MPDocument+HistoryBrowsing.m b/MacPass/MPDocument+HistoryBrowsing.m index b4e08a85..f087a55f 100644 --- a/MacPass/MPDocument+HistoryBrowsing.m +++ b/MacPass/MPDocument+HistoryBrowsing.m @@ -8,17 +8,17 @@ #import "MPDocument.h" -NSString *const MPDocumentDidEnterHistoryNotification = @"MPDocumentDidEnterHistoryNotification"; -NSString *const MPDocumentDidExitHistoryNotification = @"MPDocumentDidExitHistoryNotification"; +NSString *const MPDocumentShowEntryHistoryNotification = @"MPDocumentShowEntryHistoryNotification"; +NSString *const MPDocumentHideEntryHistoryNotification = @"MPDocumentHideEntryHistoryNotification"; @implementation MPDocument (HistoryBrowsing) -- (void)showHistory:(id)sender { - [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidEnterHistoryNotification object:self]; +- (void)showEntryHistory:(id)sender { + [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification object:self]; } -- (void)exitHistory:(id)sender { - [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidExitHistoryNotification object:self]; +- (void)hideEntryHistory:(id)sender { + [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentHideEntryHistoryNotification object:self]; } diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index 4a8d8255..82bb50ad 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -222,11 +222,14 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey; #pragma mark - #pragma mark History Browsing -FOUNDATION_EXPORT NSString *const MPDocumentDidEnterHistoryNotification; -FOUNDATION_EXPORT NSString *const MPDocumentDidExitHistoryNotification; +FOUNDATION_EXPORT NSString *const MPDocumentShowEntryHistoryNotification; +FOUNDATION_EXPORT NSString *const MPDocumentHideEntryHistoryNotification; @interface MPDocument (HistoryBrowsing) +- (IBAction)showEntryHistory:(id)sender; +- (IBAction)hideEntryHistory:(id)sender; + @end #pragma mark - diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index 2ba4d096..b36cb49f 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -496,14 +496,13 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); } - (void)showEntryHistory:(id)sender { - + id resolver = [NSApp targetForAction:@selector(currentTargetEntries)]; + NSArray *entries = resolver.currentTargetEntries; + if(entries.count != 1) { + return; // only single selection is used + } } -- (void)hideEntryHistory:(id)sender { - -} - - #pragma mark Validation - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { return ([self.document validateMenuItem:menuItem]); diff --git a/MacPass/MPEntryViewController.m b/MacPass/MPEntryViewController.m index fc1a3889..fe5e9d84 100644 --- a/MacPass/MPEntryViewController.m +++ b/MacPass/MPEntryViewController.m @@ -222,8 +222,8 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; selector:@selector(_didUnlockDatabase:) name:MPDocumentDidUnlockDatabaseNotification object:document]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didEnterHistory:) name:MPDocumentDidEnterHistoryNotification object:document]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_didExitHistory:) name:MPDocumentDidExitHistoryNotification object:document]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_showEntryHistory:) name:MPDocumentShowEntryHistoryNotification object:document]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_hideEntryHistory:) name:MPDocumentHideEntryHistoryNotification object:document]; [self.contextBarViewController registerNotificationsForDocument:document]; } @@ -474,11 +474,11 @@ NSString *const _MPTableSecurCellView = @"PasswordCell"; } } -- (void)_didEnterHistory:(NSNotification *)notification { +- (void)_showEntryHistory:(NSNotification *)notification { [self _showContextBar]; } -- (void)_didExitHistory:(NSNotification *)notification { +- (void)_hideEntryHistory:(NSNotification *)notification { [self _hideContextBar]; } #pragma mark ContextBar diff --git a/MacPass/MPPluginDataViewController.m b/MacPass/MPPluginDataViewController.m index 9ecb1565..e9db4528 100644 --- a/MacPass/MPPluginDataViewController.m +++ b/MacPass/MPPluginDataViewController.m @@ -34,7 +34,7 @@ } - (void)didLoadView { - [self.pluginDataController bind:NSContentDictionaryBinding toObject:self.representedObject withKeyPath:NSStringFromSelector(@selector(mutableCustomData)) options:nil]; + [self.pluginDataController bind:NSContentDictionaryBinding toObject:self.representedObject withKeyPath:NSStringFromSelector(@selector(customData)) options:nil]; [self.pluginDataTabelView bind:NSContentBinding toObject:self.pluginDataController withKeyPath:NSStringFromSelector(@selector(arrangedObjects)) options:nil]; self.pluginDataTabelView.backgroundColor = [NSColor clearColor]; }