feat(preferences): button to reset contacts categories to defaults

This commit is contained in:
Francis Lachapelle
2020-07-03 10:43:20 -04:00
parent 9c49fae7f4
commit 76cbe7854c
5 changed files with 38 additions and 21 deletions
+9 -6
View File
@@ -29,6 +29,7 @@
#import <SOPE/NGCards/iCalRecurrenceRule.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSObject+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoDomainDefaults.h>
@@ -299,14 +300,16 @@ static SoProduct *preferencesProduct = nil;
//
if (![defaults contactsCategories])
{
categoryLabels = [[[self labelForKey: @"contacts_category_labels" withResourceManager: [preferencesProduct resourceManager]]
componentsSeparatedByString: @","]
sortedArrayUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
NSArray *contactsCategories;
if (!categoryLabels)
categoryLabels = [NSArray array];
contactsCategories = [[[[self labelForKey: @"contacts_category_labels" withResourceManager: [preferencesProduct resourceManager]]
componentsSeparatedByString: @","] trimmedComponents]
sortedArrayUsingSelector: @selector (localizedCaseInsensitiveCompare:)];
[defaults setContactsCategories: categoryLabels];
if (!contactsCategories)
contactsCategories = [NSArray array];
[defaults setContactsCategories: contactsCategories];
}
if (![[defaults source] objectForKey: @"SOGoMailAddOutgoingAddresses"])