]> err.no Git - scalable-opengroupware.org/commitdiff
added special folder icons
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Feb 2005 01:25:57 +0000 (01:25 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 7 Feb 2005 01:25:57 +0000 (01:25 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@523 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/UI/Mailer/ChangeLog
SOGo/UI/Mailer/UIxMailTree.m
SOGo/UI/Mailer/UIxMailTree.wox
SOGo/UI/Mailer/UIxMailTreeBlock.h
SOGo/UI/Mailer/UIxMailTreeBlock.m
SOGo/UI/Mailer/Version

index e6862df772d980562140cac1bdaab3d804c73cd2..44325bd5fa1ad6095a0083afd1da8a634810f521 100644 (file)
@@ -1,5 +1,7 @@
 2005-02-07  Helge Hess  <helge.hess@opengroupware.org>
 
+       * UIxMailTree.m: added support for special folder icons (v0.9.90)
+
        * v0.9.89
 
        * UIxMailTree.m: made special folder names localizable
index 30a5fe9f31bf6495eb3888452c5d2b35f1596062..45cb57c580cb98379d758c3c5b21a776995a5123 100644 (file)
   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;
   
   /* 
   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];
   UIxMailTreeBlock *md;
   NSMutableArray   *blocks;
   NSArray          *folders;
+  NSString         *title, *icon;
   unsigned         i, count;
   
   /* process child folders */
   
   /* 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
   UIxMailTreeBlock *md;
   NSMutableArray   *blocks;
   NSArray  *folders;
+  NSString *title, *icon;
   unsigned i, count;
   
   // TODO: maybe we can join the two implementations, this might not be
   
   /* 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];
   NSMutableArray   *blocks;
   NSString         *activeName;
   NSArray          *folders;
+  NSString         *title, *icon;
   unsigned         i, count;
   
   if ([self isRootObject:_object]) /* we are at the top */
   
   /* 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
index bd83fd44b64067a96e604a84d519f0c458981679..f6624f71baf2f7152ce9a80581e9ac77acb1741d 100644 (file)
@@ -21,7 +21,8 @@
     const:cornerMinusIcon = "tbtv_corner_minus_17x17.gif"
     const:spaceIcon       = "tbtv_space_17x17.gif"
   >
-    <var:tree-data const:isTreeElement="YES" const:treeLink="">
+    <var:tree-data const:isTreeElement="YES" const:treeLink=""
+                   var:icon="item.iconName">
       <a var:href="item.link">
         <span class="treecell">
           <var:if condition="item.isActiveNode">
index da1e233b448c488b3283540f4e421d6f05648641..ee95f3e45f3388ee42da363e3684e6804ee180e9 100644 (file)
@@ -35,6 +35,7 @@
   NSString *title;
   NSString *link;
   NSArray  *blocks;
+  NSString *iconName;
   struct {
     int isPath:1;
     int isActive:1;
   } 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;
 
index 666c82051f8cc911dc0a09d391d0d371c8993b92..3930987026ccd3e55fab6cf3867c10a77544bce8 100644 (file)
 @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;
 }
 
 - (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;
index e229e7c90ea24487085f70dcb02c9dcde1a63991..ec1d8ba8b163e1c740467f37840aa2d79e35bb30 100644 (file)
@@ -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