Changeset 49dcdd
- Timestamp:
- Aug 20, 2008, 7:13:41 PM (12 years ago)
- Branches:
- master
- Children:
- f4caf5
- Parents:
- e11e2c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_storage.js
re11e2c r49dcdd 153 153 }, 154 154 155 equalsCurrentIdentity : function( ) {155 equalsCurrentIdentity : function(getCompareMatrix) { 156 156 var compareIdentityData = this.__getCurrentIdentityData(); 157 158 return this.__equals(compareIdentityData, null); 157 var retValue = { equal : null, compareMatrix : null }; 158 retValue.equal = this.__equals(compareIdentityData, null); 159 if (getCompareMatrix && !retValue.equal) // generate CompareMatrix only if non-equal 160 retValue.compareMatrix = this.getCompareMatrix(); 161 return retValue; 159 162 }, 160 163 … … 277 280 // to prevent ugly double dialogs and time-consuming double-checks 278 281 279 promptService : Components.classes["@mozilla.org/embedcomp/prompt-service;1"]280 .getService(Components.interfaces.nsIPromptService),281 282 282 rdfService : Components.classes["@mozilla.org/rdf/rdf-service;1"] 283 283 .getService(Components.interfaces.nsIRDFService), … … 386 386 vI_storage.firstUsedInputElement != inputElement) { 387 387 vI_notificationBar.dump("## vI_storage: retrieved Identity for other recipient-field before. ignoring\n"); 388 if (!storageData.equalsCurrentIdentity( )) {388 if (!storageData.equalsCurrentIdentity(false).equal) { 389 389 // add Identity to dropdown-menu 390 390 vI_msgIdentityClone.addIdentityToCloneMenu(storageData) … … 394 394 } 395 395 // only update fields if new Identity is different than old one. 396 else if (!storageData.equalsCurrentIdentity()) { 397 // add Identity to dropdown-menu 398 var menuItem = vI_msgIdentityClone.addIdentityToCloneMenu(storageData) 399 var warning = vI_storage.__getWarning("replaceVIdentity", recipient, storageData.getCompareMatrix()); 400 401 if ( // vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("timeStamp") || 402 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value") != "vid" || 403 !vI.preferences.getBoolPref("storage_warn_vI_replace") || 404 vI_storage.__askWarning(warning)) { 405 vI_msgIdentityClone.setMenuToMenuItem(menuItem) 406 /* vI_msgIdentityClone.setMenuToIdentity(storageData.id); 407 vI_smtpSelector.setMenuToKey(storageData.smtp); 408 storageData.extras.setValues();*/ 409 /* if (vI_msgIdentityClone.setIdentity( 410 vI_helper.combineNames(storageData.fullName, storageData.email), null))*/ 411 if (vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value") == "vid") 412 vI_notificationBar.setNote(vI.elements.strings.getString("vident.smartIdentity.vIStorageUsage") + ".", 413 "storage_notification"); 396 else { 397 var compResult = storageData.equalsCurrentIdentity(true); 398 if (!compResult.equal) { 399 // add Identity to dropdown-menu 400 var menuItem = vI_msgIdentityClone.addIdentityToCloneMenu(storageData) 401 var warning = vI_storage.__getWarning("replaceVIdentity", recipient, compResult.compareMatrix); 402 403 if ( // vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("timeStamp") || 404 vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value") != "vid" || 405 !vI.preferences.getBoolPref("storage_warn_vI_replace") || 406 vI_storage.__askWarning(warning)) { 407 vI_msgIdentityClone.setMenuToMenuItem(menuItem) 408 if (vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.getAttribute("value") == "vid") 409 vI_notificationBar.setNote(vI.elements.strings.getString("vident.smartIdentity.vIStorageUsage") + ".", 410 "storage_notification"); 411 } 414 412 } 415 413 } … … 454 452 if (recipientType == "addr_reply" || recipientType == "addr_followup" || 455 453 vI_storage.__isDoBcc(row) || awGetInputElement(row).value.match(/^\s*$/) ) continue; 456 // by using a Timeout the possible prompt stopps the MessageSending 457 // this is required, else lavascript context might be gone 454 // by using a setTimeout the possible prompt doesn't stopp the MessageSending 458 455 window.setTimeout(vI_storage.__updateStorageFromVIdentity, 0, awGetInputElement(row).value, recipientType) 459 456 } … … 461 458 }, 462 459 463 __getVIdentityString : function() {464 var old_address = vI_helper.getAddress();465 var id_key = vI_msgIdentityClone.elements.Obj_MsgIdentity_clone.base_id_key;466 var smtp_key = vI_smtpSelector.elements.Obj_SMTPServerList.selectedItem.getAttribute('key');467 var extras = new vI_storageExtras();468 extras.readValues();469 var localIdentityData = new identityData(old_address.email, old_address.name,470 id_key, smtp_key, extras)471 return localIdentityData.identityDescription();472 },473 474 460 __getWarning : function(warningCase, recipient, compareMatrix) { 475 461 var warning = { title: null, recLabel : null, recipient : null, warning : null, css: null, query : null }; 476 462 warning.title = vI.elements.strings.getString("vident." + warningCase + ".title") 477 463 warning.recLabel = vI.elements.strings.getString("vident." + warningCase + ".recipient") + " (" + recipient.recType + "):" 478 warning.recipient = recipient.recDesc .replace(/>/g,">").replace(/</g,"<")464 warning.recipient = recipient.recDesc; 479 465 warning.warning = 480 466 "<table class='" + warningCase + "'><thead><tr><th class='col1'/>" + … … 505 491 var storageData = vI_rdfDatasource.readVIdentityFromRDF(recipient.recDesc, recipient.recType); 506 492 if (storageData) { 507 if (!storageData.equalsCurrentIdentity() &&508 509 var warning = vI_storage.__getWarning("updateStorage", recipient, storageData.getCompareMatrix());493 var compResult = storageData.equalsCurrentIdentity(true); 494 if (!compResult.equal && !dontUpdateMultipleNoEqual) { 495 var warning = vI_storage.__getWarning("updateStorage", recipient, compResult.compareMatrix); 510 496 vI_notificationBar.dump("## vI_storage: " + warning + ".\n") 511 497 if (!vI.preferences.getBoolPref("storage_warn_update") || 512 498 vI_storage.__askWarning(warning)) 513 // vI_storage.promptService.confirm(window,"Warning",warning))514 499 vI_rdfDatasource.updateRDFFromVIdentity(recipient.recDesc, recipient.recType); 515 500 } … … 531 516 addrbook.QueryInterface(Components.interfaces.nsIAbDirectory); 532 517 var searchUri = (addrbook.directoryProperties?addrbook.directoryProperties.URI:addrbook.URI) + queryString; 533 //~ vI_notificationBar.dump("## vI_storage: searchUri '" + searchUri + "'\n");534 //~ var directory = vI_storage.rdfService.GetResource(searchUri).QueryInterface(Components.interfaces.nsIAbDirectory);535 518 536 519 // just try the following steps, they might fail if addressbook wasn't configured the right way … … 549 532 while (keepGoing == 1) { 550 533 currentCard = childCards.currentItem(); 551 //~ while (directory.childNodes && directory.childNodes.hasMoreElements()) {552 //~ currentCard = directory.childNodes.getNext();553 534 currentCard.QueryInterface(Components.interfaces.nsIAbCard); 554 //~ vI_notificationBar.dump("## vI_storage: checking '" + currentCard.displayName + "'.\n")555 535 returnVar = callFunction(addrbook, currentCard, returnVar); 556 536 try { childCards.next(); } catch (ex) { keepGoing = 0; }
Note: See TracChangeset
for help on using the changeset viewer.