Improve Preferences module and Mail account editor

pull/225/head
Francis Lachapelle 2016-10-21 10:49:09 -04:00
parent 6d695e813b
commit 24e4c60baa
4 changed files with 52 additions and 19 deletions

View File

@ -14,6 +14,7 @@
<md-input-container class="md-block md-flex">
<label><var:string label:value="Account Name"/></label>
<input type="text" required="required"
md-autofocus="true"
ng-readonly="$AccountDialogController.accountId == 0"
ng-model="$AccountDialogController.account.name"/>
</md-input-container>
@ -33,18 +34,37 @@
<md-input-container class="md-block" flex="30">
<label><var:string label:value="Port"/></label>
<input type="number" required="required" min="1" max="65535"
<input type="number" min="1" max="65535"
ng-disabled="$AccountDialogController.accountId == 0"
ng-model="$AccountDialogController.account.port"/>
ng-model="$AccountDialogController.account.port"
placeholder=""
sg-placeholder="$AccountDialogController.defaultPort"/>
</md-input-container>
</div>
<md-input-container class="md-block md-input-has-value">
<label><var:string label:value="Encryption"/></label>
<md-radio-group ng-model="$AccountDialogController.account.encryption">
<md-radio-button ng-disabled="$AccountDialogController.accountId == 0" value="none" class="md-primary"><var:string label:value="None"/></md-radio-button>
<md-radio-button ng-disabled="$AccountDialogController.accountId == 0" value="ssl"><var:string label:value="SSL"/></md-radio-button>
<md-radio-button ng-disabled="$AccountDialogController.accountId == 0" value="tls"><var:string label:value="TLS"/></md-radio-button>
<div layout="row" layout-align="space-around">
<div>
<md-radio-button
ng-click="$AccountDialogController.defaultPort = 143"
ng-disabled="$AccountDialogController.accountId == 0"
value="none" class="md-primary"><var:string label:value="None"/></md-radio-button>
</div>
<div>
<md-radio-button
ng-click="$AccountDialogController.defaultPort = 993"
ng-disabled="$AccountDialogController.accountId == 0"
value="ssl"><var:string label:value="SSL"/></md-radio-button>
</div>
<div>
<md-radio-button
ng-click="$AccountDialogController.defaultPort = 143"
ng-disabled="$AccountDialogController.accountId == 0"
value="tls"><var:string label:value="TLS"/></md-radio-button>
</div>
</div>
</md-radio-group>
</md-input-container>

View File

@ -739,7 +739,8 @@
<md-input-container class="md-block md-flex">
<input type="text"
label:aria-label="Label"
ng-model="value[0]"/>
ng-model="value[0]"
sg-focus-on="mailLabel_{{$index}}"/>
</md-input-container>
<md-button class="md-icon-button" type="button"
layout="row" layout-align="end center"

View File

@ -11,6 +11,7 @@
function AccountDialogController($mdDialog, defaults, account, accountId, mailCustomFromEnabled) {
var vm = this;
vm.defaultPort = 143;
vm.defaults = defaults;
vm.account = account;
vm.accountId = accountId;
@ -18,6 +19,11 @@
vm.cancel = cancel;
vm.save = save;
if (!vm.account.encryption)
vm.account.encryption = "none";
else if (vm.account.encryption == "ssl")
vm.defaultPort = 993;
function customFromIsReadonly() {
if (accountId > 0)
return false;

View File

@ -115,19 +115,22 @@
vm.preferences.defaults.AuxiliaryMailAccounts.push({});
account = _.last(vm.preferences.defaults.AuxiliaryMailAccounts);
account.name = l("New account");
account.identities = [
{
fullName: "",
email: ""
}
];
account.receipts = {
receiptAction: "ignore",
receiptNonRecipientAction: "ignore",
receiptOutsideDomainAction: "ignore",
receiptAnyAction: "ignore"
};
angular.extend(account,
{
name: "",
identities: [
{
fullName: "",
email: ""
}
],
receipts: {
receiptAction: "ignore",
receiptNonRecipientAction: "ignore",
receiptOutsideDomainAction: "ignore",
receiptAnyAction: "ignore"
}
});
$mdDialog.show({
controller: 'AccountDialogController',
@ -142,6 +145,8 @@
}
}).then(function() {
form.$setDirty();
}).catch(function() {
vm.preferences.defaults.AuxiliaryMailAccounts.pop();
});
}
@ -173,6 +178,7 @@
// See $omit() in the Preferences services for real key generation
var key = '_$$' + guid();
vm.preferences.defaults.SOGoMailLabelsColors[key] = ["New label", "#aaa"];
focus('mailLabel_' + (_.size(vm.preferences.defaults.SOGoMailLabelsColors) - 1));
form.$setDirty();
}