Changeset 3f1921


Ignore:
Timestamp:
Oct 2, 2009, 1:20:52 PM (10 years ago)
Author:
rene <rene@…>
Branches:
lite_0.1, multiEdit, ng_0.6, ng_0.6_help, ng_0.8, ng_0.9
Children:
3d0a0f
Parents:
77bb12
Message:

bugfix: updateStorageFromVIdentity ignored storage_dont_update_multiple and storage_warn_update

File:
1 edited

Legend:

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

    r77bb12 r3f1921  
    254254        var dontUpdateMultipleNoEqual = (vI.preferences.getBoolPref("storage_dont_update_multiple") &&
    255255                    vI_storage.multipleRecipients)
    256        
     256        vI_notificationBar.dump("## vI_storage: __updateStorageFromVIdentity dontUpdateMultipleNoEqual='" + dontUpdateMultipleNoEqual + "'\n")
    257257        recipient = vI_storage.__getDescriptionAndType(recipient, recipientType);
    258258
    259         var matchResults = { storageData : {} };
    260         matchResults.storageData[0] = vI_rdfDatasource.readVIdentityFromRDF(recipient.recDesc, recipient.recType),
    261         matchResults.storageData[1] = vI_rdfDatasource.findMatchingFilter(recipient.recDesc);
    262 
    263         for (var i = 0; i <= 1; i++) {
    264             if (matchResults.storageData[i]) {
    265                 var compResult = matchResults.storageData[i].equalsCurrentIdentity(true);
    266                 if (compResult.equal) return true;
    267                 else if (!dontUpdateMultipleNoEqual) {
    268                     var warning = vI_storage.__getWarning("updateStorage", recipient, compResult.compareMatrix);
    269                     vI_notificationBar.dump("## vI_storage: " + warning + ".\n")
    270                     var doUpdate = "accept";
    271                     if (i == 0 && vI.preferences.getBoolPref("storage_warn_update")) doUpdate = vI_storage.__askWarning(warning);
    272                     switch(doUpdate) {
    273                         case "abort":
    274                             return false;
    275                         case "accept":
    276                             vI_rdfDatasource.updateRDFFromVIdentity(recipient.recDesc, recipient.recType);
    277                             return true;
    278                     }
    279                 }
    280             }
    281         }
    282         vI_rdfDatasource.updateRDFFromVIdentity(recipient.recDesc, recipient.recType);
     259        var storageDataByType = vI_rdfDatasource.readVIdentityFromRDF(recipient.recDesc, recipient.recType);
     260        var storageDataByFilter = vI_rdfDatasource.findMatchingFilter(recipient.recDesc);
     261       
     262        // update (storing) of data by type is required if there is
     263        // no data stored by type (or different data stored) and no equal filter found
     264        var storageDataByTypeCompResult = storageDataByType?storageDataByType.equalsCurrentIdentity(true):null;
     265        var storageDataByTypeEqual = (storageDataByType && storageDataByTypeCompResult.equal);
     266        var storageDataByFilterEqual = (storageDataByFilter && storageDataByFilter.equalsCurrentIdentity(false).equal);
     267       
     268        var doUpdate = "";
     269        if (    (!storageDataByType && !storageDataByFilterEqual) ||
     270            (!storageDataByTypeEqual && !storageDataByFilterEqual && !dontUpdateMultipleNoEqual) ) {
     271            vI_notificationBar.dump("## vI_storage: __updateStorageFromVIdentity updating\n")
     272            var doUpdate = "accept";
     273            if (storageDataByType && !storageDataByTypeEqual && vI.preferences.getBoolPref("storage_warn_update")) {
     274                vI_notificationBar.dump("## vI_storage: __updateStorageFromVIdentity overwrite warning\n");
     275                doUpdate = vI_storage.__askWarning(vI_storage.__getWarning("updateStorage", recipient, storageDataByTypeCompResult.compareMatrix));
     276                if (doUpdate == "abort") return false;
     277            }
     278        }
     279        if (doUpdate == "accept") vI_rdfDatasource.updateRDFFromVIdentity(recipient.recDesc, recipient.recType);
    283280        return true;
    284281    },
Note: See TracChangeset for help on using the changeset viewer.