From 7ce6e8149f1f1050036d1682907e453f1f205eee Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 18 Nov 2012 22:36:04 +0000 Subject: Fix the selected node in the favorites connection view when adding a new favorite to an empty group. --- Source/SPConnectionController.m | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 073dc53c..a8c9da8d 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -107,7 +107,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, @end - @implementation SPConnectionController @synthesize delegate; @@ -740,12 +739,14 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, SPTreeNode *selectedNode = [self selectedFavoriteNode]; SPTreeNode *parent = ([selectedNode isGroup] && selectedNode != quickConnectItem) ? selectedNode : (SPTreeNode *)[selectedNode parentNode]; - - // Ensure the parent is expanded - [favoritesOutlineView expandItem:parent]; SPTreeNode *node = [favoritesController addFavoriteNodeWithData:favorite asChildOfNode:parent]; + //[self _reloadFavoritesViewData]; + + // Ensure the parent is expanded + [favoritesOutlineView expandItem:parent]; + [self _sortFavorites]; [self _selectNode:node]; @@ -1513,6 +1514,7 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, { [favoritesOutlineView reloadData]; [favoritesOutlineView expandItem:[[favoritesRoot childNodes] objectAtIndex:0] expandChildren:NO]; + [self _scrollToSelectedNode]; } @@ -1600,7 +1602,6 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, */ - (void)_scrollToSelectedNode { - // Don't scroll if no node is currently selected if ([favoritesOutlineView selectedRow] == -1) return; -- cgit v1.2.3