bugFix#2823

pull/42/head
Alexandre Cloutier 2014-06-26 16:08:47 -04:00
parent b6be4e6e2f
commit 302e40a1c3
5 changed files with 64 additions and 42 deletions

View File

@ -1764,23 +1764,23 @@ static NSString *userAgent = nil;
if ([ud mailAddOutgoingAddresses])
{
Class contactGCSEntry;
SOGoContactFolders *contactFolders;
NGMailAddressParser *parser;
id parsedRecipient;
SOGoContactFolder *folder;
SOGoContactGCSEntry *newContact;
NGVCard *card;
Class contactGCSEntry;
NGMailAddressParser *parser;
NSArray *matchingContacts;
NSMutableArray *recipients;
NSString *recipient, *emailAddress, *addressBook, *uid;
NSArray *matchingContacts;
id parsedRecipient;
int i;
// Get all the addressbooks
contactFolders = [[[context activeUser] homeFolderInContext: context]
lookupName: @"Contacts"
inContext: context
acquire: NO];
lookupName: @"Contacts"
inContext: context
acquire: NO];
// Get all the recipients from the current email
recipients = [self allRecipients];
for (i = 0; i < [recipients count]; i++)

View File

@ -164,34 +164,45 @@ static SoSecurityManager *sm = nil;
NSString *folderName;
SOGoGCSFolder *folder;
SOGoUser *folderOwner;
SOGoUserDefaults *ud;
roles = [[context activeUser] rolesForObject: self inContext: context];
folderOwner = [SOGoUser userWithLogin: [self ownerInContext: context]];
// We autocreate the calendars if the user is the owner, a superuser or
// if it's a resource as we won't necessarily want to login as a resource
// in order to create its database tables.
// FolderType is an enum where 0 = Personal and 1 = collected
if ([roles containsObject: SoRole_Owner] ||
(folderOwner && [folderOwner isResource]))
{
if (folderType == SOGoPersonalFolder)
{
if (folderType == SOGoPersonalFolder)
{
folderName = @"personal";
folder = [subFolderClass objectWithName: folderName inContainer: self];
[folder setDisplayName: [self defaultFolderName]];
}
else if (folderType == SOGoCollectedFolder)
{
folderName = @"collected";
folder = [subFolderClass objectWithName: folderName inContainer: self];
[folder setDisplayName: [self collectedFolderName]];
}
folderName = @"personal";
folder = [subFolderClass objectWithName: folderName inContainer: self];
[folder setDisplayName: [self defaultFolderName]];
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
if ([folder create])
[subFolders setObject: folder forKey: folderName];
[subFolders setObject: folder forKey: folderName];
}
else if (folderType == SOGoCollectedFolder)
{
ud = [[context activeUser] userDefaults];
if ([ud mailAddOutgoingAddresses]) {
folderName = @"collected";
folder = [subFolderClass objectWithName: folderName inContainer: self];
[folder setDisplayName: [self collectedFolderName]];
[folder setOCSPath: [NSString stringWithFormat: @"%@/%@", OCSPath, folderName]];
if ([folder create])
[subFolders setObject: folder forKey: folderName];
[ud setSelectedAddressBook:folderName];
}
}
}
}
- (NSException *) fetchSpecialFolders: (NSString *) sql

View File

@ -714,7 +714,7 @@ static NSArray *reminderValues = nil;
for (; count >= 0; count--)
{
if (![[folders objectAtIndex: count] isKindOfClass: [SOGoContactGCSFolder class]])
[folders removeObjectAtIndex: count];
[folders removeObjectAtIndex: count];
}
// Parse the objects in order to have only the displayName of the addressbooks to be displayed on the preferences interface
@ -728,17 +728,19 @@ static NSArray *reminderValues = nil;
[availableAddressBooksName addObject:[[folders objectAtIndex:i] displayName]];
if ([[availableAddressBooksID objectAtIndex:i] isEqualToString: @"collected"])
collectedAlreadyExist = YES;
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"];
}
}
if (!collectedAlreadyExist)
{
[availableAddressBooksID addObject: @"collected"];
[addressBooksIDWithDisplayName setObject: [self labelForKey: @"Collected Address Book"] forKey: @"collected"];
}
return availableAddressBooksID;
}

View File

@ -299,7 +299,8 @@
<dd><input type="checkbox"
const:name="addOutgoingAddresses"
const:id="addOutgoingAddresses"
var:checked="addOutgoingAddresses" />
var:checked="addOutgoingAddresses"
onChange = "onAddOutgoingAddressesCheck(this);"/>
<var:string label:value="When sending mail, add unknown recipients to my"/><br/>
<var:popup list="addressBookList" item="item"
const:id="addressBookList"

View File

@ -291,6 +291,7 @@ function initPreferences() {
$("vacationEndDate_date").disable();
});
}
onAddOutgoingAddressesCheck();
}
function initSieveFilters() {
@ -1173,6 +1174,13 @@ function serializeContactsCategories() {
/* / contact categories */
function onAddOutgoingAddressesCheck(checkBox) {
if (!checkBox) {
checkBox = $("addOutgoingAddresses");
}
$("addressBookList").disabled = !checkBox.checked;
}
function onReplyPlacementListChange() {
if ($("replyPlacementList").value == 0) {