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/suite/components/dataman/content/dataman.xml | |
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/suite/components/dataman/content/dataman.xml')
-rw-r--r-- | comm/suite/components/dataman/content/dataman.xml | 249 |
1 files changed, 249 insertions, 0 deletions
diff --git a/comm/suite/components/dataman/content/dataman.xml b/comm/suite/components/dataman/content/dataman.xml new file mode 100644 index 0000000000..de90cac68d --- /dev/null +++ b/comm/suite/components/dataman/content/dataman.xml @@ -0,0 +1,249 @@ +<?xml version="1.0"?> +<!-- 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/. --> + +<!DOCTYPE bindings [ +<!ENTITY % datamanDTD SYSTEM "chrome://communicator/locale/dataman/dataman.dtd"> +%datamanDTD; +]> + +<bindings id="datamanBindings" + xmlns="http://www.mozilla.org/xbl" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" + xmlns:xbl="http://www.mozilla.org/xbl"> + + <binding id="perm-base-item" + extends="chrome://global/content/bindings/richlistbox.xml#richlistitem"> + <implementation> + <constructor><![CDATA[ + var {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm"); + + var permLabel = this.type; + try { + permLabel = gDataman.bundle.getString("perm." + this.type + ".label"); + } + catch (e) { + } + this.setAttribute("label", permLabel); + this._updateRadio(); + ]]></constructor> + + <property name="capability"> + <getter><![CDATA[ + if (this.hasAttribute("capability")) + return this.getAttribute("capability"); + return -1; + ]]></getter> + <setter><![CDATA[ + this.setAttribute("capability", val); + this._updateRadio(); + ]]></setter> + </property> + + <property name="host" readonly="true" + onget="return this.getAttribute('host');"/> + + <property name="type" readonly="true" + onget="return this.getAttribute('type');"/> + + <method name="_updateRadio"> + <body><![CDATA[ + let radio = document.getAnonymousElementByAttribute(this, "anonid", + "permSetting-" + this.capability); + if (radio) + radio.radioGroup.selectedItem = radio; + else { + let radioGroup = document.getAnonymousElementByAttribute(this, "anonid", + "radioGroup"); + radioGroup.selectedIndex = -1; + } + ]]></body> + </method> + + <method name="useDefault"> + <parameter name="aChecked"/> + <parameter name="aUIUpdateOnly"/> + <body><![CDATA[ + let checkbox = document.getAnonymousElementByAttribute(this, "anonid", + "useDefault"); + if (checkbox.checked != aChecked) + checkbox.checked = aChecked; + let radioGroup = document.getAnonymousElementByAttribute(this, "anonid", + "radioGroup"); + radioGroup.disabled = aChecked; + if (aChecked) { + if (!aUIUpdateOnly) + gPerms.removeItem(this.host, this.type); + + this.capability = gPerms.getDefault(this.type); + } + this._updateRadio(); + ]]></body> + </method> + + <method name="setCapability"> + <parameter name="aValue"/> + <parameter name="aUIUpdateOnly"/> + <body><![CDATA[ + this.capability = aValue; + let radio = document.getAnonymousElementByAttribute(this, "anonid", + "permSetting-" + aValue); + if (radio && !radio.selected) + radio.radioGroup.selectedItem = radio; + if (!aUIUpdateOnly) + gPerms.updateItem(this.host, this.type, aValue); + ]]></body> + </method> + + <method name="handleKeyPress"> + <parameter name="aEvent"/> + <body><![CDATA[ + if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE || + (AppConstants.platform == "macosx" && + aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE)) { + this.useDefault(true); + } + ]]></body> + </method> + </implementation> + + <handlers> + <handler event="keypress" phase="capturing" + action="return this.handleKeyPress(event);"/> + </handlers> + </binding> + + <binding id="perm-generic-item" + extends="chrome://communicator/content/dataman/dataman.xml#perm-base-item"> + <content> + <xul:hbox> + <xul:label anonid="permHost" class="hostLabel" xbl:inherits="value=displayHost"/> + <xul:label anonid="permLabel" class="permissionLabel" xbl:inherits="value=label" control="radioGroup"/> + </xul:hbox> + <xul:hbox role="group" aria-labelledby="permLabel"> + <xul:checkbox class="indent" anonid="useDefault" label="&perm.UseDefault;" + oncommand="document.getBindingParent(this).useDefault(this.checked);"/> + <xul:spacer flex="1"/> + <xul:radiogroup anonid="radioGroup" orient="horizontal"> + <xul:radio anonid="permSetting-1" label="&perm.Allow;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.ALLOW_ACTION);"/> + <xul:radio anonid="permSetting-2" label="&perm.Block;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.DENY_ACTION);"/> + </xul:radiogroup> + </xul:hbox> + </content> + </binding> + + <binding id="perm-cookie-item" + extends="chrome://communicator/content/dataman/dataman.xml#perm-base-item"> + <content> + <xul:hbox> + <xul:label anonid="permHost" class="hostLabel" xbl:inherits="value=displayHost"/> + <xul:label anonid="permLabel" class="permissionLabel" xbl:inherits="value=label" control="radioGroup"/> + </xul:hbox> + <xul:hbox role="group" aria-labelledby="permLabel"> + <xul:checkbox class="indent" anonid="useDefault" label="&perm.UseDefault;" + oncommand="document.getBindingParent(this).useDefault(this.checked);"/> + <xul:spacer flex="1"/> + <xul:radiogroup anonid="radioGroup" orient="horizontal"> + <xul:radio anonid="permSetting-1" label="&perm.Allow;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.ALLOW_ACTION);"/> + <xul:radio anonid="permSetting-8" label="&perm.AllowSession;" + oncommand="document.getBindingParent(this).setCapability(Ci.nsICookiePermission.ACCESS_SESSION);"/> + <xul:radio anonid="permSetting-2" label="&perm.Block;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.DENY_ACTION);"/> + </xul:radiogroup> + </xul:hbox> + </content> + </binding> + + <binding id="perm-geo-item" + extends="chrome://communicator/content/dataman/dataman.xml#perm-base-item"> + <content> + <xul:hbox> + <xul:label anonid="permHost" class="hostLabel" xbl:inherits="value=displayHost"/> + <xul:label anonid="permLabel" class="permissionLabel" xbl:inherits="value=label" control="radioGroup"/> + </xul:hbox> + <xul:hbox role="group" aria-labelledby="permLabel"> + <xul:checkbox class="indent" anonid="useDefault" label="&perm.AskAlways;" + oncommand="document.getBindingParent(this).useDefault(this.checked);"/> + <xul:spacer flex="1"/> + <xul:radiogroup anonid="radioGroup" orient="horizontal"> + <xul:radio anonid="permSetting-1" label="&perm.Allow;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.ALLOW_ACTION);"/> + <xul:radio anonid="permSetting-2" label="&perm.Block;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.DENY_ACTION);"/> + </xul:radiogroup> + </xul:hbox> + </content> + </binding> + + <binding id="perm-password-item" extends="chrome://communicator/content/dataman/dataman.xml#perm-base-item"> + <content> + <xul:hbox> + <xul:label anonid="permHost" class="hostLabel" xbl:inherits="value=displayHost"/> + <xul:label anonid="permLabel" class="permissionLabel" xbl:inherits="value=label" control="radioGroup"/> + </xul:hbox> + <xul:hbox role="group" aria-labelledby="permLabel"> + <xul:checkbox class="indent" anonid="useDefault" hidden="true"/> + <xul:spacer flex="1"/> + <xul:radiogroup anonid="radioGroup" orient="horizontal"> + <xul:radio anonid="permSetting-1" label="&perm.AskAlways;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.ALLOW_ACTION);"/> + <xul:radio anonid="permSetting-2" label="&perm.NeverSave;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.DENY_ACTION);"/> + </xul:radiogroup> + </xul:hbox> + </content> + + <implementation> + <method name="useDefault"> + <parameter name="aChecked"/> + <body><![CDATA[ + // just for compat, makes it easier to generically "delete" perms + if (aChecked) + this.setCapability(Services.perms.ALLOW_ACTION); + ]]></body> + </method> + + <method name="setCapability"> + <parameter name="aValue"/> + <parameter name="aUIUpdateOnly"/> + <body><![CDATA[ + this.capability = aValue; + let radio = document.getAnonymousElementByAttribute(this, "anonid", + "permSetting-" + aValue); + if (radio && !radio.selected) + radio.radioGroup.selectedItem = radio; + if (!aUIUpdateOnly) + Services.logins.setLoginSavingEnabled(this.host, aValue == Services.perms.ALLOW_ACTION); + ]]></body> + </method> + </implementation> + </binding> + + <binding id="perm-content-item" + extends="chrome://communicator/content/dataman/dataman.xml#perm-base-item"> + <content> + <xul:hbox> + <xul:label anonid="permHost" class="hostLabel" xbl:inherits="value=displayHost"/> + <xul:label anonid="permLabel" class="permissionLabel" xbl:inherits="value=label" control="radioGroup"/> + </xul:hbox> + <xul:hbox role="group" aria-labelledby="permLabel"> + <xul:checkbox class="indent" anonid="useDefault" label="&perm.UseDefault;" + oncommand="document.getBindingParent(this).useDefault(this.checked);"/> + <xul:spacer flex="1"/> + <xul:radiogroup anonid="radioGroup" orient="horizontal"> + <xul:radio anonid="permSetting-1" label="&perm.Allow;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.ALLOW_ACTION);"/> + <xul:radio anonid="permSetting-3" label="&perm.AllowSameDomain;" + oncommand="document.getBindingParent(this).setCapability(NOFOREIGN);"/> + <xul:radio anonid="permSetting-2" label="&perm.Block;" + oncommand="document.getBindingParent(this).setCapability(Services.perms.DENY_ACTION);"/> + </xul:radiogroup> + </xul:hbox> + </content> + </binding> + + </bindings> |