aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPConnectionController.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-12-11 21:48:37 +0000
committerstuconnolly <stuart02@gmail.com>2010-12-11 21:48:37 +0000
commit66f0041a06b8710cd3ed3b5ff2c8cbb54004efba (patch)
treefd8e2c8099f54f0bc30c151f6ca3cc22f7f03aaa /Source/SPConnectionController.m
parent96475c12f6da064eadf2728c116f2ca88b0c4ec7 (diff)
downloadsequelpro-66f0041a06b8710cd3ed3b5ff2c8cbb54004efba.tar.gz
sequelpro-66f0041a06b8710cd3ed3b5ff2c8cbb54004efba.tar.bz2
sequelpro-66f0041a06b8710cd3ed3b5ff2c8cbb54004efba.zip
Tidy up.
Diffstat (limited to 'Source/SPConnectionController.m')
-rw-r--r--Source/SPConnectionController.m27
1 files changed, 11 insertions, 16 deletions
diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m
index f48cdc06..89dc6405 100644
--- a/Source/SPConnectionController.m
+++ b/Source/SPConnectionController.m
@@ -188,10 +188,6 @@ static const NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist";
[self addObserver:self forKeyPath:SPFavoriteSSLCertificateFileLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL];
[self addObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationEnabledKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL];
[self addObserver:self forKeyPath:SPFavoriteSSLCACertFileLocationKey options:(NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew) context:NULL];
-
- // Sort the favourites to match prefs and select the appropriate row - if a valid sort option is selected
- // TODO: Fix me, sorting currently does not work in the new outline view
- //if (currentSortItem > -1) [self _sortFavorites];
SPTreeNode *favorite = [self _favoriteNodeForFavoriteID:[prefs integerForKey:([prefs boolForKey:SPSelectLastFavoriteUsed]) ? SPLastFavoriteID : SPDefaultFavorite]];
@@ -1180,18 +1176,18 @@ static const NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist";
sortKey = SPFavoriteTypeKey;
break;
}
-
- NSSortDescriptor *sortDescriptor = nil;
-
- if (currentSortItem == SPFavoritesSortTypeItem) {
- sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:sortKey ascending:(!reverseFavoritesSort)] autorelease];
- }
- else {
- sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:sortKey ascending:(!reverseFavoritesSort) selector:@selector(caseInsensitiveCompare:)] autorelease];
+
+ // First sort the contents of all groups
+ for (SPTreeNode *node in [[[favoritesRoot childNodes] objectAtIndex:0] groupChildren])
+ {
+ [[node mutableChildNodes] sortUsingSelector:@selector(compare:)];
}
-
- // TODO: Perform actual sorting here
+ // Secondly sort the root's leaf nodes
+ [[[[favoritesRoot childNodes] objectAtIndex:0] childLeafs] sortUsingSelector:@selector(compare:)];
+
+ [favoritesController saveFavorites];
+
[self _reloadFavoritesViewData];
}
@@ -1218,8 +1214,7 @@ static const NSString *SPExportFavoritesFilename = @"SequelProFavorites.plist";
}
/**
- * Convenience method for rebuilding the connection favorites tree, reloading the outline view, expanding the
- * items and scrolling to the selected item.
+ * Convenience method for reloading the outline view, expanding the root item and scrolling to the selected item.
*/
- (void)_reloadFavoritesViewData
{