Changeset e21b59
- Timestamp:
- Apr 19, 2008, 3:03:17 PM (14 years ago)
- Branches:
- master
- Children:
- aa47dc
- Parents:
- 4dfe1d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_storage.js
r4dfe1d re21b59 40 40 email : null, 41 41 fullName : null, 42 id _key: null,43 smtp _key: null,42 id : null, 43 smtp : null, 44 44 extras : null, 45 45 __keyTranslator : null, 46 46 __combineStrings : function(stringA, stringB) { 47 var A = stringA.replace(/^\s+|\s+$/g,"");48 var B = stringB.replace(/^\s+|\s+$/g,"");47 var A = (stringA)?stringA.replace(/^\s+|\s+$/g,""):""; 48 var B = (stringB)?stringB.replace(/^\s+|\s+$/g,""):""; 49 49 if (!A) return B; 50 50 if (!B) return A; … … 58 58 return senderName + " (" + 59 59 this.__combineStrings(this.__combineStrings(idName, smtpName), extras) + ")" 60 }, 61 __equalCurrentSMTP : function() { 62 var smtp_key = vI_smtpSelector.elements.Obj_SMTPServerList.selectedItem.getAttribute('key'); 63 return (!this.__keyTranslator.getSMTP(this.smtp) && !smtp_key || 64 smtp_key == this.smtp) 65 }, 66 __equalCurrentID : function() { 67 var id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("oldvalue"); 68 if (!id_key) id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value"); 69 return ((!this.__keyTranslator.getID(this.id) && (id_key == gAccountManager.defaultAccount.defaultIdentity.key)) || 70 id_key == this.id) 71 }, 72 equalsCurrentIdentity : function() { 73 var curAddress = vI_helper.getAddress(); 74 var curExtras = new vI_storageExtras(); 75 curExtras.readValues(); // initialize with current MsgComposeDialog Values 76 77 var equal = ( (this.__equalCurrentID()) && 78 (this.__equalCurrentSMTP()) && 79 (curAddress.email == this.email) && 80 (curAddress.name == this.fullName) && 81 (this.extras.equal(curExtras)) ) 82 if (equal) vI_notificationBar.dump("## identityData: Identities are the same.\n") 83 else vI_notificationBar.dump("## identityData: Identities differ.\n") 84 return equal; 60 85 } 61 86 } … … 150 175 // see https://bugzilla.mozilla.org/show_bug.cgi?id=355367 151 176 // same seems to happen with the ondragdrop event 152 awGetInputElement(1).setAttribute("onblur", 153 "window.setTimeout(vI_storage.awOnBlur, 250, this.parentNode.parentNode.parentNode);") 154 awGetPopupElement(1).setAttribute("oncommand", 155 "window.setTimeout(vI_storage.awPopupOnCommand, 250, this);") 177 for (var row = 1; row <= top.MAX_RECIPIENTS; row ++) { 178 var input = awGetInputElement(row); 179 if (input) { 180 var oldBlur = input.getAttribute("onblur") 181 input.setAttribute("onblur", (oldBlur?oldBlur+"; ":"") + 182 "window.setTimeout(vI_storage.awOnBlur, 250, this.parentNode.parentNode.parentNode);") 183 } 184 var popup = awGetPopupElement(row); 185 if (popup) { 186 var oldCommand = popup.getAttribute("oncommand") 187 popup.setAttribute("oncommand", (oldCommand?oldCommand+"; ":"") + 188 "window.setTimeout(vI_storage.awPopupOnCommand, 250, this);") 189 } 190 } 156 191 } 157 192 vI_storage.original_functions.awSetInputAndPopupValue = awSetInputAndPopupValue; … … 217 252 } 218 253 // only update fields if new Identity is different than old one. 219 else if (! vI_storage.__equalsCurrentIdentity(storageData)) {254 else if (!storageData.equalsCurrentIdentity()) { 220 255 // add Identity to dropdown-menu 221 256 vI_msgIdentityClone.addIdentityToCloneMenu( … … 245 280 else return { recDesc : recipient, recType : "email" } 246 281 }, 247 248 __equalsCurrentIdentity : function(storageData) { 249 var curAddress = vI_helper.getAddress(); 250 var id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("oldvalue"); 251 if (!id_key) id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value"); 252 var smtp_key = vI_smtpSelector.elements.Obj_SMTPServerList.selectedItem.getAttribute('key'); 253 var extras = new vI_storageExtras(); 254 extras.readValues(); // initialize with current MsgComposeDialog Values 255 256 var equal = ( (id_key == storageData.id) && 257 (smtp_key == storageData.smtp) && 258 (curAddress.email == storageData.email) && 259 (curAddress.name == storageData.fullName) && 260 (extras.equal(storageData.extras)) ) 261 if (equal) vI_notificationBar.dump("## vI_storage: Identities are the same.\n") 262 else vI_notificationBar.dump("## vI_storage: Identities differ.\n") 263 return equal; 264 }, 265 282 266 283 storeVIdentityToAllRecipients : function(msgType) { 267 284 if (msgType != nsIMsgCompDeliverMode.Now) return; … … 354 371 var storageData = vI_rdfDatasource.readVIdentityFromRDF(recipient.recDesc, recipient.recType); 355 372 if (storageData) { 356 if (! vI_storage.__equalsCurrentIdentity(storageData) &&373 if (!storageData.equalsCurrentIdentity(storageData) && 357 374 !dontUpdateMultipleNoEqual) { 358 375 var warning = vI_storage.__getOverwriteStorageWarning(recipient, storageData);
Note: See TracChangeset
for help on using the changeset viewer.