Add folders to the storage

This commit is contained in:
Ximi1970
2020-01-11 23:21:00 +01:00
parent 86fe0b67e3
commit 778f400635
2 changed files with 7 additions and 9 deletions

View File

@@ -40,7 +40,8 @@ SysTrayX.Accounts = {
}
accounts[mailAccount[i].type].push({
id: mailAccount[i].id,
name: mailAccount[i].name
name: mailAccount[i].name,
folders: mailAccount[i].folders
});
}
@@ -70,8 +71,8 @@ SysTrayX.Accounts = {
let typeLi = document.createElement("li");
let typeInput = document.createElement("input");
typeInput.setAttribute("type", "checkbox");
typeInput.setAttribute("name", accounts[prop][i].name);
typeInput.setAttribute("value", accounts[prop][i].id);
typeInput.setAttribute("name", accounts[prop][i].id);
typeInput.setAttribute("value", JSON.stringify(accounts[prop][i]));
typeInput.setAttribute("checked", "true");
typeLi.appendChild(typeInput);
let typeText = document.createTextNode(" " + accounts[prop][i].name);
@@ -91,7 +92,7 @@ SysTrayX.Accounts = {
let accounts = result.accounts || [];
for (let i = 0; i < accounts.length; ++i) {
let checkbox = treeBase.querySelector(
`input[value=${accounts[i].id}]`
`input[name=${accounts[i].id}]`
);
if (checkbox) {
checkbox.checked = accounts[i].checked;

View File

@@ -22,11 +22,8 @@ function saveOptions(e) {
let inputs = treeBase.querySelectorAll("input");
let accounts = [];
for (let i = 0; i < inputs.length; ++i) {
accounts.push({
id: inputs[i].value,
name: inputs[i].name,
checked: inputs[i].checked
});
let account = JSON.parse(inputs[i].value);
accounts.push({ ...account, checked: inputs[i].checked });
}
// Store accounts