From 6679e5cef1ffb3f5376e78c9c518123137a99413 Mon Sep 17 00:00:00 2001 From: bamse16 Date: Tue, 24 Mar 2009 20:04:54 +0000 Subject: Added hidden preference to automatically select the last favorite you used. To enable this feature write in Terminal: bash $ defaults write com.google.code.sequel-pro selectLastFavoriteUsed YES --- Source/TableDocument.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/TableDocument.m b/Source/TableDocument.m index c4179fb4..d4a0426c 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -275,6 +275,8 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa [portField setStringValue:[self valueForKeyPath:@"selectedFavorite.port"]]; [databaseField setStringValue:[self valueForKeyPath:@"selectedFavorite.database"]]; [passwordField setStringValue:[self selectedFavoritePassword]]; + + [prefs setInteger:[favoritesController selectionIndex] forKey:@"lastFavoriteIndex"]; } /** @@ -1488,6 +1490,10 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa [self setupToolbar]; // [self connectToDB:nil]; [self performSelector:@selector(connectToDB:) withObject:tableWindow afterDelay:0.0f]; + + if([prefs boolForKey:@"selectLastFavoriteUsed"] == YES){ + [favoritesController setSelectionIndexes:[NSIndexSet indexSetWithIndex:[prefs integerForKey:@"lastFavoriteIndex"]]]; + } } - (void)windowWillClose:(NSNotification *)aNotification -- cgit v1.2.3