summaryrefslogtreecommitdiffstats
path: root/comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js
parentInitial commit. (diff)
downloadthunderbird-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-itip-identity-dialog.js')
-rw-r--r--comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js b/comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js
new file mode 100644
index 0000000000..dbc8532586
--- /dev/null
+++ b/comm/calendar/base/content/dialogs/calendar-itip-identity-dialog.js
@@ -0,0 +1,52 @@
+/* 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/. */
+
+/* global addMenuItem */
+
+var { MailServices } = ChromeUtils.import("resource:///modules/MailServices.jsm");
+
+/**
+ * @callback onOkCallback
+ * @param {nsIMsgIdentity} identity - The identity the user selected.
+ */
+
+/**
+ * @typdef {object} CalendarItipIdentityDialogArgs
+ * @property {nsIMsgIdentity[]} identities - List of identities to select from.
+ * @property {number} responseMode - One of the response mode constants
+ * from calIItipItem indicating the
+ * mode the user choose.
+ * @property {Function} onCancel - Called when the user clicks cancel.
+ * @property {onOkCallback} onOk - Called when the user selects an
+ * identity.
+ */
+
+/**
+ * Populates the identity menu list with the available identities.
+ */
+function onLoad() {
+ let label = document.getElementById("identity-menu-label");
+ document.l10n.setAttributes(
+ label,
+ window.arguments[0].responseMode == Ci.calIItipItem.NONE
+ ? "calendar-itip-identity-label-none"
+ : "calendar-itip-identity-label"
+ );
+
+ let identityMenu = document.getElementById("identity-menu");
+ for (let identity of window.arguments[0].identities) {
+ let menuitem = addMenuItem(identityMenu, identity.fullAddress, identity.fullAddress);
+ menuitem.identity = identity;
+ }
+
+ identityMenu.selectedIndex = 0;
+
+ document.addEventListener("dialogaccept", () => {
+ window.arguments[0].onOk(identityMenu.selectedItem.identity);
+ });
+
+ document.addEventListener("dialogcancel", window.arguments[0].onCancel);
+}
+
+window.addEventListener("load", onLoad);