mirror of
https://github.com/Ximi1970/systray-x.git
synced 2025-11-15 09:46:09 +01:00
Store query filters
This commit is contained in:
@@ -65,7 +65,7 @@ SysTrayX.Accounts = {
|
|||||||
|
|
||||||
if (accounts[prop]) {
|
if (accounts[prop]) {
|
||||||
let typeUl = document.createElement("ul");
|
let typeUl = document.createElement("ul");
|
||||||
typeUl.setAttribute("class", "nested");
|
typeUl.setAttribute("class", "nested active");
|
||||||
|
|
||||||
for (let i = 0; i < accounts[prop].length; ++i) {
|
for (let i = 0; i < accounts[prop].length; ++i) {
|
||||||
let typeLi = document.createElement("li");
|
let typeLi = document.createElement("li");
|
||||||
|
|||||||
@@ -13,17 +13,33 @@ function saveOptions(e) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get accounts
|
* Save accounts and filters
|
||||||
*/
|
*/
|
||||||
|
|
||||||
console.debug("Store accounts");
|
console.debug("Store accounts and filters");
|
||||||
|
|
||||||
let treeBase = document.getElementById("accountsTree");
|
let treeBase = document.getElementById("accountsTree");
|
||||||
let inputs = treeBase.querySelectorAll("input");
|
let inputs = treeBase.querySelectorAll("input");
|
||||||
let accounts = [];
|
let accounts = [];
|
||||||
|
let filters = [];
|
||||||
for (let i = 0; i < inputs.length; ++i) {
|
for (let i = 0; i < inputs.length; ++i) {
|
||||||
let account = JSON.parse(inputs[i].value);
|
let account = JSON.parse(inputs[i].value);
|
||||||
accounts.push({ ...account, checked: inputs[i].checked });
|
let checked = inputs[i].checked;
|
||||||
|
accounts.push({ ...account, checked: checked });
|
||||||
|
|
||||||
|
if (checked) {
|
||||||
|
let inboxMailFolder = account.folders.find(obj => obj.type === "inbox");
|
||||||
|
|
||||||
|
if (inboxMailFolder) {
|
||||||
|
console.debug("Filter Id: " + inboxMailFolder.accountId);
|
||||||
|
console.debug("Filter Path: " + inboxMailFolder.path);
|
||||||
|
|
||||||
|
filters.push({
|
||||||
|
unread: true,
|
||||||
|
folder: inboxMailFolder
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store accounts
|
// Store accounts
|
||||||
@@ -31,7 +47,12 @@ function saveOptions(e) {
|
|||||||
accounts: accounts
|
accounts: accounts
|
||||||
});
|
});
|
||||||
|
|
||||||
console.debug("Store accounts done");
|
// Store query filters
|
||||||
|
browser.storage.sync.set({
|
||||||
|
filters: filters
|
||||||
|
});
|
||||||
|
|
||||||
|
console.debug("Store accounts and filters done");
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreOptions() {
|
function restoreOptions() {
|
||||||
|
|||||||
Reference in New Issue
Block a user