mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-20 02:45:25 +00:00
The collected address book will be created only if the user select it in the preferences. Fix labels.
This commit is contained in:
@@ -116,6 +116,7 @@ static NSArray *reminderValues = nil;
|
||||
if ((self = [super init]))
|
||||
{
|
||||
item = nil;
|
||||
addressBooksIDWithDisplayName = nil;
|
||||
#warning user should be the owner rather than the activeUser
|
||||
ASSIGN (user, [context activeUser]);
|
||||
ASSIGN (today, [NSCalendarDate date]);
|
||||
@@ -691,8 +692,9 @@ static NSArray *reminderValues = nil;
|
||||
- (NSArray *) addressBookList
|
||||
{
|
||||
/* We want all the SourceIDS */
|
||||
NSMutableArray *folders, *contactFolders, *availableAddressBooks;
|
||||
NSMutableArray *folders, *contactFolders, *availableAddressBooksID, *availableAddressBooksName;
|
||||
int i, count;
|
||||
BOOL collectedAlreadyExist;
|
||||
|
||||
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
||||
lookupName: @"Contacts"
|
||||
@@ -702,49 +704,40 @@ static NSArray *reminderValues = nil;
|
||||
count = [folders count]-1;
|
||||
|
||||
// Inside this loop we remove all the public or shared addressbooks
|
||||
for (count; count >= 0; count--)
|
||||
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
|
||||
availableAddressBooks = [[NSMutableArray alloc] initWithCapacity: [folders count]];
|
||||
availableAddressBooksID = [NSMutableArray arrayWithCapacity: [folders count]];
|
||||
availableAddressBooksName = [NSMutableArray arrayWithCapacity: [folders count]];
|
||||
count = [folders count]-1;
|
||||
for (i=0; i <= count ; i++) {
|
||||
[availableAddressBooks addObject:[[folders objectAtIndex:i] realNameInContainer]];
|
||||
}
|
||||
collectedAlreadyExist = false;
|
||||
|
||||
return availableAddressBooks;
|
||||
for (i=0; i <= count ; i++) {
|
||||
[availableAddressBooksID addObject:[[folders objectAtIndex:i] realNameInContainer]];
|
||||
[availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]];
|
||||
|
||||
if ([[availableAddressBooksID objectAtIndex:i] isEqualToString: @"collected"])
|
||||
collectedAlreadyExist = true;
|
||||
}
|
||||
// Create the dictionary for the next function : itemAddressBookText.
|
||||
if (!addressBooksIDWithDisplayName)
|
||||
addressBooksIDWithDisplayName = [NSMutableDictionary dictionaryWithObjects:availableAddressBooksName
|
||||
forKeys:availableAddressBooksID];
|
||||
if (!collectedAlreadyExist)
|
||||
{
|
||||
[availableAddressBooksID addObject: @"collected"];
|
||||
[addressBooksIDWithDisplayName setObject: [self labelForKey: @"Collected Address Book"] forKey: @"collected"];
|
||||
}
|
||||
|
||||
return availableAddressBooksID;
|
||||
}
|
||||
- (NSString *) itemAddressBookText
|
||||
{
|
||||
NSString *displayNameAddressBookItem, *test;
|
||||
NSMutableArray *folders, *contactFolders;
|
||||
int count, i;
|
||||
|
||||
if ([item isEqualToString: @"personal"] || [item isEqualToString: @"collected"])
|
||||
displayNameAddressBookItem = [self labelForKey:[NSString stringWithFormat: item]];
|
||||
|
||||
else
|
||||
{
|
||||
contactFolders = [[[context activeUser] homeFolderInContext: context]
|
||||
lookupName: @"Contacts"
|
||||
inContext: context
|
||||
acquire: NO];
|
||||
folders = [NSMutableArray arrayWithArray: [contactFolders subFolders]];
|
||||
count = [folders count]-1;
|
||||
for (i=0; i <= count ; i++)
|
||||
{
|
||||
if ([item isEqualToString:[[folders objectAtIndex:i] realNameInContainer]])
|
||||
{
|
||||
displayNameAddressBookItem = [[folders objectAtIndex:i] displayName];
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return displayNameAddressBookItem;
|
||||
return [addressBooksIDWithDisplayName objectForKey: item];
|
||||
}
|
||||
|
||||
- (NSString *) userAddressBook
|
||||
|
||||
Reference in New Issue
Block a user