diff options
author | stuconnolly <stuart02@gmail.com> | 2012-05-03 12:05:01 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-05-03 12:05:01 +0000 |
commit | 83fa503079f7a049ffab9747b0360046474f3253 (patch) | |
tree | 028d0a92e558ba42e796847ab0f68d6e3037fb50 /Source/SPGroupNode.m | |
parent | 0d3af5fe7631325e8a892011f0595c76b1ebd49a (diff) | |
download | sequelpro-83fa503079f7a049ffab9747b0360046474f3253.tar.gz sequelpro-83fa503079f7a049ffab9747b0360046474f3253.tar.bz2 sequelpro-83fa503079f7a049ffab9747b0360046474f3253.zip |
Add support for saving the state of the connection favorites outline view.
Diffstat (limited to 'Source/SPGroupNode.m')
-rw-r--r-- | Source/SPGroupNode.m | 8 |
1 files changed, 7 insertions, 1 deletions
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 - |