Commit ee7a7a3c authored by CardBook's avatar CardBook

version 22.8

parent 7104127c

Too many changes to show.

To preserve performance only 307 of 307+ files are displayed.

manifest components/cardbookAutocompleteSearch.manifest
resource cardbook-modules modules/
content cardbook chrome/content/
locale cardbook cs chrome/locale/cs/
locale cardbook da chrome/locale/da/
locale cardbook de chrome/locale/de/
locale cardbook en-US chrome/locale/en-US/
locale cardbook fr chrome/locale/fr/
locale cardbook hu chrome/locale/hu/
locale cardbook it chrome/locale/it/
locale cardbook nl chrome/locale/nl/
locale cardbook pl chrome/locale/pl/
locale cardbook pt-PT chrome/locale/pt-PT/
locale cardbook ru chrome/locale/ru/
locale cardbook sl chrome/locale/sl/
skin cardbook classic/1.0 chrome/skin/
skin cardbook-os classic/1.0 chrome/skin/unix/ os=Linux
skin cardbook-os classic/1.0 chrome/skin/windows/ os=WINNT
skin cardbook-os classic/1.0 chrome/skin/mac/ os=Darwin
# support for customizing toolbars
style chrome://global/content/customizeToolbar.xul chrome://cardbook/skin/toolbarButton.css
style chrome://global/content/customizeToolbar.xul chrome://cardbook-os/skin/cardbookToolbarButtons.css
# support for CardBook, yellow stars, creation from emails, formatting email fields
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.xul
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookContexts.xul
# support for CardBook menu in composition window
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/ovl_cardbookComposeMsg.xul
# support for collected mail
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/collected/ovl_collected.xul
# support for expanding list
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/lists/ovl_list.xul
# support for search engines
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/filters/ovl_filters.xul
# support for filter messages
overlay chrome://messenger/content/FilterEditor.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/SearchDialog.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/mailViewSetup.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/virtualFolderProperties.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
# support for Lightning attendees
overlay chrome://calendar/content/calendar-event-dialog-attendees.xul chrome://cardbook/content/lightning/ovl_lightningAttendees.xul
overlay chrome://lightning/content/lightning-menus.xul chrome://cardbook/content/lightning/ovl_lightningMenus.xul
# support for birthdays
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/birthdays/ovl_birthdays.xul
# support for importing attachments
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/attachments/ovl_attachments.xul
# support for attaching a vCard
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/attachvCard/ovl_attachvCard.xul
# support for CardBook Tab
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookTab.xul
# support for Contacts sidebar
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/contactsSidebar/ovl_cardbookContactsSidebarMain.xul
# support for the message window
overlay chrome://messenger/content/messageWindow.xul chrome://cardbook/content/ovl_cardbookContexts.xul
manifest components/cardbookAutocompleteSearch.manifest
resource cardbook-modules modules/
content cardbook chrome/content/
locale cardbook cs chrome/locale/cs/
locale cardbook da chrome/locale/da/
locale cardbook de chrome/locale/de/
locale cardbook en-US chrome/locale/en-US/
locale cardbook fr chrome/locale/fr/
locale cardbook hu chrome/locale/hu/
locale cardbook it chrome/locale/it/
locale cardbook nl chrome/locale/nl/
locale cardbook pl chrome/locale/pl/
locale cardbook pt-PT chrome/locale/pt-PT/
locale cardbook ru chrome/locale/ru/
locale cardbook sl chrome/locale/sl/
skin cardbook classic/1.0 chrome/skin/
skin cardbook-os classic/1.0 chrome/skin/unix/ os=Linux
skin cardbook-os classic/1.0 chrome/skin/windows/ os=WINNT
skin cardbook-os classic/1.0 chrome/skin/mac/ os=Darwin
# support for customizing toolbars
style chrome://global/content/customizeToolbar.xul chrome://cardbook/skin/toolbarButton.css
style chrome://global/content/customizeToolbar.xul chrome://cardbook-os/skin/cardbookToolbarButtons.css
# support for CardBook, yellow stars, creation from emails, formatting email fields
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbook.xul
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookContexts.xul
# support for CardBook menu in composition window
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/ovl_cardbookComposeMsg.xul
# support for collected mail
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/collected/ovl_collected.xul
# support for expanding list
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/lists/ovl_list.xul
# support for search engines
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/filters/ovl_filters.xul
# support for filter messages
overlay chrome://messenger/content/FilterEditor.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/SearchDialog.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/mailViewSetup.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
overlay chrome://messenger/content/virtualFolderProperties.xul chrome://cardbook/content/filters/ovl_filterEditor.xul
# support for Lightning attendees
overlay chrome://calendar/content/calendar-event-dialog-attendees.xul chrome://cardbook/content/lightning/ovl_lightningAttendees.xul
overlay chrome://lightning/content/lightning-menus.xul chrome://cardbook/content/lightning/ovl_lightningMenus.xul
# support for birthdays
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/birthdays/ovl_birthdays.xul
# support for importing attachments
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/attachments/ovl_attachments.xul
# support for attaching a vCard
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/attachvCard/ovl_attachvCard.xul
# support for CardBook Tab
overlay chrome://messenger/content/messenger.xul chrome://cardbook/content/ovl_cardbookTab.xul
# support for Contacts sidebar
overlay chrome://messenger/content/messengercompose/messengercompose.xul chrome://cardbook/content/contactsSidebar/ovl_cardbookContactsSidebarMain.xul
# support for the message window
overlay chrome://messenger/content/messageWindow.xul chrome://cardbook/content/ovl_cardbookContexts.xul
if ("undefined" == typeof(wdw_addressbooksAdd)) {
var wdw_addressbooksAdd = {
gType : "",
gTypeFile : "",
gFile : {},
gCardDAVURLs : [],
gFinishParams : [],
gValidateURL : false,
gValidateDescription : "Validation module",
gStandardAddressbooks : [],
gSearchDefinition : {},
initSearchDefinition: function () {
if (cardbookRepository.cardbookComplexSearch[window.arguments[0].searchId]) {
wdw_addressbooksAdd.gSearchDefinition['searchAB'] = cardbookRepository.cardbookComplexSearch[window.arguments[0].searchId].searchAB;
wdw_addressbooksAdd.gSearchDefinition['matchAll'] = cardbookRepository.cardbookComplexSearch[window.arguments[0].searchId].matchAll;
wdw_addressbooksAdd.gSearchDefinition['rules'] = JSON.parse(JSON.stringify(cardbookRepository.cardbookComplexSearch[window.arguments[0].searchId].rules));
} else {
wdw_addressbooksAdd.gSearchDefinition['searchAB'] = true;
wdw_addressbooksAdd.gSearchDefinition['matchAll'] = 'and';
wdw_addressbooksAdd.gSearchDefinition['rules'] = [["","","",""]];
}
},
loadWizard: function () {
Components.utils.import("chrome://cardbook/content/cardbookRepository.js");
if (window.arguments[0].action == "first") {
wdw_addressbooksAdd.gType = "STANDARD";
wdw_addressbooksAdd.loadStandardAddressBooks();
document.getElementById('addressbook-wizard').goTo("welcomePage");
} else if (window.arguments[0].action == "search") {
wdw_addressbooksAdd.initSearchDefinition();
document.getElementById('addressbook-wizard').goTo("searchPage");
} else {
document.getElementById('addressbook-wizard').goTo("initialPage");
}
},
loadStandardAddressBooks: function () {
wdw_addressbooksAdd.gStandardAddressbooks = [];
var contactManager = Components.classes["@mozilla.org/abmanager;1"].getService(Components.interfaces.nsIAbManager);
var contacts = contactManager.directories;
while ( contacts.hasMoreElements() ) {
var contact = contacts.getNext().QueryInterface(Components.interfaces.nsIAbDirectory);
if (contact.dirPrefId == "ldap_2.servers.history" && window.arguments[0].action == "first") {
wdw_addressbooksAdd.gStandardAddressbooks.push([contact.dirPrefId, contact.dirName, true]);
} else {
wdw_addressbooksAdd.gStandardAddressbooks.push([contact.dirPrefId, contact.dirName, false]);
}
}
},
checkRequired: function () {
var canAdvance = true;
var curPage = document.getElementById('addressbook-wizard').currentPage;
if (curPage) {
let eList = curPage.getElementsByAttribute('required', 'true');
for (let i = 0; i < eList.length && canAdvance; ++i) {
canAdvance = (eList[i].value != "");
}
document.getElementById('addressbook-wizard').canAdvance = canAdvance;
}
},
checkUrlLinesRequired: function () {
var myArray = [];
for (var rootUrl in cardbookRepository.cardbookServerValidation) {
for (var url in cardbookRepository.cardbookServerValidation[rootUrl]) {
if (url == "length") {
continue;
}
myArray.push([cardbookRepository.cardbookServerValidation[rootUrl][url].displayName]);
}
}
wdw_addressbooksAdd.checkLinesRequired(myArray);
},
checkStandardLinesRequired: function () {
wdw_addressbooksAdd.checkLinesRequired(wdw_addressbooksAdd.gStandardAddressbooks);
},
checkLinesRequired: function (aArray) {
var canAdvance = true;
var oneChecked = false;
for (var i = 0; i < aArray.length; i++) {
if (document.getElementById('namesCheckbox' + aArray[i][0])) {
var aCheckbox = document.getElementById('namesCheckbox' + aArray[i][0]);
var aAddressbookName = document.getElementById('namesTextbox' + aArray[i][0]);
if (aCheckbox.checked) {
oneChecked = true;
if (aAddressbookName.value == "") {
canAdvance = false;
break;
}
}
} else {
break;
}
}
document.getElementById('addressbook-wizard').canAdvance = (canAdvance && oneChecked);
},
initialAdvance: function () {
var type = document.getElementById('addressbookType').selectedItem.value;
var page = document.getElementsByAttribute('pageid', 'initialPage')[0];
if (type == 'local') {
page.next = 'localPage';
} else if (type == 'remote') {
page.next = 'remotePage';
} else if (type == 'standard') {
wdw_addressbooksAdd.gType = "STANDARD";
wdw_addressbooksAdd.loadStandardAddressBooks();
page.next = 'namesPage';
} else if (type == 'search') {
wdw_addressbooksAdd.initSearchDefinition();
page.next = 'searchPage';
}
},
localPageTypeSelect: function () {
document.getElementById('localPageURI').value = "";
var type = document.getElementById('localPageType').selectedItem.value;
if (type == "createDB") {
document.getElementById('localPageURI').setAttribute('required', 'false');
document.getElementById('localPageURILabel').setAttribute('disabled', 'true');
document.getElementById('localPageURI').setAttribute('disabled', 'true');
document.getElementById('localPageURIButton').setAttribute('disabled', 'true');
} else {
document.getElementById('localPageURI').setAttribute('required', 'true');
document.getElementById('localPageURILabel').setAttribute('disabled', 'false');
document.getElementById('localPageURI').setAttribute('disabled', 'false');
document.getElementById('localPageURIButton').setAttribute('disabled', 'false');
}
wdw_addressbooksAdd.checkRequired();
},
localPageTypeAdvance: function () {
var type = document.getElementById('localPageType').selectedItem.value;
switch(type) {
case "createDB":
wdw_addressbooksAdd.gType = "LOCALDB";
break;
case "createDirectory":
wdw_addressbooksAdd.gType = "DIRECTORY";
wdw_addressbooksAdd.gTypeFile = "CREATEDIRECTORY";
break;
case "createFile":
wdw_addressbooksAdd.gType = "FILE";
wdw_addressbooksAdd.gTypeFile = "CREATEFILE";
break;
case "openDirectory":
wdw_addressbooksAdd.gType = "DIRECTORY";
wdw_addressbooksAdd.gTypeFile = "OPENDIRECTORY";
break;
case "openFile":
wdw_addressbooksAdd.gType = "FILE";
wdw_addressbooksAdd.gTypeFile = "OPENFILE";
break;
}
var page = document.getElementsByAttribute('pageid', 'localPage')[0];
page.next = 'namePage';
},
searchFile: function () {
cardbookNotifications.setNotification("localPageURINotifications", "OK");
var type = document.getElementById('localPageType').selectedItem.value;
switch(type) {
case "createDirectory":
case "openDirectory":
case "standard":
cardbookUtils.callDirPicker("dirChooseTitle", wdw_addressbooksAdd.checkFile);
break;
case "createFile":
cardbookUtils.callFilePicker("fileCreationTitle", "SAVE", "VCF", "", wdw_addressbooksAdd.checkFile);
break;
case "openFile":
cardbookUtils.callFilePicker("fileSelectionTitle", "OPEN", "VCF", "", wdw_addressbooksAdd.checkFile);
break;
}
},
checkFile: function (aFile) {
var myTextbox = document.getElementById('localPageURI');
var type = document.getElementById('localPageType').selectedItem.value;
if (aFile != null && aFile !== undefined && aFile != "") {
if (type == 'openFile' || type == 'createFile') {
if (cardbookUtils.isFileAlreadyOpen(aFile.path)) {
cardbookNotifications.setNotification("localPageURINotifications", "fileAlreadyOpen", aFile.path);
} else {
myTextbox.value = aFile.path;
wdw_addressbooksAdd.gFile = aFile;
}
} else {
if (cardbookUtils.isDirectoryAlreadyOpen(aFile.path)) {
cardbookNotifications.setNotification("localPageURINotifications", "directoryAlreadyOpen", aFile.path);
} else {
myTextbox.value = aFile.path;
wdw_addressbooksAdd.gFile = aFile;
}
}
}
wdw_addressbooksAdd.checkRequired();
},
checklocationNetwork: function () {
var canValidate = true;
var curPage = document.getElementById('addressbook-wizard').currentPage;
if (curPage) {
if (wdw_addressbooksAdd.gValidateURL) {
document.getElementById('addressbook-wizard').canAdvance = wdw_addressbooksAdd.gValidateURL;
document.getElementById('validateButton').disabled = !wdw_addressbooksAdd.gValidateURL;
} else {
document.getElementById('addressbook-wizard').canAdvance = wdw_addressbooksAdd.gValidateURL;
let eList = curPage.getElementsByAttribute('required', 'true');
for (let i = 0; i < eList.length && canValidate; ++i) {
canValidate = (eList[i].value != "");
}
document.getElementById('validateButton').disabled = !canValidate;
}
}
},
remotePageTypeSelect: function () {
wdw_addressbooksAdd.gValidateURL = false;
document.getElementById('remotePageURI').value = "";
document.getElementById('remotePageUsername').value = "";
document.getElementById('remotePagePassword').value = "";
var type = document.getElementById('remotePageType').selectedItem.value;
if (type == 'GOOGLE') {
document.getElementById('remotePageUriLabel').disabled=true;
document.getElementById('remotePageURI').disabled=true;
document.getElementById('remotePageURI').setAttribute('required', 'false');
document.getElementById('remotePagePasswordLabel').disabled=true;
document.getElementById('remotePagePassword').disabled=true;
document.getElementById('remotePagePassword').setAttribute('required', 'false');
document.getElementById('passwordCheckBox').disabled=true;
} else if (type == 'APPLE') {
document.getElementById('remotePageUriLabel').disabled=true;
document.getElementById('remotePageURI').disabled=true;
document.getElementById('remotePageURI').setAttribute('required', 'false');
document.getElementById('remotePagePasswordLabel').disabled=false;
document.getElementById('remotePagePassword').disabled=false;
document.getElementById('remotePagePassword').setAttribute('required', 'true');
document.getElementById('passwordCheckBox').disabled=false;
} else {
document.getElementById('remotePageUriLabel').disabled=false;
document.getElementById('remotePageURI').disabled=false;
document.getElementById('remotePageURI').setAttribute('required', 'true');
document.getElementById('remotePagePasswordLabel').disabled=false;
document.getElementById('remotePagePassword').disabled=false;
document.getElementById('remotePagePassword').setAttribute('required', 'true');
document.getElementById('passwordCheckBox').disabled=false;
}
wdw_addressbooksAdd.checklocationNetwork();
cardbookNotifications.setNotification("resultNotifications", "OK");
},
remotePageTextboxInput: function () {
wdw_addressbooksAdd.gValidateURL = false;
wdw_addressbooksAdd.checklocationNetwork();
cardbookNotifications.setNotification("resultNotifications", "OK");
},
remotePageTypeAdvance: function () {
wdw_addressbooksAdd.gType = document.getElementById('remotePageType').selectedItem.value;
},
constructComplexSearch: function () {
cardbookElementTools.loadAddressBooks("addressbookMenupopup", "addressbookMenulist", wdw_addressbooksAdd.gSearchDefinition.searchAB, true, true, true, false);
cardbookComplexSearch.loadMatchAll(wdw_addressbooksAdd.gSearchDefinition.matchAll);
cardbookComplexSearch.constructDynamicRows("searchTerms", wdw_addressbooksAdd.gSearchDefinition.rules, "3.0");
document.getElementById('searchTerms_0_valueBox').focus();
},
checkSearch: function () {
wdw_addressbooksAdd.constructComplexSearch();
document.getElementById('addressbook-wizard').canAdvance = false;
function checkTerms() {
if (cardbookComplexSearch.getSearch() != "") {
document.getElementById('addressbook-wizard').canAdvance = true;
} else {
document.getElementById('addressbook-wizard').canAdvance = false;
}
};
checkTerms();
document.getElementById('searchTerms').addEventListener("input", checkTerms, false);
document.getElementById('searchTerms').addEventListener("command", checkTerms, false);
document.getElementById('searchTerms').addEventListener("click", checkTerms, false);
},
searchPageAdvance: function () {
wdw_addressbooksAdd.gType = "SEARCH";
wdw_addressbooksAdd.gTypeFile = cardbookComplexSearch.getSearch();
var relative = wdw_addressbooksAdd.gTypeFile.match("^searchAB:([^:]*):searchAll:([^:]*)(.*)");
wdw_addressbooksAdd.gSearchDefinition.searchAB = relative[1];
if (relative[2] == "true") {
wdw_addressbooksAdd.gSearchDefinition.matchAll = true;
} else {
wdw_addressbooksAdd.gSearchDefinition.matchAll = false;
}
var tmpRuleArray = relative[3].split(/:case:/);
wdw_addressbooksAdd.gSearchDefinition.rules = [];
for (var i = 1; i < tmpRuleArray.length; i++) {
var relative = tmpRuleArray[i].match("([^:]*):field:([^:]*):term:([^:]*):value:([^:]*)");
wdw_addressbooksAdd.gSearchDefinition.rules.push([relative[1], relative[2], relative[3], relative[4]]);
}
},
showPassword: function () {
var passwordType = document.getElementById('remotePagePassword').type;
if (passwordType != "password") {
document.getElementById('remotePagePassword').type = "password";
} else {
document.getElementById('remotePagePassword').type = "";
}
},
vCardHidingMenu: function (aMenu) {
var myId = aMenu.id.replace('vCardVersionPageName', '');
if (document.getElementById(aMenu.id).selectedItem.value == "3.0") {
cardbookElementTools.loadDateFormats('dateFormatMenuPopup' + myId, 'dateFormatMenuList' + myId, "YYYY-MM-DD");
} else {
cardbookElementTools.loadDateFormats('dateFormatMenuPopup' + myId, 'dateFormatMenuList' + myId, "YYYYMMDD");
}
},
decodeURL: function (aURL) {
var relative = aURL.match("(https?)(://[^/]*)/([^#?]*)");
if (relative && relative[3]) {
var relativeHrefArray = [];
relativeHrefArray = relative[3].split("/");
for (var i = 0; i < relativeHrefArray.length; i++) {
relativeHrefArray[i] = decodeURIComponent(relativeHrefArray[i]);
}
return relative[1] + relative[2] + "/" + relativeHrefArray.join("/");
} else {
return aURL;
}
},
validateURL: function () {
document.getElementById('addressbook-wizard').canAdvance = false;
document.getElementById('remotePageURI').value = wdw_addressbooksAdd.decodeURL(document.getElementById('remotePageURI').value.trim());
document.getElementById('validateButton').disabled = true;
var type = document.getElementById('remotePageType').selectedItem.value;
var username = document.getElementById('remotePageUsername').value;
var password = document.getElementById('remotePagePassword').value;
if (type == 'GOOGLE') {
var url = cardbookRepository.cardbookgdata.GOOGLE_API;
} else if (type == 'APPLE') {
var url = cardbookRepository.APPLE_API;
wdw_addressbooksAdd.gCardDAVURLs.push([cardbookSynchronization.getSlashedUrl(url), true]); // [url, discovery]
} else {
var url = document.getElementById('remotePageURI').value;
if (cardbookSynchronization.getRootUrl(url) == "") {
cardbookNotifications.setNotification("resultNotifications", "ValidatingURLFailedLabel");
return;
}
wdw_addressbooksAdd.gCardDAVURLs.push([url, false]); // [url, discovery]
wdw_addressbooksAdd.gCardDAVURLs.push([cardbookSynchronization.getWellKnownUrl(url), true]);
var carddavURL = cardbookSynchronization.getCardDAVUrl(url, username);
if (carddavURL != "") {
wdw_addressbooksAdd.gCardDAVURLs.push([carddavURL, false]);
}
}
var dirPrefId = cardbookUtils.getUUID();
if (type == 'GOOGLE') {
cardbookNotifications.setNotification("resultNotifications", "ValidatingLabel", url, "PRIORITY_INFO_MEDIUM");
cardbookSynchronization.initRefreshToken(dirPrefId);
cardbookRepository.cardbookServerSyncRequest[dirPrefId]++;
var connection = {connUser: username, connPrefId: dirPrefId, connDescription: wdw_addressbooksAdd.gValidateDescription};
cardbookSynchronization.requestNewRefreshToken(connection);
wdw_addressbooksAdd.waitForRefreshTokenFinished(dirPrefId, url);
} else {
wdw_addressbooksAdd.validateCardDAVURL(dirPrefId, cardbookSynchronization.getRootUrl(url), username, password, type);
}
},
validateCardDAVURL: function (aDirPrefId, aUrl, aUsername, aPassword, aType) {
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.setId(aDirPrefId);
cardbookPrefService.setUrl(aUrl);
cardbookPasswordManager.removeAccount(aUsername, aUrl);
cardbookPasswordManager.addAccount(aUsername, aUrl, aPassword);
if (wdw_addressbooksAdd.gCardDAVURLs.length > 0) {
cardbookNotifications.setNotification("resultNotifications", "ValidatingLabel",