Commit 9386a516 authored by CardBook's avatar CardBook

version 27.4

parent de5ac864
# autocompletion
manifest components/cardbookAutocompleteSearch.manifest
# startup with -cardbook
component {823f4516-885f-492d-b8d3-d5e8c8316be1} components/cmd-line-handler.js
contract @mozilla.org/commandlinehandler/general-startup;1?type=cardbook {823f4516-885f-492d-b8d3-d5e8c8316be1}
category command-line-handler m-cardbook @mozilla.org/commandlinehandler/general-startup;1?type=cardbook
resource cardbook-modules modules/
resource cardbook-locale-US chrome/locale/en-US/
content cardbook chrome/content/
# locale
locale cardbook cs chrome/locale/cs/
locale cardbook da chrome/locale/da/
locale cardbook de chrome/locale/de/
......@@ -25,23 +32,33 @@ locale cardbook sl chrome/locale/sl/
locale cardbook sv-SE chrome/locale/sv-SE/
locale cardbook vi chrome/locale/vi/
# skin
skin cardbook classic/1.0 chrome/skin/
skin cardbook-config classic/1.0 chrome/skin/configuration/
skin cardbook-osversion classic/1.0 chrome/skin/osversion/unix/ os=Linux
skin cardbook-osversion classic/1.0 chrome/skin/osversion/unix58/ os=Linux appversion>=57.*
skin cardbook-osversion classic/1.0 chrome/skin/osversion/windows/ os=WINNT
skin cardbook-osversion classic/1.0 chrome/skin/osversion/windows58/ os=WINNT appversion>=57.*
skin cardbook-osversion classic/1.0 chrome/skin/osversion/mac/ os=Darwin
skin cardbook-osversion classic/1.0 chrome/skin/osversion/mac58/ os=Darwin appversion>=57.*
skin cardbook-pref classic/1.0 chrome/skin/osversion/unix/ os=Linux
skin cardbook-pref classic/1.0 chrome/skin/osversion/windows/ os=WINNT
skin cardbook-pref classic/1.0 chrome/skin/osversion/mac/ os=Darwin
skin cardbook-pref classic/1.0 chrome/skin/osversion/unix61/ os=Linux appversion>=61.0a1
skin cardbook-pref classic/1.0 chrome/skin/osversion/windows61/ os=WINNT appversion>=61.0a1
skin cardbook-pref classic/1.0 chrome/skin/osversion/mac61/ os=Darwin appversion>=61.0a1
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/unix/ os=Linux
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/windows/ os=WINNT
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/mac/ os=Darwin
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/unix58/ os=Linux appversion>=58.0a1
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/windows58/ os=WINNT appversion>=58.0a1
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/mac58/ os=Darwin appversion>=58.0a1
skin cardbook-os classic/1.0 chrome/skin/os/unix/ os=Linux
skin cardbook-os classic/1.0 chrome/skin/os/windows/ os=WINNT
skin cardbook-os classic/1.0 chrome/skin/os/mac/ os=Darwin
# support for customizing toolbars
style chrome://global/content/customizeToolbar.xul chrome://cardbook-osversion/skin/mainToolbarButton.css appversion<59.0a1
style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-osversion/skin/mainToolbarButton.css appversion>=59.0a1
style chrome://global/content/customizeToolbar.xul chrome://cardbook-osversion/skin/cardbookToolbarButtons.css appversion<59.0a1
style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-osversion/skin/cardbookToolbarButtons.css appversion>=59.0a1
style chrome://global/content/customizeToolbar.xul chrome://cardbook-toolbar/skin/mainToolbarButton.css appversion<59.0a1
style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-toolbar/skin/mainToolbarButton.css appversion>=59.0a1
style chrome://global/content/customizeToolbar.xul chrome://cardbook-toolbar/skin/cardbookToolbarButtons.css appversion<59.0a1
style chrome://messenger/content/customizeToolbar.xul chrome://cardbook-toolbar/skin/cardbookToolbarButtons.css appversion>=59.0a1
# support for CardBook, yellow stars, creation from emails, formatting email fields
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.xul
......
......@@ -113,7 +113,7 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
var lBirthdayId = cardbookUtils.getUUID();
var leventEntryTitle = cardbookPreferences.getStringPref("extensions.cardbook.eventEntryTitle");
var lBirthdayTitle = leventEntryTitle.replace("%1$S", lBirthdayName).replace("%2$S",lBirthdayAge).replace("%S", lBirthdayName).replace("%S",lBirthdayAge);
var lBirthdayTitle = leventEntryTitle.replace("%1$S", lBirthdayName).replace("%2$S",lBirthdayAge).replace("%3$S",lYear).replace("%S", lBirthdayName).replace("%S",lBirthdayAge);
// prepare Listener
var getListener = {
......
......@@ -9,7 +9,7 @@
<?xml-stylesheet href="chrome://calendar/content/widgets/calendar-widget-bindings.css" type="text/css"?>
<?xml-stylesheet href="chrome://calendar-common/skin/widgets/minimonth.css" type="text/css"?>
<!-- for the preference star -->
<?xml-stylesheet href="chrome://cardbook-os/skin/cardbookPrefStar.css" type="text/css"?>
<?xml-stylesheet href="chrome://cardbook-pref/skin/cardbookPrefStar.css" type="text/css"?>
<?xml-stylesheet href="chrome://cardbook-os/skin/cardbookExpandedClass.css" type="text/css"?>
<?xul-overlay href="chrome://cardbook/content/ovl_cardbookStringBundle.xul"?>
......
......@@ -57,9 +57,9 @@ if ("undefined" == typeof(cardbookDiscovery)) {
stopDiscovery: function (aDirPrefId, aState) {
cardbookSynchronization.finishMultipleOperations(aDirPrefId);
var total = cardbookSynchronization.getRequest() + cardbookSynchronization.getTotal() + cardbookSynchronization.getResponse() + cardbookSynchronization.getDone();
if (total === 0) {
if (aState) {
if (aState) {
var total = cardbookSynchronization.getRequest() + cardbookSynchronization.getTotal() + cardbookSynchronization.getResponse() + cardbookSynchronization.getDone();
if (total === 0) {
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerValidation : ", cardbookRepository.cardbookServerValidation);
var myAccountsToAdd = [];
var myAccountsToRemove = [];
......@@ -74,9 +74,6 @@ if ("undefined" == typeof(cardbookDiscovery)) {
// find all accounts that should be added and removed
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
if (dirPrefId != aDirPrefId) {
continue;
}
if (cardbookRepository.cardbookServerValidation[dirPrefId].length != 0) {
for (var url in cardbookRepository.cardbookServerValidation[dirPrefId]) {
if (url == "length" || url == "user") {
......@@ -107,9 +104,6 @@ if ("undefined" == typeof(cardbookDiscovery)) {
var myCurrentUser = cardbookPreferences.getUser(myCurrentAccountsNotFound[i][4]);
var myCurrentShortUrl = cardbookSynchronization.getShortUrl(myCurrentUrl);
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
if (dirPrefId != aDirPrefId) {
continue;
}
for (var url in cardbookRepository.cardbookServerValidation[dirPrefId]) {
if (url == "length" || url == "user") {
continue;
......@@ -121,21 +115,29 @@ if ("undefined" == typeof(cardbookDiscovery)) {
}
}
}
for (var i = 0; i < myAccountsToAdd.length; i++) {
cardbookDiscovery.addAddressbook(myAccountsToAdd[i]);
}
for (var i = 0; i < myAccountsToRemove.length; i++) {
cardbookDiscovery.removeAddressbook(myAccountsToRemove[i]);
}
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
cardbookSynchronization.stopDiscovery(dirPrefId);
}
}
} else {
cardbookSynchronization.stopDiscovery(aDirPrefId);
}
cardbookSynchronization.stopDiscovery(aDirPrefId);
},
addAddressbook: function (aAccountsToAdd) {
var myArgs = {action: "discovery", accountsToAdd: aAccountsToAdd};
openDialog("chrome://cardbook/content/addressbooksconfiguration/wdw_addressbooksAdd.xul", "", cardbookRepository.windowParams, myArgs);
// this function is luckily not always available
// especially after having added an address book, a new discovery does not reask for adding
if (openDialog) {
var myArgs = {action: "discovery", accountsToAdd: aAccountsToAdd};
openDialog("chrome://cardbook/content/addressbooksconfiguration/wdw_addressbooksAdd.xul", "", cardbookRepository.windowParams, myArgs);
}
},
removeAddressbook: function (aDirPrefId) {
......
......@@ -278,9 +278,10 @@ if ("undefined" == typeof(cardBookObserver)) {
case "cardbook.syncRunning":
wdw_cardbook.refreshWindow(aData);
break;
case "cardbook.cardRemovedDirect":
wdw_cardbook.clearCard();
case "cardbook.cardAddedIndirect":
case "cardbook.cardRemovedIndirect":
case "cardbook.cardRemovedDirect":
case "cardbook.cardModifiedIndirect":
case "cardbook.cardPasted":
case "cardbook.cardDragged":
......@@ -297,10 +298,10 @@ if ("undefined" == typeof(cardBookObserver)) {
break;
case "cardbook.ABAddedDirect":
case "cardbook.ABRemovedDirect":
case "cardbook.catRemovedDirect":
wdw_cardbook.clearCard();
case "cardbook.catAddedDirect":
case "cardbook.catRemovedIndirect":
case "cardbook.catRemovedDirect":
case "cardbook.catModifiedIndirect":
case "cardbook.catModifiedDirect":
case "cardbook.ABModifiedDirect":
......
......@@ -234,6 +234,20 @@ if ("undefined" == typeof(cardbookUtils)) {
}
},
getCardFromEmail: function(aEmail) {
var myTestString = aEmail.toLowerCase();
for (var i = 0; i < cardbookRepository.cardbookAccounts.length; i++) {
if (cardbookRepository.cardbookAccounts[i][1] && cardbookRepository.cardbookAccounts[i][5] && (cardbookRepository.cardbookAccounts[i][6] != "SEARCH")) {
var myDirPrefId = cardbookRepository.cardbookAccounts[i][4];
if (cardbookRepository.cardbookCardEmails[myDirPrefId]) {
if (cardbookRepository.cardbookCardEmails[myDirPrefId][myTestString]) {
return cardbookRepository.cardbookCardEmails[myDirPrefId][myTestString][0];
}
}
}
}
},
sortCardsTreeArrayByString: function (aArray, aIndex, aInvert) {
if (Services.locale.getApplicationLocale) {
var collator = Components.classes["@mozilla.org/intl/collation-factory;1"].getService(Components.interfaces.nsICollationFactory).CreateCollation(Services.locale.getApplicationLocale());
......@@ -2865,6 +2879,19 @@ if ("undefined" == typeof(cardbookUtils)) {
}
},
getBroadcasterOnCardBook: function () {
if (document.getElementById('cardboookModeBroadcasterTab')) {
if (document.getElementById('cardboookModeBroadcasterTab').getAttribute('mode') == 'cardbook') {
return true;
}
} else if (document.getElementById('cardboookModeBroadcasterWindow')) {
if (document.getElementById('cardboookModeBroadcasterWindow').getAttribute('mode') == 'cardbook') {
return true;
}
}
return false;
},
formatStringForOutput: function(aStringCode, aValuesArray, aErrorCode) {
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
if (aValuesArray) {
......
if ("undefined" == typeof(cardbookWebDAV)) {
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.importGlobalProperties(["XMLHttpRequest"]);
if (Services.vc.compare(Services.appinfo.version, "61") >= 0) {
Components.utils.importGlobalProperties(["XMLHttpRequest"]);
}
function XMLToJSONParser(doc) {
this._buildTree(doc);
......
......@@ -6,7 +6,7 @@
<?xml-stylesheet href="chrome://cardbook/skin/cardbookCheckboxes.css" type="text/css"?>
<?xul-overlay href="chrome://cardbook/content/ovl_cardbookStringBundle.xul"?>
<!-- for the preference star -->
<?xml-stylesheet href="chrome://cardbook-os/skin/cardbookPrefStar.css" type="text/css"?>
<?xml-stylesheet href="chrome://cardbook-pref/skin/cardbookPrefStar.css" type="text/css"?>
<!DOCTYPE window [
<!ENTITY % configurationDTD SYSTEM "chrome://cardbook/locale/wdw_cardbookConfiguration.dtd"> %configurationDTD;
<!ENTITY % namesDTD SYSTEM "chrome://cardbook/locale/wdw_nameEdition.dtd"> %namesDTD;
......
......@@ -33,7 +33,7 @@ if ("undefined" == typeof(ovl_cardbookLayout)) {
},
setCheckboxes: function() {
if (document.getElementById("cardboookModeBroadcaster").getAttribute("mode") == "cardbook") {
if (cardbookUtils.getBroadcasterOnCardBook()) {
document.getElementById("cardbookABPaneItem").hidden=false;
document.getElementById("cardbookContactPaneItem").hidden=false;
document.getElementById("menu_showFolderPane").hidden=true;
......@@ -50,6 +50,11 @@ if ("undefined" == typeof(ovl_cardbookLayout)) {
}
},
setCheckboxesForWindow: function() {
document.getElementById("cardbookABPaneItem").setAttribute('checked', cardbookPreferences.getBoolPref("extensions.cardbook.viewABPane"));
document.getElementById("cardbookContactPaneItem").setAttribute('checked', cardbookPreferences.getBoolPref("extensions.cardbook.viewABContact"));
},
setBoxes: function(aEvent) {
aEvent.stopImmediatePropagation();
var paneConfig = 0;
......@@ -102,20 +107,23 @@ if ("undefined" == typeof(ovl_cardbookLayout)) {
// for the displayed name of emails
// InitViewLayoutStyleMenu
(function() {
// Keep a reference to the original function.
var _original = InitViewLayoutStyleMenu;
// Override a function.
InitViewLayoutStyleMenu = function() {
// for the standalone window, does not exist
if ("undefined" != typeof(InitViewLayoutStyleMenu)) {
// Keep a reference to the original function.
var _original = InitViewLayoutStyleMenu;
ovl_cardbookLayout.setCheckboxes();
// Execute some action afterwards.
if (document.getElementById("cardboookModeBroadcaster").getAttribute("mode") == "cardbook") {
ovl_cardbookLayout.setBoxes(arguments[0]);
} else {
// Execute original function.
_original.apply(null, arguments);
}
};
// Override a function.
InitViewLayoutStyleMenu = function() {
ovl_cardbookLayout.setCheckboxes();
// Execute some action afterwards.
if (document.getElementById("cardboookModeBroadcaster").getAttribute("mode") == "cardbook") {
ovl_cardbookLayout.setBoxes(arguments[0]);
} else {
// Execute original function.
_original.apply(null, arguments);
}
};
}
})();
......@@ -11,7 +11,7 @@
var rv = _original.apply(null, arguments);
// Execute some action afterwards.
if (document.getElementById('cardboookModeBroadcaster').getAttribute('mode') == 'cardbook') {
if (cardbookUtils.getBroadcasterOnCardBook()) {
onViewToolbarsPopupShowing(arguments[0], ["navigation-toolbox", "cardbook-toolbox"], arguments[1]);
}
......@@ -35,7 +35,7 @@
var rv = _original.apply(null, arguments);
// Execute some action afterwards.
if (document.getElementById('cardboookModeBroadcaster').getAttribute('mode') == 'cardbook') {
if (cardbookUtils.getBroadcasterOnCardBook()) {
onViewToolbarsPopupShowing(arguments[0], ["navigation-toolbox", "cardbook-toolbox"], arguments[1]);
}
......
if ("undefined" == typeof(ovl_cardbookFindEmails)) {
Components.utils.import("resource:///modules/gloda/msg_search.js");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("chrome://cardbook/content/cardbookRepository.js");
var ovl_cardbookFindEmails = {
findEmailsFromEmail: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
ovl_cardbookFindEmails.findEmails(null, [myEmail]);
},
findAllEmailsFromContact: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
if (ovl_cardbookMailContacts) {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail, ovl_cardbookMailContacts.getIdentityKey());
} else {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail);
}
if (isEmailRegistered) {
var myCard = cardbookUtils.getCardFromEmail(myEmail);
ovl_cardbookFindEmails.findEmails([myCard], null);
}
},
findEmails: function (aListOfSelectedCard, aListOfSelectedEmails) {
var listOfEmail = [];
if (aListOfSelectedCard != null && aListOfSelectedCard !== undefined && aListOfSelectedCard != "") {
for (var i = 0; i < aListOfSelectedCard.length; i++) {
if (!aListOfSelectedCard[i].isAList) {
for (var j = 0; j < aListOfSelectedCard[i].email.length; j++) {
listOfEmail.push(aListOfSelectedCard[i].email[j][0][0].toLowerCase());
}
} else {
listOfEmail.push(aListOfSelectedCard[i].fn.replace('"', '\"'));
}
}
} else if (aListOfSelectedEmails != null && aListOfSelectedEmails !== undefined && aListOfSelectedEmails != "") {
listOfEmail = JSON.parse(JSON.stringify(aListOfSelectedEmails));
}
var tabmail = document.getElementById("tabmail");
if (!tabmail) {
// Try opening new tabs in an existing 3pane window
let mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) {
tabmail = mail3PaneWindow.document.getElementById("tabmail");
mail3PaneWindow.focus();
}
}
// gloda is not defined when used from an independant window
tabmail.openTab("glodaFacet", {searcher: new GlodaMsgSearcher(null, '"' + listOfEmail.join('" "') + '"', false)});
}
};
};
if ("undefined" == typeof(ovl_cardbookFindEvents)) {
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
Components.utils.import("chrome://cardbook/content/cardbookRepository.js");
var ovl_cardbookFindEvents = {
findEventsFromEmail: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
if (ovl_cardbookMailContacts) {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail, ovl_cardbookMailContacts.getIdentityKey());
} else {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail);
}
if (isEmailRegistered) {
var myCard = cardbookUtils.getCardFromEmail(myEmail);
ovl_cardbookFindEvents.findEvents(null, [myEmail], myEmail, "mailto:" + myEmail, myCard.fn);
} else {
var myDisplayName = myEmailNode.getAttribute('displayName');
ovl_cardbookFindEvents.findEvents(null, [myEmail], myEmail, "mailto:" + myEmail, myDisplayName);
}
},
findAllEventsFromContact: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
if (ovl_cardbookMailContacts) {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail, ovl_cardbookMailContacts.getIdentityKey());
} else {
var isEmailRegistered = cardbookRepository.isEmailRegistered(myEmail);
}
if (isEmailRegistered) {
var myCard = cardbookUtils.getCardFromEmail(myEmail);
ovl_cardbookFindEvents.findEvents([myCard], null, myCard.fn, "mailto:" + myEmail, myCard.fn);
}
},
findEvents: function (aListOfSelectedCard, aListOfSelectedEmails, aDisplayName, aAttendeeId, aAttendeeName) {
var listOfEmail = [];
if (aListOfSelectedCard != null && aListOfSelectedCard !== undefined && aListOfSelectedCard != "") {
for (var i = 0; i < aListOfSelectedCard.length; i++) {
if (!aListOfSelectedCard[i].isAList) {
for (var j = 0; j < aListOfSelectedCard[i].email.length; j++) {
listOfEmail.push(aListOfSelectedCard[i].email[j][0][0].toLowerCase());
}
} else {
listOfEmail.push(aListOfSelectedCard[i].fn.replace('"', '\"'));
}
}
} else if (aListOfSelectedEmails != null && aListOfSelectedEmails !== undefined && aListOfSelectedEmails != "") {
listOfEmail = JSON.parse(JSON.stringify(aListOfSelectedEmails));
}
var myArgs = {listOfEmail: listOfEmail, displayName: aDisplayName, attendeeId: aAttendeeId, attendeeName: aAttendeeName};
var myWindow = window.openDialog("chrome://cardbook/content/lightning/wdw_cardbookEventContacts.xul", "", cardbookRepository.modalWindowParams, myArgs);
}
};
};
......@@ -28,20 +28,6 @@ if ("undefined" == typeof(ovl_cardbookMailContacts)) {
return cardbookRepository.isEmailRegistered(aEmail, ovl_cardbookMailContacts.getIdentityKey());
},
getCardFromEmail: function(aEmail) {
var myTestString = aEmail.toLowerCase();
for (var i = 0; i < cardbookRepository.cardbookAccounts.length; i++) {
if (cardbookRepository.cardbookAccounts[i][1] && cardbookRepository.cardbookAccounts[i][5] && (cardbookRepository.cardbookAccounts[i][6] != "SEARCH")) {
var myDirPrefId = cardbookRepository.cardbookAccounts[i][4];
if (cardbookRepository.cardbookCardEmails[myDirPrefId]) {
if (cardbookRepository.cardbookCardEmails[myDirPrefId][myTestString]) {
return cardbookRepository.cardbookCardEmails[myDirPrefId][myTestString][0];
}
}
}
}
},
addToCardBook: function(aDirPrefId) {
try {
var myNewCard = new cardbookCardParser();
......@@ -94,7 +80,7 @@ if ("undefined" == typeof(ovl_cardbookMailContacts)) {
var isEmailRegistered = ovl_cardbookMailContacts.isEmailRegistered(myEmail);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
var myCard = cardbookUtils.getCardFromEmail(myEmail);
var myOutCard = new cardbookCardParser();
cardbookUtils.cloneCard(myCard, myOutCard);
if (myOutCard.isAList) {
......@@ -118,105 +104,12 @@ if ("undefined" == typeof(ovl_cardbookMailContacts)) {
var isEmailRegistered = ovl_cardbookMailContacts.isEmailRegistered(myEmail);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
var myCard = cardbookUtils.getCardFromEmail(myEmail);
wdw_cardbook.deleteCardsAndValidate("cardbook.cardRemovedIndirect", [myCard]);
UpdateEmailNodeDetails(myEmail, myEmailNode);
}
},
findEmailsFromEmail: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
ovl_cardbookMailContacts.findEmails(null, [myEmail]);
},
findAllEmailsFromContact: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
var isEmailRegistered = ovl_cardbookMailContacts.isEmailRegistered(myEmail);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
ovl_cardbookMailContacts.findEmails([myCard], null);
}
},
findEmails: function (aListOfSelectedCard, aListOfSelectedEmails) {
var listOfEmail = [];
if (aListOfSelectedCard != null && aListOfSelectedCard !== undefined && aListOfSelectedCard != "") {
for (var i = 0; i < aListOfSelectedCard.length; i++) {
if (!aListOfSelectedCard[i].isAList) {
for (var j = 0; j < aListOfSelectedCard[i].email.length; j++) {
listOfEmail.push(aListOfSelectedCard[i].email[j][0][0].toLowerCase());
}
} else {
listOfEmail.push(aListOfSelectedCard[i].fn.replace('"', '\"'));
}
}
} else if (aListOfSelectedEmails != null && aListOfSelectedEmails !== undefined && aListOfSelectedEmails != "") {
listOfEmail = JSON.parse(JSON.stringify(aListOfSelectedEmails));
}
var tabmail = document.getElementById("tabmail");
if (!tabmail) {
// Try opening new tabs in an existing 3pane window
let mail3PaneWindow = Services.wm.getMostRecentWindow("mail:3pane");
if (mail3PaneWindow) {
tabmail = mail3PaneWindow.document.getElementById("tabmail");
mail3PaneWindow.focus();
}
}
// gloda is not defined when used from an independant window
tabmail.openTab("glodaFacet", {searcher: new GlodaMsgSearcher(null, '"' + listOfEmail.join('" "') + '"', false)});
},
findEventsFromEmail: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
var isEmailRegistered = ovl_cardbookMailContacts.isEmailRegistered(myEmail);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
ovl_cardbookMailContacts.findEvents(null, [myEmail], myEmail, "mailto:" + myEmail, myCard.fn);
} else {
var myDisplayName = myEmailNode.getAttribute('displayName');
ovl_cardbookMailContacts.findEvents(null, [myEmail], myEmail, "mailto:" + myEmail, myDisplayName);
}
},
findAllEventsFromContact: function() {
var myPopupNode = document.popupNode;
var myEmailNode = findEmailNodeFromPopupNode(myPopupNode, 'emailAddressPopup');
var myEmail = myEmailNode.getAttribute('emailAddress');
var isEmailRegistered = ovl_cardbookMailContacts.isEmailRegistered(myEmail);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
ovl_cardbookMailContacts.findEvents([myCard], null, myCard.fn, "mailto:" + myEmail, myCard.fn);
}
},
findEvents: function (aListOfSelectedCard, aListOfSelectedEmails, aDisplayName, aAttendeeId, aAttendeeName) {
var listOfEmail = [];
if (aListOfSelectedCard != null && aListOfSelectedCard !== undefined && aListOfSelectedCard != "") {
for (var i = 0; i < aListOfSelectedCard.length; i++) {
if (!aListOfSelectedCard[i].isAList) {
for (var j = 0; j < aListOfSelectedCard[i].email.length; j++) {
listOfEmail.push(aListOfSelectedCard[i].email[j][0][0].toLowerCase());
}
} else {
listOfEmail.push(aListOfSelectedCard[i].fn.replace('"', '\"'));
}
}
} else if (aListOfSelectedEmails != null && aListOfSelectedEmails !== undefined && aListOfSelectedEmails != "") {
listOfEmail = JSON.parse(JSON.stringify(aListOfSelectedEmails));
}
var myArgs = {listOfEmail: listOfEmail, displayName: aDisplayName, attendeeId: aAttendeeId, attendeeName: aAttendeeName};
var myWindow = window.openDialog("chrome://cardbook/content/lightning/wdw_cardbookEventContacts.xul", "", cardbookRepository.modalWindowParams, myArgs);
},
hideOldAddressbook: function (aExclusive) {
if (aExclusive) {
document.getElementById("addToAddressBookItem").setAttribute("hidden", true);
......@@ -290,7 +183,7 @@ if ("undefined" == typeof(ovl_cardbookMailContacts)) {
ovl_cardbookMailContacts.hideOrShowNewAddressbook(isEmailRegistered);
if (isEmailRegistered) {
var myCard = ovl_cardbookMailContacts.getCardFromEmail(myEmail);
var myCard = cardbookUtils.getCardFromEmail(myEmail);
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
document.getElementById("editInCardBookMenu").setAttribute("cardbookId", myCard.dirPrefId+"::"+myCard.uid);
if (cardbookPreferences.getReadOnly(myCard.dirPrefId)) {
......
......@@ -4,19 +4,16 @@ if ("undefined" == typeof(wdw_migrate)) {
var wdw_migrate = {
customMap : [ ["1", false], ["2", false], ["3", false], ["4", false] ],
customMap : { "X-CUSTOM1": {add: false, number:"1"}, "X-CUSTOM2": {add: false, number:"2"}, "X-CUSTOM3": {add: false, number:"3"}, "X-CUSTOM4": {add: false, number:"4"} },
allLists : {},
writeCustomToPreference: function () {
var myType = 'pers';
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var customLabel = strBundle.GetStringFromName("customLabel");
result = cardbookRepository.customFields[myType];
var myCount = result.length;
for (var i = 0; i < wdw_migrate.customMap.length; i++) {
if (wdw_migrate.customMap[i][1]) {
for (var myCode in wdw_migrate.customMap) {
if (wdw_migrate.customMap[myCode].add) {
var found = false
var myCode = "X-CUSTOM" + wdw_migrate.customMap[i][0];
for (var j = 0; j < result.length; j++) {
if (result[j][0] == myCode) {
found = true;
......@@ -24,7 +21,7 @@ if ("undefined" == typeof(wdw_migrate)) {
}
}
if (!found) {
cardbookPreferences.setCustomFields(myType, myCount, myCode + ":" + customLabel + wdw_migrate.customMap[i][0]);
cardbookPreferences.setCustomFields(myType, myCount, myCode + ":" + wdw_migrate.customMap[myCode].label);
myCount++;
}
}
......@@ -34,6 +31,7 @@ if ("undefined" == typeof(wdw_migrate)) {
translateStandardCards: function (aDirPrefIdTarget, aDirPrefIdTargetName, aABCard, aVersion, aDateFormat, aMode) {
try {
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var myCard = new cardbookCardParser();
myCard.dirPrefId = aDirPrefIdTarget;
cardbookUtils.setCardUUID(myCard);
......@@ -43,15 +41,29 @@ if ("undefined" == typeof(wdw_migrate)) {
var myMapData = aABCard.getProperty(myMap[i][0],"");
myCard[myMap[i][1]] = myMapData;
}
for (var i = 0; i < wdw_migrate.customMap.length; i++) {
var myMapData = aABCard.getProperty("Custom" + wdw_migrate.customMap[i][0],"");
for (var myCode in wdw_migrate.customMap) {
var myMapData = aABCard.getProperty("Custom" + wdw_migrate.customMap[myCode].number,"");
if (myMapData != "") {
myCard.others.push("X-CUSTOM" + wdw_migrate.customMap[i][0] + ":" + myMapData);
if (!wdw_migrate.customMap[i][1]) {
wdw_migrate.customMap[i][1] = true;
myCard.others.push(myCode + ":" + myMapData);
if (!wdw_migrate.customMap[myCode].add) {
wdw_migrate.customMap[myCode].add = true;
wdw_migrate.customMap[myCode].label = strBundle.GetStringFromName("customLabel") + wdw_migrate.customMap[myCode].number;
}
}
}
var myMapForCustom = [ ["PhoneticFirstName", "X-PHONETIC-FIRST-NAME"], ["PhoneticLastName", "X-PHONETIC-LAST-NAME"] ];
for (var i = 0; i < myMapForCustom.length; i++) {
var myMapData = aABCard.getProperty(myMapForCustom[i][0],"");
if (myMapData != "") {
myCard.others.push(myMapForCustom[i][1] + ":" + myMapData);
if (!wdw_migrate.customMap[myMapForCustom[i][1]]) {
wdw_migrate.customMap[myMapForCustom[i][1]] = {}
wdw_migrate.customMap[myMapForCustom[i][1]].add = true;
wdw_migrate.customMap[myMapForCustom[i][1]].label = strBundle.GetStringFromName(myMapForCustom[i][0] + "Label");
}
}
}
var myDep = aABCard.getProperty("Department","");
var myOrg = aABCard.getProperty("Company","");
if (myDep != "") {
......
......@@ -14,7 +14,7 @@ if ("undefined" == typeof(cardbookTabType)) {
},
onTabClosing: function(aTab) {
if (aTab.mode.name == "cardbook") {
document.getElementById("cardboookModeBroadcaster").setAttribute("mode", "mail");