More drafting on history browsing

This commit is contained in:
michael starke
2014-08-20 01:22:54 +02:00
parent e1d38ad6e2
commit ac3a41e4a0
7 changed files with 70 additions and 12 deletions

View File

@@ -13,6 +13,7 @@
#import "MPDocument.h"
#import "MPDocument+Search.h"
#import "MPDocument+Autotype.h"
#import "MPDocument+HistoryBrowsing.h"
#import "MPDocumentWindowController.h"
#import "MPPasteBoardController.h"
@@ -235,6 +236,9 @@ 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];
[self.contextBarViewController registerNotificationsForDocument:document];
}
@@ -413,6 +417,20 @@ NSString *const _MPTAbleSecurCellView = @"PasswordCell";
}
}
- (void)_didEnterHistory:(NSNotification *)notification {
[self _showContextBar];
/* TODO: Show modification date column if not present? */
MPDocument *document = [[self windowController] document];
[self.entryArrayController bind:NSContentArrayBinding toObject:document.selectedEntry withKeyPath:NSStringFromSelector(@selector(history)) options:nil];
}
- (void)_didExitHistory:(NSNotification *)notification {
[self _hideContextBar];
MPDocument *document = [[self windowController] document];
document.selectedItem = document.selectedEntry;
}
#pragma mark ContextBar
- (void)_updateContextBar {
MPDocument *document = [[self windowController] document];