This is just some static backup of the original site, don't expect every link to work!

Changeset ab83a7


Ignore:
Timestamp:
Sep 10, 2018, 2:44:19 PM (4 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
1fb53b
Parents:
a2a993
Message:

removed old legacy solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/identityDataExtras/characterEncoding.js

    ra2a993 rab83a7  
    3232Cu.import("resource://v_identity/vI_identityDataExtras.js");
    3333Cu.import("resource://v_identity/vI_log.js");
    34 let legacy = false; // use pre TB-32 legacy code
    35 try {
    36   Cu.import("resource://gre/modules/CharsetMenu.jsm");
    37 } catch (e) {
    38   legacy = true; // pre TB-32-version, might be removed in the future
    39 }
    40 
    4134
    4235let Log = setupLogging("virtualIdentity.identityDataExtras.characterEncoding");
     
    7467    if (!this.value)
    7568      return;
    76     // pre TB-32-version, might be removed in the future --------------------------------
    77     if (legacy) {
    78       // old style
    79       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 yet
    83         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     // ----------------------------------------------------------------------------------
    9169    this._currentWindow.gMsgCompose.compFields.characterSet = this.value;
    9270    this._currentWindow.SetDocumentCharacterSet(this.value);
     
    9472
    9573  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");
    10281      }
    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");
    11784    }
    11885    this._currentWindow.document.getElementById("vI_" + this.option + "_store").doCommand();
     
    134101    // check if element is selected (list might not contain relevant entry)
    135102      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;
    145106  }
    146107}
Note: See TracChangeset for help on using the changeset viewer.