Commit 4a5c44fc authored by CardBook's avatar CardBook

pre version 24.3

parent 5801f680
......@@ -12,6 +12,7 @@ locale cardbook fr chrome/locale/fr/
locale cardbook hr chrome/locale/hr/
locale cardbook hu chrome/locale/hu/
locale cardbook it chrome/locale/it/
locale cardbook lt chrome/locale/lt/
locale cardbook nl chrome/locale/nl/
locale cardbook pl chrome/locale/pl/
locale cardbook pt-PT chrome/locale/pt-PT/
......
......@@ -392,9 +392,8 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
},
validateCardDAVURL: function (aDirPrefId, aUsername, aPassword, aType) {
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.setId(aDirPrefId);
cardbookPrefService.setUrl(wdw_addressbooksAdd.gCardDAVURLs[0][0]);
cardbookPreferences.setId(aDirPrefId, aDirPrefId);
cardbookPreferences.setUrl(aDirPrefId, wdw_addressbooksAdd.gCardDAVURLs[0][0]);
cardbookPasswordManager.removeAccount(aUsername, wdw_addressbooksAdd.gCardDAVURLs[0][0]);
cardbookPasswordManager.addAccount(aUsername, wdw_addressbooksAdd.gCardDAVURLs[0][0], aPassword);
......@@ -424,8 +423,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(wdw_addressbooksAdd.gValidateDescription + " : debug mode : cardbookRepository.cardbookServerDiscoveryError : ", cardbookRepository.cardbookServerDiscoveryError[aDirPrefId]);
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(wdw_addressbooksAdd.gValidateDescription + " : debug mode : cardbookRepository.cardbookServerValidation : ", cardbookRepository.cardbookServerValidation[aDirPrefId]);
if (cardbookRepository.cardbookServerDiscoveryError[aDirPrefId] >= 1) {
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.delBranch();
cardbookPreferences.delBranch(aDirPrefId);
wdw_addressbooksAdd.gCardDAVURLs.shift();
if (cardbookRepository.cardbookServerValidation[aDirPrefId] && cardbookRepository.cardbookServerValidation[aDirPrefId].length == 0) {
cardbookSynchronization.finishMultipleOperations(aDirPrefId);
......@@ -449,8 +447,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
} else if (cardbookRepository.cardbookServerDiscoveryRequest[aDirPrefId] !== cardbookRepository.cardbookServerDiscoveryResponse[aDirPrefId] || cardbookRepository.cardbookServerDiscoveryResponse[aDirPrefId] === 0) {
cardbookNotifications.setNotification("resultNotifications", "ValidatingLabel", wdw_addressbooksAdd.gCardDAVURLs[0][0], "PRIORITY_INFO_MEDIUM");
} else {
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.delBranch();
cardbookPreferences.delBranch(aDirPrefId);
wdw_addressbooksAdd.gCardDAVURLs.shift();
if (cardbookRepository.cardbookServerValidation[aDirPrefId] && cardbookRepository.cardbookServerValidation[aDirPrefId].length == 0) {
cardbookSynchronization.finishMultipleOperations(aDirPrefId);
......@@ -524,8 +521,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
document.getElementById('readonlyRow').setAttribute('hidden', 'true');
document.getElementById('urnuuidRow').setAttribute('hidden', 'true');
if (window.arguments[0].dirPrefId != null && window.arguments[0].dirPrefId !== undefined && window.arguments[0].dirPrefId != "") {
var cardbookPrefService = new cardbookPreferenceService(window.arguments[0].dirPrefId);
aTextbox.value = cardbookPrefService.getName();
aTextbox.value = cardbookPreferences.getName(window.arguments[0].dirPrefId);
}
} else {
document.getElementById('colorRow').removeAttribute('hidden');
......@@ -729,12 +725,11 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var name = document.getElementById('namePageName').value;
var color = document.getElementById('serverColorInput').value;
var vCardVersion = document.getElementById('vCardVersionPageName').value;
var dirPrefId = cardbookUtils.getUUID();
if (window.arguments[0].dirPrefId != null && window.arguments[0].dirPrefId !== undefined && window.arguments[0].dirPrefId != "") {
dirPrefId = window.arguments[0].dirPrefId;
var cardbookPrefService = new cardbookPreferenceService(window.arguments[0].dirPrefId);
var enabled = cardbookPrefService.getEnabled();
var dirPrefId = window.arguments[0].dirPrefId;
var enabled = cardbookPreferences.getEnabled(window.arguments[0].dirPrefId);
} else {
var dirPrefId = cardbookUtils.getUUID();
var enabled = true;
}
wdw_addressbooksAdd.gFinishParams.push({searchDef: wdw_addressbooksAdd.gTypeFile, name: name, username: "", color: color, vcard: vCardVersion, enabled: enabled, dirPrefId: dirPrefId, DBcached: false, firstAction: false});
......@@ -855,8 +850,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
createAddressbook: function () {
for (var i = 0; i < wdw_addressbooksAdd.gFinishParams.length; i++) {
let cardbookPrefService = new cardbookPreferenceService(wdw_addressbooksAdd.gFinishParams[i].dirPrefId);
if (cardbookPrefService.getType() === "SEARCH" && wdw_addressbooksAdd.gType === "SEARCH") {
if (cardbookPreferences.getType(wdw_addressbooksAdd.gFinishParams[i].dirPrefId) === "SEARCH" && wdw_addressbooksAdd.gType === "SEARCH") {
wdw_cardbook.modifySearchAddressbook(wdw_addressbooksAdd.gFinishParams[i].dirPrefId, wdw_addressbooksAdd.gFinishParams[i].name, wdw_addressbooksAdd.gFinishParams[i].color, wdw_addressbooksAdd.gFinishParams[i].vcard, wdw_addressbooksAdd.gFinishParams[i].readonly,
wdw_addressbooksAdd.gFinishParams[i].dateFormat, wdw_addressbooksAdd.gFinishParams[i].urnuuid, wdw_addressbooksAdd.gFinishParams[i].searchDef);
return;
......@@ -906,8 +900,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
// if the first proposed import of standard address books is finished OK
// then set CardBook as exclusive
if (wdw_addressbooksAdd.gFinishParams[i].firstAction) {
var prefs = Services.prefs;
prefs.setBoolPref("extensions.cardbook.exclusive", true);
cardbookPreferences.setBoolPref("extensions.cardbook.exclusive", true);
}
}
} else if (wdw_addressbooksAdd.gType === "LOCALDB") {
......
......@@ -5,11 +5,10 @@ if ("undefined" == typeof(ovl_attachvCard)) {
var ovl_attachvCard = {
attachvCard: function () {
var cardbookPrefService = new cardbookPreferenceService();
var selected = document.getElementById("msgIdentity").selectedItem;
var key = selected.getAttribute("identitykey");
var result = [];
result = cardbookPrefService.getAllVCards();
result = cardbookPreferences.getAllVCards();
for (var i = 0; i < result.length; i++) {
var resultArray = result[i].split("::");
if (resultArray[0] == "true") {
......
......@@ -118,9 +118,8 @@ if ("undefined" == typeof(cardbookAutocomplete)) {
var OSName="LINUX";
}
cardbookAutocomplete.defineMsgIconsRules();
var prefs = Services.prefs;
var autocompleteWithColor = prefs.getBoolPref("extensions.cardbook.autocompleteWithColor");
var useColor = prefs.getComplexValue("extensions.cardbook.useColor", Components.interfaces.nsISupportsString).data;
var autocompleteWithColor = cardbookPreferences.getBoolPref("extensions.cardbook.autocompleteWithColor");
var useColor = cardbookPreferences.getStringPref("extensions.cardbook.useColor");
if (useColor == "text") {
var colorProperty = "color";
var treeCellProperty="-moz-tree-cell-text";
......@@ -138,8 +137,7 @@ if ("undefined" == typeof(cardbookAutocomplete)) {
for (var i = 0; i < cardbookRepository.cardbookAccounts.length; i++) {
if (cardbookRepository.cardbookAccounts[i][1] && cardbookRepository.cardbookAccounts[i][5] && cardbookRepository.cardbookAccounts[i][6] != "SEARCH") {
var dirPrefId = cardbookRepository.cardbookAccounts[i][4];
var cardbookPrefService = new cardbookPreferenceService(dirPrefId);
var myColor = cardbookPrefService.getColor()
var myColor = cardbookPreferences.getColor(dirPrefId)
var myStyle = cardbookRepository.getIconType(cardbookRepository.cardbookAccounts[i][6]) + " color_" + dirPrefId;
cardbookAutocomplete.createCssMsgAccountRules(styleSheet, myStyle, myColor, OSName, autocompleteWithColor, treeCellProperty, colorProperty);
}
......@@ -154,13 +152,12 @@ if ("undefined" == typeof(cardbookAutocomplete)) {
setCompletion: function(aTextBox) {
try {
var prefs = Services.prefs;
if (prefs.getBoolPref("extensions.cardbook.autocompletion")) {
if (cardbookPreferences.getBoolPref("extensions.cardbook.autocompletion")) {
aTextBox.setAttribute('autocompletesearch', 'addrbook-cardbook');
} else {
aTextBox.setAttribute('autocompletesearch', 'addrbook ldap');
}
if (prefs.getBoolPref("extensions.cardbook.debugMode") || prefs.getBoolPref("extensions.cardbook.autocompleteShowAddressbook")) {
if (cardbookPreferences.getBoolPref("extensions.cardbook.debugMode") || cardbookPreferences.getBoolPref("extensions.cardbook.autocompleteShowAddressbook")) {
aTextBox.showCommentColumn = true;
} else {
aTextBox.showCommentColumn = false;
......
......@@ -24,7 +24,7 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
},
getCalendars: function () {
var myCalendar = cardbookBirthdaysUtils.getPref("extensions.cardbook.calendarsNameList");
var myCalendar = cardbookPreferences.getStringPref("extensions.cardbook.calendarsNameList");
var calendarManager = Components.classes["@mozilla.org/calendar/manager;1"].getService(Components.interfaces.calICalendarManager);
var lCalendars = calendarManager.getCalendars({});
......@@ -36,7 +36,7 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
},
syncWithLightning: function () {
var maxDaysUntilNextBirthday = cardbookBirthdaysUtils.getPref("extensions.cardbook.numberOfDaysForWriting");
var maxDaysUntilNextBirthday = cardbookPreferences.getStringPref("extensions.cardbook.numberOfDaysForWriting");
cardbookBirthdaysUtils.loadBirthdays(maxDaysUntilNextBirthday);
cardbookBirthdaysUtils.getCalendars();
......@@ -123,7 +123,7 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
var lBirthdayId = cardbookUtils.getUUID();
var leventEntryTitle = cardbookBirthdaysUtils.getPref("extensions.cardbook.eventEntryTitle");
var leventEntryTitle = cardbookPreferences.getStringPref("extensions.cardbook.eventEntryTitle");
var checkTest = leventEntryTitle.split("%S").length - 1;
if (checkTest != 2) {
var lBirthdayTitle = strBundle.getFormattedString("eventEntryTitleMessage", [lBirthdayName, lBirthdayAge]);
......@@ -182,17 +182,17 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
var iCalString = "BEGIN:VCALENDAR\n";
iCalString += "BEGIN:VEVENT\n";
var calendarEntryCategories = cardbookBirthdaysUtils.getPref("extensions.cardbook.calendarEntryCategories");
var calendarEntryCategories = cardbookPreferences.getStringPref("extensions.cardbook.calendarEntryCategories");
if (calendarEntryCategories !== "") {
iCalString += "CATEGORIES:" + calendarEntryCategories + "\n";
}
var eventEntryWholeDay = cardbookBirthdaysUtils.getPref("extensions.cardbook.eventEntryWholeDay");
var eventEntryWholeDay = cardbookPreferences.getBoolPref("extensions.cardbook.eventEntryWholeDay");
if (eventEntryWholeDay) {
iCalString += "DTSTART:" + aDate + "\n";
iCalString += "DTEND:" + aNextDate + "\n";
} else {
var eventEntryTime = cardbookBirthdaysUtils.getPref("extensions.cardbook.eventEntryTime");
var eventEntryTime = cardbookPreferences.getStringPref("extensions.cardbook.eventEntryTime");
var EmptyParamRegExp1 = new RegExp("(.*)([^0-9])(.*)", "ig");
if (eventEntryTime.replace(EmptyParamRegExp1, "$1")!=eventEntryTime) {
var eventEntryTimeHour = eventEntryTime.replace(EmptyParamRegExp1, "$1");
......@@ -211,10 +211,13 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
iCalString += "DTEND:" + aDate + "T" + lBirthdayTimeString + "\n";
}
// set Alarm
var lcalendarEntryAlarm = parseInt(cardbookBirthdaysUtils.getPref("extensions.cardbook.calendarEntryAlarm"));
if (!isNaN(lcalendarEntryAlarm)) {
iCalString += "BEGIN:VALARM\nACTION:DISPLAY\nTRIGGER:-P" + lcalendarEntryAlarm + "D\nEND:VALARM\n";
// set Alarms
var lcalendarEntryAlarm = cardbookPreferences.getStringPref("extensions.cardbook.calendarEntryAlarm");
var lcalendarEntryAlarmArray = lcalendarEntryAlarm.split(',');
for (var i = 0; i < lcalendarEntryAlarmArray.length; i++) {
if (!isNaN(parseInt(lcalendarEntryAlarmArray[i]))) {
iCalString += "BEGIN:VALARM\nACTION:DISPLAY\nTRIGGER:-PT" + parseInt(lcalendarEntryAlarmArray[i]) + "H\nEND:VALARM\n";
}
}
// finalize iCalString
......@@ -250,16 +253,6 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
aCalendar2.addItem(event, addListener);
},
getPref: function (Name) {
var prefs = Services.prefs;
if (prefs.getPrefType(Name) == prefs.PREF_STRING){
var a = prefs.getComplexValue(Name, Components.interfaces.nsISupportsString).data;
return a;
} else if (prefs.getPrefType(Name) == prefs.PREF_BOOL){
return prefs.getBoolPref(Name);
}
},
daysBetween: function (date1, date2) {
// The number of milliseconds in one day
var oneDay = 1000 * 60 * 60 * 24
......@@ -331,9 +324,9 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
},
loadBirthdays: function (lnumberOfDays) {
var myContact = cardbookBirthdaysUtils.getPref("extensions.cardbook.addressBooksNameList");
var searchInNote = cardbookBirthdaysUtils.getPref("extensions.cardbook.searchInNote");
var useOnlyEmail = cardbookBirthdaysUtils.getPref("extensions.cardbook.useOnlyEmail");
var myContact = cardbookPreferences.getStringPref("extensions.cardbook.addressBooksNameList");
var searchInNote = cardbookPreferences.getBoolPref("extensions.cardbook.searchInNote");
var useOnlyEmail = cardbookPreferences.getBoolPref("extensions.cardbook.useOnlyEmail");
var strBundle = document.getElementById("cardbook-strings");
var eventInNoteEventPrefix = strBundle.getString("eventInNoteEventPrefix");
var deathSuffix = strBundle.getString("deathSuffix");
......@@ -343,8 +336,7 @@ if ("undefined" == typeof(cardbookBirthdaysUtils)) {
var myCard = cardbookRepository.cardbookCards[i];
var myDirPrefId = myCard.dirPrefId;
if (myContact.includes(myDirPrefId) || myContact === "allAddressBooks") {
var cardbookPrefService = new cardbookPreferenceService(myDirPrefId);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(myDirPrefId);
var myDirPrefName = cardbookUtils.getPrefNameFromPrefId(myDirPrefId);
var myFieldList = ['bday' , 'anniversary', 'deathdate'];
for (var k = 0; k < myFieldList.length; k++) {
......
......@@ -6,8 +6,8 @@ if ("undefined" == typeof(ovl_birthdays)) {
lTimerPopup : null,
lPopupShowed : 0,
lEventTimerPopup : { notify: function(lTimerPopup) {
if (cardbookBirthdaysUtils.getPref("extensions.cardbook.showPeriodicPopup")) {
var popupTime = cardbookBirthdaysUtils.getPref("extensions.cardbook.periodicPopupIime");
if (cardbookPreferences.getBoolPref("extensions.cardbook.showPeriodicPopup")) {
var popupTime = cardbookPreferences.getStringPref("extensions.cardbook.periodicPopupIime");
var dateOfToday = new Date();
var dateOfTodayHour = (dateOfToday.getHours()<10?'0':'') + dateOfToday.getHours();
var dateOfTodayMin = (dateOfToday.getMinutes()<10?'0':'') + dateOfToday.getMinutes();
......@@ -38,11 +38,11 @@ if ("undefined" == typeof(ovl_birthdays)) {
} },
onLoad: function() {
if (cardbookBirthdaysUtils.getPref("extensions.cardbook.showPopupOnStartup")) {
if (cardbookPreferences.getBoolPref("extensions.cardbook.showPopupOnStartup")) {
ovl_birthdays.onShowPopup();
}
if (cardbookBirthdaysUtils.getPref("extensions.cardbook.syncWithLightningOnStartup")) {
if (cardbookPreferences.getBoolPref("extensions.cardbook.syncWithLightningOnStartup")) {
AddonManager.getAddonByID(cardbookRepository.LIGHTNING_ID, ovl_birthdays.displaySyncListAddon);
}
},
......@@ -66,9 +66,9 @@ if ("undefined" == typeof(ovl_birthdays)) {
},
onShowPopup: function() {
var maxDaysUntilNextBirthday = cardbookBirthdaysUtils.getPref("extensions.cardbook.numberOfDaysForSearching");
var maxDaysUntilNextBirthday = cardbookPreferences.getStringPref("extensions.cardbook.numberOfDaysForSearching");
cardbookBirthdaysUtils.loadBirthdays(maxDaysUntilNextBirthday);
var lshowPopupEvenIfNoBirthday = cardbookBirthdaysUtils.getPref("extensions.cardbook.showPopupEvenIfNoBirthday");
var lshowPopupEvenIfNoBirthday = cardbookPreferences.getBoolPref("extensions.cardbook.showPopupEvenIfNoBirthday");
if ((cardbookBirthdaysUtils.lBirthdayList.length>0) || lshowPopupEvenIfNoBirthday) {
ovl_birthdays.displayBirthdayList();
}
......
......@@ -9,6 +9,7 @@
<script src="chrome://cardbook/content/cardbookUtils.js"/>
<script src="chrome://cardbook/content/cardbookDates.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
<script src="chrome://cardbook/content/birthdays/cardbookBirthdaysUtils.js"/>
<script src="chrome://cardbook/content/birthdays/ovl_birthdays.js"/>
......
......@@ -58,8 +58,7 @@ if ("undefined" == typeof(wdw_birthdayList)) {
}
for (var i in cardbookBirthdaysUtils.lBirthdayAccountList) {
var dirPrefId = i;
var cardbookPrefService = new cardbookPreferenceService(dirPrefId);
var color = cardbookPrefService.getColor()
var color = cardbookPreferences.getColor(dirPrefId)
if (createSearchRules > 1) {
cardbookRepository.createCssCardRules(styleSheet, dirPrefId, color);
}
......@@ -73,7 +72,7 @@ if ("undefined" == typeof(wdw_birthdayList)) {
wdw_birthdayList.setupWindow();
var strBundle = document.getElementById("cardbook-strings");
var maxDaysUntilNextBirthday = cardbookBirthdaysUtils.getPref("extensions.cardbook.numberOfDaysForSearching");
var maxDaysUntilNextBirthday = cardbookPreferences.getStringPref("extensions.cardbook.numberOfDaysForSearching");
cardbookBirthdaysUtils.loadBirthdays(maxDaysUntilNextBirthday);
cardbookBirthdaysUtils.lBirthdayList = cardbookUtils.sortArrayByNumber(cardbookBirthdaysUtils.lBirthdayList,0,1);
wdw_birthdayList.loadCssRules();
......
......@@ -22,7 +22,7 @@ if ("undefined" == typeof(wdw_birthdaySync)) {
do_refresh: function () {
var strBundle = document.getElementById("cardbook-strings");
var maxDaysUntilNextBirthday = cardbookBirthdaysUtils.getPref("extensions.cardbook.numberOfDaysForWriting");
var maxDaysUntilNextBirthday = cardbookPreferences.getStringPref("extensions.cardbook.numberOfDaysForWriting");
// if there are no birthdays in the configured timespan
if (cardbookBirthdaysUtils.lBirthdayList.length == 0) {
......
......@@ -56,9 +56,8 @@ if ("undefined" == typeof(wdw_cardEdition)) {
}
} else if (aCard.version == "3.0") {
document.getElementById('kindTextBox').value = "";
var prefs = Services.prefs;
var kindCustom = prefs.getComplexValue("extensions.cardbook.kindCustom", Components.interfaces.nsISupportsString).data;
var memberCustom = prefs.getComplexValue("extensions.cardbook.memberCustom", Components.interfaces.nsISupportsString).data;
var kindCustom = cardbookPreferences.getStringPref("extensions.cardbook.kindCustom");
var memberCustom = cardbookPreferences.getStringPref("extensions.cardbook.memberCustom");
for (var i = 0; i < aCard.others.length; i++) {
var localDelim1 = aCard.others[i].indexOf(":",0);
if (localDelim1 >= 0) {
......@@ -412,8 +411,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
loadDefaultVersion: function () {
if (wdw_cardEdition.workingCard.version == "") {
var myDirPrefId = document.getElementById('addressbookMenulist').selectedItem.value;
var cardbookPrefService = new cardbookPreferenceService(myDirPrefId);
document.getElementById("versionTextBox").value = cardbookPrefService.getVCardVersion();
document.getElementById("versionTextBox").value = cardbookPreferences.getVCardVersion(myDirPrefId);
wdw_cardEdition.workingCard.version = document.getElementById("versionTextBox").value;
} else {
document.getElementById("versionTextBox").value = wdw_cardEdition.workingCard.version;
......@@ -517,8 +515,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
},
validateCalendarPanel: function (aValue, aType) {
var cardbookPrefService = new cardbookPreferenceService(document.getElementById('dirPrefIdTextBox').value);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(document.getElementById('dirPrefIdTextBox').value);
if (wdw_cardEdition.panel === 1) {
var myValue = cardbookDates.convertDateToDateString(aValue, dateFormat);
document.getElementById(aType + 'LightningPanel').hidePopup();
......@@ -599,8 +596,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
displayCard: function (aCard) {
wdw_cardEdition.clearCard();
var cardbookPrefService = new cardbookPreferenceService(aCard.dirPrefId);
var aReadOnly = cardbookPrefService.getReadOnly();
var aReadOnly = cardbookPreferences.getReadOnly(aCard.dirPrefId);
var aFollowLink = false;
cardbookUtils.displayCard(aCard, aReadOnly, aFollowLink);
......@@ -759,8 +755,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
},
loadDateFormatLabels: function () {
var cardbookPrefService = new cardbookPreferenceService(wdw_cardEdition.workingCard.dirPrefId);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(wdw_cardEdition.workingCard.dirPrefId);
var strBundle = document.getElementById("cardbook-strings");
myD = strBundle.getString("dateFormatsDLabel");
myM = strBundle.getString("dateFormatsMLabel");
......@@ -774,9 +769,8 @@ if ("undefined" == typeof(wdw_cardEdition)) {
},
showCorrectTabs: function () {
var prefs = Services.prefs;
document.getElementById('advancedTab').setAttribute("collapsed", !prefs.getBoolPref("extensions.cardbook.advancedTabView"));
document.getElementById('mailPopularityTab').setAttribute("collapsed", !prefs.getBoolPref("extensions.cardbook.mailPopularityTabView"));
document.getElementById('advancedTab').setAttribute("collapsed", !cardbookPreferences.getBoolPref("extensions.cardbook.advancedTabView"));
document.getElementById('mailPopularityTab').setAttribute("collapsed", !cardbookPreferences.getBoolPref("extensions.cardbook.mailPopularityTabView"));
},
load: function () {
......
......@@ -226,9 +226,8 @@ if ("undefined" == typeof(cardbookCardParser)) {
case "END":
break;
case "UID":
var cardbookPrefService = new cardbookPreferenceService(this.dirPrefId);
this.uid = vCardDataArrayTrailer.replace(/^urn:uuid:/i, "");
if (cardbookPrefService.getUrnuuid()) {
if (cardbookPreferences.getUrnuuid(this.dirPrefId)) {
this.uid = "urn:uuid:" + this.uid;
}
break;
......@@ -430,10 +429,8 @@ if ("undefined" == typeof(cardbookCardParser)) {
}
// for users that shares Thunderbird contacts between profiles, it's good to automatically record Thunderbird custom fields
if (vCardDataArrayHeader == "X-CUSTOM1" || vCardDataArrayHeader == "X-CUSTOM2" || vCardDataArrayHeader == "X-CUSTOM3" || vCardDataArrayHeader == "X-CUSTOM4") {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var customLabel = strBundle.GetStringFromName("customLabel");
var cardbookPrefService = new cardbookPreferenceService(this.dirPrefId);
var found = false
for (var i = 0; i < cardbookRepository.customFields['pers'].length; i++) {
if (cardbookRepository.customFields['pers'][i][0] == vCardDataArrayHeader) {
......@@ -442,7 +439,7 @@ if ("undefined" == typeof(cardbookCardParser)) {
}
}
if (!found) {
cardbookPrefService.setCustomFields('pers', cardbookRepository.customFields['pers'].length, vCardDataArrayHeader + ":" + customLabel + vCardDataArrayHeader.replace("X-CUSTOM", ""));
cardbookPreferences.setCustomFields('pers', cardbookRepository.customFields['pers'].length, vCardDataArrayHeader + ":" + customLabel + vCardDataArrayHeader.replace("X-CUSTOM", ""));
cardbookRepository.loadCustoms();
}
}
......
......@@ -21,8 +21,7 @@ if ("undefined" == typeof(cardbookDates)) {
if (aCard[aField] == "") {
return new Date(Date.UTC('666', '6', '6'));
} else {
var cardbookPrefService = new cardbookPreferenceService(aCard.dirPrefId);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(aCard.dirPrefId);
var myDate = cardbookDates.convertDateStringToDate(aCard[aField], dateFormat);
if (myDate == "WRONGDATE") {
return new Date(Date.UTC('666', '6', '6'));
......@@ -41,8 +40,7 @@ if ("undefined" == typeof(cardbookDates)) {
if (aCard[aField] == "") {
return "";
} else {
var cardbookPrefService = new cardbookPreferenceService(aCard.dirPrefId);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(aCard.dirPrefId);
return cardbookDates.getFormattedDateForDateString(aCard[aField], dateFormat);
}
}
......@@ -98,8 +96,7 @@ if ("undefined" == typeof(cardbookDates)) {
if (aCard.bday == "") {
return "";
} else {
var cardbookPrefService = new cardbookPreferenceService(aCard.dirPrefId);
var dateFormat = cardbookPrefService.getDateFormat();
var dateFormat = cardbookPreferences.getDateFormat(aCard.dirPrefId);
var lDateOfBirth = cardbookDates.convertDateStringToDate(aCard.bday, dateFormat);
if (lDateOfBirth == "WRONGDATE") {
return "?";
......@@ -382,8 +379,7 @@ if ("undefined" == typeof(cardbookDates)) {
},
convertAddressBookDate: function (aDirPrefId, aDirPrefName, aSourceDateFormat, aTargetDateFormat) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var eventInNoteEventPrefix = strBundle.GetStringFromName("eventInNoteEventPrefix");
for (i in cardbookRepository.cardbookCards) {
var myCard = cardbookRepository.cardbookCards[i];
......
......@@ -8,8 +8,7 @@ if ("undefined" == typeof(cardbookDiscovery)) {
startDiscovery: function () {
var allURLs = [];
var cardbookPrefService = new cardbookPreferenceService();
allURLs = cardbookPrefService.getURLs();
allURLs = cardbookPreferences.getURLs();
if (allURLs.length == 0) {
cardbookRepository.cardbookSyncMode = "NOSYNC";
......@@ -55,9 +54,8 @@ if ("undefined" == typeof(cardbookDiscovery)) {
continue;
}
for (var i = 0; i < myCurrentAccounts.length; i++) {
var cardbookPrefService = new cardbookPreferenceService(myCurrentAccounts[i][4]);
var myCurrentUrl = cardbookPrefService.getUrl();
var myCurrentUser = cardbookPrefService.getUser();
var myCurrentUrl = cardbookPreferences.getUrl(myCurrentAccounts[i][4]);
var myCurrentUser = cardbookPreferences.getUser(myCurrentAccounts[i][4]);
if ((myCurrentUser == cardbookRepository.cardbookServerValidation[dirPrefId].user) && (myCurrentUrl == cardbookUtils.decodeURL(url))) {
cardbookRepository.cardbookServerValidation[dirPrefId].length--;
cardbookRepository.cardbookServerValidation[dirPrefId][url].forget = true;
......@@ -76,9 +74,8 @@ if ("undefined" == typeof(cardbookDiscovery)) {
var myCurrentAccountsNotFound = [];
myCurrentAccountsNotFound = myCurrentAccounts.filter(onlyCardDAV);
for (var i = 0; i < myCurrentAccountsNotFound.length; i++) {
var cardbookPrefService = new cardbookPreferenceService(myCurrentAccountsNotFound[i][4]);
var myCurrentUrl = cardbookPrefService.getUrl();
var myCurrentUser = cardbookPrefService.getUser();
var myCurrentUrl = cardbookPreferences.getUrl(myCurrentAccountsNotFound[i][4]);
var myCurrentUser = cardbookPreferences.getUser(myCurrentAccountsNotFound[i][4]);
var myCurrentShortUrl = cardbookSynchronization.getShortUrl(myCurrentUrl);
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
for (var url in cardbookRepository.cardbookServerValidation[dirPrefId]) {
......@@ -111,13 +108,11 @@ if ("undefined" == typeof(cardbookDiscovery)) {
// no need to set the sync mode for removing deleted CARDDAV account
removeAddressbook: function (aDirPrefId, aSource) {
try {
var cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
var myDirPrefIdName = cardbookPrefService.getName();
var myDirPrefUrl = cardbookPrefService.getUrl();
var myDirPrefIdType = cardbookPrefService.getType();
var myDirPrefIdName = cardbookPreferences.getName(aDirPrefId);
var myDirPrefUrl = cardbookPreferences.getUrl(aDirPrefId);
var myDirPrefIdType = cardbookPreferences.getType(aDirPrefId);
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var prompts = Services.prompt;
var confirmTitle = strBundle.GetStringFromName("confirmTitle");
var confirmMsg = strBundle.formatStringFromName("accountDeletionDiscoveryConfirmMessage", [myDirPrefIdName], 1);
......@@ -128,8 +123,7 @@ if ("undefined" == typeof(cardbookDiscovery)) {
cardbookRepository.removeAccountFromRepository(aDirPrefId);
// cannot be launched from cardbookRepository
cardbookIndexedDB.removeAccount(aDirPrefId, myDirPrefIdName);
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.delBranch();
cardbookPreferences.delBranch(aDirPrefId);
wdw_cardbook.loadCssRules();
cardbookUtils.formatStringForOutput("addressbookClosed", [myDirPrefIdName]);
wdw_cardbooklog.addActivity("addressbookClosed", [myDirPrefIdName], "deleteMail");
......
......@@ -86,8 +86,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
},
loadAccountsOrCatsTreeMenu: function (aPopupName, aMenuName, aDefaultId) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var myPopup = document.getElementById(aPopupName);
cardbookElementTools.deleteRows(aPopupName);
var defaultIndex = 0;
......@@ -108,8 +107,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
},
loadInclExcl: function (aPopupName, aMenuName, aDefaultId) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var myPopup = document.getElementById(aPopupName);
cardbookElementTools.deleteRows(aPopupName);
var defaultIndex = 0;
......@@ -134,8 +132,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
var defaultIndex = 0;
var j = 0;
var myResult = [["", ""]];
var cardbookPrefService = new cardbookPreferenceService();
myResult = myResult.concat(cardbookPrefService.getAllTypesByType("gender"));
myResult = myResult.concat(cardbookPreferences.getAllTypesByType("gender"));
for (var i = 0; i < myResult.length; i++) {
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", myResult[i][1]);
......@@ -155,8 +152,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
var defaultIndex = 0;
var j = 0;
if (aAddAllMailAccounts) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", strBundle.GetStringFromName("allMailAccounts"));
menuItem.setAttribute("value", "allMailAccounts");
......@@ -203,8 +199,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
var defaultIndex = 0;
var j = 0;
if (aAddAllABs) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://messenger/locale/addressbook/addressBook.properties");
var strBundle = Services.strings.createBundle("chrome://messenger/locale/addressbook/addressBook.properties");
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", strBundle.GetStringFromName("allAddressBooks"));
menuItem.setAttribute("value", "allAddressBooks");
......@@ -278,8 +273,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
}
if (!(aInclRestrictionList && aInclRestrictionList[aDefaultPrefId])) {
if (aAddAllCats) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", strBundle.GetStringFromName("allCategories"));
menuItem.setAttribute("value", "allCategories");
......@@ -290,8 +284,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
j++;
}
if (aAddOnlyCats) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", strBundle.GetStringFromName("onlyCategories"));
menuItem.setAttribute("value", "onlyCategories");
......@@ -302,8 +295,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
j++;
}
if (aAddNoCats) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var menuItem = document.createElement("menuitem");
menuItem.setAttribute("label", strBundle.GetStringFromName("noCategory"));
menuItem.setAttribute("value", "noCategory");
......@@ -368,8 +360,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
},
loadDateFormats: function (aPopupName, aMenuName, aDefaultValue) {
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var strBundle = Services.strings.createBundle("chrome://cardbook/locale/cardbook.properties");
var myPopup = document.getElementById(aPopupName);
cardbookElementTools.deleteRows(aPopupName);
var defaultIndex = 0;
......@@ -595,8 +586,7 @@ if ("undefined" == typeof(cardbookElementTools)) {
aMenulist.appendChild(aMenupopup);
aMenupopup.setAttribute('id', aType + '_' + aIndex + '_menupopupTerm');
cardbookElementTools.deleteRows(aMenupopup.id);
var stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://messenger/locale/search-operators.properties");
var strBundle = Services.strings.createBundle("chrome://messenger/locale/search-operators.properties");
var found = false;
var operators = ['Contains', 'DoesntContain', 'Is', 'Isnt', 'BeginsWith', 'EndsWith', 'IsEmpty', 'IsntEmpty']
for (var i = 0; i < operators.length; i++) {
......
......@@ -5,7 +5,7 @@ if ("undefined" == typeof(cardbookObserver)) {
registerAll: function(aPrefObserver) {
aPrefObserver.branch = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("extensions.cardbook.");
if (!("addObserver" in aPrefObserver.branch)) {
aPrefObserver.branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
aPrefObserver.branch.QueryInterface(Components.interfaces.nsIPrefBranch);
}
aPrefObserver.branch.addObserver("", aPrefObserver, false);
},
......
......@@ -20,8 +20,7 @@ if ("undefined" == typeof(cardbookPasswordManager)) {
},
getNotNullPassword: function (aUsername, aPrefId) {
var cardbookPrefService = new cardbookPreferenceService(aPrefId);
var myUrl = cardbookPrefService.getUrl();
var myUrl = cardbookPreferences.getUrl(aPrefId);
var result = cardbookPasswordManager.getPassword(aUsername, myUrl);
if (result == "") {
var myArgs = {site: myUrl, username: aUsername, password: "", context: "Missing", action: ""};
......@@ -36,8 +35,7 @@ if ("undefined" == typeof(cardbookPasswordManager)) {
},
getChangedPassword: function (aUsername, aPrefId) {
var cardbookPrefService = new cardbookPreferenceService(aPrefId);
var myUrl = cardbookPrefService.getUrl();
var myUrl = cardbookPreferences.getUrl(aPrefId);
var myArgs = {site: myUrl, username: aUsername, password: "", context: "Wrong", action: ""};
var myWindow = window.openDialog("chrome://cardbook/content/wdw_password.xul", "", cardbookRepository.modalWindowParams, myArgs);