Changeset c3feaa for chrome/content/v_identity/vI_storageExtras.js
- Timestamp:
- Aug 16, 2011, 10:12:23 PM (11 years ago)
- Branches:
- ng_0.8, ng_0.9
- Children:
- 190674
- Parents:
- 92fd25
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_storageExtras.js
r92fd25 rc3feaa 22 22 * ***** END LICENSE BLOCK ***** */ 23 23 24 function vI_storageExtras_adapt(sourceId, targetId) { 24 virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) { 25 function storageExtras_adapt(sourceId, targetId) { 25 26 var checked = document.getElementById(sourceId).getAttribute("checked"); 26 27 if (targetId) var target = document.getElementById(targetId) … … 30 31 } 31 32 32 var vI_storageExtrasHelper = {33 var storageExtrasHelper = { 33 34 seamonkey_old : null, 34 35 … … 38 39 39 40 hideUnusedEditorFields : function() { 40 var storageExtras = new vI_storageExtras();41 var localStorageExtras = new storageExtras(); 41 42 var allHidden = true; 42 43 var hide = (document.getElementById("vI_storageExtras_hideUnusedEditorFields").getAttribute("checked") == "true") 43 for( var i = 0; i < storageExtras.extras.length; i++ ) {44 var hidden = hide && ! vI_storageExtrasHelper.preferences.getBoolPref(storageExtras.extras[i].option)44 for( var i = 0; i < localStorageExtras.extras.length; i++ ) { 45 var hidden = hide && !storageExtrasHelper.preferences.getBoolPref(localStorageExtras.extras[i].option) 45 46 if (!hidden) allHidden = false 46 document.getElementById("vI_" + storageExtras.extras[i].option).setAttribute("hidden", hidden)47 document.getElementById("vI_" + storageExtras.extras[i].option + "_store").setAttribute("hidden", hidden)47 document.getElementById("vI_" + localStorageExtras.extras[i].option).setAttribute("hidden", hidden) 48 document.getElementById("vI_" + localStorageExtras.extras[i].option + "_store").setAttribute("hidden", hidden) 48 49 } 49 50 document.getElementById("storeValue").setAttribute("hidden", allHidden) … … 53 54 } 54 55 55 function vI_storageExtras(rdfDatasource, resource) {56 // function vI_storageExtras_checkbox(field, option, composeDialogElementID, updateFunction, identityValue) {56 function storageExtras(rdfDatasource, resource) { 57 // function storageExtras_checkbox(field, option, composeDialogElementID, updateFunction, identityValue) { 57 58 this.extras = [ 58 new vI_storageExtras_checkbox(59 new storageExtras_checkbox( 59 60 "reciept", "storageExtras_returnReciept", "returnReceiptMenu", null, function(identity) { return identity.requestReturnReceipt; }), 60 new vI_storageExtras_checkbox(61 new storageExtras_checkbox( 61 62 "fcc", "storageExtras_fcc", "fcc_switch", null, function(identity) { return identity.doFcc; }), 62 new vI_storageExtras_characterEncoding(),63 new vI_storageExtras_msgFormat(),64 new vI_storageExtras_checkbox(63 new storageExtras_characterEncoding(), 64 new storageExtras_msgFormat(), 65 new storageExtras_checkbox( 65 66 "sMimeEnc", "storageExtras_sMime_messageEncryption", "menu_securityEncryptRequire1", 66 67 function() { return ((typeof(setSecuritySettings)=='function')?setSecuritySettings(1):null) }, 67 68 function(identity) { return (identity.getIntAttribute('encryptionpolicy') == 2) }), 68 new vI_storageExtras_checkbox(69 new storageExtras_checkbox( 69 70 "sMimeSig", "storageExtras_sMime_messageSignature", "menu_securitySign1", 70 71 function() { return ((typeof(setSecuritySettings)=='function')?setSecuritySettings(1):null) }, 71 72 function(identity) { return (identity.getBoolAttribute('sign_mail')) }), 72 new vI_storageExtras_checkbox(73 new storageExtras_checkbox( 73 74 "PGPEnc", "storageExtras_openPGP_messageEncryption", "enigmail_encrypted_send", 74 75 function() { return ((typeof(enigSetMenuSettings)=='function')?enigSetMenuSettings(''):null) }, 75 76 function(identity) { return (identity.getIntAttribute('defaultEncryptionPolicy') > 0) }), 76 new vI_storageExtras_checkbox(77 new storageExtras_checkbox( 77 78 "PGPSig", "storageExtras_openPGP_messageSignature", "enigmail_signed_send", 78 79 function() { return ((typeof(enigSetMenuSettings)=='function')?enigSetMenuSettings(''):null) }, 79 80 function(identity) { return ((identity.getIntAttribute('defaultEncryptionPolicy') > 0)?identity.getBoolAttribute('pgpSignEncrypted'):identity.getBoolAttribute('pgpSignPlain')) }), 80 new vI_storageExtras_checkbox(81 new storageExtras_checkbox( 81 82 "PGPMIME", "storageExtras_openPGP_PGPMIME", "enigmail_sendPGPMime", 82 83 function() { return ((typeof(enigSetMenuSettings)=='function')?enigSetMenuSettings(''):null) }, … … 86 87 } 87 88 88 vI_storageExtras.prototype = {89 storageExtras.prototype = { 89 90 loopForRDF : function(rdfDatasource, resource, type) { 90 91 for( var i = 0; i < this.extras.length; i++ ) { 91 // if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: loopForRDF " + rdfDatasource + "\n");92 // if (vI.notificationBar) vI.notificationBar.dump("## vI.rdfDatasource: loopForRDF " + rdfDatasource + "\n"); 92 93 // only if pref set and feature(element available) or for dataEditor 93 94 if (typeof(gMsgCompose) == "undefined" || !gMsgCompose || this.extras[i].active) { … … 103 104 // just give a duplicate of the current storageExtras, else we will work with pointers 104 105 getDuplicate : function() { 105 var newExtras = new vI_storageExtras();106 var newExtras = new storageExtras(); 106 107 for( var i = 0; i < this.extras.length; i++ ) { 107 108 newExtras.extras[i].value = this.extras[i].value; … … 166 167 for( var i = 0; i < this.extras.length; i++ ) { 167 168 if (this.extras[i].active) this.extras[i].readIdentityValue(identity) 168 // vI _notificationBar.dump("## vI_storageExtras readIdentityValues "+ this.extras[i].field + "=" + this.extras[i].value + "\n");169 // vI.notificationBar.dump("## storageExtras readIdentityValues "+ this.extras[i].field + "=" + this.extras[i].value + "\n"); 169 170 } 170 171 }, … … 173 174 for( var i = 0; i < this.extras.length; i++ ) { 174 175 if (this.extras[i].active) this.extras[i].setValue() 175 // vI _notificationBar.dump("## vI_storageExtras setValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");176 // vI.notificationBar.dump("## storageExtras setValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n"); 176 177 } 177 178 }, 178 179 readValues : function() { 179 180 for( var i = 0; i < this.extras.length; i++ ) { 180 // vI _notificationBar.dump("## vI_storageExtras preparing readValue "+ this.extras[i].field +"\n");181 // vI.notificationBar.dump("## storageExtras preparing readValue "+ this.extras[i].field +"\n"); 181 182 if (this.extras[i].active) this.extras[i].readValue() 182 // vI _notificationBar.dump("## vI_storageExtras readValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n");183 // vI.notificationBar.dump("## storageExtras readValue "+ this.extras[i].field + "=" + this.extras[i].value + "\n"); 183 184 } 184 185 }, … … 189 190 for( var i = 0; i < this.extras.length; i++ ) { 190 191 this.extras[i].readEditorValue(); 191 // vI _notificationBar.dump("## vI_storageExtras readValue " + this.extras[i].field + "=" + this.extras[i].value + "\n");192 } 193 }, 194 195 // add value's to the pref object, required for rdfDataTree 192 // vI.notificationBar.dump("## storageExtras readValue " + this.extras[i].field + "=" + this.extras[i].value + "\n"); 193 } 194 }, 195 196 // add value's to the pref object, required for rdfDataTreeCollection 196 197 addPrefs : function(pref) { 197 198 for( var i = 0; i < this.extras.length; i++ ) … … 200 201 } 201 202 202 function vI_storageExtras_characterEncoding_setMenuMark() {203 function storageExtras_characterEncoding_setMenuMark() { 203 204 var maileditCharsetMenu = document.getElementById("maileditCharsetMenu") 204 205 var value = maileditCharsetMenu.getAttribute("unmarkedValue") … … 209 210 } 210 211 } 211 function vI_storageExtras_characterEncoding() {212 this.active = vI_storageExtrasHelper.preferences.getBoolPref("storage") &&213 vI_storageExtrasHelper.preferences.getBoolPref(this.option)212 function storageExtras_characterEncoding() { 213 this.active = storageExtrasHelper.preferences.getBoolPref("storage") && 214 storageExtrasHelper.preferences.getBoolPref(this.option) 214 215 this.comp = { compareValue : null, equal : null } 215 216 } 216 vI_storageExtras_characterEncoding.prototype = {217 storageExtras_characterEncoding.prototype = { 217 218 active : null, 218 219 value : null, … … 246 247 var onpopupshowing = maileditCharsetMenu.getAttribute("onpopupshowing") 247 248 document.getElementById("maileditCharsetMenu").setAttribute("onpopupshowing", 248 onpopupshowing + "; vI_storageExtras_characterEncoding_setMenuMark();")249 onpopupshowing + ";storageExtras_characterEncoding_setMenuMark();") 249 250 } 250 251 gMsgCompose.compFields.characterSet = this.value; … … 254 255 // read the value from the internal vI object, global object might not be available any more 255 256 // happens especially while storing after sending the message 256 this.value = vI _main.gMsgCompose.compFields.characterSet;257 this.value = vI.main.gMsgCompose.compFields.characterSet; 257 258 if (gCharsetConvertManager) { 258 259 var charsetAlias = gCharsetConvertManager.getCharsetAlias(this.value); … … 281 282 } 282 283 283 function vI_storageExtras_msgFormat() {284 this.active = vI_storageExtrasHelper.preferences.getBoolPref("storage") &&285 vI_storageExtrasHelper.preferences.getBoolPref(this.option)284 function storageExtras_msgFormat() { 285 this.active = storageExtrasHelper.preferences.getBoolPref("storage") && 286 storageExtrasHelper.preferences.getBoolPref(this.option) 286 287 this.comp = { value : null, compareValue : null, equal : null } 287 288 } 288 vI_storageExtras_msgFormat.prototype = {289 storageExtras_msgFormat.prototype = { 289 290 active : null, 290 291 value : null, … … 338 339 } 339 340 340 function vI_storageExtras_sMime_messageEncryption() {341 this.active = vI_storageExtrasHelper.preferences.getBoolPref("storage") &&342 vI_storageExtrasHelper.preferences.getBoolPref(this.option)341 function storageExtras_sMime_messageEncryption() { 342 this.active = storageExtrasHelper.preferences.getBoolPref("storage") && 343 storageExtrasHelper.preferences.getBoolPref(this.option) 343 344 this.comp = { value : null, compareValue : null, equal : null } 344 345 } 345 vI_storageExtras_sMime_messageEncryption.prototype = {346 storageExtras_sMime_messageEncryption.prototype = { 346 347 active : null, 347 348 value : null, … … 375 376 // function to set or read the value from/to the MessageCompose Dialog 376 377 setValue : function() { 377 vI _notificationBar.dump("## storageExtras_sMime_messageEncryption \n");378 vI.notificationBar.dump("## storageExtras_sMime_messageEncryption \n"); 378 379 var doEncryptElem = document.getElementById("menu_securityEncryptRequire1"); 379 380 if (this.value == null) return; … … 405 406 406 407 // a general checkbox for extra options. Has to provide some additional information 407 function vI_storageExtras_checkbox(field, option, composeDialogElementID, updateFunction, identityValue) {408 function storageExtras_checkbox(field, option, composeDialogElementID, updateFunction, identityValue) { 408 409 this.field = field; // description of the option 409 410 this.option = option; // option string to get preference settings … … 411 412 this.updateFunction = updateFunction; 412 413 this.valueFromIdentityFunction = identityValue; 413 this.active = vI_storageExtrasHelper.preferences.getBoolPref("storage") &&414 vI_storageExtrasHelper.preferences.getBoolPref(this.option)414 this.active = storageExtrasHelper.preferences.getBoolPref("storage") && 415 storageExtrasHelper.preferences.getBoolPref(this.option) 415 416 // elements are never available in DataTree, so leave this out. 416 417 // && document.getElementById(this.composeDialogElementID); 417 418 this.comp = { compareValue : null, equal : null } 418 419 } 419 vI_storageExtras_checkbox.prototype = {420 storageExtras_checkbox.prototype = { 420 421 active : null, 421 422 value : null, … … 457 458 458 459 if ((element.getAttribute("checked") == "true") != (this.value == "true")) { 459 vI _notificationBar.dump("## vI_storageExtras change "+ this.field + " to " + this.value + " with doCommand\n");460 vI.notificationBar.dump("## storageExtras change "+ this.field + " to " + this.value + " with doCommand\n"); 460 461 element.doCommand(); 461 462 } … … 483 484 } 484 485 } 486 487 vI.storageExtras = storageExtras; 488 vI.storageExtrasHelper = storageExtrasHelper; 489 vI.storageExtras_adapt = storageExtras_adapt; 490 }});
Note: See TracChangeset
for help on using the changeset viewer.