diff options
author | rowanbeentje <rowan@beent.je> | 2012-10-06 11:48:15 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2012-10-06 11:48:15 +0000 |
commit | ecb5c70566d1303288e4faf170bda40672a799e1 (patch) | |
tree | 2882fa5fd6f25eed9c754e810785f5834225b95f /Source/SPConnectionControllerInitializer.m | |
parent | ada181f6fe5b010a5ab56030d16b35e92e58af10 (diff) | |
download | sequelpro-ecb5c70566d1303288e4faf170bda40672a799e1.tar.gz sequelpro-ecb5c70566d1303288e4faf170bda40672a799e1.tar.bz2 sequelpro-ecb5c70566d1303288e4faf170bda40672a799e1.zip |
Change the connection screen interface, particularly relating to favourite editing on the connection screen (Issue #1339, Issue #1440):
- No longer save changes made to connection favourites as soon as the interface is updated
- Alter the interfaace if favourites are editing, offering to save the changes either to the old connection favourite or to a new favourite
- Add a "Test connection" button to verify changes before saving
- Add a "Quick Connect" entry to the top of the connection view's favourites list so a blank form is always available
- Use a custom highlight when editing favourites to show the favourite has changed but is still linked
- Reduce the margin on the left-hand side of the connection favourites list to increase the available space
- Alter favourite name generation, making it less aggressive when generating names from partial details (eg creating names of just "@") and removing the user
- Alter key icon usage to correctly update the button appearance if an SSL or SSH key is selected
Diffstat (limited to 'Source/SPConnectionControllerInitializer.m')
-rw-r--r-- | Source/SPConnectionControllerInitializer.m | 37 |
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]; } |