mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-17 15:59:24 +00:00
Search toggle now actually toggles.
This commit is contained in:
@@ -66,19 +66,20 @@ NSString *const kMPDocumentSearchResultsKey = @"kMPDocumentSearchResul
|
|||||||
return; // We need to read the button state
|
return; // We need to read the button state
|
||||||
}
|
}
|
||||||
MPEntrySearchFlags toggleFlag = [sender tag];
|
MPEntrySearchFlags toggleFlag = [sender tag];
|
||||||
|
MPEntrySearchFlags newFlags = MPEntrySearchNone;
|
||||||
switch([sender state]) {
|
switch([sender state]) {
|
||||||
case NSOffState:
|
case NSOffState:
|
||||||
toggleFlag ^= MPEntrySearchAllFlags;
|
toggleFlag ^= MPEntrySearchAllFlags;
|
||||||
|
newFlags = self.activeFlags & toggleFlag;
|
||||||
break;
|
break;
|
||||||
case NSOnState:
|
case NSOnState:
|
||||||
/* On is fine */
|
newFlags = self.activeFlags | toggleFlag;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NSAssert(NO, @"Internal state is inconsistent");
|
NSAssert(NO, @"Internal state is inconsistent");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MPEntrySearchFlags newFlags = self.activeFlags & toggleFlag;
|
if(newFlags != self.activeFlags) {
|
||||||
if(newFlags == self.activeFlags) {
|
|
||||||
self.activeFlags = (newFlags == MPEntrySearchNone) ? MPEntrySearchTitles : newFlags;
|
self.activeFlags = (newFlags == MPEntrySearchNone) ? MPEntrySearchTitles : newFlags;
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidChangeSearchFlags object:self];
|
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidChangeSearchFlags object:self];
|
||||||
[self updateSearch:self];
|
[self updateSearch:self];
|
||||||
|
|||||||
@@ -255,8 +255,11 @@ NSString *const MPToolbarItemSearch = @"TOOLBAR_SEARCH";
|
|||||||
if(_displayModeBeforeSearch == NSToolbarDisplayModeLabelOnly) {
|
if(_displayModeBeforeSearch == NSToolbarDisplayModeLabelOnly) {
|
||||||
[self.toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
|
[self.toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
|
||||||
}
|
}
|
||||||
[[self.searchField window] makeFirstResponder:self.searchField];
|
/* only make the searchfield first responder if it's not aleady in an active search */
|
||||||
[self.searchField selectText:self];
|
if(![self.searchField currentEditor]) {
|
||||||
|
[[self.searchField window] makeFirstResponder:self.searchField];
|
||||||
|
[self.searchField selectText:self];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)_didExitSearch:(NSNotification *)notification {
|
- (void)_didExitSearch:(NSNotification *)notification {
|
||||||
|
|||||||
Reference in New Issue
Block a user