diff options
-rw-r--r-- | Source/SPTreeNode.m | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/Source/SPTreeNode.m b/Source/SPTreeNode.m index 79217a9f..7be4f09a 100644 --- a/Source/SPTreeNode.m +++ b/Source/SPTreeNode.m @@ -250,21 +250,25 @@ #pragma mark - #pragma mark Other -/*- (NSComparisonResult)compare:(SPTreeNode *)node +- (NSString *)description { - id selfObject = [self representedObject]; - id nodeObject = [node representedObject]; + NSMutableString *description = [NSMutableString string]; - if ([selfObject isKindOfClass:[SPFavoriteNode class]] && [nodeObject isKindOfClass:[SPFavoriteNode class]]) { - - return [[[selfObject nodeFavorite] objectForKey:SPFavoriteNameKey] localizedCaseInsensitiveCompare:[[nodeObject nodeFavorite] objectForKey:SPFavoriteNameKey]]; - } - else if ([selfObject isKindOfClass:[SPGroupNode class]] && [nodeObject isKindOfClass:[SPGroupNode class]]) { + [description appendString:[[self representedObject] description]]; + [description appendString:@"\n"]; + + NSArray *nodes = [self childNodes]; + + for (NSUInteger i = 0; i < [nodes count]; i++) + { + SPTreeNode *node = [nodes objectAtIndex:i]; + + [description appendString:([node isGroup]) ? [node description] : [[node representedObject] description]]; - return [[selfObject nodeName] localizedCaseInsensitiveCompare:[nodeObject nodeName]]; + if (i < ([nodes count] - 1)) [description appendString:@"\n"]; } - return NSOrderedSame; -}*/ + return description; +} @end |