Changeset c3feaa for chrome/content/v_identity/vI_rdfDatasource.js
- Timestamp:
- Aug 16, 2011, 10:12:23 PM (11 years ago)
- Branches:
- ng_0.8, ng_0.9
- Children:
- 190674
- Parents:
- 92fd25
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chrome/content/v_identity/vI_rdfDatasource.js
r92fd25 rc3feaa 24 24 25 25 26 27 function vI_rdfDatasource(rdfFileName, dontRegisterObserver) {26 virtualIdentityExtension.ns(function() { with (virtualIdentityExtension.LIB) { 27 function rdfDatasource(rdfFileName, dontRegisterObserver) { 28 28 this._rdfFileName = rdfFileName; 29 29 if (this._rdfFileName) this.init(); … … 31 31 } 32 32 33 vI_rdfDatasource.prototype = {33 rdfDatasource.prototype = { 34 34 _rdfVersion : "0.0.5", 35 35 _rdfService : Components.classes["@mozilla.org/rdf/rdf-service;1"] … … 80 80 81 81 init: function() { 82 // if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource init.\n");82 // if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource init.\n"); 83 83 84 84 this._openRdfDataSource(); … … 91 91 92 92 // 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"); 94 94 }, 95 95 … … 109 109 var fileURI = protoHandler.newFileURI(newFile); 110 110 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"); 112 112 113 113 this._rdfDataSource = 114 114 this._rdfService.GetDataSourceBlocking(fileURI.spec); 115 115 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"); 117 117 }, 118 118 … … 161 161 rdfUpgrade : function() { 162 162 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 " + 164 164 currentVersion + "\nrdf-upgrade required.\n") 165 165 switch (currentVersion) { … … 175 175 } 176 176 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"); 178 178 }, 179 179 // ************** RDF UPGRADE CODE **************************************************** 180 180 // only used for upgrade to 0.0.3 - loop through all ressources. 181 181 _transferAllResources : function () { 182 if (vI _notificationBar) vI_notificationBar.dump("upgrade: transferAllResources ");182 if (vI.notificationBar) vI.notificationBar.dump("upgrade: transferAllResources "); 183 183 var enumerator = this._rdfDataSource.GetAllResources(); 184 184 while (enumerator && enumerator.hasMoreElements()) { … … 200 200 if (container.IndexOf(resource) == -1) container.AppendElement(resource); 201 201 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"); 205 205 }, 206 206 // ************** RDF UPGRADE CODE **************************************************** 207 207 _tagDefaultSMTP: function() { 208 if (vI _notificationBar) vI_notificationBar.dump("upgrade: tagDefaultSMTP ");208 if (vI.notificationBar) vI.notificationBar.dump("upgrade: tagDefaultSMTP "); 209 209 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { 210 210 var enumerator = this.getContainer(treeType).GetElements(); … … 213 213 resource.QueryInterface(Components.interfaces.nsIRDFResource); 214 214 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"); 220 220 }, 221 221 // ************** RDF UPGRADE CODE **************************************************** 222 222 _createAccountInfoContainers: function() { 223 if (vI _notificationBar) vI_notificationBar.dump("upgrade: createAccountInfoContainers \n");223 if (vI.notificationBar) vI.notificationBar.dump("upgrade: createAccountInfoContainers \n"); 224 224 var rdfContainerUtils = Components.classes["@mozilla.org/rdf/container-utils;1"]. 225 225 getService(Components.interfaces.nsIRDFContainerUtils); … … 253 253 // ************** RDF UPGRADE CODE **************************************************** 254 254 _createRDFContainers: function() { 255 if (vI _notificationBar) vI_notificationBar.dump("upgrade: createRDFContainers ");255 if (vI.notificationBar) vI.notificationBar.dump("upgrade: createRDFContainers "); 256 256 var rdfContainerUtils = Components.classes["@mozilla.org/rdf/container-utils;1"]. 257 257 getService(Components.interfaces.nsIRDFContainerUtils); … … 340 340 341 341 cleanAccountInfo : function() { 342 if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: cleanAccountInfo\n");342 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: cleanAccountInfo\n"); 343 343 344 344 var enumerator = this._identityContainer.GetElements(); … … 381 381 382 382 searchIdentityMismatch : function() { 383 if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: searchIdentityMismatch");383 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: searchIdentityMismatch"); 384 384 385 385 var relevantIDs = this.getRelevantIDs(); … … 408 408 } 409 409 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"); 411 411 412 412 window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0, … … 416 416 } 417 417 else { 418 if (vI _notificationBar) vI_notificationBar.dump(" found no mismatch\n");418 if (vI.notificationBar) vI.notificationBar.dump(" found no mismatch\n"); 419 419 return false; 420 420 } … … 424 424 var keyField = (type == "identity")?"id":"smtp" // field to change is 'id' or 'smtp' dependent on type 425 425 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 + ": "); 427 427 // search relevant Identities 428 428 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { … … 434 434 if (mismatchItems[i].key == "") this._unsetRDFValue(resource, keyField, mismatchItems[i].oldkey) 435 435 else this._setRDFValue(resource, keyField, mismatchItems[i].key) 436 if (vI _notificationBar) vI_notificationBar.dump(".");436 if (vI.notificationBar) vI.notificationBar.dump("."); 437 437 } 438 438 } 439 439 } 440 if (vI _notificationBar) vI_notificationBar.dump("\n");440 if (vI.notificationBar) vI.notificationBar.dump("\n"); 441 441 } 442 442 }, … … 451 451 resource.QueryInterface(Components.interfaces.nsIRDFResource); 452 452 var smtp = this._getRDFValue(resource, "smtp") 453 if (smtp && smtp != vI _DEFAULT_SMTP_TAG) {453 if (smtp && smtp != vI.DEFAULT_SMTP_TAG) { 454 454 if (!relevantSMTPs[smtp]) relevantSMTPs[smtp] = 1; else relevantSMTPs[smtp] += 1; 455 455 } … … 460 460 461 461 searchSmtpMismatch : function() { 462 if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: searchSmtpMismatch");462 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: searchSmtpMismatch"); 463 463 464 464 var relevantSMTPs = this.getRelevantSMTPs(); … … 484 484 } 485 485 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"); 487 487 window.openDialog("chrome://v_identity/content/vI_rdfAccountMismatchDialog.xul",0, 488 488 "chrome, dialog, modal, alwaysRaised, resizable=yes", "smtp", mismatchSMTPs, … … 491 491 } 492 492 else { 493 if (vI _notificationBar) vI_notificationBar.dump(" found no mismatch\n");493 if (vI.notificationBar) vI.notificationBar.dump(" found no mismatch\n"); 494 494 return false; 495 495 } … … 497 497 498 498 storeAccountInfo : function() { 499 if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts\n");499 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts\n"); 500 500 501 501 var AccountManager = Components.classes["@mozilla.org/messenger/account-manager;1"] … … 505 505 for (let j = 0; j < account.identities.Count(); j++) { 506 506 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"); 508 508 509 509 var resource = this._rdfService.GetResource(this._rdfNS + this._rdfNSIdentities + "/" + identity.key); … … 519 519 520 520 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"); 522 522 var resource = parent._rdfService.GetResource(parent._rdfNS + parent._rdfNSSMTPservers + "/" + server.key); 523 523 parent._setRDFValue(resource, "label", (server.description?server.description:server.hostname)); … … 536 536 } 537 537 538 // if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: storeAccounts done\n");538 // if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: storeAccounts done\n"); 539 539 }, 540 540 … … 561 561 if (!this._rdfDataSource) return null; 562 562 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"); 564 564 return null; 565 565 } … … 577 577 578 578 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"); 580 580 this._unsetRDFValue(resource, "email", this._getRDFValue(resource, "email")) 581 581 this._unsetRDFValue(resource, "fullName", this._getRDFValue(resource, "fullName")) … … 584 584 this._unsetRDFValue(resource, "name", this._getRDFValue(resource, "name")) 585 585 586 var extras = new vI _storageExtras(this, resource);586 var extras = new vI.storageExtras(this, resource); 587 587 extras.loopForRDF(this, resource, "unset"); 588 588 this.getContainer(recType).RemoveElement(resource, true); … … 590 590 591 591 _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"); 593 593 var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field); 594 594 var name = this._rdfService.GetLiteral(value?value:""); … … 601 601 }, 602 602 603 // this will be used from rdfDataTree to get all RDF values, callFunction is vI _rdfDataTree.__addNewDatum603 // this will be used from rdfDataTree to get all RDF values, callFunction is vI.rdfDataTreeCollection.__addNewDatum 604 604 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"); 606 606 var enumerator = this.getContainer(treeType).GetElements(); 607 607 while (enumerator && enumerator.hasMoreElements()) { … … 613 613 var id = this._getRDFValue(resource, "id") 614 614 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); 617 617 618 var localIdentityData = new vI _identityData(email, fullName, id, smtp, extras)618 var localIdentityData = new vI.identityData(email, fullName, id, smtp, extras) 619 619 addNewDatum (resource, name, localIdentityData, idData) 620 620 } … … 622 622 623 623 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"); 625 625 var enumerator = this._filterContainer.GetElements(); 626 626 while (enumerator && enumerator.hasMoreElements()) { … … 634 634 if (filter == "") continue; 635 635 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 '" 637 637 + 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 '" 639 639 + filter + "'\n"); recentfilterType = filterType.StrCmp; } 640 640 … … 643 643 try { /^\/(.*)\/$/.exec(filter); 644 644 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"); 646 646 return this._readVIdentityFromRDF(resource); 647 647 } … … 650 650 case filterType.StrCmp: 651 651 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"); 653 653 return this._readVIdentityFromRDF(resource); 654 654 } … … 656 656 } 657 657 } 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"); 659 659 return null; 660 660 }, … … 666 666 if (!this._rdfDataSource.hasArcOut(resource, email)) { 667 667 // 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"); 669 669 return null; 670 670 } 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"); 672 672 673 673 return this._readVIdentityFromRDF(resource); … … 679 679 var id = this._getRDFValue(resource, "id") 680 680 var smtp = this._getRDFValue(resource, "smtp") 681 if (!smtp) smtp = vI _NO_SMTP_TAG;681 if (!smtp) smtp = vI.NO_SMTP_TAG; 682 682 683 if (vI _notificationBar) vI_notificationBar.dump("## vI_rdfDatasource: email='" + email +683 if (vI.notificationBar) vI.notificationBar.dump("## rdfDatasource: email='" + email + 684 684 "' fullName='" + fullName + "' id='" + id + "' smtp='" + smtp + "'\n"); 685 685 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"); 688 688 689 var localIdentityData = new vI _identityData(email, fullName, id, smtp, extras)689 var localIdentityData = new vI.identityData(email, fullName, id, smtp, extras) 690 690 return localIdentityData; 691 691 }, 692 692 693 693 _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"); 695 695 var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field); 696 696 var target = this._rdfDataSource.GetTarget(resource, predicate, true); … … 702 702 this.updateRDF(recDescription, recType, 703 703 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"), 706 706 null, null); 707 707 }, … … 715 715 716 716 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"); 718 718 719 719 // 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"); 721 721 // return; 722 722 // } … … 728 728 var resource = this._getRDFResourceForVIdentity(prevRecDescription, prevRecType); 729 729 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"); 731 731 732 732 var position = this.getContainer(recType).IndexOf(resource); // check for index in new recType … … 740 740 this._setRDFValue(resource, "id", localIdentityData.id.key); 741 741 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) 743 743 this._setRDFValue(resource, "smtp", localIdentityData.smtp.key); 744 744 else this._unsetRDFValue(resource, "smtp", this._getRDFValue(resource, "smtp")) … … 747 747 localIdentityData.extras.loopForRDF(this, resource, "set"); 748 748 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"); 750 750 if (position != -1) this.getContainer(recType).InsertElementAt(resource, position, true); 751 751 else this.getContainer(recType).AppendElement(resource); … … 753 753 754 754 _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"); 756 756 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"); 758 758 var predicate = this._rdfService.GetResource(this._rdfNS + "rdf#" + field); 759 759 var name = this._rdfService.GetLiteral(value); … … 771 771 observe : function(subject, topic, data) { 772 772 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"); 774 774 this.searchIdentityMismatch(); 775 775 this.searchSmtpMismatch(); … … 778 778 }, 779 779 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"); 781 781 var obsService = Components.classes["@mozilla.org/observer-service;1"]. 782 782 getService(Components.interfaces.nsIObserverService) … … 796 796 797 797 // create with name of the file to import into 798 function vI_rdfDatasourceImporter(rdfFileName) {798 function rdfDatasourceImporter(rdfFileName) { 799 799 this._rdfFileName = rdfFileName; 800 800 if (this._rdfFileName) this.import(); 801 801 } 802 802 803 vI_rdfDatasourceImporter.prototype = {803 rdfDatasourceImporter.prototype = { 804 804 _rdfService : Components.classes["@mozilla.org/rdf/rdf-service;1"] 805 805 .getService(Components.interfaces.nsIRDFService), … … 844 844 values.id = values.id?values.id:"import_" + id 845 845 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"); 847 847 } 848 848 return relevantIDs; … … 876 876 values.smtp = values.smtp?values.smtp:"import_" + smtp; 877 877 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"); 879 879 } 880 880 return relevantSMTPs; … … 906 906 907 907 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"); 909 909 910 910 var importRdfDataFile = Components.classes["@mozilla.org/file/local;1"] … … 916 916 filePicker.file.copyTo(importRdfDataFile.parent,importRdfDataFile.leafName); 917 917 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"); 919 919 920 920 // init Datasources 921 this._rdfImportDataSource = new vI_rdfDatasource(importRdfDataFile.leafName, true);921 this._rdfImportDataSource = new rdfDatasource(importRdfDataFile.leafName, true); 922 922 923 923 // search matching IDs and SMTPs for anyones used in import-file … … 925 925 var relevantSMTPs = this._translateRelevantSMTPs(); 926 926 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"); 929 929 930 930 for each (treeType in Array("email", "maillist", "newsgroup", "filter")) { 931 931 // 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); 933 933 var container = this._rdfImportDataSource.getContainer(treeType) 934 934 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"); 936 936 var enumerator = container.GetElements(); 937 937 // 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); 939 939 var count = 0; 940 940 while (enumerator.hasMoreElements()) { 941 941 var resource = enumerator.getNext(); count += 1; 942 942 resource.QueryInterface(Components.interfaces.nsIRDFResource); 943 if (vI _notificationBar) vI_notificationBar.dump("## " + count + " ");943 if (vI.notificationBar) vI.notificationBar.dump("## " + count + " "); 944 944 var name = this._rdfImportDataSource._getRDFValue(resource, "name") 945 945 var email = this._rdfImportDataSource._getRDFValue(resource, "email") … … 948 948 id = id?relevantIDs[id].id:null 949 949 var smtp = this._rdfImportDataSource._getRDFValue(resource, "smtp") 950 smtp = (smtp && smtp != vI _DEFAULT_SMTP_TAG)?relevantSMTPs[smtp].smtp:smtp951 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) 953 953 954 954 this._rdfDataSource.updateRDF(name, treeType, localIdentityData, false, false, null, null) … … 959 959 } 960 960 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"); 962 962 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); 967 967 968 968 this._storeMappedIDs(relevantIDs); … … 974 974 this._rdfDataSource.clean(); 975 975 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"); 978 978 } 979 979 } 980 980 } 981 vI.rdfDatasource = rdfDatasource; 982 vI.rdfDatasourceImporter = rdfDatasourceImporter; 983 }});
Note: See TracChangeset
for help on using the changeset viewer.