From 83fa503079f7a049ffab9747b0360046474f3253 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 3 May 2012 12:05:01 +0000 Subject: Add support for saving the state of the connection favorites outline view. --- Source/SPGroupNode.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/SPGroupNode.m') diff --git a/Source/SPGroupNode.m b/Source/SPGroupNode.m index 7bf1124b..d52dd54b 100644 --- a/Source/SPGroupNode.m +++ b/Source/SPGroupNode.m @@ -27,10 +27,12 @@ // Constants static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; +static NSString *SPGroupNodeIsExpandedKey = @"SPGroupNodeIsExpanded"; @implementation SPGroupNode @synthesize nodeName; +@synthesize nodeIsExpanded; #pragma mark - #pragma mark Initialisation @@ -39,6 +41,7 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; { if ((self = [super init])) { [self setNodeName:nil]; + [self setNodeIsExpanded:YES]; } return self; @@ -66,6 +69,7 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; SPGroupNode *node = [[[self class] allocWithZone:zone] init]; [node setNodeName:[self nodeName]]; + [node setNodeIsExpanded:[self nodeIsExpanded]]; return node; } @@ -76,6 +80,7 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; - (id)initWithCoder:(NSCoder *)coder { [self setNodeName:[coder decodeObjectForKey:SPGroupNodeNameKey]]; + [self setNodeIsExpanded:[[coder decodeObjectForKey:SPGroupNodeIsExpandedKey] boolValue]]; return self; } @@ -83,6 +88,7 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:[self nodeName] forKey:SPGroupNodeNameKey]; + [coder encodeObject:[NSNumber numberWithBool:[self nodeIsExpanded]] forKey:SPGroupNodeIsExpandedKey]; } #pragma mark - @@ -90,7 +96,7 @@ static NSString *SPGroupNodeNameKey = @"SPGroupNodeName"; - (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p ('%@')>", [self className], self, [self nodeName]]; + return [NSString stringWithFormat:@"<%@: %p ('%@', %@)>", [self className], self, [self nodeName], [NSNumber numberWithBool:[self nodeIsExpanded]]]; } #pragma mark - -- cgit v1.2.3