aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionControllerDataSource.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-10-06 11:48:15 +0000
committerrowanbeentje <rowan@beent.je>2012-10-06 11:48:15 +0000
commitecb5c70566d1303288e4faf170bda40672a799e1 (patch)
tree2882fa5fd6f25eed9c754e810785f5834225b95f /Source/SPConnectionControllerDataSource.m
parentada181f6fe5b010a5ab56030d16b35e92e58af10 (diff)
downloadsequelpro-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/SPConnectionControllerDataSource.m')
-rw-r--r--Source/SPConnectionControllerDataSource.m36
1 files changed, 30 insertions, 6 deletions
diff --git a/Source/SPConnectionControllerDataSource.m b/Source/SPConnectionControllerDataSource.m
index 86f6db49..d7f3d235 100644
--- a/Source/SPConnectionControllerDataSource.m
+++ b/Source/SPConnectionControllerDataSource.m
@@ -39,7 +39,6 @@
@interface SPConnectionController ()
- (void)_reloadFavoritesViewData;
-- (void)_updateFavoritePasswordsFromField:(NSControl *)control;
@end
@@ -47,16 +46,42 @@
#ifndef SP_REFACTOR
+/**
+ * Return the number of children for the specified item in the favourites tree.
+ * Note that to support the "Quick Connect" entry, the returned count is amended
+ * for the top level.
+ */
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
SPTreeNode *node = (item == nil ? favoritesRoot : (SPTreeNode *)item);
-
+
+ // If at the root, return the count plus one for the "Quick Connect" entry
+ if (!item) {
+ return [[node childNodes] count] + 1;
+ }
+
return [[node childNodes] count];
}
+/**
+ * Return the branch at the specified index of a supplied tree level.
+ * Note that to support the "Quick Connect" entry, children of the top level
+ * have their offsets amended.
+ */
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)childIndex ofItem:(id)item
{
+
+ // For the top level of the tree, return the "Quick Connect" child for position zero;
+ // amend all other positions to compensate for the faked position.
+ if (!item) {
+ if (childIndex == 0) {
+ return quickConnectItem;
+ }
+ childIndex--;
+ }
+
SPTreeNode *node = (item == nil ? favoritesRoot : (SPTreeNode *)item);
+
return NSArrayObjectAtIndex([node childNodes], childIndex);
}
@@ -83,11 +108,10 @@
SPTreeNode *node = [self selectedFavoriteNode];
if (![node isGroup]) {
+
// Updating the name triggers a KVO update
- [self setName:newName];
-
- // Update associated Keychain items
- [self _updateFavoritePasswordsFromField:nil];
+ [self setName:newName];
+ [self saveFavorite:self];
}
else {
[[node representedObject] setNodeName:newName];