mirror of
https://github.com/MacPass/MacPass.git
synced 2026-02-02 02:48:23 +00:00
Removed unneeded property. Changed how search tracks updates when file structure changes. Fixes #721
This commit is contained in:
@@ -42,11 +42,11 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
|||||||
- (void)enterSearchWithContext:(MPEntrySearchContext *)context {
|
- (void)enterSearchWithContext:(MPEntrySearchContext *)context {
|
||||||
/* the search context is loaded via defaults */
|
/* the search context is loaded via defaults */
|
||||||
self.searchContext = context;
|
self.searchContext = context;
|
||||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:NSUndoManagerDidRedoChangeNotification object:self.undoManager];
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:KPKTreeDidAddEntryNotification object:self.tree];
|
||||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:NSUndoManagerDidUndoChangeNotification object:self.undoManager];
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:KPKTreeDidAddGroupNotification object:self.tree];
|
||||||
/* Do not do this since it seems to break the undo/redo grouping completly!
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:KPKTreeDidRemoveEntryNotification object:self.tree];
|
||||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:NSUndoManagerDidCloseUndoGroupNotification object:self.undoManager];
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(updateSearch:) name:KPKTreeDidRemoveGroupNotification object:self.tree];
|
||||||
*/
|
|
||||||
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidEnterSearchNotification object:self];
|
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidEnterSearchNotification object:self];
|
||||||
[self updateSearch:self];
|
[self updateSearch:self];
|
||||||
/* clear selection */
|
/* clear selection */
|
||||||
@@ -77,11 +77,12 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)exitSearch:(id)sender {
|
- (void)exitSearch:(id)sender {
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:NSUndoManagerDidUndoChangeNotification object:self.undoManager];
|
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:NSUndoManagerDidRedoChangeNotification object:self.undoManager];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKTreeDidAddEntryNotification object:self.tree];
|
||||||
/* No need to do this since we did not register in the first place see [MPDocument enterSearchWithContext:]
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKTreeDidAddGroupNotification object:self.tree];
|
||||||
[NSNotificationCenter.defaultCenter removeObserver:self name:NSUndoManagerDidCloseUndoGroupNotification object:self.undoManager];
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKTreeDidRemoveEntryNotification object:self.tree];
|
||||||
*/
|
[NSNotificationCenter.defaultCenter removeObserver:self name:KPKTreeDidRemoveGroupNotification object:self.tree];
|
||||||
|
|
||||||
self.searchContext = nil;
|
self.searchContext = nil;
|
||||||
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidExitSearchNotification object:self];
|
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidExitSearchNotification object:self];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
|||||||
}
|
}
|
||||||
|
|
||||||
@property (strong) MPContextBarViewController *contextBarViewController;
|
@property (strong) MPContextBarViewController *contextBarViewController;
|
||||||
@property (strong) NSArray *filteredEntries;
|
|
||||||
|
|
||||||
@property (weak) IBOutlet NSTableView *entryTable;
|
@property (weak) IBOutlet NSTableView *entryTable;
|
||||||
@property (assign) MPDisplayMode displayMode;
|
@property (assign) MPDisplayMode displayMode;
|
||||||
@@ -502,8 +501,7 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
|||||||
- (void)_didUpdateSearchResults:(NSNotification *)notification {
|
- (void)_didUpdateSearchResults:(NSNotification *)notification {
|
||||||
NSArray *result = notification.userInfo[kMPDocumentSearchResultsKey];
|
NSArray *result = notification.userInfo[kMPDocumentSearchResultsKey];
|
||||||
NSAssert(result != nil, @"Results should never be nil");
|
NSAssert(result != nil, @"Results should never be nil");
|
||||||
self.filteredEntries = result;
|
self.entryArrayController.content = result;
|
||||||
self.entryArrayController.content = self.filteredEntries;
|
|
||||||
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = NO;
|
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = NO;
|
||||||
[self _updateContextBar];
|
[self _updateContextBar];
|
||||||
}
|
}
|
||||||
@@ -512,7 +510,6 @@ NSString *const _MPTableSecurCellView = @"PasswordCell";
|
|||||||
- (void)_didExitSearch:(NSNotification *)notification {
|
- (void)_didExitSearch:(NSNotification *)notification {
|
||||||
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = YES;
|
[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier].hidden = YES;
|
||||||
self.entryArrayController.content = nil;
|
self.entryArrayController.content = nil;
|
||||||
self.filteredEntries = nil;
|
|
||||||
self.displayMode = MPDisplayModeEntries;
|
self.displayMode = MPDisplayModeEntries;
|
||||||
[self _updateContextBar];
|
[self _updateContextBar];
|
||||||
MPDocument *document = notification.object;
|
MPDocument *document = notification.object;
|
||||||
|
|||||||
Reference in New Issue
Block a user