aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-04-29 11:30:51 +0000
committerstuconnolly <stuart02@gmail.com>2012-04-29 11:30:51 +0000
commit27614654120c64c4d708e299b3ec8f01cd837415 (patch)
tree5e0d54dd73631faa99edf50d3281eefdfa78886c
parent37b58a7b37cabc7409be30f57671d7af05961436 (diff)
downloadsequelpro-27614654120c64c4d708e299b3ec8f01cd837415.tar.gz
sequelpro-27614654120c64c4d708e299b3ec8f01cd837415.tar.bz2
sequelpro-27614654120c64c4d708e299b3ec8f01cd837415.zip
Add imported favorites to the root node and preserve sorting if enabled.
-rw-r--r--Source/SPConnectionControllerDelegate.m12
1 files changed, 12 insertions, 0 deletions
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];
}
/**