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

Ignore:
Timestamp:
Nov 3, 2014, 12:35:40 PM (8 years ago)
Author:
rene <rene@…>
Branches:
ng_0.9
Children:
7204cb
Parents:
3c9c29
Message:

code formatting (no code changes)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • modules/identityDataExtras/characterEncoding.js

    r3c9c29 r509348  
    3434let legacy = false; // use pre TB-32 legacy code
    3535try {
    36     Cu.import("resource://gre/modules/CharsetMenu.jsm");
     36  Cu.import("resource://gre/modules/CharsetMenu.jsm");
    3737} catch (e) {
    38     legacy = true; // pre TB-32-version, might be removed in the future
     38  legacy = true; // pre TB-32-version, might be removed in the future
    3939}
    40    
     40
    4141
    4242let Log = setupLogging("virtualIdentity.identityDataExtras.characterEncoding");
     
    4444function identityDataExtrasObject_characterEncoding(currentWindow) {
    4545  this.currentWindow = currentWindow;
    46   this.field  = "charEnc";                        // description of the option
    47   this.option = "storageExtras_characterEncoding";    // option string to get preference settings
     46  this.field = "charEnc"; // description of the option
     47  this.option = "storageExtras_characterEncoding"; // option string to get preference settings
    4848}
    4949identityDataExtrasObject_characterEncoding.prototype = {
    5050  __proto__: identityDataExtrasObject.prototype,
    51  
    52   get valueHtml() { return this.valueNice; },
     51
     52  get valueHtml() {
     53    return this.valueNice;
     54  },
    5355  get valueNice() {
    54       return this.value?this.currentWindow.gCharsetConvertManager
    55                   .getCharsetTitle(this.currentWindow.gCharsetConvertManager.getCharsetAlias(this.value)):"";
     56    return this.value ? this.currentWindow.gCharsetConvertManager
     57      .getCharsetTitle(this.currentWindow.gCharsetConvertManager.getCharsetAlias(this.value)) : "";
    5658  },
    5759
    5860  // pre TB-32-version, might be removed in the future --------------------------------
    59   _setMenuMark: function() {
     61  _setMenuMark: function () {
    6062    var maileditCharsetMenu = this.currentWindow.document.getElementById("maileditCharsetMenu")
    6163    var value = maileditCharsetMenu.getAttribute("unmarkedValue")
    6264    if (value) {
    63         var menuitem = this.currentWindow.document.getElementById(value);
    64         if (menuitem)
    65           menuitem.setAttribute('checked', 'true');
    66         maileditCharsetMenu.removeAttribute("unmarkedValue")
     65      var menuitem = this.currentWindow.document.getElementById(value);
     66      if (menuitem)
     67        menuitem.setAttribute('checked', 'true');
     68      maileditCharsetMenu.removeAttribute("unmarkedValue")
    6769    }
    6870  },
    6971  // ----------------------------------------------------------------------------------
    70  
    71   setValueToEnvironment_msgCompose: function() {
     72
     73  setValueToEnvironment_msgCompose: function () {
    7274    if (!this.value)
    7375      return;
    7476    // pre TB-32-version, might be removed in the future --------------------------------
    7577    if (legacy) {
    76         // old style
    77         var menuitem = this.currentWindow.document.getElementById(this.value);
    78         if (menuitem)
     78      // old style
     79      var menuitem = this.currentWindow.document.getElementById(this.value);
     80      if (menuitem)
    7981        menuitem.setAttribute('checked', 'true');
    80         else { // set menumark later if menu is not ready yet
     82      else { // set menumark later if menu is not ready yet
    8183        var maileditCharsetMenu = this.currentWindow.document.getElementById("maileditCharsetMenu")
    8284        maileditCharsetMenu.setAttribute("unmarkedValue", this.value)
    8385        var onpopupshowing = maileditCharsetMenu.getAttribute("onpopupshowing")
    8486        this.currentWindow.document.getElementById("maileditCharsetMenu").setAttribute("onpopupshowing",
    85             onpopupshowing + ";this._setMenuMark();")
    86         }
     87          onpopupshowing + ";this._setMenuMark();")
     88      }
    8789    }
    8890    // ----------------------------------------------------------------------------------
     
    9092    this.currentWindow.SetDocumentCharacterSet(this.value);
    9193  },
    92  
    93   setValueToEnvironment_dataEditor: function() {
     94
     95  setValueToEnvironment_dataEditor: function () {
    9496    // pre TB-32-version, might be removed in the future --------------------------------
    9597    if (legacy) {
    9698      this.currentWindow.CreateMenu('mailedit'); // this is part of the magic included by the xul-binding
    97         if (this.value != null) {
    98             this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem = this.currentWindow.document.getElementById(this.value);
    99             this.currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true");
    100         }
     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");
     102      }
    101103    }
    102104    // ----------------------------------------------------------------------------------
    103105    else {
    104         CharsetMenu.build(this.currentWindow.document.getElementById("charsetPopup"), false, false)
    105         if (this.value != null) {
    106             CharsetMenu.update(this.currentWindow.document.getElementById("maileditCharsetMenu"), this.value);
    107             this.currentWindow.document.getElementById("maileditCharsetMenu").setAttribute("label",CharsetMenu._getCharsetLabel(this.value));
    108             this.currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true");
    109         }
     106      CharsetMenu.build(this.currentWindow.document.getElementById("charsetPopup"), false, false)
     107      if (this.value != null) {
     108        CharsetMenu.update(this.currentWindow.document.getElementById("maileditCharsetMenu"), this.value);
     109        this.currentWindow.document.getElementById("maileditCharsetMenu").setAttribute("label", CharsetMenu._getCharsetLabel(this.value));
     110        this.currentWindow.document.getElementById("vI_" + this.option + "_store").setAttribute("checked", "true");
     111      }
    110112    }
    111113    this.currentWindow.document.getElementById("vI_" + this.option + "_store").doCommand();
    112114  },
    113  
    114   getValueFromEnvironment_msgCompose: function() {
     115
     116  getValueFromEnvironment_msgCompose: function () {
    115117    // read the value from the internal vI object, global object might not be available any more
    116118    // happens especially while storing after sending the message
     
    119121      var charsetAlias = this.currentWindow.gCharsetConvertManager.getCharsetAlias(this.value);
    120122      if (charsetAlias == "us-ascii")
    121         this.value = "ISO-8859-1";   // no menu item for "us-ascii"
     123        this.value = "ISO-8859-1"; // no menu item for "us-ascii"
    122124    }
    123125  },
    124  
    125   getValueFromEnvironment_dataEditor: function() {
     126
     127  getValueFromEnvironment_dataEditor: function () {
    126128    if (this.currentWindow.document.getElementById("vI_" + this.option + "_store").getAttribute("checked") == "true")
    127       // check if element is selected (list might not contain relevant entry)
     129    // check if element is selected (list might not contain relevant entry)
    128130      if (this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem)
    129         // pre TB-32-version, might be removed in the future --------------------------------
     131      // pre TB-32-version, might be removed in the future --------------------------------
    130132        if (legacy) {
    131             this.value = this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.id
     133          this.value = this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.id
    132134        }
    133135        // ----------------------------------------------------------------------------------
    134136        else {
    135             this.value = this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.getAttribute('charset');
    136         }
    137     else
     137          this.value = this.currentWindow.document.getElementById("maileditCharsetMenu").selectedItem.getAttribute('charset');
     138        } else
    138139      this.value = null;
    139140  }
Note: See TracChangeset for help on using the changeset viewer.