aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionControllerInitializer.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPConnectionControllerInitializer.m')
-rw-r--r--Source/SPConnectionControllerInitializer.m37
1 files changed, 25 insertions, 12 deletions
diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m
index cee0770a..73ebcad8 100644
--- a/Source/SPConnectionControllerInitializer.m
+++ b/Source/SPConnectionControllerInitializer.m
@@ -33,6 +33,7 @@
#import "SPConnectionControllerInitializer.h"
#import "SPKeychain.h"
#import "SPFavoritesController.h"
+#import "SPFavoriteTextFieldCell.h"
#import "SPTreeNode.h"
#import "SPFavoriteNode.h"
#import "SPGroupNode.h"
@@ -78,13 +79,14 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
connectionSSHKeychainItemAccount = nil;
initComplete = NO;
- isEditing = NO;
+ isEditingItemName = NO;
isConnecting = NO;
+ isTestingConnection = NO;
sshTunnel = nil;
mySQLConnection = nil;
cancellingConnection = NO;
mySQLConnectionCancelled = NO;
- favoriteNameFieldWasTouched = YES;
+ favoriteNameFieldWasAutogenerated = NO;
[self loadNib];
[self registerForNotifications];
@@ -101,9 +103,8 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
// Generic folder image for use in the outline view's groups
folderImage = [[[NSWorkspace sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] retain];
-
[folderImage setSize:NSMakeSize(16, 16)];
-
+
// Set up a keychain instance and preferences reference, and create the initial favorites list
keychain = [[SPKeychain alloc] init];
prefs = [[NSUserDefaults standardUserDefaults] retain];
@@ -111,11 +112,20 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
// Create a reference to the favorites controller, forcing the data to be loaded from disk
// and the tree to be constructed.
favoritesController = [SPFavoritesController sharedFavoritesController];
-
+
// Tree references
favoritesRoot = [favoritesController favoritesTree];
currentFavorite = nil;
-
+
+ // Create the "Quick Connect" placeholder group
+ quickConnectItem = [[SPTreeNode treeNodeWithRepresentedObject:[SPGroupNode groupNodeWithName:[NSLocalizedString(@"Quick Connect", @"Quick connect item label") uppercaseString]]] retain];
+ [quickConnectItem setIsGroup:YES];
+
+ // Create a NSOutlineView cell for the Quick Connect group
+ quickConnectCell = [[SPFavoriteTextFieldCell alloc] init];
+ [quickConnectCell setDrawsDividerUnderCell:YES];
+ [quickConnectCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+
// Update the UI
[self _reloadFavoritesViewData];
[self setUpFavoritesOutlineView];
@@ -290,13 +300,16 @@ static NSString *SPConnectionViewNibName = @"ConnectionView";
SPTreeNode *favorite = [self _favoriteNodeForFavoriteID:[prefs integerForKey:[prefs boolForKey:SPSelectLastFavoriteUsed] ? SPLastFavoriteID : SPDefaultFavorite]];
if (favorite) {
+
+ if (favorite == quickConnectItem) {
+ [self _selectNode:favorite];
+ } else {
+ NSNumber *typeNumber = [[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey];
+ previousType = typeNumber ? [typeNumber integerValue] : SPTCPIPConnection;
- NSNumber *typeNumber = [[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey];
-
- previousType = typeNumber ? [typeNumber integerValue] : SPTCPIPConnection;
-
- [self _selectNode:favorite];
- [self resizeTabViewToConnectionType:[[[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey] integerValue] animating:NO];
+ [self _selectNode:favorite];
+ [self resizeTabViewToConnectionType:[[[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey] integerValue] animating:NO];
+ }
[self _scrollToSelectedNode];
}