diff options
author | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2019-11-03 00:17:46 -0400 |
commit | 302bf1b523012e11b60425d6eee1221ebc2724eb (patch) | |
tree | b191a895f8716efcbe42f454f37597a545a6f421 /mailnews/base/content/charsetList.xml | |
parent | 21b3f6247403c06f85e1f45d219f87549862198f (diff) | |
download | UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.gz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.lz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.tar.xz UXP-302bf1b523012e11b60425d6eee1221ebc2724eb.zip |
Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1
Diffstat (limited to 'mailnews/base/content/charsetList.xml')
-rw-r--r-- | mailnews/base/content/charsetList.xml | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/mailnews/base/content/charsetList.xml b/mailnews/base/content/charsetList.xml new file mode 100644 index 000000000..bff43059e --- /dev/null +++ b/mailnews/base/content/charsetList.xml @@ -0,0 +1,69 @@ +<?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/. +--> + +<bindings id="charsetListBinding" + xmlns="http://www.mozilla.org/xbl" + xmlns:xbl="http://www.mozilla.org/xbl" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <binding id="charsetpicker" + extends="chrome://global/content/bindings/menulist.xml#menulist"> + <implementation> + <constructor><![CDATA[ + let charsetValues = ""; + + if (this.getAttribute("subset") == "sending") + charsetValues = ["UTF-8", "EUC-KR", "gbk", "gb18030", "ISO-2022-JP", + "ISO-8859-1", "ISO-8859-7", "windows-1252"]; + + else if (!this.getAttribute("subset") + || this.getAttribute("subset") == "viewing") + charsetValues = ["UTF-8", "Big5", "EUC-KR", "gbk", "ISO-2022-JP", + "ISO-8859-1", "ISO-8859-2", "ISO-8859-7", + "windows-874", "windows-1250", "windows-1251", + "windows-1252", "windows-1255", "windows-1256", + "windows-1257", "windows-1258"]; + + Components.utils.import("resource://gre/modules/Services.jsm"); + + let charsetBundle = Services.strings.createBundle( + "chrome://messenger/locale/charsetTitles.properties"); + let aMenuList = this; + let menuLabels = []; + + charsetValues.forEach(function(item) { + let strCharset = charsetBundle.GetStringFromName( + item.toLowerCase() + ".title"); + + menuLabels.push({label: strCharset, value: item}); + }); + + menuLabels.sort(function(a, b) { + if (a.value == "UTF-8" || a.label < b.label) + return -1; + else if (b.value == "UTF-8" || a.label > b.label) + return 1; + return 0; + }); + + menuLabels.forEach(function(item) { + aMenuList.appendItem(item.label, item.value); + }); + + // Selecting appropiate menu item corresponding to preference stored + // value. + if (this.hasAttribute("preference")) { + const Ci = Components.interfaces; + + let preference = Services.prefs.getComplexValue( + this.getAttribute("preference"), Ci.nsIPrefLocalizedString); + this.value = preference.data; + } + ]]></constructor> + </implementation> + </binding> +</bindings> |