diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js')
-rw-r--r-- | comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js b/comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js new file mode 100644 index 0000000000..0f39cecbf1 --- /dev/null +++ b/comm/calendar/base/content/dialogs/calendar-providerUninstall-dialog.js @@ -0,0 +1,58 @@ +/* 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/. */ + +var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm"); + +window.addEventListener("DOMContentLoaded", onLoad); +function onLoad() { + let extension = window.arguments[0].extension; + document.getElementById("provider-name-label").value = extension.name; + + let calendarList = document.getElementById("calendar-list"); + + for (let calendar of cal.manager.getCalendars()) { + if (calendar.providerID != extension.id) { + continue; + } + + let item = document.createXULElement("richlistitem"); + item.setAttribute("calendar-id", calendar.id); + + let checkbox = document.createXULElement("checkbox"); + checkbox.classList.add("calendar-selected"); + item.appendChild(checkbox); + + let colorMarker = document.createElement("div"); + colorMarker.classList.add("calendar-color"); + item.appendChild(colorMarker); + colorMarker.style.backgroundColor = calendar.getProperty("color"); + + let label = document.createXULElement("label"); + label.classList.add("calendar-name"); + label.value = calendar.name; + item.appendChild(label); + + calendarList.appendChild(item); + } +} + +document.addEventListener("dialogaccept", () => { + // Tell our caller that the extension should be uninstalled. + let args = window.arguments[0]; + args.shouldUninstall = true; + + let calendarList = document.getElementById("calendar-list"); + + // Unsubscribe from all selected calendars + for (let item of calendarList.children) { + if (item.querySelector(".calendar-selected").checked) { + cal.manager.unregisterCalendar(cal.manager.getCalendarById(item.getAttribute("calendar-id"))); + } + } +}); + +document.addEventListener("dialogcancel", () => { + let args = window.arguments[0]; + args.shouldUninstall = false; +}); |