From: helge Date: Mon, 7 Feb 2005 01:10:41 +0000 (+0000) Subject: added localization of special folder names X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9045974485226234621cf675ce313251e7721820;p=scalable-opengroupware.org added localization of special folder names git-svn-id: http://svn.opengroupware.org/SOGo/trunk@522 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/UI/Mailer/ChangeLog b/SOGo/UI/Mailer/ChangeLog index be1020b7..e6862df7 100644 --- a/SOGo/UI/Mailer/ChangeLog +++ b/SOGo/UI/Mailer/ChangeLog @@ -1,3 +1,22 @@ +2005-02-07 Helge Hess + + * v0.9.89 + + * UIxMailTree.m: made special folder names localizable + + * English.lproj/default.strings: added some folder translations + +2005-02-06 Helge Hess + + * v0.9.88 + + * UIxMailTree.m: some code cleanups, does not use -fetchSubfolders of + SOGoObject anymore (to be useful for any object) + + * UIxMailMainFrame.wox: made "Folders" title localizable + + * UIxMailListView.wox: removed some superflous section + 2005-01-31 Helge Hess * UIxMailView.m: implemented 'expunge' action (delete button in the diff --git a/SOGo/UI/Mailer/English.lproj/default.strings b/SOGo/UI/Mailer/English.lproj/default.strings index 49d96fda..6137407a 100644 --- a/SOGo/UI/Mailer/English.lproj/default.strings +++ b/SOGo/UI/Mailer/English.lproj/default.strings @@ -25,6 +25,15 @@ "msgnumber_to" = "to"; "msgnumber_of" = "of"; +/* Tree */ + +"SentFolderName" = "Sent"; +"TrashFolderName" = "Trash"; +"InboxFolderName" = "Inbox"; +"DraftsFolderName" = "Drafts"; +"SieveFolderName" = "Filters"; +"Folders" = "Folders"; /* title line */ + /* MailMoveToPopUp */ "MoveTo" = "Move …"; diff --git a/SOGo/UI/Mailer/UIxMailListView.wox b/SOGo/UI/Mailer/UIxMailListView.wox index 6e4bbf12..134fe172 100644 --- a/SOGo/UI/Mailer/UIxMailListView.wox +++ b/SOGo/UI/Mailer/UIxMailListView.wox @@ -198,11 +198,4 @@ - diff --git a/SOGo/UI/Mailer/UIxMailMainFrame.wox b/SOGo/UI/Mailer/UIxMailMainFrame.wox index 36265f3e..652848a2 100644 --- a/SOGo/UI/Mailer/UIxMailMainFrame.wox +++ b/SOGo/UI/Mailer/UIxMailMainFrame.wox @@ -58,7 +58,8 @@
-
Folders
+
diff --git a/SOGo/UI/Mailer/UIxMailTree.m b/SOGo/UI/Mailer/UIxMailTree.m index 5870cfb7..30a5fe9f 100644 --- a/SOGo/UI/Mailer/UIxMailTree.m +++ b/SOGo/UI/Mailer/UIxMailTree.m @@ -18,7 +18,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -// $Id: UIxMailTree.m 278 2004-08-26 23:29:09Z helge $ #include @@ -31,10 +30,19 @@ #include "UIxMailTreeBlock.h" #include +#include #include "common.h" #include #include +/* + Support special icons: + tbtv_leaf_corner_17x17.gif + tbtv_inbox_17x17.gif + tbtv_drafts_17x17.gif + tbtv_sent_17x17.gif + tbtv_trash_17x17.gif +*/ @implementation UIxMailTree @@ -44,6 +52,21 @@ [super dealloc]; } +/* icons */ + +- (NSString *)defaultIconName { + return @"tbtv_leaf_corner_17x17.gif"; +} + +- (NSString *)iconNameForType:(NSString *)_type { + if (![_type isNotNull]) + return [self defaultIconName]; + + //return @"tbtv_drafts_17x17.gif"; + + return [self defaultIconName]; +} + /* accessors */ - (void)setItem:(id)_item { @@ -53,6 +76,42 @@ return self->item; } +- (NSString *)itemIconName { + // TODO: only called once! + NSString *ftype; + + ftype = [[self item] valueForKey:@"outlookFolderClass"]; + return [self iconNameForType:ftype]; +} + +/* fetching subfolders */ + +- (NSArray *)fetchSubfoldersOfObject:(id)_object { + /* Walk over toManyRelationshipKeys and lookup the controllers for them. */ + NSMutableArray *ma; + NSArray *names; + unsigned i, count; + + if ((names = [_object toManyRelationshipKeys]) == nil) + return nil; + + count = [names count]; + ma = [NSMutableArray arrayWithCapacity:(count + 1)]; + for (i = 0; i < count; i++) { + id folder; + + folder = [_object lookupName:[names objectAtIndex:i] inContext:nil + acquire:NO]; + if (folder == nil) + continue; + if ([folder isKindOfClass:[NSException class]]) + continue; + + [ma addObject:folder]; + } + return ma; +} + /* navigation nodes */ - (BOOL)isRootObject:(id)_object { @@ -62,6 +121,7 @@ return YES; } + // TODO: make this a parameter to make UIxMailTree reusable return [_object isKindOfClass:NSClassFromString(@"SOGoMailAccounts")]; } @@ -75,6 +135,35 @@ return link; } +- (NSString *)titleForObject:(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"]; + break; + case 9: + if ([ftype isEqualToString:@"IPF.Inbox"]) + return [self labelForKey:@"InboxFolderName"]; + if ([ftype isEqualToString:@"IPF.Trash"]) + return [self labelForKey:@"TrashFolderName"]; + break; + case 10: + if ([ftype isEqualToString:@"IPF.Drafts"]) + return [self labelForKey:@"DraftsFolderName"]; + if ([ftype isEqualToString:@"IPF.Filter"]) + return [self labelForKey:@"SieveFolderName"]; + } + + return [_object davDisplayName]; +} + - (UIxMailTreeBlock *)treeNavigationBlockForLeafNode:(id)_o atDepth:(int)_d { UIxMailTreeBlock *md; id blocks; @@ -88,7 +177,7 @@ : nil; md = [UIxMailTreeBlock blockWithName:nil - title:[_o davDisplayName] + title:[self titleForObject:_o] link:[self treeNavigationLinkForObject:_o atDepth:_d] isPathNode:NO isActiveNode:NO childBlocks:blocks]; @@ -96,15 +185,18 @@ } - (UIxMailTreeBlock *)treeNavigationBlockForRootNode:(id)_object { - /* this generates the block for the clientObject */ + /* + This generates the block for the root object (root of the tree, we get + there by walking up the chain starting with the client object). + */ UIxMailTreeBlock *md; - NSMutableArray *blocks; - NSArray *folders; - unsigned i, count; + NSMutableArray *blocks; + NSArray *folders; + unsigned i, count; /* process child folders */ - folders = [_object fetchSubfolders]; + folders = [self fetchSubfoldersOfObject:_object]; count = [folders count]; blocks = [NSMutableArray arrayWithCapacity:count]; for (i = 0; i < count; i++) { @@ -120,7 +212,7 @@ /* build block */ md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[_object davDisplayName] + title:[self titleForObject:_object] link:[@"../" stringByAppendingString: [_object nameInContainer]] isPathNode:YES isActiveNode:YES @@ -130,7 +222,7 @@ - (UIxMailTreeBlock *)treeNavigationBlockForActiveNode:(id)_object { /* - this generates the block for the clientObject (the object which has the + This generates the block for the clientObject (the object which has the focus) */ UIxMailTreeBlock *md; @@ -145,7 +237,7 @@ /* process child folders */ - folders = [_object fetchSubfolders]; + folders = [self fetchSubfoldersOfObject:_object]; count = [folders count]; blocks = [NSMutableArray arrayWithCapacity:count]; for (i = 0; i < count; i++) { @@ -160,7 +252,7 @@ /* build block */ md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[_object davDisplayName] + title:[self titleForObject:_object] link:@"." isPathNode:YES isActiveNode:YES childBlocks:blocks]; @@ -186,7 +278,7 @@ /* process child folders */ - folders = [_object fetchSubfolders]; + folders = [self fetchSubfoldersOfObject:_object]; count = [folders count]; blocks = [NSMutableArray arrayWithCapacity:count]; for (i = 0; i < count; i++) { @@ -205,7 +297,7 @@ /* build block */ md = [UIxMailTreeBlock blockWithName:[_object nameInContainer] - title:[_object davDisplayName] + title:[self titleForObject:_object] 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 35287698..bd83fd44 100644 --- a/SOGo/UI/Mailer/UIxMailTree.wox +++ b/SOGo/UI/Mailer/UIxMailTree.wox @@ -5,6 +5,7 @@ xmlns:rsrc="OGo:url" xmlns:label="OGo:label" > +