From 4626039e5c195fafdab3e25fb7306f6270765fc4 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Mon, 13 Apr 2015 09:47:33 -0400 Subject: [PATCH] (fix) JavaScript errors on Mail preferences tab --- UI/PreferencesUI/UIxPreferences.m | 67 ++++++++----------- UI/Templates/PreferencesUI/UIxPreferences.wox | 48 ++++++++----- 2 files changed, 61 insertions(+), 54 deletions(-) diff --git a/UI/PreferencesUI/UIxPreferences.m b/UI/PreferencesUI/UIxPreferences.m index a0be42acd..b5733748e 100644 --- a/UI/PreferencesUI/UIxPreferences.m +++ b/UI/PreferencesUI/UIxPreferences.m @@ -800,62 +800,51 @@ static NSArray *reminderValues = nil; // - (NSArray *) addressBookList { - /* We want all the SourceIDS */ - NSMutableArray *folders, *availableAddressBooksID, *availableAddressBooksName; - SOGoParentFolder *contactFolders; - + NSMutableArray *folders, *localAddressBooks; + SOGoParentFolder *contactFolder; + SOGoContactGCSFolder *addressbook; int i, count; BOOL collectedAlreadyExist; - - contactFolders = [[[context activeUser] homeFolderInContext: context] + + // Fetch all addressbooks + contactFolder = [[[context activeUser] homeFolderInContext: context] lookupName: @"Contacts" inContext: context acquire: NO]; - folders = [NSMutableArray arrayWithArray: [contactFolders subFolders]]; - count = [folders count]-1; - - // Inside this loop we remove all the public or shared addressbooks - for (; count >= 0; count--) + folders = [NSMutableArray arrayWithArray: [contactFolder subFolders]]; + count = [folders count]; + + // Remove all public addressbooks + for (count--; count >= 0; count--) { if (![[folders objectAtIndex: count] isKindOfClass: [SOGoContactGCSFolder class]]) [folders removeObjectAtIndex: count]; } - - // Parse the objects in order to have only the displayName of the addressbooks to be displayed on the preferences interface - availableAddressBooksID = [NSMutableArray arrayWithCapacity: [folders count]]; - availableAddressBooksName = [NSMutableArray arrayWithCapacity: [folders count]]; - count = [folders count]-1; + + // Build list of local addressbooks + localAddressBooks = [NSMutableArray arrayWithCapacity: [folders count]]; + count = [folders count]; collectedAlreadyExist = NO; - - for (i = 0; i <= count ; i++) + + for (i = 0; i < count ; i++) { - [availableAddressBooksID addObject:[[folders objectAtIndex:i] realNameInContainer]]; - [availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]]; - - if ([[availableAddressBooksID objectAtIndex:i] isEqualToString: @"collected"]) + addressbook = [folders objectAtIndex: i]; + [localAddressBooks addObject: [NSDictionary dictionaryWithObjectsAndKeys: + [addressbook nameInContainer], @"id", + [addressbook displayName], @"name", + nil]]; + if ([[addressbook nameInContainer] isEqualToString: @"collected"]) collectedAlreadyExist = YES; } - // Create the dictionary for the next function : itemAddressBookText. - if (!addressBooksIDWithDisplayName) - { - addressBooksIDWithDisplayName = [[NSMutableDictionary alloc] initWithObjects:availableAddressBooksName - forKeys:availableAddressBooksID]; - } if (!collectedAlreadyExist) { - [availableAddressBooksID addObject: @"collected"]; - [addressBooksIDWithDisplayName setObject: [self labelForKey: @"Collected Address Book"] forKey: @"collected"]; + [localAddressBooks addObject: [NSDictionary dictionaryWithObjectsAndKeys: + @"collected", @"id", + [self labelForKey: @"Collected Address Book"], @"name", + nil]]; } - - return availableAddressBooksID; -} -// -// Used by wox template -// -- (NSString *) itemAddressBookText -{ - return [addressBooksIDWithDisplayName objectForKey: item]; + return localAddressBooks; } // - (NSString *) userAddressBook diff --git a/UI/Templates/PreferencesUI/UIxPreferences.wox b/UI/Templates/PreferencesUI/UIxPreferences.wox index 86fc4db20..a726d0514 100644 --- a/UI/Templates/PreferencesUI/UIxPreferences.wox +++ b/UI/Templates/PreferencesUI/UIxPreferences.wox @@ -526,14 +526,16 @@ + ng-false-value="0" + label:aria-label="Show subscribed mailboxes only"> + ng-false-value="0" + label:aria-label="Sort messages by threads"> @@ -541,14 +543,15 @@ + ng-false-value="0" + label:arial-label="When sending mail, add unknown recipients to my"> - - + + @@ -655,12 +658,14 @@ + layout="row" layout-align="end center" + label:aria-label="Edit Filter">
+ layout="row" layout-align="end center" + label:aria-label="Delete Filter">
@@ -668,7 +673,9 @@
- +
@@ -690,14 +697,17 @@ + layout="row" layout-align="end center" + label:aria-label="Delete Label">
- +
@@ -721,12 +731,17 @@ + layout="row" + layout-align="end center" + label:aria-label="Edit Account">
+ ng-show="$index > 0" + type="button" + layout="row" + layout-align="end center" + label:aria-label="Delete Account">
@@ -734,7 +749,9 @@
- +
@@ -752,7 +769,8 @@ + ng-false-value="0" + label:aria-label="Enable vacation auto reply">