Adium

Changeset 23983

Show
Ignore:
Timestamp:
06/14/2008 07:24:11 PM (6 months ago)
Author:
evands
Message:

When escape is pressed in the standard contact list while in a search, it removes the selection on first press as it normally. Once there is no selection, pressing escape again now closes the search field. Refs #10031

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Frameworks/Adium Framework/Source/AIAbstractListController.h

    r23952 r23983  
    166166@interface NSObject(AIListControllerOptionalDelegateMethods) 
    167167- (void)toggleFindPanel:(id)sender; 
    168 - (void)forwardKeyEventToFindPanel:(NSEvent *)theEvent; 
     168- (BOOL)forwardKeyEventToFindPanel:(NSEvent *)theEvent; 
    169169@end 
    170170 
  • trunk/Frameworks/Adium Framework/Source/AIAbstractListController.m

    r23952 r23983  
    964964- (void)outlineViewToggleFindPanel:(NSOutlineView *)outlineView; 
    965965{ 
    966         if ([[self delegate]respondsToSelector:@selector(toggleFindPanel:)]) 
    967                 [[self delegate]toggleFindPanel:outlineView]; 
     966        if ([[self delegate] respondsToSelector:@selector(toggleFindPanel:)]) 
     967                [[self delegate] toggleFindPanel:outlineView]; 
    968968} 
    969969- (BOOL)outlineView:(NSOutlineView *)outlineView forwardKeyEventToFindPanel:(NSEvent *)event; 
    970970{ 
    971         if ([[self delegate]respondsToSelector:@selector(forwardKeyEventToFindPanel:)]) { 
    972                 [[self delegate]forwardKeyEventToFindPanel:event]; 
    973                 return YES; 
     971        if ([[self delegate] respondsToSelector:@selector(forwardKeyEventToFindPanel:)]) { 
     972                return [[self delegate] forwardKeyEventToFindPanel:event]; 
    974973        } else { 
    975974                return NO; 
  • trunk/Frameworks/AIUtilities Framework/Source/AIOutlineView.m

    r23921 r23983  
    129129                        [self findNext:self]; 
    130130 
    131                 } else if([[self delegate] respondsToSelector:@selector(outlineView:forwardKeyEventToFindPanel:)] &&  
    132                                   !([theEvent modifierFlags] & NSCommandKeyMask) &&  
    133                                   !([theEvent modifierFlags] & NSControlKeyMask) && 
    134                                   [[[NSCharacterSet controlCharacterSet]invertedSet]characterIsMember:pressedChar]) { 
     131                } else if ([[self delegate] respondsToSelector:@selector(outlineView:forwardKeyEventToFindPanel:)] &&  
     132                                   !([theEvent modifierFlags] & NSCommandKeyMask) &&  
     133                                   !([theEvent modifierFlags] & NSControlKeyMask)) { 
    135134                        //handle any key we have not alredy handled that is a visable character and likely not to be a shortcut key (no command or control key modifiers) by asking the delegate to add it to the search string 
    136                         if(![[self delegate]outlineView:self forwardKeyEventToFindPanel:theEvent]) { 
     135                        if (![[self delegate] outlineView:self forwardKeyEventToFindPanel:theEvent]) { 
    137136                                //the delegate's find panel could not handle the event, so we just pass it to super 
    138137                                [super keyDown:theEvent]; 
  • trunk/Source/AIStandardListWindowController.h

    r23277 r23983  
    6464 
    6565- (void)toggleFindPanel:(id)sender; 
    66 - (void)forwardKeyEventToFindPanel:(NSEvent *)theEvent; 
    6766- (IBAction)hideFilterBar:(id)sender; 
    6867- (IBAction)filterContacts:(id)sender; 
  • trunk/Source/AIStandardListWindowController.m

    r23979 r23983  
    10111011 * @brief Forward typing events from the contact list to the filter bar 
    10121012 */ 
    1013 - (void)forwardKeyEventToFindPanel:(NSEvent *)theEvent; 
     1013- (BOOL)forwardKeyEventToFindPanel:(NSEvent *)theEvent; 
    10141014{ 
    10151015        //if we were not searching something before, we need to show the filter bar first without animation 
    1016         [self showFilterBarWithAnimation:NO]; 
    1017          
    1018         [[self window] makeFirstResponder:searchField]; 
    1019         [[[self window] fieldEditor:YES forObject:searchField] keyDown:theEvent]; 
     1016        NSString        *charString = [theEvent charactersIgnoringModifiers]; 
     1017        unichar         pressedChar = 0; 
     1018 
     1019        //Get the pressed character 
     1020        if ([charString length] == 1) pressedChar = [charString characterAtIndex:0]; 
     1021 
     1022#define NSEscapeFunctionKey 27 
     1023        if ((pressedChar == NSEscapeFunctionKey) && ([contactListView selectedRow] != -1)) { 
     1024                return NO; 
     1025 
     1026        } else { 
     1027                if (!filterBarIsVisible) 
     1028                        [self showFilterBarWithAnimation:NO]; 
     1029 
     1030                [[self window] makeFirstResponder:searchField]; 
     1031                [[[self window] fieldEditor:YES forObject:searchField] keyDown:theEvent]; 
     1032                 
     1033                return YES; 
     1034        } 
    10201035} 
    10211036