Changeset 49dcdd


Ignore:
Timestamp:
Aug 20, 2008, 7:13:41 PM (13 years ago)
Author:
rene <rene@…>
Branches:
master
Children:
f4caf5
Parents:
e11e2c
Message:

compareMatrix was not the required one, so give it back on comparison
removed obsolete lines

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chrome/content/v_identity/vI_storage.js

    re11e2c r49dcdd  
    153153    },
    154154
    155     equalsCurrentIdentity : function() {
     155    equalsCurrentIdentity : function(getCompareMatrix) {
    156156        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;
    159162    },
    160163
     
    277280                // to prevent ugly double dialogs and time-consuming double-checks
    278281   
    279     promptService : Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
    280             .getService(Components.interfaces.nsIPromptService),
    281            
    282282    rdfService : Components.classes["@mozilla.org/rdf/rdf-service;1"]
    283283            .getService(Components.interfaces.nsIRDFService),
     
    386386            vI_storage.firstUsedInputElement != inputElement) {
    387387            vI_notificationBar.dump("## vI_storage: retrieved Identity for other recipient-field before. ignoring\n");
    388             if (!storageData.equalsCurrentIdentity()) {
     388            if (!storageData.equalsCurrentIdentity(false).equal) {
    389389                    // add Identity to dropdown-menu
    390390                    vI_msgIdentityClone.addIdentityToCloneMenu(storageData)
     
    394394        }
    395395        // 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                }
    414412            }
    415413        }
     
    454452            if (recipientType == "addr_reply" || recipientType == "addr_followup" ||
    455453                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
    458455            window.setTimeout(vI_storage.__updateStorageFromVIdentity, 0, awGetInputElement(row).value, recipientType)
    459456        }
     
    461458    },
    462459   
    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 
    474460    __getWarning : function(warningCase, recipient, compareMatrix) {
    475461        var warning = { title: null, recLabel : null, recipient : null, warning : null, css: null, query : null };
    476462        warning.title = vI.elements.strings.getString("vident." + warningCase + ".title")
    477463        warning.recLabel = vI.elements.strings.getString("vident." + warningCase + ".recipient") +  " (" + recipient.recType + "):"
    478         warning.recipient = recipient.recDesc.replace(/>/g,"&gt;").replace(/</g,"&lt;")
     464        warning.recipient = recipient.recDesc;
    479465        warning.warning =
    480466            "<table class='" + warningCase + "'><thead><tr><th class='col1'/>" +
     
    505491        var storageData = vI_rdfDatasource.readVIdentityFromRDF(recipient.recDesc, recipient.recType);
    506492        if (storageData) {
    507             if (!storageData.equalsCurrentIdentity() &&
    508                 !dontUpdateMultipleNoEqual) {
    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);
    510496                vI_notificationBar.dump("## vI_storage: " + warning + ".\n")
    511497                if (!vI.preferences.getBoolPref("storage_warn_update") ||
    512498                        vI_storage.__askWarning(warning))
    513 //                      vI_storage.promptService.confirm(window,"Warning",warning))
    514499                vI_rdfDatasource.updateRDFFromVIdentity(recipient.recDesc, recipient.recType);
    515500            }
     
    531516            addrbook.QueryInterface(Components.interfaces.nsIAbDirectory);
    532517            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);
    535518           
    536519            // just try the following steps, they might fail if addressbook wasn't configured the right way
     
    549532            while (keepGoing == 1) {
    550533                currentCard = childCards.currentItem();
    551             //~ while (directory.childNodes && directory.childNodes.hasMoreElements()) {
    552                 //~ currentCard = directory.childNodes.getNext();
    553534                currentCard.QueryInterface(Components.interfaces.nsIAbCard);
    554                 //~ vI_notificationBar.dump("## vI_storage:             checking '" + currentCard.displayName + "'.\n")
    555535                returnVar = callFunction(addrbook, currentCard, returnVar);
    556536                try { childCards.next(); } catch (ex) { keepGoing = 0; }
Note: See TracChangeset for help on using the changeset viewer.