(fix) many adjustments regarding auxiliary accounts

pull/91/head
Ludovic Marcotte 2015-04-30 11:19:30 -04:00 committed by Francis Lachapelle
parent 6d64242382
commit f515543e33
3 changed files with 33 additions and 8 deletions

View File

@ -56,7 +56,7 @@ static SoProduct *preferencesProduct = nil;
- (WOResponse *) jsonDefaultsAction
{
NSMutableDictionary *values;
NSMutableDictionary *values, *account;
SOGoUserDefaults *defaults;
NSMutableArray *accounts;
NSArray *categoryLabels;
@ -208,15 +208,27 @@ static SoProduct *preferencesProduct = nil;
if ([[defaults source] dirty])
[defaults synchronize];
//
// We inject our default mail account, something we don't want to do before we
// call -synchronize on our defaults.
//
values = [[[[defaults source] values] mutableCopy] autorelease];
accounts = [NSMutableArray arrayWithArray: [values objectForKey: @"AuxiliaryMailAccounts"]];
[accounts insertObject: [[[context activeUser] mailAccounts] objectAtIndex: 0]
atIndex: 0];
account = [[[context activeUser] mailAccounts] objectAtIndex: 0];
if (![account objectForKey: @"receipts"])
{
[account setObject: [NSDictionary dictionaryWithObjectsAndKeys: @"ignore", @"receiptAction",
@"ignore", @"receiptNonRecipientAction",
@"ignore", @"receiptOutsideDomainAction",
@"ignore", @"receiptAnyAction", nil]
forKey: @"receipts"];
}
[accounts insertObject: account atIndex: 0];
[values setObject: accounts forKey: @"AuxiliaryMailAccounts"];
return [self _makeResponse: values];
}

View File

@ -32,9 +32,9 @@
ng-readonly="accountId == 0" ng-model="account.port"/>
</md-input-container>
<label><var:string label:value="Encryption:"/></label>
<md-radio-group ng-model="account.encryption">
<label><var:string label:value="Encryption:"/></label>
<md-radio-button ng-disabled="accountId == 0" value="none"><var:string label:value="None"/></md-radio-button>
<md-radio-button ng-disabled="accountId == 0" value="none" class="md-primary"><var:string label:value="None"/></md-radio-button>
<md-radio-button ng-disabled="accountId == 0" value="ssl"><var:string label:value="SSL"/></md-radio-button>
<md-radio-button ng-disabled="accountId == 0" value="tls"><var:string label:value="TLS"/></md-radio-button>
</md-radio-group>
@ -47,7 +47,7 @@
<md-input-container>
<label><var:string label:value="Password:"/></label>
<input type="password" ng-readonly="account.isDefault == 1"
<input type="password" ng-readonly="accountId == 0"
ng-model="account.password"/>
</md-input-container>

View File

@ -99,11 +99,24 @@
$scope.addMailAccount = function(ev) {
$scope.preferences.defaults.AuxiliaryMailAccounts.push({});
var account = _.last($scope.preferences.defaults.AuxiliaryMailAccounts);
account['name'] = "New account";
account['identities'] = [];
account['identities'][0] = {};
account['identities'][0]['fullName'] = "";
account['identities'][0]['email'] = "";
account['receipts'] = {};
account['receipts']['receiptAction'] = "ignore";
account['receipts']['receiptNonRecipientAction'] = "ignore";
account['receipts']['receiptOutsideDomainAction'] = "ignore";
account['receipts']['receiptAnyAction'] = "ignore";
$mdDialog.show({
controller: AccountDialogCtrl,
templateUrl: 'editAccount?account=new',
targetEvent: ev,
locals: { account: account }
locals: { account: account,
accountId: ($scope.preferences.defaults.AuxiliaryMailAccounts.length-1),
mailCustomFromEnabled: window.mailCustomFromEnabled}
});
};