From 3e61054aaf7402e65ccd374b0baeb99707102796 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Thu, 29 Mar 2007 18:17:47 +0000 Subject: [PATCH] Monotone-Parent: a43f16c8cf580c2fed97407d3923b03048908bdd Monotone-Revision: 3fb431fb255053cb2a899f221fd04e412a67a33a Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-03-29T18:17:47 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 6 +++ UI/Contacts/UIxContactsListViewContainer.h | 4 +- UI/Contacts/UIxContactsListViewContainer.m | 57 +++++++++++----------- 3 files changed, 36 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index e9b26301e..4091f7b80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-03-29 Wolfgang Sourdeau + * UI/Contacts/UIxContactsListViewContainer.m + ([UIxContactsListViewContainer -additionalFolders]): take the list + of subscribed folders from the new property list used for the user + settings. The value of its key is SubscribedFolders for the + dictionary entry named "Contacts". + * UI/Contacts/UIxContactsListView.m ([UIxContactsListView -canAccessContentAction]): new method to override the one from UIxFoldersActions by taking into account the fact that, this time, diff --git a/UI/Contacts/UIxContactsListViewContainer.h b/UI/Contacts/UIxContactsListViewContainer.h index 7bed4f897..5be9899fd 100644 --- a/UI/Contacts/UIxContactsListViewContainer.h +++ b/UI/Contacts/UIxContactsListViewContainer.h @@ -34,6 +34,7 @@ NSString *foldersPrefix; NSString *selectorComponentClass; NSString *currentAdditionalFolder; + NSDictionary *additionalFolders; id currentFolder; } @@ -43,15 +44,14 @@ - (NSArray *) contactFolders; -- (NSString *) contactFolderId; - (NSString *) currentContactFolderId; - (NSString *) currentContactFolderName; -- (NSString *) additionalAddressBooks; - (NSArray *) additionalFolders; - (void) setCurrentAdditionalFolder: (NSString *) newCurrentAdditionalFolder; - (NSString *) currentAdditionalFolder; +- (NSString *) currentAdditionalFolderName; @end diff --git a/UI/Contacts/UIxContactsListViewContainer.m b/UI/Contacts/UIxContactsListViewContainer.m index b6e218f67..34fa3a32c 100644 --- a/UI/Contacts/UIxContactsListViewContainer.m +++ b/UI/Contacts/UIxContactsListViewContainer.m @@ -21,11 +21,13 @@ */ #import +#import #import #import #import +#import #import #import @@ -41,11 +43,18 @@ { foldersPrefix = nil; selectorComponentClass = nil; + additionalFolders = nil; } return self; } +- (void) dealloc +{ + [additionalFolders release]; + [super dealloc]; +} + - (void) setSelectorComponentClass: (NSString *) aComponentClass { selectorComponentClass = aComponentClass; @@ -101,13 +110,6 @@ return foldersPrefix; } -- (NSString *) contactFolderId -{ - return [NSString stringWithFormat: @"%@/%@", - [self foldersPrefix], - [[self clientObject] nameInContainer]]; -} - - (NSArray *) contactFolders { SOGoContactFolders *folderContainer; @@ -129,32 +131,23 @@ return [self labelForKey: [currentFolder displayName]]; } -- (BOOL) isFolderCurrent -{ - return [[self currentContactFolderId] isEqualToString: [self contactFolderId]]; -} - -- (NSString *) additionalAddressBooks -{ - NSUserDefaults *ud; - - ud = [[context activeUser] userDefaults]; - - return [ud objectForKey: @"additionaladdressbooks"]; -} - - (NSArray *) additionalFolders { - NSString *folders; - NSArray *folderNames; + AgenorUserManager *um; + NSUserDefaults *ud; + NSString *login; - folders = [self additionalAddressBooks]; - if ([folders length] > 0) - folderNames = [folders componentsSeparatedByString: @","]; - else - folderNames = nil; + if (!additionalFolders) + { + um = [AgenorUserManager sharedUserManager]; + login = [[context activeUser] login]; + ud = [um getUserSettingsForUID: login]; + additionalFolders + = [[ud objectForKey: @"Contacts"] objectForKey: @"SubscribedFolders"]; + [additionalFolders retain]; + } - return folderNames; + return [additionalFolders allKeys]; } - (void) setCurrentAdditionalFolder: (NSString *) newCurrentAdditionalFolder @@ -167,6 +160,12 @@ return currentAdditionalFolder; } +- (NSString *) currentAdditionalFolderName +{ + return [[additionalFolders objectForKey: currentAdditionalFolder] + objectForKey: @"displayName"]; +} + - (BOOL) hasContactSelectionButtons { return (selectorComponentClass != nil);