summaryrefslogtreecommitdiffstats
path: root/content/manager
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 06:29:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 06:29:37 +0000
commit9355e23a909a7801b3ccdf68ee05b3480be42407 (patch)
tree78220623341b88bd42d16929e2acb3e5ef52e0c8 /content/manager
parentInitial commit. (diff)
downloadtbsync-9355e23a909a7801b3ccdf68ee05b3480be42407.tar.xz
tbsync-9355e23a909a7801b3ccdf68ee05b3480be42407.zip
Adding upstream version 4.7.upstream/4.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'content/manager')
-rw-r--r--content/manager/accountManager.js140
-rw-r--r--content/manager/accountManager.xhtml27
-rw-r--r--content/manager/accounts.js498
-rw-r--r--content/manager/accounts.xhtml119
-rw-r--r--content/manager/addonoptions.xhtml15
-rw-r--r--content/manager/catman.xhtml25
-rw-r--r--content/manager/editAccount.js391
-rw-r--r--content/manager/editAccount.xhtml87
-rw-r--r--content/manager/eventlog/eventlog.js158
-rw-r--r--content/manager/eventlog/eventlog.xhtml21
-rw-r--r--content/manager/help.xhtml58
-rw-r--r--content/manager/installProvider.xhtml35
-rw-r--r--content/manager/manageProvider.js40
-rw-r--r--content/manager/manager.css38
-rw-r--r--content/manager/missingProvider.xhtml21
-rw-r--r--content/manager/noaccounts.xhtml17
-rw-r--r--content/manager/support-wizard/support-wizard.xhtml44
-rw-r--r--content/manager/supporter.xhtml77
18 files changed, 1811 insertions, 0 deletions
diff --git a/content/manager/accountManager.js b/content/manager/accountManager.js
new file mode 100644
index 0000000..d442222
--- /dev/null
+++ b/content/manager/accountManager.js
@@ -0,0 +1,140 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { TbSync } = ChromeUtils.import("chrome://tbsync/content/tbsync.jsm");
+
+var tbSyncAccountManager = {
+
+ onloadoptions: function () {
+ window.close();
+ },
+
+ onunloadoptions: function () {
+ TbSync.manager.openManagerWindow(0);
+ },
+
+ onload: function () {
+ TbSync.AccountManagerTabs = ["accounts.xhtml", "catman.xhtml", "supporter.xhtml", "help.xhtml"];
+ tbSyncAccountManager.selectTab(0);
+ },
+
+ onunload: function () {
+ TbSync.manager.prefWindowObj = null;
+ },
+
+ selectTab: function (t) {
+ const LOAD_FLAGS_NONE = Components.interfaces.nsIWebNavigation.LOAD_FLAGS_NONE;
+
+ //set active tab (css selector for background color)
+ for (let i=0; i<TbSync.AccountManagerTabs.length; i++) {
+ if (i==t) document.getElementById("tbSyncAccountManager.t" + i).setAttribute("active","true");
+ else document.getElementById("tbSyncAccountManager.t" + i).setAttribute("active","false");
+ }
+ TbSync.manager.prefWindowObj.document.getElementById("tbSyncAccountManager.installProvider").hidden=true;
+
+ //load XUL
+ document.getElementById("tbSyncAccountManager.contentWindow").setAttribute("src", "chrome://tbsync/content/manager/"+TbSync.AccountManagerTabs[t]);
+ },
+
+
+
+ //help tab
+ getLogPref: function() {
+ let log = document.getElementById("tbSyncAccountManager.logLevel");
+ log.value = Math.min(3, TbSync.prefs.getIntPref("log.userdatalevel"));
+ },
+
+ toggleLogPref: function() {
+ let log = document.getElementById("tbSyncAccountManager.logLevel");
+ TbSync.prefs.setIntPref("log.userdatalevel", log.value);
+ },
+
+ initSupportWizard: function() {
+ document.getElementById("SupportWizard").getButton("finish").disabled = true;
+
+ let menu = document.getElementById("tbsync.supportwizard.faultycomponent");
+
+ let providers = Object.keys(TbSync.providers.loadedProviders);
+ for (let i=0; i < providers.length; i++) {
+ let item = document.createXULElement("menuitem");
+ item.setAttribute("value", providers[i]);
+ item.setAttribute("label", TbSync.getString("supportwizard.provider::" + TbSync.providers[providers[i]].Base.getProviderName()));
+ menu.appendChild(item);
+ }
+
+ document.getElementById("tbsync.supportwizard.faultycomponent.menulist").addEventListener("select", tbSyncAccountManager.checkSupportWizard);
+ document.getElementById("tbsync.supportwizard.description").addEventListener("input", tbSyncAccountManager.checkSupportWizard);
+ document.addEventListener("wizardfinish", tbSyncAccountManager.prepareBugReport);
+
+ // bug https://bugzilla.mozilla.org/show_bug.cgi?id=1618252
+ document.getElementById('SupportWizard')._adjustWizardHeader();
+ },
+
+ checkSupportWizard: function() {
+ let provider = document.getElementById("tbsync.supportwizard.faultycomponent").parentNode.value;
+ let subject = document.getElementById("tbsync.supportwizard.summary").value;
+ let description = document.getElementById("tbsync.supportwizard.description").value;
+
+ //just check and update button status
+ document.getElementById("SupportWizard").getButton("finish").disabled = (provider == "" || subject == "" || description== "");
+ },
+
+ prepareBugReport: function(event) {
+ let provider = document.getElementById("tbsync.supportwizard.faultycomponent").parentNode.value;
+ let subject = document.getElementById("tbsync.supportwizard.summary").value;
+ let description = document.getElementById("tbsync.supportwizard.description").value;
+
+ if (provider == "" || subject == "" || description== "") {
+ event.preventDefault();
+ return;
+ }
+
+ //special if core is selected, which is not a provider
+ let email = (TbSync.providers.loadedProviders.hasOwnProperty(provider)) ? TbSync.providers[provider].Base.getMaintainerEmail() : "john.bieling@gmx.de";
+ let version = (TbSync.providers.loadedProviders.hasOwnProperty(provider)) ? " " + TbSync.providers.loadedProviders[provider].version : "";
+ TbSync.manager.createBugReport(email, "[" + provider.toUpperCase() + version + "] " + subject, description);
+ },
+
+
+
+ //community tab
+ initCommunity: function() {
+ let listOfContributors = document.getElementById("listOfContributors");
+ let sponsors = {};
+
+ let providers = Object.keys(TbSync.providers.loadedProviders);
+ for (let i=0; i < providers.length; i++) {
+ let provider = providers[i];
+ let template = listOfContributors.firstElementChild.cloneNode(true);
+ template.setAttribute("provider", provider);
+ template.children[0].setAttribute("src", TbSync.providers[provider].Base.getProviderIcon(48));
+ template.children[1].children[0].textContent = TbSync.providers[provider].Base.getProviderName();
+ listOfContributors.appendChild(template);
+ Object.assign(sponsors, TbSync.providers[provider].Base.getSponsors());
+ }
+ listOfContributors.removeChild(listOfContributors.firstElementChild);
+
+ let listOfSponsors = document.getElementById("listOfSponsors");
+ let sponsorlist = Object.keys(sponsors);
+ sponsorlist.sort();
+ for (let i=0; i < sponsorlist.length; i++) {
+ let sponsor = sponsors[sponsorlist[i]];
+ let template = listOfSponsors.firstElementChild.cloneNode(true);
+ if (sponsor.link) template.setAttribute("link", sponsor.link);
+ if (sponsor.icon) template.children[0].setAttribute("src", sponsor.icon);
+ template.children[1].children[0].textContent = sponsor.name;
+ template.children[1].children[1].textContent = sponsor.description;
+ listOfSponsors.appendChild(template);
+ listOfSponsors.appendChild(template);
+ }
+ listOfSponsors.removeChild(listOfSponsors.firstElementChild);
+ }
+};
diff --git a/content/manager/accountManager.xhtml b/content/manager/accountManager.xhtml
new file mode 100644
index 0000000..d136240
--- /dev/null
+++ b/content/manager/accountManager.xhtml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="__TBSYNCMSG_manager.title__"
+ onload="tbSyncAccountManager.onload();"
+ onunload="tbSyncAccountManager.onunload();"
+ width="760" height="620" >
+
+ <vbox id="manager" flex="1">
+ <hbox id="tbtoolbar">
+ <vbox id="tbSyncAccountManager.t0" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="tbSyncAccountManager.selectTab(0)"><hbox flex="1" pack="center" style="min-width:60px"><image src="chrome://tbsync/content/skin/settings32.png" style="width: 32px; height: 32px" /></hbox><hbox flex="1" pack="center"><label value="__TBSYNCMSG_manager.accountsettings__" /></hbox></vbox>
+ <vbox id="tbSyncAccountManager.t1" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="tbSyncAccountManager.selectTab(1)"><hbox flex="1" pack="center" style="min-width:60px"><image src="chrome://tbsync/content/skin/catman32.png" style="width: 32px; height: 32px" /></hbox><hbox flex="1" pack="center"><label value="Category Manager" /></hbox></vbox>
+ <vbox id="tbSyncAccountManager.t2" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="tbSyncAccountManager.selectTab(2)"><hbox flex="1" pack="center" style="min-width:60px"><image src="chrome://tbsync/content/skin/group32.png" style="width: 32px; height: 32px" /></hbox><hbox flex="1" pack="center"><label value="__TBSYNCMSG_manager.community__" /></hbox></vbox>
+ <vbox id="tbSyncAccountManager.t3" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="tbSyncAccountManager.selectTab(3)"><hbox flex="1" pack="center" style="min-width:60px"><image src="chrome://tbsync/content/skin/help32.png" style="width: 32px; height: 32px" /></hbox><hbox flex="1" pack="center"><label value="__TBSYNCMSG_manager.help__" /></hbox></vbox>
+ <vbox id="tbSyncAccountManager.installProvider" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" hidden="true"><hbox flex="1" pack="center" style="min-width:60px"><image src="chrome://tbsync/content/skin/provider32.png" style="width: 32px; height: 32px" /></hbox><hbox flex="1" pack="center"><label value="__TBSYNCMSG_manager.provider__" /></hbox></vbox>
+ </hbox>
+ <browser id="tbSyncAccountManager.contentWindow" type="chrome" src="" disablehistory="true" flex="1"/>
+ </vbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/accounts.js b/content/manager/accounts.js
new file mode 100644
index 0000000..45774b1
--- /dev/null
+++ b/content/manager/accounts.js
@@ -0,0 +1,498 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { TbSync } = ChromeUtils.import("chrome://tbsync/content/tbsync.jsm");
+
+var tbSyncAccounts = {
+
+ selectedAccount: null,
+
+ onload: function () {
+ //scan accounts, update list and select first entry (because no id is passed to updateAccountList)
+ //the onSelect event of the List will load the selected account
+ //also update/init add menu
+ this.updateAvailableProvider();
+
+ Services.obs.addObserver(tbSyncAccounts.updateProviderListObserver, "tbsync.observer.manager.updateProviderList", false);
+ Services.obs.addObserver(tbSyncAccounts.updateAccountsListObserver, "tbsync.observer.manager.updateAccountsList", false);
+ Services.obs.addObserver(tbSyncAccounts.updateAccountSyncStateObserver, "tbsync.observer.manager.updateSyncstate", false);
+ Services.obs.addObserver(tbSyncAccounts.updateAccountNameObserver, "tbsync.observer.manager.updateAccountName", false);
+ Services.obs.addObserver(tbSyncAccounts.toggleEnableStateObserver, "tbsync.observer.manager.toggleEnableState", false);
+ },
+
+ onunload: function () {
+ Services.obs.removeObserver(tbSyncAccounts.updateProviderListObserver, "tbsync.observer.manager.updateProviderList");
+ Services.obs.removeObserver(tbSyncAccounts.updateAccountsListObserver, "tbsync.observer.manager.updateAccountsList");
+ Services.obs.removeObserver(tbSyncAccounts.updateAccountSyncStateObserver, "tbsync.observer.manager.updateSyncstate");
+ Services.obs.removeObserver(tbSyncAccounts.updateAccountNameObserver, "tbsync.observer.manager.updateAccountName");
+ Services.obs.removeObserver(tbSyncAccounts.toggleEnableStateObserver, "tbsync.observer.manager.toggleEnableState");
+ },
+
+ hasInstalledProvider: function (accountID) {
+ let provider = TbSync.db.getAccountProperty(accountID, "provider");
+ return TbSync.providers.loadedProviders.hasOwnProperty(provider);
+ },
+
+ updateDropdown: function (selector) {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+ let selectedAccount = null;
+ let selectedAccountName = "";
+ let isActionsDropdown = (selector == "accountActions");
+
+ let isSyncing = false;
+ let isConnected = false;
+ let isEnabled = false;
+ let isInstalled = false;
+
+ if (accountsList.selectedItem !== null && !isNaN(accountsList.selectedItem.value)) {
+ //some item is selected
+ let selectedItem = accountsList.selectedItem;
+ selectedAccount = selectedItem.value;
+ selectedAccountName = selectedItem.childNodes[1].getAttribute("value");
+ isSyncing = TbSync.core.isSyncing(selectedAccount);
+ isConnected = TbSync.core.isConnected(selectedAccount);
+ isEnabled = TbSync.core.isEnabled(selectedAccount);
+ isInstalled = tbSyncAccounts.hasInstalledProvider(selectedAccount);
+ }
+
+ //hide if no accounts are avail (which is identical to no account selected)
+ if (isActionsDropdown) document.getElementById(selector + "SyncAllAccounts").hidden = (selectedAccount === null);
+
+ //hide if no account is selected
+ if (isActionsDropdown) document.getElementById(selector + "Separator").hidden = (selectedAccount === null);
+ document.getElementById(selector + "DeleteAccount").hidden = (selectedAccount === null);
+ document.getElementById(selector + "DisableAccount").hidden = (selectedAccount === null) || !isEnabled || !isInstalled;
+ document.getElementById(selector + "EnableAccount").hidden = (selectedAccount === null) || isEnabled || !isInstalled;
+ document.getElementById(selector + "SyncAccount").hidden = (selectedAccount === null) || !isConnected || !isInstalled;
+ document.getElementById(selector + "RetryConnectAccount").hidden = (selectedAccount === null) || isConnected || !isEnabled || !isInstalled;
+
+ if (document.getElementById(selector + "ShowEventLog")) {
+ document.getElementById(selector + "ShowEventLog").hidden = false;
+ document.getElementById(selector + "ShowEventLog").disabled = false;
+ }
+
+ if (selectedAccount !== null) {
+ //disable if currently syncing (and displayed)
+ document.getElementById(selector + "DeleteAccount").disabled = isSyncing;
+ document.getElementById(selector + "DisableAccount").disabled = isSyncing;
+ document.getElementById(selector + "EnableAccount").disabled = isSyncing;
+ document.getElementById(selector + "SyncAccount").disabled = isSyncing;
+ //adjust labels - only in global actions dropdown
+ if (isActionsDropdown) document.getElementById(selector + "DeleteAccount").label = TbSync.getString("accountacctions.delete").replace("##accountname##", selectedAccountName);
+ if (isActionsDropdown) document.getElementById(selector + "SyncAccount").label = TbSync.getString("accountacctions.sync").replace("##accountname##", selectedAccountName);
+ if (isActionsDropdown) document.getElementById(selector + "EnableAccount").label = TbSync.getString("accountacctions.enable").replace("##accountname##", selectedAccountName);
+ if (isActionsDropdown) document.getElementById(selector + "DisableAccount").label = TbSync.getString("accountacctions.disable").replace("##accountname##", selectedAccountName);
+ }
+ },
+
+ synchronizeAccount: function () {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+ if (accountsList.selectedItem !== null && !isNaN(accountsList.selectedItem.value) && !TbSync.core.isSyncing(accountsList.selectedItem.value)) {
+ if (tbSyncAccounts.hasInstalledProvider(accountsList.selectedItem.value)) {
+ TbSync.core.syncAccount(accountsList.selectedItem.value);
+ }
+ }
+ },
+
+ deleteAccount: function () {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+ if (accountsList.selectedItem !== null && !isNaN(accountsList.selectedItem.value) && !TbSync.core.isSyncing(accountsList.selectedItem.value)) {
+ let nextAccount = -1;
+ if (accountsList.selectedIndex > 0) {
+ //first try to select the item after this one, otherwise take the one before
+ if (accountsList.selectedIndex + 1 < accountsList.getRowCount()) nextAccount = accountsList.getItemAtIndex(accountsList.selectedIndex + 1).value;
+ else nextAccount = accountsList.getItemAtIndex(accountsList.selectedIndex - 1).value;
+ }
+
+ if (!tbSyncAccounts.hasInstalledProvider(accountsList.selectedItem.value)) {
+ if (confirm(TbSync.getString("prompt.Erase").replace("##accountName##", accountsList.selectedItem.getAttribute("label")))) {
+ //delete account and all folders from db
+ TbSync.db.removeAccount(accountsList.selectedItem.value);
+ //update list
+ this.updateAccountsList(nextAccount);
+ }
+ } else if (confirm(TbSync.getString("prompt.DeleteAccount").replace("##accountName##", accountsList.selectedItem.getAttribute("label")))) {
+ //cache all folders and remove associated targets
+ TbSync.core.disableAccount(accountsList.selectedItem.value);
+
+ // the following call might fail, as not all providers provide that method, it was mainly added to cleanup stored passwords
+ try {
+ let accountData = new TbSync.AccountData(accountsList.selectedItem.value);
+ TbSync.providers[accountData.getAccountProperty("provider")].Base.onDeleteAccount(accountData);
+ } catch (e) { Components.utils.reportError(e);}
+
+ //delete account and all folders from db
+ TbSync.db.removeAccount(accountsList.selectedItem.value);
+ //update list
+ this.updateAccountsList(nextAccount);
+ }
+ }
+ },
+
+
+
+ /* * *
+ * Observer to catch update list request (upon provider load/unload)
+ */
+ updateAccountsListObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //aData is the accountID to be selected
+ //if missing, it will try to not change selection
+ tbSyncAccounts.updateAccountsList(aData);
+ }
+ },
+
+ updateProviderListObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //aData is a provider
+ tbSyncAccounts.updateAvailableProvider(aData);
+ }
+ },
+
+ toggleEnableState: function () {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+
+ if (accountsList.selectedItem !== null && !isNaN(accountsList.selectedItem.value) && !TbSync.core.isSyncing(accountsList.selectedItem.value)) {
+ let isConnected = TbSync.core.isConnected(accountsList.selectedItem.value);
+ if (!isConnected || window.confirm(TbSync.getString("prompt.Disable"))) {
+ tbSyncAccounts.toggleAccountEnableState(accountsList.selectedItem.value);
+ }
+ }
+ },
+
+ /* * *
+ * Observer to catch enable state toggle
+ */
+ toggleEnableStateObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ tbSyncAccounts.toggleAccountEnableState(aData);
+ }
+ },
+
+ //is not prompting, this is doing the actual toggle
+ toggleAccountEnableState: function (accountID) {
+ if (tbSyncAccounts.hasInstalledProvider(accountID)) {
+ let isEnabled = TbSync.core.isEnabled(accountID);
+
+ if (isEnabled) {
+ //we are enabled and want to disable (do not ask, if not connected)
+ TbSync.core.disableAccount(accountID);
+ Services.obs.notifyObservers(null, "tbsync.observer.manager.updateAccountSettingsGui", accountID);
+ tbSyncAccounts.updateAccountStatus(accountID);
+ } else {
+ //we are disabled and want to enabled
+ TbSync.core.enableAccount(accountID);
+ Services.obs.notifyObservers(null, "tbsync.observer.manager.updateAccountSettingsGui", accountID);
+ TbSync.core.syncAccount(accountID);
+ }
+ }
+ },
+
+ /* * *
+ * Observer to catch synstate changes and to update account icons
+ */
+ updateAccountSyncStateObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ if (aData) {
+ //since we want rotating arrows on each syncstate change, we need to run this on each syncstate
+ tbSyncAccounts.updateAccountStatus(aData);
+ }
+ }
+ },
+
+ setStatusImage: function (accountID, obj) {
+ let statusImage = this.getStatusImage(accountID, obj.src);
+ if (statusImage != obj.src) {
+ obj.src = statusImage;
+ }
+ },
+
+ getStatusImage: function (accountID, current = "") {
+ let src = "";
+
+ if (!tbSyncAccounts.hasInstalledProvider(accountID)) {
+ src = "error16.png";
+ } else {
+ switch (TbSync.db.getAccountProperty(accountID, "status").split(".")[0]) {
+ case "success":
+ src = "tick16.png";
+ break;
+
+ case "disabled":
+ src = "disabled16.png";
+ break;
+
+ case "info":
+ case "notsyncronized":
+ case "modified":
+ src = "info16.png";
+ break;
+
+ case "warning":
+ src = "warning16.png";
+ break;
+
+ case "syncing":
+ switch (current.replace("chrome://tbsync/content/skin/","")) {
+ case "sync16_1.png":
+ src = "sync16_2.png";
+ break;
+ case "sync16_2.png":
+ src = "sync16_3.png";
+ break;
+ case "sync16_3.png":
+ src = "sync16_4.png";
+ break;
+ case "sync16_4.png":
+ src = "sync16_1.png";
+ break;
+ default:
+ src = "sync16_1.png";
+ TbSync.core.getSyncDataObject(accountID).accountManagerLastUpdated = 0;
+ break;
+ }
+ if ((Date.now() - TbSync.core.getSyncDataObject(accountID).accountManagerLastUpdated) < 300) {
+ return current;
+ }
+ TbSync.core.getSyncDataObject(accountID).accountManagerLastUpdated = Date.now();
+ break;
+
+ default:
+ src = "error16.png";
+ }
+ }
+
+ return "chrome://tbsync/content/skin/" + src;
+ },
+
+ updateAccountLogo: function (id) {
+ let accountData = new TbSync.AccountData(id);
+ let listItem = document.getElementById("tbSyncAccounts.accounts." + id);
+ if (listItem) {
+ let obj = listItem.childNodes[0];
+ obj.src = tbSyncAccounts.hasInstalledProvider(id) ? TbSync.providers[accountData.getAccountProperty("provider")].Base.getProviderIcon(16, accountData) : "chrome://tbsync/content/skin/provider16.png";
+ }
+ },
+
+ updateAccountStatus: function (id) {
+ let listItem = document.getElementById("tbSyncAccounts.accounts." + id);
+ if (listItem) {
+ let obj = listItem.childNodes[2];
+ this.setStatusImage(id, obj);
+ }
+ },
+
+ updateAccountNameObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ let pos = aData.indexOf(":");
+ let id = aData.substring(0, pos);
+ let name = aData.substring(pos+1);
+ tbSyncAccounts.updateAccountName (id, name);
+ }
+ },
+
+ updateAccountName: function (id, name) {
+ let listItem = document.getElementById("tbSyncAccounts.accounts." + id);
+ if (listItem.childNodes[1].getAttribute("value") != name) {
+ listItem.childNodes[1].setAttribute("value", name);
+ }
+ },
+
+ updateAvailableProvider: function (provider = null) {
+ //either add/remove a specific provider, or rebuild the list from scratch
+ if (provider) {
+ //update single provider entry
+ tbSyncAccounts.updateAddMenuEntry(provider);
+ } else {
+ //add default providers
+ for (let provider in TbSync.providers.defaultProviders) {
+ tbSyncAccounts.updateAddMenuEntry(provider);
+ }
+ //update/add all remaining installed providers
+ for (let provider in TbSync.providers.loadedProviders) {
+ tbSyncAccounts.updateAddMenuEntry(provider);
+ }
+ }
+
+ this.updateAccountsList();
+
+ let selectedAccount = this.getSelectedAccount();
+ if (selectedAccount !== null && TbSync.db.getAccountProperty(selectedAccount, "provider") == provider) {
+ tbSyncAccounts.loadSelectedAccount();
+ }
+ },
+
+ updateAccountsList: function (accountToSelect = null) {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+ let accounts = TbSync.db.getAccounts();
+
+ // try to keep the currently selected account, if accountToSelect is not given
+ if (accountToSelect === null) {
+ let s = accountsList.getItemAtIndex(accountsList.selectedIndex);
+ if (s) {
+ // there is an entry selected, do not change it
+ accountToSelect = s.value;
+ }
+ }
+
+ if (accounts.allIDs.length > null) {
+
+ //get current accounts in list and remove entries of accounts no longer there
+ let listedAccounts = [];
+ for (let i=accountsList.getRowCount()-1; i>=0; i--) {
+ let item = accountsList.getItemAtIndex(i);
+ listedAccounts.push(item.value);
+ if (accounts.allIDs.indexOf(item.value) == -1) {
+ item.remove();
+ }
+ }
+
+ //accounts array is without order, extract keys (ids) and loop over keys
+ for (let i = 0; i < accounts.allIDs.length; i++) {
+
+ if (listedAccounts.indexOf(accounts.allIDs[i]) == -1) {
+ //add all missing accounts (always to the end of the list)
+ let newListItem = document.createXULElement("richlistitem");
+ newListItem.setAttribute("id", "tbSyncAccounts.accounts." + accounts.allIDs[i]);
+ newListItem.setAttribute("value", accounts.allIDs[i]);
+ newListItem.setAttribute("align", "center");
+ newListItem.setAttribute("label", accounts.data[accounts.allIDs[i]].accountname);
+ newListItem.setAttribute("style", "padding: 5px 0px;");
+ newListItem.setAttribute("ondblclick", "tbSyncAccounts.toggleEnableState();");
+
+ //add icon (use "install provider" icon, if provider not installed)
+ let itemType = document.createXULElement("image");
+ //itemType.setAttribute("width", "16");
+ //itemType.setAttribute("height", "16");
+ itemType.setAttribute("style", "margin: 0px 0px 0px 5px; width:16px; height:16px");
+ newListItem.appendChild(itemType);
+
+ //add account name
+ let itemLabel = document.createXULElement("label");
+ itemLabel.setAttribute("flex", "1");
+ newListItem.appendChild(itemLabel);
+
+ //add account status
+ let itemStatus = document.createXULElement("image");
+ //itemStatus.setAttribute("width", "16");
+ //itemStatus.setAttribute("height", "16");
+ itemStatus.setAttribute("style", "margin: 0px 5px; width:16px; height:16px");
+ newListItem.appendChild(itemStatus);
+
+ accountsList.appendChild(newListItem);
+ }
+
+ //update/set actual values
+ this.updateAccountName(accounts.allIDs[i], accounts.data[accounts.allIDs[i]].accountname);
+ this.updateAccountStatus(accounts.allIDs[i]);
+ this.updateAccountLogo(accounts.allIDs[i]);
+ }
+
+ //find selected item
+ for (let i=0; i<accountsList.getRowCount(); i++) {
+ if (accountToSelect === null || accountToSelect == accountsList.getItemAtIndex(i).value) {
+ accountsList.selectedIndex = i;
+ accountsList.ensureIndexIsVisible(i);
+ break;
+ }
+ }
+
+ } else {
+ //No defined accounts, empty accounts list and load dummy
+ for (let i=accountsList.getRowCount()-1; i>=0; i--) {
+ accountsList.getItemAtIndex(i).remove();
+ }
+ document.getElementById("tbSyncAccounts.contentFrame").setAttribute("src", "chrome://tbsync/content/manager/noaccounts.xhtml");
+ }
+ },
+
+ updateAddMenuEntry: function (provider) {
+ let isDefault = TbSync.providers.defaultProviders.hasOwnProperty(provider);
+ let isInstalled = TbSync.providers.loadedProviders.hasOwnProperty(provider);
+
+ let entry = document.getElementById("addMenuEntry_" + provider);
+ if (entry === null) {
+ //add basic menu entry
+ let newItem = window.document.createXULElement("menuitem");
+ newItem.setAttribute("id", "addMenuEntry_" + provider);
+ newItem.setAttribute("value", provider);
+ newItem.setAttribute("class", "menuitem-iconic");
+ newItem.addEventListener("click", function () {tbSyncAccounts.addAccountAction(provider)}, false);
+ newItem.setAttribute("hidden", true);
+ entry = window.document.getElementById("accountActionsAddAccount").appendChild(newItem);
+ }
+
+ //Update label, icon and hidden according to isDefault and isInstalled
+ if (isInstalled) {
+ entry.setAttribute("label", TbSync.providers[provider].Base.getProviderName());
+ entry.setAttribute("image", TbSync.providers[provider].Base.getProviderIcon(16));
+ entry.setAttribute("hidden", false);
+ } else if (isDefault) {
+ entry.setAttribute("label", TbSync.providers.defaultProviders[provider].name);
+ entry.setAttribute("image", "chrome://tbsync/content/skin/provider16.png");
+ entry.setAttribute("hidden", false);
+ } else {
+ entry.setAttribute("hidden", true);
+ }
+ },
+
+ getSelectedAccount: function () {
+ let accountsList = document.getElementById("tbSyncAccounts.accounts");
+ if (accountsList.selectedItem !== null && !isNaN(accountsList.selectedItem.value)) {
+ //get id of selected account from value of selectedItem
+ return accountsList.selectedItem.value;
+ }
+ return null;
+ },
+
+ //load the pref page for the currently selected account (triggered by onSelect)
+ loadSelectedAccount: function () {
+ let selectedAccount = this.getSelectedAccount();
+
+ if (selectedAccount !== null) { //account id could be 0, so need to check for null explicitly
+ let provider = TbSync.db.getAccountProperty(selectedAccount, "provider");
+ if (tbSyncAccounts.hasInstalledProvider(selectedAccount)) {
+ document.getElementById("tbSyncAccounts.contentFrame").setAttribute("src", "chrome://tbsync/content/manager/editAccount.xhtml?provider="+provider+"&id=" + selectedAccount);
+ } else {
+ document.getElementById("tbSyncAccounts.contentFrame").setAttribute("src", "chrome://tbsync/content/manager/missingProvider.xhtml?provider="+provider);
+ }
+ }
+ },
+
+
+
+
+ addAccountAction: function (provider) {
+ let isDefault = TbSync.providers.defaultProviders.hasOwnProperty(provider);
+ let isInstalled = TbSync.providers.loadedProviders.hasOwnProperty(provider);
+
+ if (isInstalled) {
+ tbSyncAccounts.addAccount(provider);
+ } else if (isDefault) {
+ tbSyncAccounts.installProvider(provider);
+ }
+ },
+
+ addAccount: function (provider) {
+ TbSync.providers.loadedProviders[provider].createAccountWindow = window.openDialog(TbSync.providers[provider].Base.getCreateAccountWindowUrl(), "TbSyncNewAccountWindow", "centerscreen,resizable=no");
+ TbSync.providers.loadedProviders[provider].createAccountWindow.addEventListener("unload", function () { TbSync.manager.prefWindowObj.focus(); });
+ },
+
+ installProvider: function (provider) {
+ for (let i=0; i<TbSync.AccountManagerTabs.length; i++) {
+ TbSync.manager.prefWindowObj.document.getElementById("tbSyncAccountManager.t" + i).setAttribute("active","false");
+ }
+ TbSync.manager.prefWindowObj.document.getElementById("tbSyncAccountManager.installProvider").hidden=false;
+ TbSync.manager.prefWindowObj.document.getElementById("tbSyncAccountManager.installProvider").setAttribute("active","true");
+ TbSync.manager.prefWindowObj.document.getElementById("tbSyncAccountManager.contentWindow").setAttribute("src", "chrome://tbsync/content/manager/installProvider.xhtml?provider="+provider);
+ },
+
+};
diff --git a/content/manager/accounts.xhtml b/content/manager/accounts.xhtml
new file mode 100644
index 0000000..663c835
--- /dev/null
+++ b/content/manager/accounts.xhtml
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="tbSyncAccounts.onload();"
+ onunload="tbSyncAccounts.onunload();"
+ title="TbSync Account Settings" >
+
+ <popupset>
+ <menupopup id="tbsync.accountmanger.ContextMenu" onpopupshowing="tbSyncAccounts.updateDropdown('contextMenu');">
+ <menuitem id="contextMenuRetryConnectAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/connect16.png"
+ label="__TBSYNCMSG_manager.RetryConnectAccount__"
+ oncommand="tbSyncAccounts.synchronizeAccount();"/>
+ <menuitem id="contextMenuSyncAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/sync16.png"
+ label="__TBSYNCMSG_manager.SynchronizeAccount__"
+ oncommand="tbSyncAccounts.synchronizeAccount();"/>
+ <menuitem id="contextMenuEnableAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/connect16.png"
+ label="__TBSYNCMSG_manager.EnableAccount__"
+ oncommand="tbSyncAccounts.toggleEnableState();"/>
+ <menuitem id="contextMenuDisableAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/disabled16.png"
+ label="__TBSYNCMSG_manager.DisableAccount__"
+ oncommand="tbSyncAccounts.toggleEnableState();"/>
+ <menuitem id="contextMenuDeleteAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/del16.png"
+ label="__TBSYNCMSG_manager.DeleteAccount__"
+ oncommand="tbSyncAccounts.deleteAccount();"/>
+ </menupopup>
+ </popupset>
+
+ <hbox flex="1">
+ <vbox width="200">
+ <richlistbox
+ id="tbSyncAccounts.accounts"
+ flex="1"
+ style="margin: 0 1px; width: 200px;"
+ seltype="single"
+ context="tbsync.accountmanger.ContextMenu"
+ onkeypress="if (event.keyCode == 46) {tbSyncAccounts.deleteAccount();}"
+ onselect="tbSyncAccounts.loadSelectedAccount();">
+ <listheader style="border-bottom: 1px solid lightgrey;">
+ <treecol style="font-weight:bold;" label="" width="26" flex="0" />
+ <treecol style="font-weight:bold;" label="__TBSYNCMSG_manager.accounts__" flex="1" />
+ <treecol style="font-weight:bold;text-align:right;" label="__TBSYNCMSG_manager.status__" flex="0" />
+ </listheader>
+ </richlistbox>
+ <hbox style="margin:1ex 0 0 0">
+ <vbox style="margin:0" flex="1">
+ <button
+ id="tbSyncAccounts.btnAccountActions"
+ label="__TBSYNCMSG_manager.AccountActions__"
+ style="margin:0"
+ type="menu">
+ <menupopup id="accountActionsDropdown" onpopupshowing="tbSyncAccounts.updateDropdown('accountActions');">
+ <menu
+ class="menu-iconic"
+ image="chrome://tbsync/content/skin/add16.png"
+ label="__TBSYNCMSG_manager.AddAccount__">
+ <menupopup id="accountActionsAddAccount" />
+ </menu>
+ <menuitem id="accountActionsSyncAllAccounts"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/sync16.png"
+ label="__TBSYNCMSG_manager.SyncAll__"
+ oncommand="TbSync.core.syncAllAccounts();"/>
+ <menuitem id="accountActionsShowEventLog"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/warning16.png"
+ label="__TBSYNCMSG_manager.ShowEventLog__"
+ oncommand="TbSync.eventlog.open()"/>
+ <menuseparator id="accountActionsSeparator"/>
+ <menuitem id="accountActionsDeleteAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/del16.png"
+ label="__TBSYNCMSG_manager.DeleteAccount__"
+ oncommand="tbSyncAccounts.deleteAccount();"/>
+ <menuitem id="accountActionsDisableAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/disabled16.png"
+ label="__TBSYNCMSG_manager.DisableAccount__"
+ oncommand="tbSyncAccounts.toggleEnableState();"/>
+ <menuitem id="accountActionsEnableAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/connect16.png"
+ label="__TBSYNCMSG_manager.EnableAccount__"
+ oncommand="tbSyncAccounts.toggleEnableState();"/>
+ <menuitem id="accountActionsSyncAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/sync16.png"
+ label="__TBSYNCMSG_manager.SynchronizeAccount__"
+ oncommand="tbSyncAccounts.synchronizeAccount();"/>
+ <menuitem id="accountActionsRetryConnectAccount"
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/connect16.png"
+ label="__TBSYNCMSG_manager.RetryConnectAccount__"
+ oncommand="tbSyncAccounts.synchronizeAccount();"/>
+ </menupopup>
+ </button>
+ </vbox>
+ </hbox>
+ </vbox>
+ <browser id="tbSyncAccounts.contentFrame" type="chrome" src="" disablehistory="true" flex="1" style="margin-left:12px;"/>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accounts.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/addonoptions.xhtml b/content/manager/addonoptions.xhtml
new file mode 100644
index 0000000..8ee9c10
--- /dev/null
+++ b/content/manager/addonoptions.xhtml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="__TBSYNCMSG_manager.title__"
+ onload="tbSyncAccountManager.onloadoptions();"
+ onunload="tbSyncAccountManager.onunloadoptions();"
+ width="180" height="80" >
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/catman.xhtml b/content/manager/catman.xhtml
new file mode 100644
index 0000000..ce78783
--- /dev/null
+++ b/content/manager/catman.xhtml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="Category Manager" >
+
+ <hbox flex="1" id="mainframe">
+ <vbox flex="1">
+ <html:p>
+ __TBSYNCMSG_manager.catman.text__
+ </html:p>
+
+ <html:p onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="TbSync.manager.openLink('https://addons.thunderbird.net/addon/categorymanager/');" style="color:blue;text-decoration: underline;padding-left:1em;">
+ https://addons.thunderbird.net/addon/categorymanager/
+ </html:p>
+ </vbox>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/editAccount.js b/content/manager/editAccount.js
new file mode 100644
index 0000000..ff4db50
--- /dev/null
+++ b/content/manager/editAccount.js
@@ -0,0 +1,391 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { TbSync } = ChromeUtils.import("chrome://tbsync/content/tbsync.jsm");
+
+var tbSyncAccountSettings = {
+
+ accountID: null,
+ provider: null,
+ settings: null,
+ updateTimer: Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer),
+
+ updateFolderListObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //only run if is request for this account and main frame is visible
+ let accountID = aData;
+ if (accountID == tbSyncAccountSettings.accountID && !document.getElementById('tbsync.accountsettings.frame').hidden) {
+ //make sure, folderlist is visible, otherwise our updates will be discarded (may cause errors)
+ tbSyncAccountSettings.updateFolderList();
+ tbSyncAccountSettings.updateGui();
+ }
+ }
+ },
+
+ reloadAccountSettingObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //only run if is request for this account and main frame is visible
+ let data = JSON.parse(aData);
+ if (data.accountID == tbSyncAccountSettings.accountID && !document.getElementById('tbsync.accountsettings.frame').hidden) {
+ tbSyncAccountSettings.reloadSetting(data.setting);
+ }
+ }
+ },
+
+ updateGuiObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //only run if is request for this account and main frame is visible
+ let accountID = aData;
+ if (accountID == tbSyncAccountSettings.accountID && !document.getElementById('tbsync.accountsettings.frame').hidden) {
+ tbSyncAccountSettings.updateGui();
+ }
+ }
+ },
+
+ updateSyncstateObserver: {
+ observe: function (aSubject, aTopic, aData) {
+ //only run if is request for this account and main frame is visible
+ let accountID = aData;
+ if (accountID == tbSyncAccountSettings.accountID && !document.getElementById('tbsync.accountsettings.frame').hidden) {
+ let syncstate = TbSync.core.getSyncDataObject(accountID).getSyncState().state;
+ if (syncstate == "accountdone") {
+ tbSyncAccountSettings.updateGui();
+ } else {
+ tbSyncAccountSettings.updateSyncstate();
+ }
+ }
+ }
+ },
+
+ onload: function () {
+ //load observers
+ Services.obs.addObserver(tbSyncAccountSettings.updateFolderListObserver, "tbsync.observer.manager.updateFolderList", false);
+ Services.obs.addObserver(tbSyncAccountSettings.updateGuiObserver, "tbsync.observer.manager.updateAccountSettingsGui", false);
+ Services.obs.addObserver(tbSyncAccountSettings.reloadAccountSettingObserver, "tbsync.observer.manager.reloadAccountSetting", false);
+ Services.obs.addObserver(tbSyncAccountSettings.updateSyncstateObserver, "tbsync.observer.manager.updateSyncstate", false);
+ //get the selected account from the loaded URI
+ tbSyncAccountSettings.accountID = window.location.toString().split("id=")[1];
+ tbSyncAccountSettings.accountData = new TbSync.AccountData(tbSyncAccountSettings.accountID);
+
+ //get information for that acount
+ tbSyncAccountSettings.provider = TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, "provider");
+ tbSyncAccountSettings.settings = Object.keys(TbSync.providers.getDefaultAccountEntries(tbSyncAccountSettings.provider)).sort();
+
+ //add header to folderlist
+ let header = TbSync.providers[tbSyncAccountSettings.provider].folderList.getHeader();
+ let folderlistHeader = window.document.getElementById('tbsync.accountsettings.folderlist.header');
+ for (let h=0; h < header.length; h++) {
+ let listheader = window.document.createXULElement("treecol");
+ for (let a in header[h]) {
+ if (header[h].hasOwnProperty(a)) {
+ listheader.setAttribute(a, header[h][a]);
+ }
+ }
+ folderlistHeader.appendChild(listheader);
+ }
+
+ //load overlays from the provider (if any)
+ TbSync.messenger.overlayManager.injectAllOverlays(window, "chrome://tbsync/content/manager/editAccount.xhtml?provider=" + tbSyncAccountSettings.provider);
+ if (window.tbSyncEditAccountOverlay && window.tbSyncEditAccountOverlay.hasOwnProperty("onload")) {
+ tbSyncEditAccountOverlay.onload(window, new TbSync.AccountData(tbSyncAccountSettings.accountID));
+ }
+ tbSyncAccountSettings.loadSettings();
+
+ //done, folderlist must be updated while visible
+ document.getElementById('tbsync.accountsettings.frame').hidden = false;
+ tbSyncAccountSettings.updateFolderList();
+
+ if (Services.appinfo.OS == "Darwin") { //we might need to find a way to detect MacOS like styling, other themes move the header bar into the tabpanel as well
+ document.getElementById('manager.tabpanels').style["padding-top"] = "3ex";
+ }
+ },
+
+
+ onunload: function () {
+ tbSyncAccountSettings.updateTimer.cancel();
+ if (!document.getElementById('tbsync.accountsettings.frame').hidden) {
+ Services.obs.removeObserver(tbSyncAccountSettings.updateFolderListObserver, "tbsync.observer.manager.updateFolderList");
+ Services.obs.removeObserver(tbSyncAccountSettings.updateGuiObserver, "tbsync.observer.manager.updateAccountSettingsGui");
+ Services.obs.removeObserver(tbSyncAccountSettings.reloadAccountSettingObserver, "tbsync.observer.manager.reloadAccountSetting");
+ Services.obs.removeObserver(tbSyncAccountSettings.updateSyncstateObserver, "tbsync.observer.manager.updateSyncstate");
+ }
+ },
+
+
+ folderListVisible: function () {
+ let box = document.getElementById('tbsync.accountsettings.folderlist').getBoundingClientRect();
+ let visible = box.width && box.height;
+ return visible;
+ },
+
+
+ reloadSetting: function (setting) {
+ let pref = document.getElementById("tbsync.accountsettings.pref." + setting);
+ let label = document.getElementById("tbsync.accountsettings.label." + setting);
+
+ if (pref) {
+ //is this a checkbox?
+ if ((pref.tagName == "checkbox") || ((pref.tagName == "input") && (pref.type == "checkbox"))) {
+ //BOOL
+ if (TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, setting)) pref.setAttribute("checked", true);
+ else pref.removeAttribute("checked");
+ } else {
+ //Not BOOL
+ pref.value = TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, setting);
+ }
+ }
+ },
+
+
+ /**
+ * Run through all defined TbSync settings and if there is a corresponding
+ * field in the settings dialog, fill it with the stored value.
+ */
+ loadSettings: function () {
+ for (let i=0; i < tbSyncAccountSettings.settings.length; i++) {
+ let pref = document.getElementById("tbsync.accountsettings.pref." + tbSyncAccountSettings.settings[i]);
+ let label = document.getElementById("tbsync.accountsettings.label." + tbSyncAccountSettings.settings[i]);
+
+ if (pref) {
+ //is this a checkbox?
+ let event = "blur";
+ if ((pref.tagName == "checkbox") || ((pref.tagName == "input") && (pref.type == "checkbox"))) {
+ //BOOL
+ if (TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, tbSyncAccountSettings.settings[i])) pref.setAttribute("checked", true);
+ else pref.removeAttribute("checked");
+ event = "command";
+ } else {
+ //Not BOOL
+ if (pref.tagName == "menulist") {
+ pref.value = TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, tbSyncAccountSettings.settings[i]);
+ event = "command";
+ } else {
+ pref.setAttribute("value", TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, tbSyncAccountSettings.settings[i]));
+ }
+ }
+
+ pref.addEventListener(event, function() {tbSyncAccountSettings.instantSaveSetting(this)});
+ }
+ }
+
+ tbSyncAccountSettings.updateGui();
+ },
+
+ updateGui: function () {
+ let status = TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, "status");
+
+ let isConnected = TbSync.core.isConnected(tbSyncAccountSettings.accountID);
+ let isEnabled = TbSync.core.isEnabled(tbSyncAccountSettings.accountID);
+ let isSyncing = TbSync.core.isSyncing(tbSyncAccountSettings.accountID);
+
+ { //disable settings if connected or syncing
+ let items = document.getElementsByClassName("lockIfConnected");
+ for (let i=0; i < items.length; i++) {
+ if (isConnected || isSyncing || items[i].getAttribute("alwaysDisabled") == "true") {
+ items[i].setAttribute("disabled", true);
+ items[i].style["color"] = "darkgrey";
+ } else {
+ items[i].removeAttribute("disabled");
+ items[i].style["color"] = "black";
+ }
+ }
+ }
+
+ document.getElementById('tbsync.accountsettings.connectbtn.container').hidden = !(isEnabled && !isConnected && !isSyncing);
+ //currently we use a fixed button which is hidden during sync
+ //document.getElementById('tbsync.accountsettings.connectbtn').label = TbSync.getString("manager." + (isSyncing ? "connecting" : "tryagain"));
+
+ { //show elements if connected (this also hides/unhides the folderlist)
+ let items = document.getElementsByClassName("showIfConnected");
+ for (let i=0; i < items.length; i++) {
+ items[i].hidden = !isConnected;
+ }
+ }
+
+ { //show elements if enabled
+ let items = document.getElementsByClassName("showIfEnabled");
+ for (let i=0; i < items.length; i++) {
+ items[i].hidden = !isEnabled;
+ }
+ }
+
+ document.getElementById('tbsync.accountsettings.enabled').checked = isEnabled;
+ document.getElementById('tbsync.accountsettings.enabled').disabled = isSyncing;
+ document.getElementById('tbsync.accountsettings.folderlist').disabled = isSyncing;
+ document.getElementById('tbsync.accountsettings.syncbtn').disabled = isSyncing;
+ document.getElementById('tbsync.accountsettings.connectbtn').disabled = isSyncing;
+
+ tbSyncAccountSettings.updateSyncstate();
+
+ //change color of syncstate according to status
+ let showEventLogButton = false;
+ switch (status) {
+ case "success":
+ case "disabled":
+ case "syncing":
+ document.getElementById("syncstate").removeAttribute("style");
+ break;
+
+ case "notsyncronized":
+ document.getElementById("syncstate").setAttribute("style","color: red");
+ break;
+
+ default:
+ document.getElementById("syncstate").setAttribute("style","color: red");
+ showEventLogButton = TbSync.eventlog.get(tbSyncAccountSettings.accountID).length > 0;
+ }
+ document.getElementById('tbsync.accountsettings.eventlogbtn').hidden = !showEventLogButton;
+ },
+
+ updateSyncstate: function () {
+ tbSyncAccountSettings.updateTimer.cancel();
+
+ // if this account is beeing synced, display syncstate, otherwise print status
+ let status = TbSync.db.getAccountProperty(tbSyncAccountSettings.accountID, "status");
+ let isSyncing = TbSync.core.isSyncing(tbSyncAccountSettings.accountID);
+ let isConnected = TbSync.core.isConnected(tbSyncAccountSettings.accountID);
+ let isEnabled = TbSync.core.isEnabled(tbSyncAccountSettings.accountID);
+ let syncdata = TbSync.core.getSyncDataObject(tbSyncAccountSettings.accountID);
+
+ if (isSyncing) {
+ let accounts = TbSync.db.getAccounts().data;
+
+ let s = syncdata.getSyncState();
+ let syncstate = s.state;
+ let synctime = s.timestamp;
+
+ let msg = TbSync.getString("syncstate." + syncstate, tbSyncAccountSettings.provider);
+
+ if (syncstate.split(".")[0] == "send") {
+ // append timeout countdown
+ let diff = Date.now() - synctime;
+ if (diff > 2000) msg = msg + " (" + Math.round((TbSync.providers[tbSyncAccountSettings.provider].Base.getConnectionTimeout(tbSyncAccountSettings.accountData) - diff)/1000) + "s)";
+ // re-schedule update, if this is a waiting syncstate
+ tbSyncAccountSettings.updateTimer.init(tbSyncAccountSettings.updateSyncstate, 1000, 0);
+ }
+ document.getElementById("syncstate").textContent = msg;
+ } else {
+ let localized = TbSync.getString("status." + (isEnabled ? status : "disabled"), tbSyncAccountSettings.provider);
+ document.getElementById("syncstate").textContent = localized;
+ }
+
+
+ if (tbSyncAccountSettings.folderListVisible()) {
+ //update syncstates of folders in folderlist, if visible - remove obsolete entries while we are here
+ let folderData = TbSync.providers[tbSyncAccountSettings.provider].Base.getSortedFolders(tbSyncAccountSettings.accountData);
+ let folderList = document.getElementById("tbsync.accountsettings.folderlist");
+
+ for (let i=folderList.getRowCount()-1; i>=0; i--) {
+ let item = folderList.getItemAtIndex(i);
+ if (folderData.filter(f => f.folderID == item.folderData.folderID).length == 0) {
+ item.remove();
+ } else {
+ TbSync.providers[tbSyncAccountSettings.provider].folderList.updateRow(document, item, item.folderData);
+ }
+ }
+ }
+ },
+
+ updateFolderList: function () {
+ //get updated list of folderIDs
+ let folderData = TbSync.providers[tbSyncAccountSettings.provider].Base.getSortedFolders(tbSyncAccountSettings.accountData);
+
+ //remove entries from folderlist, which no longer exists and build reference array with current elements
+ let folderList = document.getElementById("tbsync.accountsettings.folderlist");
+ folderList.hidden=true;
+
+ let foldersElements = {};
+ for (let i=folderList.getRowCount()-1; i>=0; i--) {
+ if (folderData.filter(f => f.folderID == folderList.getItemAtIndex(i).folderData.folderID).length == 0) {
+ folderList.getItemAtIndex(i).remove();
+ } else {
+ foldersElements[folderList.getItemAtIndex(i).folderData.folderID] = folderList.getItemAtIndex(i);
+ }
+ }
+
+ //update folderlist
+ for (let i=0; i < folderData.length; i++) {
+ let nextItem = null;
+
+ //if this entry does not exist, create it
+ if (foldersElements.hasOwnProperty(folderData[i].folderID)) {
+ //get reference to current element
+ nextItem = foldersElements[folderData[i].folderID];
+ } else {
+ //add new entry, attach FolderData of this folder as folderData
+ nextItem = document.createXULElement("richlistitem");
+ nextItem.folderData = folderData[i];
+
+ //add row
+ nextItem.appendChild(TbSync.providers[tbSyncAccountSettings.provider].folderList.getRow(document, folderData[i]));
+ }
+
+ //add/move row and update its content
+ let addedItem = folderList.appendChild(nextItem);
+ TbSync.providers[tbSyncAccountSettings.provider].folderList.updateRow(document, addedItem, folderData[i]);
+
+ //ensureElementIsVisible also forces internal update of rowCount, which sometimes is not updated automatically upon appendChild
+ folderList.ensureElementIsVisible(addedItem);
+ }
+ folderList.hidden = false;
+ },
+
+
+
+
+
+ instantSaveSetting: function (field) {
+ let setting = field.id.replace("tbsync.accountsettings.pref.","");
+ let value = "";
+
+ if ((field.tagName == "checkbox") || ((field.tagName == "input") && (field.type == "checkbox"))) {
+ if (field.checked) value = true;
+ else value = false;
+ } else {
+ value = field.value;
+ }
+ TbSync.db.setAccountProperty(tbSyncAccountSettings.accountID, setting, value);
+
+ if (setting == "accountname") {
+ Services.obs.notifyObservers(null, "tbsync.observer.manager.updateAccountName", tbSyncAccountSettings.accountID + ":" + field.value);
+ }
+ TbSync.db.saveAccounts(); //write modified accounts to disk
+ },
+
+ toggleEnableState: function (element) {
+ if (!TbSync.core.isConnected(tbSyncAccountSettings.accountID)) {
+ //if not connected, we can toggle without prompt
+ Services.obs.notifyObservers(null, "tbsync.observer.manager.toggleEnableState", tbSyncAccountSettings.accountID);
+ return;
+ }
+
+ if (window.confirm(TbSync.getString("prompt.Disable"))) {
+ Services.obs.notifyObservers(null, "tbsync.observer.manager.toggleEnableState", tbSyncAccountSettings.accountID);
+ } else {
+ //invalid, toggle checkbox back
+ element.setAttribute("checked", true);
+ }
+ },
+
+
+ onFolderListContextMenuShowing: function () {
+ let folderList = document.getElementById("tbsync.accountsettings.folderlist");
+ let aFolderIsSelected = (!folderList.disabled && folderList.selectedItem !== null && folderList.selectedItem.value !== undefined);
+ let menupopup = document.getElementById("tbsync.accountsettings.FolderListContextMenu");
+
+ if (aFolderIsSelected) {
+ TbSync.providers[tbSyncAccountSettings.provider].folderList.onContextMenuShowing(window, folderList.selectedItem.folderData);
+ } else {
+ TbSync.providers[tbSyncAccountSettings.provider].folderList.onContextMenuShowing(window, null);
+ }
+ },
+
+};
diff --git a/content/manager/editAccount.xhtml b/content/manager/editAccount.xhtml
new file mode 100644
index 0000000..9381678
--- /dev/null
+++ b/content/manager/editAccount.xhtml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window id="tbsync.accountsettings"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ omscope="tbSyncAccountSettings"
+ onload="tbSyncAccountSettings.onload()"
+ onunload="tbSyncAccountSettings.onunload()"
+ title="" >
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/editAccount.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+
+ <popupset>
+ <menupopup
+ id="tbsync.accountsettings.FolderListContextMenu"
+ folderID=""
+ onpopupshowing="tbSyncAccountSettings.onFolderListContextMenuShowing();">
+ <menuitem
+ class="menuitem-iconic"
+ image="chrome://tbsync/content/skin/warning16.png"
+ label="__TBSYNCMSG_manager.ShowEventLog__"
+ oncommand="TbSync.eventlog.open(tbSyncAccountSettings.accountID, this.parentNode.getAttribute('folderID'));"/>
+ </menupopup>
+ </popupset>
+
+ <tabbox id="tbsync.accountsettings.frame" hidden="true" flex="1">
+
+ <tabs id="manager.tabs" orient="horizontal" value="">
+ <tab id="manager.tabs.status" label="__TBSYNCMSG_manager.tabs.status__" />
+ </tabs>
+
+ <tabpanels flex="1" id="manager.tabpanels" style="margin:0;padding:1ex;">
+ <tabpanel id="manager.tabpanels.status" orient="vertical"><!-- STATUS -->
+ <vbox flex="1">
+ <label class="header" style="margin-left:0; margin-bottom:1ex;" value="__TBSYNCMSG_manager.tabs.status.general__" />
+ <checkbox id="tbsync.accountsettings.enabled" oncommand="tbSyncAccountSettings.toggleEnableState(this);" label="__TBSYNCMSG_manager.tabs.status.enableThisAccount__" />
+
+ <vbox class="showIfEnabled" style="height:100px; overflow-x: hidden; overflow-y:hidden">
+ <hbox flex="1">
+ <vbox flex="1">
+ <label class="header" style="margin-left:0; margin-bottom:1ex; margin-top:2ex;" value="__TBSYNCMSG_manager.status__" />
+ <description id="syncstate"></description>
+ </vbox>
+ <vbox flex="0">
+ <label class="header" style="margin-left:0; margin-bottom:1ex; margin-top:1ex; visibility: hidden" value="nix" />
+ <button id="tbsync.accountsettings.eventlogbtn" label="__TBSYNCMSG_manager.ShowEventLog__" oncommand="TbSync.eventlog.open()" />
+ </vbox>
+ </hbox>
+ </vbox>
+
+ <vbox flex="1">
+ <vbox class="showIfConnected" flex="1">
+ <label style="margin-left:0; margin-bottom: 1ex; margin-top: 2ex" class="header" value="__TBSYNCMSG_manager.tabs.status.resources__"/>
+ <description>__TBSYNCMSG_manager.tabs.status.resources.intro__</description>
+ <richlistbox
+ id="tbsync.accountsettings.folderlist"
+ style="margin: 0 1px 1px 1ex;padding:0; height:225px; overflow-x: hidden;"
+ context="tbsync.accountsettings.FolderListContextMenu"
+ seltype="single">
+ <listheader id="tbsync.accountsettings.folderlist.header" style="border-bottom: 1px solid lightgrey;">
+ </listheader>
+ </richlistbox>
+ <vbox flex="0" style="margin:1ex 0 0 0;">
+ <hbox flex="1" align="center" pack="end">
+ <description style="text-align:right" flex="1" control="tbsync.accountsettings.pref.autosync" tooltiptext="__TBSYNCMSG_manager.tabs.status.never__">__TBSYNCMSG_manager.tabs.status.autotime__</description>
+ <html:input style="width:50px;margin-bottom:0; margin-top:0" id="tbsync.accountsettings.pref.autosync" tooltiptext="__TBSYNCMSG_manager.tabs.status.never__" />
+ <button id="tbsync.accountsettings.syncbtn" style="margin-right:0; margin-bottom:0; margin-top:0; padding: 0 1ex;" label="__TBSYNCMSG_manager.tabs.status.sync__" oncommand="TbSync.core.syncAccount(tbSyncAccountSettings.accountID)" />
+ </hbox>
+ </vbox>
+ </vbox>
+ </vbox>
+
+ <hbox id="tbsync.accountsettings.connectbtn.container" flex="0" style="margin:1ex 0 0 0;" pack="end">
+ <button id="tbsync.accountsettings.connectbtn" style="margin-right:0; margin-bottom:0; margin-top:0; padding: 0 1ex;" label="__TBSYNCMSG_manager.tabs.status.tryagain__" oncommand="TbSync.core.syncAccount(tbSyncAccountSettings.accountID)" />
+ </hbox>
+
+ </vbox>
+ </tabpanel>
+ </tabpanels>
+
+ </tabbox>
+
+</window>
diff --git a/content/manager/eventlog/eventlog.js b/content/manager/eventlog/eventlog.js
new file mode 100644
index 0000000..eaa0b47
--- /dev/null
+++ b/content/manager/eventlog/eventlog.js
@@ -0,0 +1,158 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
+var { TbSync } = ChromeUtils.import("chrome://tbsync/content/tbsync.jsm");
+
+var tbSyncEventLog = {
+
+ onload: function () {
+ Services.obs.addObserver(tbSyncEventLog.updateEventLog, "tbsync.observer.eventlog.update", false);
+
+ let eventlog = document.getElementById('tbsync.eventlog');
+ eventlog.hidden = true;
+
+ //init list
+ let events = TbSync.eventlog.get();
+ for (let i=0; i < events.length; i++) {
+ let item = tbSyncEventLog.addLogEntry(events[i]);
+ eventlog.appendChild(item);
+ }
+ eventlog.hidden = false;
+ eventlog.ensureIndexIsVisible(eventlog.getRowCount()-1);
+ document.getElementById("tbsync.eventlog.clear").addEventListener("click", tbSyncEventLog.onclear);
+ document.getElementById("tbsync.eventlog.close").addEventListener("click", () => window.close());
+ },
+
+ onclear: function () {
+ TbSync.eventlog.clear();
+
+ let eventlog = document.getElementById('tbsync.eventlog');
+ eventlog.hidden = true;
+
+ for (let i=eventlog.getRowCount()-1; i>=0; i--) {
+ eventlog.getItemAtIndex(i).remove();
+ }
+
+ eventlog.hidden = false;
+ },
+
+ onunload: function () {
+ Services.obs.removeObserver(tbSyncEventLog.updateEventLog, "tbsync.observer.eventlog.update");
+ },
+
+ updateEventLog: {
+ observe: function (aSubject, aTopic, aData) {
+ let events = TbSync.eventlog.get();
+ if (events.length > 0) {
+ let eventlog = document.getElementById('tbsync.eventlog');
+ eventlog.hidden = true;
+
+ let item = tbSyncEventLog.addLogEntry(events[events.length-1]);
+ eventlog.appendChild(item);
+
+ eventlog.hidden = false;
+ eventlog.ensureIndexIsVisible(eventlog.getRowCount()-1);
+ }
+ }
+ },
+
+
+ addLogEntry: function (entry) {
+
+ //left column
+ let leftColumn = document.createXULElement("vbox");
+ //leftColumn.setAttribute("width", "24");
+ leftColumn.setAttribute("style", "width: 24px;");
+
+ let image = document.createXULElement("image");
+ let src = entry.type.endsWith("_rerun") ? "sync" : entry.type;
+ image.setAttribute("src", "chrome://tbsync/content/skin/" + src + "16.png");
+ image.setAttribute("style", "margin:4px 4px 4px 4px;");
+ leftColumn.appendChild(image);
+
+ //right column
+ let rightColumn = document.createXULElement("vbox");
+ rightColumn.setAttribute("flex","1");
+
+ let d = new Date(entry.timestamp);
+ let timestamp = document.createXULElement("description");
+ timestamp.setAttribute("flex", "1");
+ timestamp.setAttribute("class", "header");
+ timestamp.textContent = d.toLocaleTimeString();
+ rightColumn.appendChild(timestamp);
+
+ let hBox = document.createXULElement("hbox");
+ hBox.flex = "1";
+ let vBoxLeft = document.createXULElement("vbox");
+ vBoxLeft.flex = "1";
+ let vBoxRight = document.createXULElement("vbox");
+
+ let msg = document.createXULElement("description");
+ msg.setAttribute("flex", "1");
+ msg.setAttribute("class", "header");
+ msg.textContent = entry.message;
+ vBoxLeft.appendChild(msg);
+
+ if (entry.link) {
+ let link = document.createXULElement("button");
+ link.setAttribute("label", TbSync.getString("manager.help"));
+ link.setAttribute("oncommand", "TbSync.manager.openLink('" + entry.link + "')");
+ vBoxRight.appendChild(link);
+ }
+
+ hBox.appendChild(vBoxLeft);
+ hBox.appendChild(vBoxRight);
+ rightColumn.appendChild(hBox);
+
+ if (entry.accountname || entry.provider) {
+ let account = document.createXULElement("label");
+ if (entry.accountname) account.setAttribute("value", "Account: " + entry.accountname + (entry.provider ? " (" + entry.provider.toUpperCase() + ")" : ""));
+ else account.setAttribute("value", "Provider: " + entry.provider.toUpperCase());
+ rightColumn.appendChild(account);
+ }
+
+ if (entry.foldername) {
+ let folder = document.createXULElement("label");
+ folder.setAttribute("value", "Resource: " + entry.foldername);
+ rightColumn.appendChild(folder);
+ }
+
+ if (entry.details) {
+ let lines = entry.details.split("\n");
+ let line = document.createElementNS("http://www.w3.org/1999/xhtml", "textarea");
+ line.setAttribute("readonly", "true");
+ line.setAttribute("wrap", "off");
+ line.setAttribute("rows", lines.length);
+ line.setAttribute("style", "font-family: monospace; font-size: 10px;");
+ line.setAttribute("class", "plain");
+ line.value = entry.details.trim();
+
+ let container = document.createXULElement("vbox");
+ container.setAttribute("style", "margin-left:1ex;margin-top:1ex;");
+ container.appendChild(line);
+
+ rightColumn.appendChild(container);
+ }
+
+ //columns
+ let columns = document.createXULElement("hbox");
+ columns.setAttribute("flex", "1");
+ columns.appendChild(leftColumn);
+ columns.appendChild(rightColumn);
+
+ //richlistitem
+ let richlistitem = document.createXULElement("richlistitem");
+ richlistitem.setAttribute("style", "padding:4px; border-bottom: 1px solid lightgrey;");
+ richlistitem.appendChild(columns);
+
+ return richlistitem;
+ },
+};
diff --git a/content/manager/eventlog/eventlog.xhtml b/content/manager/eventlog/eventlog.xhtml
new file mode 100644
index 0000000..b71af18
--- /dev/null
+++ b/content/manager/eventlog/eventlog.xhtml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<window
+ title="__TBSYNCMSG_eventlog.title__"
+ onload="tbSyncEventLog.onload();"
+ onunload="tbSyncEventLog.onunload();"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" >
+
+ <script type="application/javascript" src="chrome://tbsync/content/manager/eventlog/eventlog.js"/>
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+
+ <vbox flex="1">
+ <richlistbox id="tbsync.eventlog" style="padding:5px; height:360px" seltype="single" disabled="true"/>
+ <hbox style="padding: 5px">
+ <vbox flex="1"></vbox>
+ <button id="tbsync.eventlog.clear" label="__TBSYNCMSG_eventlog.clear__" />
+ <button id="tbsync.eventlog.close" label="__TBSYNCMSG_eventlog.close__" />
+ </hbox>
+ </vbox>
+</window>
diff --git a/content/manager/help.xhtml b/content/manager/help.xhtml
new file mode 100644
index 0000000..675bf53
--- /dev/null
+++ b/content/manager/help.xhtml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="tbSyncAccountManager.getLogPref();"
+ title="Help" >
+
+ <hbox flex="1" id="mainframe">
+ <vbox flex="1">
+
+ <html:p>
+ <html:b>__TBSYNCMSG_manager.help.needhelp__</html:b><html:br/><html:br/>
+ __TBSYNCMSG_manager.help.wiki__
+ </html:p>
+
+ <html:p onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="TbSync.manager.openTranslatedLink('https://github.com/jobisoft/TbSync/wiki');" style="color:blue;text-decoration: underline;padding-left:1em;margin:0 0 24px 0">
+ https://github.com/jobisoft/TbSync/wiki
+ </html:p>
+
+ <html:p>
+ <html:b>__TBSYNCMSG_manager.help.foundabug__</html:b><html:br/><html:br/>
+ <html:span>__TBSYNCMSG_manager.help.fixit__</html:span>
+ </html:p>
+
+ <hbox align="center">
+ <label value="__TBSYNCMSG_manager.help.debugmode__" />
+ <menulist flex="0" id="tbSyncAccountManager.logLevel" oncommand="tbSyncAccountManager.toggleLogPref();">
+ <menupopup>
+ <menuitem label="__TBSYNCMSG_manager.help.debuglevel.0__" value="0" />
+ <menuitem label="__TBSYNCMSG_manager.help.debuglevel.1__" value="1" />
+ <menuitem label="__TBSYNCMSG_manager.help.debuglevel.2__" value="2" />
+ <menuitem label="__TBSYNCMSG_manager.help.debuglevel.3__" value="3" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <html:p>
+ __TBSYNCMSG_manager.help.createbugreportinfo__
+ </html:p>
+
+ <hbox>
+ <button style="margin:0 0 0 1em; padding: 0 1ex;" label="__TBSYNCMSG_manager.help.createbugreport__" oncommand="TbSync.manager.openBugReportWizard();" />
+ <button style="margin:0 0 0 1em; padding: 0 1ex;" label="__TBSYNCMSG_manager.help.viewdebuglog__" oncommand="TbSync.manager.viewDebugLog();" />
+ </hbox>
+
+ <hbox flex="1">
+ </hbox>
+
+ </vbox>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/installProvider.xhtml b/content/manager/installProvider.xhtml
new file mode 100644
index 0000000..9ccdd75
--- /dev/null
+++ b/content/manager/installProvider.xhtml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="tbSyncManageProvider.prepInstall();"
+ title="Install additional synchronization provider for TbSync" >
+
+ <hbox flex="1" id="mainframe">
+ <vbox flex="1">
+
+ <hbox>
+ <html:p style="font-weight: bold" id="header"></html:p>
+ </hbox>
+
+ <html:p>
+ __TBSYNCMSG_manager.installprovider.link__
+ </html:p>
+
+ <html:p id="link" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="TbSync.manager.prefWindowObj.tbSyncAccountManager.selectTab(0); TbSync.manager.openTBtab(this.getAttribute('link'));" style="color:blue;text-decoration: underline;padding-left:1em;">
+ </html:p>
+
+ <html:p id="warning" style="font-weight: bold">
+ __TBSYNCMSG_manager.installprovider.warning__
+ </html:p>
+
+ </vbox>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/manageProvider.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/manageProvider.js b/content/manager/manageProvider.js
new file mode 100644
index 0000000..01b3be5
--- /dev/null
+++ b/content/manager/manageProvider.js
@@ -0,0 +1,40 @@
+/*
+ * This file is part of TbSync.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+ "use strict";
+
+var { TbSync } = ChromeUtils.import("chrome://tbsync/content/tbsync.jsm");
+
+var tbSyncManageProvider = {
+
+ prepInstall: function () {
+ let url = window.location.toString();
+ let provider = url.split("provider=")[1];
+ window.document.getElementById("header").textContent = TbSync.getString("installProvider.header::" + TbSync.providers.defaultProviders[provider].name);
+
+ window.document.getElementById("link").textContent = TbSync.providers.defaultProviders[provider].homepageUrl;
+ window.document.getElementById("link").setAttribute("link", TbSync.providers.defaultProviders[provider].homepageUrl);
+
+ window.document.getElementById("warning").hidden = TbSync.providers.defaultProviders[provider].homepageUrl.startsWith("https://addons.thunderbird.net");
+ },
+
+ prepMissing: function () {
+ let url = window.location.toString();
+ let provider = url.split("provider=")[1];
+
+ let e = window.document.getElementById("missing");
+ let v = e.textContent;
+ e.textContent = v.replace("##provider##", provider.toUpperCase());
+
+ if (TbSync.providers.defaultProviders.hasOwnProperty(provider)) {
+ window.document.getElementById("link").textContent = TbSync.providers.defaultProviders[provider].homepageUrl;
+ window.document.getElementById("link").setAttribute("link", TbSync.providers.defaultProviders[provider].homepageUrl);
+ }
+
+ },
+};
diff --git a/content/manager/manager.css b/content/manager/manager.css
new file mode 100644
index 0000000..c6359bf
--- /dev/null
+++ b/content/manager/manager.css
@@ -0,0 +1,38 @@
+#manager {
+ margin:8px 12px 12px 12px;
+}
+
+#tbtoolbar {
+ border:1px solid darkgrey;
+ background-color: #ffffff;
+ padding: 0;
+ margin:0 0 12px 0;
+}
+
+#tbtoolbar vbox {
+ margin: 0;
+ padding:6px 6px 2px 6px;
+ background-color: #ffffff;
+}
+
+#tbtoolbar vbox:hover {
+ background-color: #e0e8f6;
+}
+
+#tbtoolbar vbox[active="true"] {
+ background-color: #c1d2ee;
+}
+
+#mainframe {
+ padding:0 12px;
+ margin:0;
+}
+
+.row vbox {
+ width:140px;
+}
+
+iframe {
+ margin:0;
+ padding:0;
+}
diff --git a/content/manager/missingProvider.xhtml b/content/manager/missingProvider.xhtml
new file mode 100644
index 0000000..fbdc26f
--- /dev/null
+++ b/content/manager/missingProvider.xhtml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="tbSyncManageProvider.prepMissing();"
+ title="TbSync Account Settings" >
+
+ <hbox flex="1" pack="center">
+ <vbox flex="1" pack="center">
+ <description style="text-align:center" id="missing">__TBSYNCMSG_manager.missingprovider__</description>
+ <html:p id="link" onmouseover="this.style.cursor='pointer'" onmouseout="this.style.cursor='default'" onclick="TbSync.manager.openTBtab(this.getAttribute('link'));" style="color:blue; text-decoration: underline; text-align:center;"></html:p>
+ </vbox>
+
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/manageProvider.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/noaccounts.xhtml b/content/manager/noaccounts.xhtml
new file mode 100644
index 0000000..2437218
--- /dev/null
+++ b/content/manager/noaccounts.xhtml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="TbSync Account Settings" >
+
+ <hbox flex="1" pack="center">
+ <vbox flex="1" pack="center">
+ <description style="text-align:center">__TBSYNCMSG_manager.noaccounts__</description>
+ </vbox>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>
diff --git a/content/manager/support-wizard/support-wizard.xhtml b/content/manager/support-wizard/support-wizard.xhtml
new file mode 100644
index 0000000..ce7ea27
--- /dev/null
+++ b/content/manager/support-wizard/support-wizard.xhtml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+
+<window
+ width="500"
+ height="600"
+ onload="tbSyncAccountManager.initSupportWizard();"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <linkset>
+ <html:link rel="localization" href="toolkit/global/wizard.ftl"/>
+ </linkset>
+
+ <wizard
+ id="SupportWizard"
+ title="__TBSYNCMSG_supportwizard.title__">
+
+ <wizardpage onFirstPage="true" label="__TBSYNCMSG_supportwizard.pagetitle__">
+ <label value="__TBSYNCMSG_supportwizard.label.faultycomponent__"/>
+ <menulist id="tbsync.supportwizard.faultycomponent.menulist">
+ <menupopup id="tbsync.supportwizard.faultycomponent">
+ <menuitem hidden="true" selected="true" label="__TBSYNCMSG_supportwizard.label.selectcomponent__" value="" />
+ <menuitem label="__TBSYNCMSG_manager.title__" value="core" />
+ </menupopup>
+ </menulist>
+
+ <label style="margin-top:1em" value="__TBSYNCMSG_supportwizard.label.summary__"/>
+ <html:input id="tbsync.supportwizard.summary" oninput="tbSyncAccountManager.checkSupportWizard()" />
+
+ <label style="margin-top:1em" value="__TBSYNCMSG_supportwizard.label.description__"/>
+ <html:textarea rows="15" style="margin-left: 1ex;" id="tbsync.supportwizard.description" />
+
+ <description style="margin-top:1em">
+ __TBSYNCMSG_supportwizard.footer__
+ </description>
+ </wizardpage>
+
+ </wizard>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+
+</window>
diff --git a/content/manager/supporter.xhtml b/content/manager/supporter.xhtml
new file mode 100644
index 0000000..a9bee40
--- /dev/null
+++ b/content/manager/supporter.xhtml
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://tbsync/content/manager/manager.css" type="text/css"?>
+
+<window
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ onload="tbSyncAccountManager.initCommunity();"
+ title="Community" >
+
+ <hbox flex="1" id="mainframe">
+ <vbox flex="1">
+ <html:p>
+ <html:b>__TBSYNCMSG_manager.supporter.contributors__</html:b>
+ <html:div id="listOfContributors" style="margin-top:10px">
+
+ <html:div provider="" style="width:225px; margin: 0 0 10px 0; float:left;">
+ <html:img
+ src=""
+ style="width:48px; height:48px; margin:4px 0 0 10px; float:left"
+ onclick="TbSync.manager.openLink(TbSync.providers.loadedProviders[this.parentNode.getAttribute('provider')].addon.homepageURL);"
+ onmouseover="this.style.cursor='pointer'"
+ onmouseout="this.style.cursor='default'" />
+ <html:div style="padding-left: 65px;">
+ <html:div>__TBSYNCMSG_manager.title__</html:div>
+ <html:div style="font-style:italic">__TBSYNCMSG_manager.provider4tbsync__</html:div>
+ <html:div style="font-style:italic;">[<html:span
+ onclick="TbSync.manager.openLink(TbSync.providers.loadedProviders[this.parentNode.parentNode.parentNode.getAttribute('provider')].addon.contributorsURL);"
+ onmouseover="this.style.cursor='pointer'"
+ onmouseout="this.style.cursor='default'"
+ style="color:blue;text-decoration: underline;">__TBSYNCMSG_manager.supporter.details__</html:span>]</html:div>
+ </html:div>
+ </html:div>
+
+ <html:div provider="" style="width:225px; margin: 0 0 10px 0; float:left;">
+ <html:img
+ src="chrome://tbsync/content/skin/tbsync64.png"
+ style="width:48px; height:48px; margin:4px 0 0 10px; float:left"
+ onclick="TbSync.manager.openLink(TbSync.addon.homepageURL);"
+ onmouseover="this.style.cursor='pointer'"
+ onmouseout="this.style.cursor='default'" />
+ <html:div style="padding-left: 65px;">
+ <html:span></html:span>
+ <html:div>TbSync</html:div>
+ <html:div style="font-style:italic">__TBSYNCMSG_manager.shorttitle__</html:div>
+ <html:div style="font-style:italic;">[<html:span
+ onclick="TbSync.manager.openLink(TbSync.addon.contributorsURL);"
+ onmouseover="this.style.cursor='pointer'"
+ onmouseout="this.style.cursor='default'"
+ style="color:blue;text-decoration: underline;">__TBSYNCMSG_manager.supporter.details__</html:span>]</html:div>
+ </html:div>
+ </html:div>
+
+ </html:div>
+ </html:p>
+
+
+ <html:p>
+ <html:b>__TBSYNCMSG_manager.supporter.sponsors__</html:b>
+ <html:div id="listOfSponsors" style="margin-top:10px">
+ <html:div link="" style="width:225px; margin: 0 0 10px 0; float:left;">
+ <html:img src="chrome://tbsync/content/skin/user48.png" style="width:48px; height:48px; padding:0px; margin:0 0 0 10px; border:1px solid #d3d3d3; float:left" onclick="if (this.parentNode.getAttribute('link') != '') {TbSync.manager.openLink(this.parentNode.getAttribute('link'));}" onmouseover="if (this.parentNode.getAttribute('link') != '') {this.style.cursor='pointer'}" onmouseout="this.style.cursor='default'" />
+ <html:div style="padding-left: 65px;">
+ <html:div >Name</html:div>
+ <html:div style="font-style:italic">Description</html:div>
+ </html:div>
+ </html:div>
+ </html:div>
+ </html:p>
+
+ </vbox>
+ </hbox>
+
+ <script type="text/javascript" src="chrome://tbsync/content/manager/accountManager.js" />
+ <script type="text/javascript" src="chrome://tbsync/content/scripts/locales.js" />
+</window>