mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
adde re-selection of groups when exiting search.
This commit is contained in:
@@ -50,7 +50,6 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
||||
[NSNotificationCenter.defaultCenter postNotificationName:MPDocumentDidEnterSearchNotification object:self];
|
||||
[self updateSearch:self];
|
||||
/* clear selection */
|
||||
self.selectedGroups = nil;
|
||||
self.selectedEntries = nil;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
|
||||
@interface MPOutlineViewController () {
|
||||
BOOL _bindingEstablished;
|
||||
NSIndexSet *_storedSelectionIndexSet;
|
||||
MPOutlineContextMenuDelegate *_menuDelegate;
|
||||
|
||||
}
|
||||
@@ -100,7 +101,6 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
name:MPDidActivateViewNotification
|
||||
object:self.outlineView];
|
||||
|
||||
|
||||
NSView *clipView = self.outlineView.enclosingScrollView.contentView;
|
||||
[NSNotificationCenter.defaultCenter addObserver:self
|
||||
selector:@selector(_outlineDidScroll:)
|
||||
@@ -226,6 +226,8 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
- (void)registerNotificationsForDocument:(MPDocument *)document {
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didAddGroup:) name:MPDocumentDidAddGroupNotification object:document];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didRevertDocument:) name:MPDocumentDidRevertNotification object:document];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didEnterSearch:) name:MPDocumentDidEnterSearchNotification object:document];
|
||||
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(_didExitSearch:) name:MPDocumentDidExitSearchNotification object:document];
|
||||
}
|
||||
|
||||
- (void)clearSelection {
|
||||
@@ -273,6 +275,16 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
[self clearSelection];
|
||||
}
|
||||
|
||||
- (void)_didEnterSearch:(NSNotification *)notification {
|
||||
// store seelection
|
||||
_storedSelectionIndexSet = self.outlineView.selectedRowIndexes;
|
||||
[self clearSelection];
|
||||
}
|
||||
|
||||
- (void)_didExitSearch:(NSNotification *)notification {
|
||||
[self.outlineView selectRowIndexes:_storedSelectionIndexSet byExtendingSelection:NO];
|
||||
}
|
||||
|
||||
- (id)itemUnderMouse {
|
||||
NSPoint mouseLocation = [self.outlineView.window mouseLocationOutsideOfEventStream];
|
||||
NSPoint localPoint = [self.outlineView convertPoint:mouseLocation fromView:self.outlineView.window.contentView];
|
||||
|
||||
Reference in New Issue
Block a user