Changeset ab83a7
- Timestamp:
- Sep 10, 2018, 2:44:19 PM (4 years ago)
- Branches:
- ng_0.9
- Children:
- 1fb53b
- Parents:
- a2a993
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
modules/identityDataExtras/characterEncoding.js
ra2a993 rab83a7 32 32 Cu.import("resource://v_identity/vI_identityDataExtras.js"); 33 33 Cu.import("resource://v_identity/vI_log.js"); 34 let legacy = false; // use pre TB-32 legacy code35 try {36 Cu.import("resource://gre/modules/CharsetMenu.jsm");37 } catch (e) {38 legacy = true; // pre TB-32-version, might be removed in the future39 }40 41 34 42 35 let Log = setupLogging("virtualIdentity.identityDataExtras.characterEncoding"); … … 74 67 if (!this.value) 75 68 return; 76 // pre TB-32-version, might be removed in the future --------------------------------77 if (legacy) {78 // old style79 var menuitem = this._currentWindow.document.getElementById(this.value);80 if (menuitem)81 menuitem.setAttribute('checked', 'true');82 else { // set menumark later if menu is not ready yet83 var maileditCharsetMenu = this._currentWindow.document.getElementById("maileditCharsetMenu")84 maileditCharsetMenu.setAttribute("unmarkedValue", this.value)85 var onpopupshowing = maileditCharsetMenu.getAttribute("onpopupshowing")86 this._currentWindow.document.getElementById("maileditCharsetMenu").setAttribute("onpopupshowing",87 onpopupshowing + ";this._setMenuMark();")88 }89 }90 // ----------------------------------------------------------------------------------91 69 this._currentWindow.gMsgCompose.compFields.characterSet = this.value; 92 70 this._currentWindow.SetDocumentCharacterSet(this.value); … … 94 72 95 73 setValueToEnvironment_dataEditor: function () { 96 // pre TB-32-version, might be removed in the future -------------------------------- 97 if (legacy) { 98 this._currentWindow.CreateMenu('mailedit'); // this is part of the magic included by the xul-binding 99 if (this.value != null) { 100 this._currentWindow.document.getElementById("maileditCharsetMenu").selectedItem = this._currentWindow.document.getElementById(this.value); 101 this._currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true"); 74 CharsetMenu.build(this._currentWindow.document.getElementById("charsetPopup"), true, false) 75 if (this.value != null) { 76 let menu = this._currentWindow.document.getElementById("maileditCharsetMenu"); 77 let menuitem = menu.getElementsByAttribute("charset", this.value).item(0); 78 if (menuitem) { 79 menu.selectedItem = menuitem; 80 menuitem.setAttribute("checked", "true"); 102 81 } 103 } 104 // ---------------------------------------------------------------------------------- 105 else { 106 CharsetMenu.build(this._currentWindow.document.getElementById("charsetPopup"), true, false) 107 if (this.value != null) { 108 let menu = this._currentWindow.document.getElementById("maileditCharsetMenu"); 109 let menuitem = menu.getElementsByAttribute("charset", this.value).item(0); 110 if (menuitem) { 111 menu.selectedItem = menuitem; 112 menuitem.setAttribute("checked", "true"); 113 } 114 menu.setAttribute("label", CharsetMenu._getCharsetLabel(this.value)); 115 this._currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true"); 116 } 82 menu.setAttribute("label", CharsetMenu._getCharsetLabel(this.value)); 83 this._currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true"); 117 84 } 118 85 this._currentWindow.document.getElementById("vI_" + this.option + "_store").doCommand(); … … 134 101 // check if element is selected (list might not contain relevant entry) 135 102 if (this._currentWindow.document.getElementById("maileditCharsetMenu").selectedItem) 136 // pre TB-32-version, might be removed in the future -------------------------------- 137 if (legacy) { 138 this.value = this._currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.id 139 } 140 // ---------------------------------------------------------------------------------- 141 else { 142 this.value = this._currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.getAttribute('charset'); 143 } else 144 this.value = null; 103 this.value = this._currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.getAttribute('charset'); 104 else 105 this.value = null; 145 106 } 146 107 }
Note: See TracChangeset
for help on using the changeset viewer.