aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPConnectionController.m6
-rw-r--r--Source/SPDatabaseDocument.m6
2 files changed, 9 insertions, 3 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index 5ea3aa77..ad2bdf62 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -110,8 +110,9 @@
[favoritesTable setDoubleAction:@selector(initiateConnection:)];
[favoritesTable registerForDraggedTypes:[NSArray arrayWithObject:favoritesPBoardType]];
[favoritesTable setDraggingSourceOperationMask:NSDragOperationMove forLocal:YES];
- // Set the focus to the favorites table and select the appropriate row
- [[tableDocument parentWindow] setInitialFirstResponder:favoritesTable];
+
+ // Sort the favourites to match prefs and select the appropriate row
+ [self _sortFavorites];
NSInteger tableRow;
if ([prefs boolForKey:SPSelectLastFavoriteUsed] == YES) {
tableRow = [prefs integerForKey:SPLastFavoriteIndex] + 1;
@@ -128,7 +129,6 @@
[self resizeTabViewToConnectionType:SPTCPIPConnection animating:NO];
}
}
- [self _sortFavorites];
return self;
}
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index c91a5c08..d5ebb24c 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -3972,6 +3972,12 @@
*/
- (void)setParentWindow:(NSWindow *)aWindow
{
+ // If the window is being set for the first time - connection controller is visible - update focus
+ if (!parentWindow && !mySQLConnection) {
+ [aWindow makeFirstResponder:[connectionController valueForKey:@"favoritesTable"]];
+ [connectionController performSelector:@selector(updateFavoriteSelection:) withObject:self afterDelay:0.0];
+ }
+
parentWindow = aWindow;
SPSSHTunnel *currentTunnel = [connectionController valueForKeyPath:@"sshTunnel"];
if (currentTunnel) [currentTunnel setParentWindow:parentWindow];