From 77b2f3d777bc743b7b96a9f2267d1a89d704510d Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Thu, 21 Feb 2013 00:50:15 +0000 Subject: - When favorites in the connection view gave no password, no longer set the focus to the password field as soon as they're selected; instead, make the password field the next responder for tab keys. This addresses Issue #1555. --- Source/SPFavoritesOutlineView.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'Source/SPFavoritesOutlineView.m') diff --git a/Source/SPFavoritesOutlineView.m b/Source/SPFavoritesOutlineView.m index f4fc3a7a..6972309b 100644 --- a/Source/SPFavoritesOutlineView.m +++ b/Source/SPFavoritesOutlineView.m @@ -37,6 +37,8 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 6; @implementation SPFavoritesOutlineView +@synthesize justGainedFocus; + - (void) awakeFromNib { systemVersion = 0; @@ -45,9 +47,19 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 6; - (BOOL)acceptsFirstResponder { + if ([[self window] firstResponder] != self) { + [self setJustGainedFocus:YES]; + } + return YES; } +- (BOOL)resignFirstResponder +{ + [self setJustGainedFocus:NO]; + return [super resignFirstResponder];; +} + /** * Right-click at row will select that row before ordering out the contextual menu * if not more than one row is selected. @@ -76,6 +88,15 @@ static NSUInteger SPFavoritesOutlineViewUnindent = 6; [[self delegate] performSelector:[self doubleAction]]; return; + + // If the Tab key is used, change focus rather than entering edit mode. + } else if ([[event characters] length] && [[event characters] characterAtIndex:0] == NSTabCharacter) { + if (([event modifierFlags] & NSShiftKeyMask) != NSShiftKeyMask) { + [[self window] selectKeyViewFollowingView:self]; + } else { + [[self window] selectKeyViewPrecedingView:self]; + } + return; } [super keyDown:event]; -- cgit v1.2.3