fixed wrong content display when clearing search or exiting history display.

This commit is contained in:
michael starke
2017-04-19 22:06:16 +02:00
parent d97a7e53fc
commit b059f6b6a6
2 changed files with 16 additions and 4 deletions

View File

@@ -19,11 +19,17 @@ NSString *const MPDocumentHideEntryHistoryNotification = @"MPDocumentHideEntryH
if(entries.count != 1) {
return; // only single selection is used
}
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification object:self userInfo:@{ MPDocumentEntryKey: entries.firstObject }];
if(self.hasSearch) {
[self exitSearch:sender];
}
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentShowEntryHistoryNotification
object:self
userInfo:@{ MPDocumentEntryKey: entries.firstObject }];
}
- (void)hideEntryHistory:(id)sender {
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentHideEntryHistoryNotification object:self];
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentHideEntryHistoryNotification
object:self];
}

View File

@@ -459,7 +459,6 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
NSArray *result = notification.userInfo[kMPDocumentSearchResultsKey];
NSAssert(result != nil, @"Resutls should never be nil");
self.filteredEntries = result;
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController bind:NSContentArrayBinding toObject:self withKeyPath:NSStringFromSelector(@selector(filteredEntries)) options:nil];
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = NO;
[self _updateContextBar];
@@ -468,9 +467,13 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
- (void)_didExitSearch:(NSNotification *)notification {
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = YES;
[self.entryArrayController unbind:NSContentArrayBinding];
self.entryArrayController.content = nil;
self.filteredEntries = nil;
self.displayMode = MPDisplayModeEntries;
[self _updateContextBar];
MPDocument *document = notification.object;
document.selectedGroups = document.selectedGroups;
}
- (void)_didEnterSearch:(NSNotification *)notification {
@@ -493,14 +496,17 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
self.displayMode = MPDisplayModeHistory;
KPKEntry *entry = notification.userInfo[MPDocumentEntryKey];
NSAssert(entry != nil, @"Resutls should never be nil");
[self.entryArrayController unbind:NSContentArrayBinding];
[self.entryArrayController bind:NSContentArrayBinding toObject:entry withKeyPath:NSStringFromSelector(@selector(history)) options:nil];
[self _updateContextBar];
}
- (void)_hideEntryHistory:(NSNotification *)notification {
self.displayMode = MPDisplayModeEntries;
[self.entryArrayController unbind:NSContentArrayBinding];
self.entryArrayController.content = nil;
[self _updateContextBar];
MPDocument *document = notification.object;
document.selectedGroups = document.selectedGroups;
}
#pragma mark ContextBar
- (void)_updateContextBar {