The collected address book will be created only if the user select it in the preferences. Fix labels.
parent
bce701208a
commit
1da1764aae
|
@ -1 +1,2 @@
|
|||
"Personal Address Book" = "Carnet d'adresses personnel";
|
||||
"Collected Address Book" = "Carnet d'adresses recueilli";
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
@interface SOGoContactFolders : SOGoParentFolder
|
||||
|
||||
- (NSString *) defaultFolderName;
|
||||
- (NSString *) collectedFolderName;
|
||||
|
||||
- (NSException *) renameLDAPAddressBook: (NSString *) sourceID
|
||||
withDisplayName: (NSString *) newDisplayName;
|
||||
|
|
|
@ -268,7 +268,7 @@ Class SOGoContactSourceFolderK;
|
|||
SOGoUser *currentUser;
|
||||
id <SOGoSource> source;
|
||||
|
||||
if ([sourceID isEqualToString: @"personal"] || [sourceID isEqualToString: @"collected"])
|
||||
if ([sourceID isEqualToString: @"personal"])
|
||||
result = [NSException exceptionWithHTTPStatus: 403
|
||||
reason: (@"folder '%@' cannot be deleted", sourceID)];
|
||||
else
|
||||
|
@ -295,6 +295,11 @@ Class SOGoContactSourceFolderK;
|
|||
return [self labelForKey: @"Personal Address Book"];
|
||||
}
|
||||
|
||||
- (NSString *) collectedFolderName
|
||||
{
|
||||
return [self labelForKey: @"Collected Address Book"];
|
||||
}
|
||||
|
||||
- (NSArray *) toManyRelationshipKeys
|
||||
{
|
||||
NSMutableArray *keys;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
+ (Class) subFolderClass;
|
||||
|
||||
- (NSString *) defaultFolderName;
|
||||
- (NSString *) collectedFolderName;
|
||||
|
||||
- (NSException *) appendPersonalSources;
|
||||
- (void) removeSubFolder: (NSString *) subfolderName;
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#import <DOM/DOMElement.h>
|
||||
#import <DOM/DOMProtocols.h>
|
||||
#import <SaxObjC/XMLNamespaces.h>
|
||||
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
#import <SOGo/SOGoUserSettings.h>
|
||||
|
||||
#import "NSObject+DAV.h"
|
||||
|
@ -175,18 +175,18 @@ static SoSecurityManager *sm = nil;
|
|||
if ([roles containsObject: SoRole_Owner] ||
|
||||
(folderOwner && [folderOwner isResource]))
|
||||
{
|
||||
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
||||
if (folderType == 0)
|
||||
if (folderType == SOGoPersonalFolder)
|
||||
{
|
||||
folderName = @"personal";
|
||||
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
||||
[folder setDisplayName: [self defaultFolderName]];
|
||||
}
|
||||
else if (folderType == 1)
|
||||
else if (folderType == SOGoCollectedFolder)
|
||||
{
|
||||
folderName = @"Collected Address Book";
|
||||
folderName = @"collected";
|
||||
folder = [subFolderClass objectWithName: folderName inContainer: self];
|
||||
[folder setDisplayName: [self collectedFolderName]];
|
||||
}
|
||||
|
||||
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
|
||||
|
||||
if ([folder create])
|
||||
|
@ -203,6 +203,8 @@ static SoSecurityManager *sm = nil;
|
|||
SOGoGCSFolder *folder;
|
||||
NSString *key;
|
||||
NSException *error;
|
||||
SOGoUserDefaults *ud;
|
||||
ud = [[context activeUser] userDefaults];
|
||||
|
||||
if (!subFolderClass)
|
||||
subFolderClass = [[self class] subFolderClass];
|
||||
|
@ -221,15 +223,16 @@ static SoSecurityManager *sm = nil;
|
|||
[subFolders setObject: folder forKey: key];
|
||||
}
|
||||
}
|
||||
if (folderType == 0)
|
||||
if (folderType == SOGoPersonalFolder)
|
||||
{
|
||||
if (![subFolders objectForKey: @"personal"])
|
||||
[self createSpecialFolder: SOGoPersonalFolder];
|
||||
}
|
||||
else if (folderType == 1)
|
||||
else if (folderType == SOGoCollectedFolder)
|
||||
{
|
||||
if (![subFolders objectForKey: @"collected"])
|
||||
[self createSpecialFolder: SOGoCollectedFolder];
|
||||
if ([[ud selectedAddressBook] isEqualToString:@"collected"])
|
||||
[self createSpecialFolder: SOGoCollectedFolder];
|
||||
}
|
||||
}
|
||||
return error;
|
||||
|
|
|
@ -97,8 +97,7 @@
|
|||
"Show time as busy outside working hours" = "Show time as busy outside working hours";
|
||||
"First week of year :" = "First week of year:";
|
||||
"Enable reminders for Calendar items" = "Enable reminders for Calendar items";
|
||||
"Play a sound when a reminder comes due"
|
||||
= "Play a sound when a reminder comes due";
|
||||
"Play a sound when a reminder comes due" = "Play a sound when a reminder comes due";
|
||||
"Default reminder :" = "Default reminder:";
|
||||
|
||||
"firstWeekOfYear_January1" = "Starts on january 1";
|
||||
|
@ -139,8 +138,6 @@
|
|||
"messagecheck_every_20_minutes" = "Every 20 minutes";
|
||||
"messagecheck_every_30_minutes" = "Every 30 minutes";
|
||||
"messagecheck_once_per_hour" = "Once per hour";
|
||||
"personal" = "Personal addressbook";
|
||||
"collected" = "Collected addresses";
|
||||
|
||||
"Forward messages:" = "Forward messages:";
|
||||
"messageforward_inline" = "Inline";
|
||||
|
@ -159,6 +156,10 @@
|
|||
"displayremoteinlineimages_never" = "Never";
|
||||
"displayremoteinlineimages_always" = "Always";
|
||||
|
||||
/* Contact */
|
||||
"Personal Address Book" = "Personal Address Book";
|
||||
"Collected Address Book" = "Collected Address Book";
|
||||
|
||||
/* IMAP Accounts */
|
||||
"New Mail Account" = "New Mail Account";
|
||||
|
||||
|
|
|
@ -157,6 +157,10 @@
|
|||
"displayremoteinlineimages_never" = "Jamais";
|
||||
"displayremoteinlineimages_always" = "Toujours";
|
||||
|
||||
/* Contact */
|
||||
"Personal Address Book" = "Carnet d'adresses personnel";
|
||||
"Collected Address Book" = "Carnet d'adresses recueilli";
|
||||
|
||||
/* IMAP Accounts */
|
||||
"New Mail Account" = "Nouveau compte";
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@
|
|||
id item;
|
||||
SOGoUser *user;
|
||||
|
||||
// Addressbook
|
||||
NSMutableDictionary *addressBooksIDWithDisplayName;
|
||||
|
||||
// Calendar categories
|
||||
NSString *category;
|
||||
NSArray *calendarCategories;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue