diff --git a/MacPass/MPDocument+HistoryBrowsing.m b/MacPass/MPDocument+HistoryBrowsing.m index f087a55f..97a3e64d 100644 --- a/MacPass/MPDocument+HistoryBrowsing.m +++ b/MacPass/MPDocument+HistoryBrowsing.m @@ -14,7 +14,12 @@ NSString *const MPDocumentHideEntryHistoryNotification = @"MPDocumentHideEntryH @implementation MPDocument (HistoryBrowsing) - (void)showEntryHistory:(id)sender { - [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification object:self]; + id resolver = [NSApp targetForAction:@selector(currentTargetEntries)]; + NSArray *entries = resolver.currentTargetEntries; + if(entries.count != 1) { + return; // only single selection is used + } + [[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification object:self userInfo:@{ MPDocumentEntryKey: entries.firstObject }]; } - (void)hideEntryHistory:(id)sender { diff --git a/MacPass/MPDocument.h b/MacPass/MPDocument.h index 82bb50ad..7b9c0f67 100644 --- a/MacPass/MPDocument.h +++ b/MacPass/MPDocument.h @@ -222,6 +222,10 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey; #pragma mark - #pragma mark History Browsing +/** + * Posted by the document to signal a reqest for history display. + * the userInfo dictionary has one key MPDocumentEntryKey with the entry to display the history for + */ FOUNDATION_EXPORT NSString *const MPDocumentShowEntryHistoryNotification; FOUNDATION_EXPORT NSString *const MPDocumentHideEntryHistoryNotification; diff --git a/MacPass/MPDocumentWindowController.h b/MacPass/MPDocumentWindowController.h index e7b1ec96..2596a5c6 100644 --- a/MacPass/MPDocumentWindowController.h +++ b/MacPass/MPDocumentWindowController.h @@ -53,8 +53,6 @@ - (IBAction)pickExpiryDate:(id)sender; - (IBAction)performAutotypeForEntry:(id)sender; -- (IBAction)showEntryHistory:(id)sender; -- (IBAction)hideEntryHistory:(id)sender; #pragma mark Helper - (IBAction)fixAutotype:(id)sender; diff --git a/MacPass/MPDocumentWindowController.m b/MacPass/MPDocumentWindowController.m index b36cb49f..c8410395 100644 --- a/MacPass/MPDocumentWindowController.m +++ b/MacPass/MPDocumentWindowController.m @@ -495,14 +495,6 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword); [contentView layoutSubtreeIfNeeded]; } -- (void)showEntryHistory:(id)sender { - id resolver = [NSApp targetForAction:@selector(currentTargetEntries)]; - NSArray *entries = resolver.currentTargetEntries; - if(entries.count != 1) { - return; // only single selection is used - } -} - #pragma mark Validation - (BOOL)validateMenuItem:(NSMenuItem *)menuItem { return ([self.document validateMenuItem:menuItem]);