summaryrefslogtreecommitdiffstats
path: root/mailnews/base/content/charsetList.xml
diff options
context:
space:
mode:
Diffstat (limited to 'mailnews/base/content/charsetList.xml')
-rw-r--r--mailnews/base/content/charsetList.xml69
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>