From cc89c3931f95ebc34a593b46e2770a76690cc0fd Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 7 Feb 2005 01:25:57 +0000 Subject: [PATCH] added special folder icons git-svn-id: http://svn.opengroupware.org/SOGo/trunk@523 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Mailer/ChangeLog | 2 + SOGo/UI/Mailer/UIxMailTree.m | 63 ++++++++++++++++++++++--------- SOGo/UI/Mailer/UIxMailTree.wox | 3 +- SOGo/UI/Mailer/UIxMailTreeBlock.h | 5 ++- SOGo/UI/Mailer/UIxMailTreeBlock.m | 26 ++++++++----- SOGo/UI/Mailer/Version | 3 +- 6 files changed, 72 insertions(+), 30 deletions(-) diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index e6862df7..44325bd5 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,5 +1,7 @@ 2005-02-07 Helge Hess + * UIxMailTree.m: added support for special folder icons (v0.9.90) + * v0.9.89 * UIxMailTree.m: made special folder names localizable diff --git a/SOGo/UI/Mailer/UIxMailTree.m b/SOGo/UI/Mailer/UIxMailTree.m index 30a5fe9f..45cb57c5 100644 --- a/SOGo/UI/Mailer/UIxMailTree.m +++ b/SOGo/UI/Mailer/UIxMailTree.m @@ -135,37 +135,58 @@ return link; } -- (NSString *)titleForObject:(id)_object { +- (void)getTitle:(NSString **)_t andIcon:(NSString **)_icon + forObject:(id)_object +{ // TODO: need to refactor for reuse! NSString *ftype; unsigned len; ftype = [_object valueForKey:@"outlookFolderClass"]; len = [ftype length]; - + switch (len) { case 8: - if ([ftype isEqualToString:@"IPF.Sent"]) - return [self labelForKey:@"SentFolderName"]; + if ([ftype isEqualToString:@"IPF.Sent"]) { + *_t = [self labelForKey:@"SentFolderName"]; + *_icon = @"tbtv_sent_17x17.gif"; + return; + } break; case 9: - if ([ftype isEqualToString:@"IPF.Inbox"]) - return [self labelForKey:@"InboxFolderName"]; - if ([ftype isEqualToString:@"IPF.Trash"]) - return [self labelForKey:@"TrashFolderName"]; + if ([ftype isEqualToString:@"IPF.Inbox"]) { + *_t = [self labelForKey:@"InboxFolderName"]; + *_icon = @"tbtv_inbox_17x17.gif"; + return; + } + if ([ftype isEqualToString:@"IPF.Trash"]) { + *_t = [self labelForKey:@"TrashFolderName"]; + *_icon = @"tbtv_trash_17x17.gif"; + return; + } break; case 10: - if ([ftype isEqualToString:@"IPF.Drafts"]) - return [self labelForKey:@"DraftsFolderName"]; - if ([ftype isEqualToString:@"IPF.Filter"]) - return [self labelForKey:@"SieveFolderName"]; + if ([ftype isEqualToString:@"IPF.Drafts"]) { + *_t = [self labelForKey:@"DraftsFolderName"]; + *_icon = @"tbtv_drafts_17x17.gif"; + return; + } + if ([ftype isEqualToString:@"IPF.Filter"]) { + *_t = [self labelForKey:@"SieveFolderName"]; + *_icon = nil; + return; + } + break; } - return [_object davDisplayName]; + *_t = [_object davDisplayName]; + *_icon = nil; + return; } - (UIxMailTreeBlock *)treeNavigationBlockForLeafNode:(id)_o atDepth:(int)_d { UIxMailTreeBlock *md; + NSString *n, *i; id blocks; /* @@ -175,9 +196,11 @@ blocks = [[_o toManyRelationshipKeys] count] > 0 ? [[NSArray alloc] initWithObjects:@"FAKE", nil] : nil; + + [self getTitle:&n andIcon:&i forObject:_o]; md = [UIxMailTreeBlock blockWithName:nil - title:[self titleForObject:_o] + title:n iconName:i link:[self treeNavigationLinkForObject:_o atDepth:_d] isPathNode:NO isActiveNode:NO childBlocks:blocks]; @@ -192,6 +215,7 @@ UIxMailTreeBlock *md; NSMutableArray *blocks; NSArray *folders; + NSString *title, *icon; unsigned i, count; /* process child folders */ @@ -211,8 +235,9 @@ /* build block */ + [self getTitle:&title andIcon:&icon forObject:_object]; md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[self titleForObject:_object] + title:title iconName:icon link:[@"../" stringByAppendingString: [_object nameInContainer]] isPathNode:YES isActiveNode:YES @@ -228,6 +253,7 @@ UIxMailTreeBlock *md; NSMutableArray *blocks; NSArray *folders; + NSString *title, *icon; unsigned i, count; // TODO: maybe we can join the two implementations, this might not be @@ -251,8 +277,9 @@ /* build block */ + [self getTitle:&title andIcon:&icon forObject:_object]; md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[self titleForObject:_object] + title:title iconName:icon link:@"." isPathNode:YES isActiveNode:YES childBlocks:blocks]; @@ -267,6 +294,7 @@ NSMutableArray *blocks; NSString *activeName; NSArray *folders; + NSString *title, *icon; unsigned i, count; if ([self isRootObject:_object]) /* we are at the top */ @@ -296,8 +324,9 @@ /* build block */ + [self getTitle:&title andIcon:&icon forObject:_object]; md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[self titleForObject:_object] + title:title iconName:icon link:[self treeNavigationLinkForObject:_object atDepth:(_depth + 1)] isPathNode:YES isActiveNode:NO diff --git a/SOGo/UI/Mailer/UIxMailTree.wox b/SOGo/UI/Mailer/UIxMailTree.wox index bd83fd44..f6624f71 100644 --- a/SOGo/UI/Mailer/UIxMailTree.wox +++ b/SOGo/UI/Mailer/UIxMailTree.wox @@ -21,7 +21,8 @@ const:cornerMinusIcon = "tbtv_corner_minus_17x17.gif" const:spaceIcon = "tbtv_space_17x17.gif" > - + diff --git a/SOGo/UI/Mailer/UIxMailTreeBlock.h b/SOGo/UI/Mailer/UIxMailTreeBlock.h index da1e233b..ee95f3e4 100644 --- a/SOGo/UI/Mailer/UIxMailTreeBlock.h +++ b/SOGo/UI/Mailer/UIxMailTreeBlock.h @@ -35,6 +35,7 @@ NSString *title; NSString *link; NSArray *blocks; + NSString *iconName; struct { int isPath:1; int isActive:1; @@ -42,11 +43,11 @@ } flags; } -+ (id)blockWithName:(NSString *)_name title:(NSString *)_title ++ (id)blockWithName:(NSString *)_n title:(NSString *)_t iconName:(NSString *)_i link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive childBlocks:(NSArray *)_blocks; -- (id)initWithName:(NSString *)_name title:(NSString *)_title +- (id)initWithName:(NSString *)_n title:(NSString *)_t iconName:(NSString *)_i link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive childBlocks:(NSArray *)_blocks; diff --git a/SOGo/UI/Mailer/UIxMailTreeBlock.m b/SOGo/UI/Mailer/UIxMailTreeBlock.m index 666c8205..39309870 100644 --- a/SOGo/UI/Mailer/UIxMailTreeBlock.m +++ b/SOGo/UI/Mailer/UIxMailTreeBlock.m @@ -25,26 +25,30 @@ @implementation UIxMailTreeBlock + (id)blockWithName:(NSString *)_name title:(NSString *)_title + iconName:(NSString *)_icon link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive childBlocks:(NSArray *)_blocks { UIxMailTreeBlock *block; - block = [[self alloc] initWithName:_name title:_title link:_link + block = [[self alloc] initWithName:_name title:_title iconName:_icon + link:_link isPathNode:_isPath isActiveNode:_isActive childBlocks:_blocks]; return [block autorelease]; } - (id)initWithName:(NSString *)_name title:(NSString *)_title + iconName:(NSString *)_icon link:(NSString *)_link isPathNode:(BOOL)_isPath isActiveNode:(BOOL)_isActive childBlocks:(NSArray *)_blocks { if ((self = [self init])) { - self->name = [_name copy]; - self->title = [_title copy]; - self->link = [_link copy]; - self->blocks = [_blocks retain]; + self->name = [_name copy]; + self->title = [_title copy]; + self->iconName = [_icon copy]; + self->link = [_link copy]; + self->blocks = [_blocks retain]; self->flags.isPath = _isPath ? 1 : 0; self->flags.isActive = _isActive ? 1 : 0; @@ -53,10 +57,11 @@ } - (void)dealloc { - [self->blocks release]; - [self->name release]; - [self->title release]; - [self->link release]; + [self->iconName release]; + [self->blocks release]; + [self->name release]; + [self->title release]; + [self->link release]; [super dealloc]; } @@ -71,6 +76,9 @@ - (NSString *)link { return self->link; } +- (NSString *)iconName { + return self->iconName; +} - (NSArray *)children { return self->blocks; diff --git a/SOGo/UI/Mailer/Version b/SOGo/UI/Mailer/Version index e229e7c9..ec1d8ba8 100644 --- a/SOGo/UI/Mailer/Version +++ b/SOGo/UI/Mailer/Version @@ -1,7 +1,8 @@ # version file -SUBMINOR_VERSION:=89 +SUBMINOR_VERSION:=90 +# v0.9.89 requires SoObjects/Mailer v0.9.67 # v0.9.87 requires SoObjects/Mailer v0.9.65 # v0.9.86 requires SoObjects/Mailer v0.9.64 # v0.9.85 requires SoObjects/Mailer v0.9.63 -- 2.39.5