This is just some static backup of the original site, don't expect every link to work!

Ignore:
Timestamp:
Aug 16, 2011, 10:12:23 PM (11 years ago)
Author:
rene <rene@…>
Branches:
ng_0.8, ng_0.9
Children:
190674
Parents:
92fd25
Message:

clean namespace from pollution

File:
1 edited

Legend:

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

    r92fd25 rc3feaa  
    2424
    2525
    26 
    27 function vI_rdfDatasource(rdfFileName, dontRegisterObserver) {
     26virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) {
     27function rdfDatasource(rdfFileName, dontRegisterObserver) {
    2828    this._rdfFileName = rdfFileName;
    2929    if (this._rdfFileName) this.init();
     
    3131}
    3232
    33 vI_rdfDatasource.prototype = {
     33rdfDatasource.prototype = {
    3434    _rdfVersion :       "0.0.5",
    3535    _rdfService :       Components.classes["@mozilla.org/rdf/rdf-service;1"]
     
    8080
    8181    init: function() {
    82 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource init.\n");
     82//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource init.\n");
    8383
    8484        this._openRdfDataSource();
     
    9191           
    9292//         this.refreshAccountInfo();
    93 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource init done.\n");
     93//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource init done.\n");
    9494    },
    9595   
     
    109109        var fileURI = protoHandler.newFileURI(newFile);
    110110
    111         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource init: read rdf from '" + fileURI.spec + "'\n");
     111        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource init: read rdf from '" + fileURI.spec + "'\n");
    112112
    113113        this._rdfDataSource =
    114114            this._rdfService.GetDataSourceBlocking(fileURI.spec);
    115115           
    116 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource read rdf from '" + fileURI.spec + "' done." + this._rdfService + "\n");
     116//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource read rdf from '" + fileURI.spec + "' done." + this._rdfService + "\n");
    117117    },
    118118   
     
    161161    rdfUpgrade : function() {
    162162        var currentVersion = this.getCurrentRDFFileVersion();
    163         if (vI_notificationBar) vI_notificationBar.dump("checking for previous version of rdf, found " +
     163        if (vI.notificationBar) vI.notificationBar.dump("checking for previous version of rdf, found " +
    164164            currentVersion + "\nrdf-upgrade required.\n")
    165165        switch (currentVersion) {
     
    175175        }
    176176        this.storeRDFVersion();
    177         if (vI_notificationBar) vI_notificationBar.dump("rdf-upgrade to " + this.getCurrentRDFFileVersion() + " done.\n\n");
     177        if (vI.notificationBar) vI.notificationBar.dump("rdf-upgrade to " + this.getCurrentRDFFileVersion() + " done.\n\n");
    178178    },
    179179    // **************    RDF UPGRADE CODE    ****************************************************
    180180    // only used for upgrade to 0.0.3 - loop through all ressources.
    181181    _transferAllResources : function () {
    182         if (vI_notificationBar) vI_notificationBar.dump("upgrade: transferAllResources ");
     182        if (vI.notificationBar) vI.notificationBar.dump("upgrade: transferAllResources ");
    183183        var enumerator = this._rdfDataSource.GetAllResources();
    184184        while (enumerator && enumerator.hasMoreElements()) {
     
    200200            if (container.IndexOf(resource) == -1) container.AppendElement(resource);
    201201       
    202             if (vI_notificationBar) vI_notificationBar.dump(".");
    203         }
    204         if (vI_notificationBar) vI_notificationBar.dump("\n");
     202            if (vI.notificationBar) vI.notificationBar.dump(".");
     203        }
     204        if (vI.notificationBar) vI.notificationBar.dump("\n");
    205205    },
    206206    // **************    RDF UPGRADE CODE    ****************************************************
    207207    _tagDefaultSMTP: function() {
    208         if (vI_notificationBar) vI_notificationBar.dump("upgrade: tagDefaultSMTP ");
     208        if (vI.notificationBar) vI.notificationBar.dump("upgrade: tagDefaultSMTP ");
    209209        for each (treeType in Array("email", "maillist", "newsgroup", "filter")) {
    210210            var enumerator = this.getContainer(treeType).GetElements();
     
    213213                resource.QueryInterface(Components.interfaces.nsIRDFResource);
    214214                var smtp = this._getRDFValue(resource, "smtp")
    215                 if (!smtp || smtp == "") this._setRDFValue(resource, "smtp", vI_DEFAULT_SMTP_TAG);
    216                 if (vI_notificationBar) vI_notificationBar.dump(".");
    217             }
    218         }
    219         if (vI_notificationBar) vI_notificationBar.dump("\n");
     215                if (!smtp || smtp == "") this._setRDFValue(resource, "smtp", vI.DEFAULT_SMTP_TAG);
     216                if (vI.notificationBar) vI.notificationBar.dump(".");
     217            }
     218        }
     219        if (vI.notificationBar) vI.notificationBar.dump("\n");
    220220    },
    221221    // **************    RDF UPGRADE CODE    ****************************************************
    222222    _createAccountInfoContainers: function() {
    223         if (vI_notificationBar) vI_notificationBar.dump("upgrade: createAccountInfoContainers \n");
     223        if (vI.notificationBar) vI.notificationBar.dump("upgrade: createAccountInfoContainers \n");
    224224        var rdfContainerUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].
    225225            getService(Components.interfaces.nsIRDFContainerUtils);
     
    253253    // **************    RDF UPGRADE CODE    ****************************************************
    254254    _createRDFContainers: function() {
    255         if (vI_notificationBar) vI_notificationBar.dump("upgrade: createRDFContainers ");
     255        if (vI.notificationBar) vI.notificationBar.dump("upgrade: createRDFContainers ");
    256256        var rdfContainerUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].
    257257            getService(Components.interfaces.nsIRDFContainerUtils);
     
    340340   
    341341    cleanAccountInfo : function() {
    342         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: cleanAccountInfo\n");
     342        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: cleanAccountInfo\n");
    343343       
    344344        var enumerator = this._identityContainer.GetElements();
     
    381381   
    382382    searchIdentityMismatch : function() {
    383         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: searchIdentityMismatch");
     383        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: searchIdentityMismatch");
    384384
    385385        var relevantIDs = this.getRelevantIDs();
     
    408408        }
    409409        if (mismatchIDs.length > 0) {
    410             if (vI_notificationBar) vI_notificationBar.dump(" found mismatches on id(s).\n");
     410            if (vI.notificationBar) vI.notificationBar.dump(" found mismatches on id(s).\n");
    411411           
    412412            window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0,
     
    416416        }
    417417        else {
    418             if (vI_notificationBar) vI_notificationBar.dump(" found no mismatch\n");
     418            if (vI.notificationBar) vI.notificationBar.dump(" found no mismatch\n");
    419419            return false;
    420420        }
     
    424424        var keyField = (type == "identity")?"id":"smtp" // field to change is 'id' or 'smtp' dependent on type
    425425        for (var i = 0; i < mismatchItems.length; i++) {
    426             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: repairAccountMismatch change " + mismatchItems[i].oldkey + " into " + mismatchItems[i].key + ": ");
     426            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: repairAccountMismatch change " + mismatchItems[i].oldkey + " into " + mismatchItems[i].key + ": ");
    427427            // search relevant Identities
    428428            for each (treeType in Array("email", "maillist", "newsgroup", "filter")) {
     
    434434                        if (mismatchItems[i].key == "") this._unsetRDFValue(resource, keyField, mismatchItems[i].oldkey)
    435435                        else this._setRDFValue(resource, keyField, mismatchItems[i].key)
    436                         if (vI_notificationBar) vI_notificationBar.dump(".");
     436                        if (vI.notificationBar) vI.notificationBar.dump(".");
    437437                    }
    438438                }
    439439            }
    440             if (vI_notificationBar) vI_notificationBar.dump("\n");
     440            if (vI.notificationBar) vI.notificationBar.dump("\n");
    441441        }
    442442    },
     
    451451                resource.QueryInterface(Components.interfaces.nsIRDFResource);
    452452                var smtp = this._getRDFValue(resource, "smtp")
    453                 if (smtp && smtp != vI_DEFAULT_SMTP_TAG) {
     453                if (smtp && smtp != vI.DEFAULT_SMTP_TAG) {
    454454                    if (!relevantSMTPs[smtp]) relevantSMTPs[smtp] = 1; else relevantSMTPs[smtp] += 1;
    455455                }
     
    460460   
    461461    searchSmtpMismatch : function() {
    462         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: searchSmtpMismatch");
     462        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: searchSmtpMismatch");
    463463
    464464        var relevantSMTPs = this.getRelevantSMTPs();
     
    484484        }
    485485        if (mismatchSMTPs.length > 0) {
    486             if (vI_notificationBar) vI_notificationBar.dump(" found mismatches on smtp(s).\n");
     486            if (vI.notificationBar) vI.notificationBar.dump(" found mismatches on smtp(s).\n");
    487487            window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0,
    488488                    "chrome, dialog, modal, alwaysRaised, resizable=yes", "smtp", mismatchSMTPs,
     
    491491        }
    492492        else {
    493             if (vI_notificationBar) vI_notificationBar.dump(" found no mismatch\n");
     493            if (vI.notificationBar) vI.notificationBar.dump(" found no mismatch\n");
    494494            return false;
    495495        }
     
    497497
    498498    storeAccountInfo : function() {
    499         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts\n");
     499        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts\n");
    500500
    501501        var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"]
     
    505505            for (let j = 0; j < account.identities.Count(); j++) {
    506506                var identity = account.identities.QueryElementAt(j, Components.interfaces.nsIMsgIdentity);
    507 //                 if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts identity store id " + identity.key + "\n");
     507//                 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts identity store id " + identity.key + "\n");
    508508
    509509                var resource = this._rdfService.GetResource(this._rdfNS + this._rdfNSIdentities + "/" + identity.key);
     
    519519       
    520520        function storeSmtp(server, parent) {
    521 //             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts smtp store id " + server.key + "\n");
     521//             if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts smtp store id " + server.key + "\n");
    522522            var resource = parent._rdfService.GetResource(parent._rdfNS + parent._rdfNSSMTPservers + "/" + server.key);
    523523            parent._setRDFValue(resource, "label", (server.description?server.description:server.hostname));
     
    536536        }
    537537
    538 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts done\n");
     538//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts done\n");
    539539    },
    540540
     
    561561        if (!this._rdfDataSource) return null;
    562562        if (!recDescription) {
    563             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: _getRDFResourceForVIdentity: no Recipient given.\n");
     563            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: _getRDFResourceForVIdentity: no Recipient given.\n");
    564564            return null;
    565565        }
     
    577577   
    578578    removeVIdentityFromRDF : function (resource, recType) {
    579 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: removeVIdentityFromRDF " + resource.ValueUTF8 + ".\n");
     579//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: removeVIdentityFromRDF " + resource.ValueUTF8 + ".\n");
    580580        this._unsetRDFValue(resource, "email", this._getRDFValue(resource, "email"))
    581581        this._unsetRDFValue(resource, "fullName", this._getRDFValue(resource, "fullName"))
     
    584584        this._unsetRDFValue(resource, "name", this._getRDFValue(resource, "name"))
    585585       
    586         var extras = new vI_storageExtras(this, resource);
     586        var extras = new vI.storageExtras(this, resource);
    587587        extras.loopForRDF(this, resource, "unset");
    588588        this.getContainer(recType).RemoveElement(resource, true);
     
    590590   
    591591    _unsetRDFValue : function (resource, field, value) {
    592 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource _unsetRDFValue " + this._rdfService  + " " + this._rdfDataSource + "\n");
     592//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource _unsetRDFValue " + this._rdfService  + " " + this._rdfDataSource + "\n");
    593593        var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field);
    594594        var name = this._rdfService.GetLiteral(value?value:"");
     
    601601    },
    602602   
    603     // this will be used from rdfDataTree to get all RDF values, callFunction is vI_rdfDataTree.__addNewDatum
     603    // this will be used from rdfDataTree to get all RDF values, callFunction is vI.rdfDataTreeCollection.__addNewDatum
    604604    readAllEntriesFromRDF : function (addNewDatum, treeType, idData) {
    605 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: readAllEntriesFromRDF " + this._rdfService  + " " + this._rdfDataSource + " " + this + "\n");
     605//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: readAllEntriesFromRDF " + this._rdfService  + " " + this._rdfDataSource + " " + this + "\n");
    606606        var enumerator = this.getContainer(treeType).GetElements();
    607607        while (enumerator && enumerator.hasMoreElements()) {
     
    613613            var id = this._getRDFValue(resource, "id")
    614614            var smtp = this._getRDFValue(resource, "smtp")
    615             if (!smtp) smtp = vI_NO_SMTP_TAG;
    616             var extras = new vI_storageExtras(this, resource);
     615            if (!smtp) smtp = vI.NO_SMTP_TAG;
     616            var extras = new vI.storageExtras(this, resource);
    617617           
    618             var localIdentityData = new vI_identityData(email, fullName, id, smtp, extras)
     618            var localIdentityData = new vI.identityData(email, fullName, id, smtp, extras)
    619619            addNewDatum (resource, name, localIdentityData, idData)
    620620        }
     
    622622   
    623623    findMatchingFilter : function (recDescription) {
    624         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter for " + recDescription + ".\n");
     624        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter for " + recDescription + ".\n");
    625625        var enumerator = this._filterContainer.GetElements();
    626626        while (enumerator && enumerator.hasMoreElements()) {
     
    634634            if (filter == "") continue;
    635635            if (/^\/(.*)\/$/.exec(filter))
    636                 { if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter with RegExp '"
     636                { if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter with RegExp '"
    637637                    + filter.replace(/\\/g,"\\\\") + "'\n"); recentfilterType = filterType.RegExp; }
    638             else    { if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter, compare with '"
     638            else    { if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter, compare with '"
    639639                    + filter + "'\n"); recentfilterType = filterType.StrCmp; }
    640640           
     
    643643                    try {   /^\/(.*)\/$/.exec(filter);
    644644                        if (recDescription.match(new RegExp(RegExp.$1,"i"))) {
    645                             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter found stored data.\n");
     645                            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter found stored data.\n");
    646646                            return this._readVIdentityFromRDF(resource);
    647647                        }
     
    650650                case filterType.StrCmp:
    651651                    if (recDescription.toLowerCase().indexOf(filter.toLowerCase()) != -1) {
    652                         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter found stored data.\n");
     652                        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter found stored data.\n");
    653653                        return this._readVIdentityFromRDF(resource);
    654654                    }
     
    656656            }
    657657        }
    658         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: findMatchingFilter no match found.\n");
     658        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: findMatchingFilter no match found.\n");
    659659        return null;
    660660    },
     
    666666        if (!this._rdfDataSource.hasArcOut(resource, email)) {
    667667            // no data available --> give up.
    668             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: readVIdentityFromRDF no data found.\n");
     668            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: readVIdentityFromRDF no data found.\n");
    669669            return null;
    670670        }
    671         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: readVIdentityFromRDF found stored data.\n");
     671        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: readVIdentityFromRDF found stored data.\n");
    672672       
    673673        return this._readVIdentityFromRDF(resource);
     
    679679        var id = this._getRDFValue(resource, "id")
    680680        var smtp = this._getRDFValue(resource, "smtp")
    681         if (!smtp) smtp = vI_NO_SMTP_TAG;
     681        if (!smtp) smtp = vI.NO_SMTP_TAG;
    682682       
    683         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: email='" + email +
     683        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: email='" + email +
    684684            "' fullName='" + fullName + "' id='" + id + "' smtp='" + smtp + "'\n");
    685685       
    686         var extras = new vI_storageExtras(this, resource);
    687         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: extras:" + extras.status() + "\n");
     686        var extras = new vI.storageExtras(this, resource);
     687        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: extras:" + extras.status() + "\n");
    688688       
    689         var localIdentityData = new vI_identityData(email, fullName, id, smtp, extras)
     689        var localIdentityData = new vI.identityData(email, fullName, id, smtp, extras)
    690690        return localIdentityData;
    691691    },
    692692
    693693    _getRDFValue : function (resource, field) {
    694 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource _getRDFValue " + this._rdfService  + " " + this._rdfDataSource + " " + this + "\n");
     694//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource _getRDFValue " + this._rdfService  + " " + this._rdfDataSource + " " + this + "\n");
    695695        var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field);
    696696        var target = this._rdfDataSource.GetTarget(resource, predicate, true);
     
    702702        this.updateRDF(recDescription, recType,
    703703            document.getElementById("msgIdentity_clone").identityData,
    704             (vI_statusmenu.objSaveBaseIDMenuItem.getAttribute("checked") == "true"),
    705             (vI_statusmenu.objSaveSMTPMenuItem.getAttribute("checked") == "true"),
     704            (vI.statusmenu.objSaveBaseIDMenuItem.getAttribute("checked") == "true"),
     705            (vI.statusmenu.objSaveSMTPMenuItem.getAttribute("checked") == "true"),
    706706            null, null);
    707707    },
     
    715715
    716716    updateRDF : function (recDescription, recType, localIdentityData, storeBaseID, storeSMTP, prevRecDescription, prevRecType) {
    717 //         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource (" + this._rdfNS + "): updateRDF recDescription=" + recDescription + " localIdentityData.email=" + localIdentityData.email + ".\n");
     717//         if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource (" + this._rdfNS + "): updateRDF recDescription=" + recDescription + " localIdentityData.email=" + localIdentityData.email + ".\n");
    718718       
    719719//      if (!localIdentityData.email) {
    720 //          if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: updateRDF: no Sender-email for Recipient, aborting.\n");
     720//          if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: updateRDF: no Sender-email for Recipient, aborting.\n");
    721721//          return;
    722722//      }
     
    728728        var resource = this._getRDFResourceForVIdentity(prevRecDescription, prevRecType);
    729729        if (!resource) return;
    730 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: updateRDF " + resource.ValueUTF8 + ".\n");
     730//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: updateRDF " + resource.ValueUTF8 + ".\n");
    731731       
    732732        var position = this.getContainer(recType).IndexOf(resource); // check for index in new recType
     
    740740            this._setRDFValue(resource, "id", localIdentityData.id.key);
    741741        else    this._unsetRDFValue(resource, "id", this._getRDFValue(resource, "id"))
    742         if (storeSMTP && localIdentityData.smtp.key != vI_NO_SMTP_TAG)
     742        if (storeSMTP && localIdentityData.smtp.key != vI.NO_SMTP_TAG)
    743743            this._setRDFValue(resource, "smtp", localIdentityData.smtp.key);
    744744        else    this._unsetRDFValue(resource, "smtp", this._getRDFValue(resource, "smtp"))
     
    747747        localIdentityData.extras.loopForRDF(this, resource, "set");
    748748       
    749         if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: updateRDF add " + resource.ValueUTF8 + " at position " + position + ".\n");
     749        if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: updateRDF add " + resource.ValueUTF8 + " at position " + position + ".\n");
    750750        if (position != -1) this.getContainer(recType).InsertElementAt(resource, position, true);
    751751        else this.getContainer(recType).AppendElement(resource);
     
    753753
    754754    _setRDFValue : function (resource, field, value) {
    755 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: _setRDFValue " + resource.ValueUTF8 + " " + field + " " + value + ".\n");
     755//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: _setRDFValue " + resource.ValueUTF8 + " " + field + " " + value + ".\n");
    756756        if (!value) return value; // return if some value was not set.
    757 //      if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource _setRDFValue " + this._rdfService + " " + this._rdfDataSource + "\n");
     757//      if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource _setRDFValue " + this._rdfService + " " + this._rdfDataSource + "\n");
    758758        var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field);
    759759        var name = this._rdfService.GetLiteral(value);
     
    771771        observe : function(subject, topic, data) {
    772772            if (topic == "am-smtpChanges" || topic == "am-acceptChanges") {
    773                 if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: account/smtp changes observed\n");
     773                if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: account/smtp changes observed\n");
    774774                this.searchIdentityMismatch();
    775775                this.searchSmtpMismatch();
     
    778778        },
    779779        register : function() {
    780             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: register AccountManagerObserver\n");
     780            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: register AccountManagerObserver\n");
    781781            var obsService = Components.classes["@mozilla.org/observer-service;1"].
    782782                getService(Components.interfaces.nsIObserverService)
     
    796796
    797797// create with name of the file to import into
    798 function vI_rdfDatasourceImporter(rdfFileName) {
     798function rdfDatasourceImporter(rdfFileName) {
    799799    this._rdfFileName = rdfFileName;
    800800    if (this._rdfFileName) this.import();
    801801}
    802802
    803 vI_rdfDatasourceImporter.prototype = {
     803rdfDatasourceImporter.prototype = {
    804804    _rdfService :       Components.classes["@mozilla.org/rdf/rdf-service;1"]
    805805                            .getService(Components.interfaces.nsIRDFService),
     
    844844            values.id = values.id?values.id:"import_" + id
    845845            relevantIDs[id] = values;
    846             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: translate relevant ID from previous '" + id + "' to current '" + relevantIDs[id].id + "'\n");
     846            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: translate relevant ID from previous '" + id + "' to current '" + relevantIDs[id].id + "'\n");
    847847        }
    848848        return relevantIDs;
     
    876876            values.smtp = values.smtp?values.smtp:"import_" + smtp;
    877877            relevantSMTPs[smtp] = values;
    878             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: translate relevant SMTP from previous '" + smtp + "' to current '" + relevantSMTPs[smtp].smtp + "'\n");
     878            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: translate relevant SMTP from previous '" + smtp + "' to current '" + relevantSMTPs[smtp].smtp + "'\n");
    879879        }
    880880        return relevantSMTPs;
     
    906906       
    907907        if (filePicker.show() == Components.interfaces.nsIFilePicker.returnOK) {
    908             if (vI_notificationBar) vI_notificationBar.dump("\n## vI_rdfDatasourceImporter IMPORT\n## vI_rdfDatasourceImporter import: preparation:\n");
     908            if (vI.notificationBar) vI.notificationBar.dump("\n## rdfDatasourceImporter IMPORT\n## rdfDatasourceImporter import: preparation:\n");
    909909           
    910910            var importRdfDataFile = Components.classes["@mozilla.org/file/local;1"]
     
    916916            filePicker.file.copyTo(importRdfDataFile.parent,importRdfDataFile.leafName);
    917917
    918             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: copied file from " + filePicker.file.path + " to " + importRdfDataFile.path + "'\n");
     918            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: copied file from " + filePicker.file.path + " to " + importRdfDataFile.path + "'\n");
    919919           
    920920            // init Datasources
    921             this._rdfImportDataSource = new vI_rdfDatasource(importRdfDataFile.leafName, true);
     921            this._rdfImportDataSource = new rdfDatasource(importRdfDataFile.leafName, true);
    922922           
    923923            // search matching IDs and SMTPs for anyones used in import-file
     
    925925            var relevantSMTPs = this._translateRelevantSMTPs();
    926926           
    927             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: preparation done.\n");
    928             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: starting import:\n");
     927            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: preparation done.\n");
     928            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: starting import:\n");
    929929
    930930            for each (treeType in Array("email", "maillist", "newsgroup", "filter")) {
    931931                // re-initialize importDataSource to point rdfService to the right Resources
    932                 this._rdfImportDataSource = new vI_rdfDatasource(importRdfDataFile.leafName, true);
     932                this._rdfImportDataSource = new rdfDatasource(importRdfDataFile.leafName, true);
    933933                var container = this._rdfImportDataSource.getContainer(treeType)
    934934                if (container.GetCount() == 0) continue;
    935                 if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter importing " + treeType + ": " + container.GetCount()+ " datasets from " + this._rdfImportDataSource._rdfDataSource.URI + "\n");
     935                if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter importing " + treeType + ": " + container.GetCount()+ " datasets from " + this._rdfImportDataSource._rdfDataSource.URI + "\n");
    936936                var enumerator = container.GetElements();
    937937                // re-initialize dataSource to point rdfService to the right Resources
    938                 this._rdfDataSource = new vI_rdfDatasource(this._rdfFileName, true);
     938                this._rdfDataSource = new rdfDatasource(this._rdfFileName, true);
    939939                var count = 0;
    940940                while (enumerator.hasMoreElements()) {
    941941                    var resource = enumerator.getNext(); count += 1;
    942942                    resource.QueryInterface(Components.interfaces.nsIRDFResource);
    943                     if (vI_notificationBar) vI_notificationBar.dump("## " + count + " ");
     943                    if (vI.notificationBar) vI.notificationBar.dump("## " + count + " ");
    944944                    var name = this._rdfImportDataSource._getRDFValue(resource, "name")
    945945                    var email = this._rdfImportDataSource._getRDFValue(resource, "email")
     
    948948                    id = id?relevantIDs[id].id:null
    949949                    var smtp = this._rdfImportDataSource._getRDFValue(resource, "smtp")
    950                     smtp = (smtp && smtp != vI_DEFAULT_SMTP_TAG)?relevantSMTPs[smtp].smtp:smtp
    951                     var extras = new vI_storageExtras(this._rdfImportDataSource, resource);
    952                     var localIdentityData = new vI_identityData(email, fullName, id, smtp, extras)
     950                    smtp = (smtp && smtp != vI.DEFAULT_SMTP_TAG)?relevantSMTPs[smtp].smtp:smtp
     951                    var extras = new vI.storageExtras(this._rdfImportDataSource, resource);
     952                    var localIdentityData = new vI.identityData(email, fullName, id, smtp, extras)
    953953                   
    954954                    this._rdfDataSource.updateRDF(name, treeType, localIdentityData, false, false, null, null)
     
    959959            }
    960960           
    961             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: removing temporary file " + importRdfDataFile.path + ".\n");
     961            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: removing temporary file " + importRdfDataFile.path + ".\n");
    962962            this._rdfImportDataSource = null; importRdfDataFile.remove(false);
    963             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: import done.\n");
    964            
    965             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: cleaning ID/SMTP storages:\n");
    966             this._rdfDataSource = new vI_rdfDatasource(this._rdfFileName, true);
     963            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: import done.\n");
     964           
     965            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: cleaning ID/SMTP storages:\n");
     966            this._rdfDataSource = new rdfDatasource(this._rdfFileName, true);
    967967           
    968968            this._storeMappedIDs(relevantIDs);
     
    974974            this._rdfDataSource.clean();
    975975            this._rdfDataSource = null;
    976             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter import: cleaning ID/SMTP storages done.\n");
    977             if (vI_notificationBar) vI_notificationBar.dump("## vI_rdfDatasourceImporter IMPORT DONE.\n");
     976            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter import: cleaning ID/SMTP storages done.\n");
     977            if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasourceImporter IMPORT DONE.\n");
    978978        }
    979979    }
    980980}
     981vI.rdfDatasource = rdfDatasource;
     982vI.rdfDatasourceImporter = rdfDatasourceImporter;
     983}});
Note: See TracChangeset for help on using the changeset viewer.