From 27614654120c64c4d708e299b3ec8f01cd837415 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Sun, 29 Apr 2012 11:30:51 +0000 Subject: Add imported favorites to the root node and preserve sorting if enabled. --- Source/SPConnectionControllerDelegate.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'Source') diff --git a/Source/SPConnectionControllerDelegate.m b/Source/SPConnectionControllerDelegate.m index dc429faf..e2557601 100644 --- a/Source/SPConnectionControllerDelegate.m +++ b/Source/SPConnectionControllerDelegate.m @@ -40,6 +40,7 @@ static NSString *SPDatabaseImage = @"database-small"; @interface SPConnectionController () - (void)_checkHost; +- (void)_sortFavorites; - (void)_favoriteTypeDidChange; - (void)_reloadFavoritesViewData; - (void)_updateFavoritePasswordsFromField:(NSControl *)control; @@ -526,6 +527,17 @@ static NSString *SPDatabaseImage = @"database-small"; */ - (void)favoritesImportData:(NSArray *)data { + // Add each of the imported favorites to the root node + for (NSMutableDictionary *favorite in data) + { + [favoritesController addFavoriteNodeWithData:favorite asChildOfNode:nil]; + } + + if (currentSortItem > SPFavoritesSortUnsorted) { + [self _sortFavorites]; + } + + [self _reloadFavoritesViewData]; } /** -- cgit v1.2.3