mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 01:12:31 +00:00
moved history display actino to MPDocument
This commit is contained in:
@@ -14,7 +14,12 @@ NSString *const MPDocumentHideEntryHistoryNotification = @"MPDocumentHideEntryH
|
|||||||
@implementation MPDocument (HistoryBrowsing)
|
@implementation MPDocument (HistoryBrowsing)
|
||||||
|
|
||||||
- (void)showEntryHistory:(id)sender {
|
- (void)showEntryHistory:(id)sender {
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification object:self];
|
id<MPTargetNodeResolving> 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 {
|
- (void)hideEntryHistory:(id)sender {
|
||||||
|
|||||||
@@ -222,6 +222,10 @@ FOUNDATION_EXPORT NSString *const MPDocumentGroupKey;
|
|||||||
#pragma mark -
|
#pragma mark -
|
||||||
#pragma mark History Browsing
|
#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 MPDocumentShowEntryHistoryNotification;
|
||||||
FOUNDATION_EXPORT NSString *const MPDocumentHideEntryHistoryNotification;
|
FOUNDATION_EXPORT NSString *const MPDocumentHideEntryHistoryNotification;
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,6 @@
|
|||||||
- (IBAction)pickExpiryDate:(id)sender;
|
- (IBAction)pickExpiryDate:(id)sender;
|
||||||
|
|
||||||
- (IBAction)performAutotypeForEntry:(id)sender;
|
- (IBAction)performAutotypeForEntry:(id)sender;
|
||||||
- (IBAction)showEntryHistory:(id)sender;
|
|
||||||
- (IBAction)hideEntryHistory:(id)sender;
|
|
||||||
|
|
||||||
#pragma mark Helper
|
#pragma mark Helper
|
||||||
- (IBAction)fixAutotype:(id)sender;
|
- (IBAction)fixAutotype:(id)sender;
|
||||||
|
|||||||
@@ -495,14 +495,6 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
|
|||||||
[contentView layoutSubtreeIfNeeded];
|
[contentView layoutSubtreeIfNeeded];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)showEntryHistory:(id)sender {
|
|
||||||
id<MPTargetNodeResolving> resolver = [NSApp targetForAction:@selector(currentTargetEntries)];
|
|
||||||
NSArray *entries = resolver.currentTargetEntries;
|
|
||||||
if(entries.count != 1) {
|
|
||||||
return; // only single selection is used
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark Validation
|
#pragma mark Validation
|
||||||
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
|
||||||
return ([self.document validateMenuItem:menuItem]);
|
return ([self.document validateMenuItem:menuItem]);
|
||||||
|
|||||||
Reference in New Issue
Block a user