diff --git a/UI/PreferencesUI/UIxJSONPreferences.m b/UI/PreferencesUI/UIxJSONPreferences.m index 9ac86347a..5b1b9558c 100644 --- a/UI/PreferencesUI/UIxJSONPreferences.m +++ b/UI/PreferencesUI/UIxJSONPreferences.m @@ -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]; } diff --git a/UI/Templates/PreferencesUI/UIxAccountEditor.wox b/UI/Templates/PreferencesUI/UIxAccountEditor.wox index c37b7c1da..37766329a 100644 --- a/UI/Templates/PreferencesUI/UIxAccountEditor.wox +++ b/UI/Templates/PreferencesUI/UIxAccountEditor.wox @@ -32,9 +32,9 @@ ng-readonly="accountId == 0" ng-model="account.port"/> + - - + @@ -47,7 +47,7 @@ - diff --git a/UI/WebServerResources/js/PreferencesUI.js b/UI/WebServerResources/js/PreferencesUI.js index b330b5d02..5e9b22202 100644 --- a/UI/WebServerResources/js/PreferencesUI.js +++ b/UI/WebServerResources/js/PreferencesUI.js @@ -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} }); };