Commit 47b99e6f authored by CardBook's avatar CardBook

pre version 23.8

parent 12fb39f5
......@@ -18,10 +18,13 @@ 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
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/unix58/ os=Linux appversion>=57.*
skin cardbook-os classic/1.0 chrome/skin/windows/ os=WINNT
skin cardbook-os classic/1.0 chrome/skin/windows58/ os=WINNT appversion>=57.*
skin cardbook-os classic/1.0 chrome/skin/mac/ os=Darwin
skin cardbook-os classic/1.0 chrome/skin/mac58/ os=Darwin appversion>=57.*
# support for customizing toolbars
style chrome://global/content/customizeToolbar.xul chrome://cardbook/skin/toolbarButton.css
......
......@@ -39,6 +39,7 @@
<script src="chrome://cardbook/content/cardbookElementTools.js"/>
<script src="chrome://cardbook/content/cardbookTypes.js"/>
<script src="chrome://cardbook/content/complexSearch/cardbookComplexSearch.js"/>
<script src="chrome://cardbook/content/wdw_cardbook.js"/>
<script src="wdw_addressbooksAdd.js"/>
<wizardpage pageid="welcomePage"
......@@ -227,7 +228,7 @@
label="&wizard.label;"
description="&namePage.wizard.description;"
onpageshow="wdw_addressbooksAdd.loadName();"
onpageadvanced="wdw_addressbooksAdd.createAddressbook();">
onpageadvanced="wdw_addressbooksAdd.prepareAddressbook();">
<grid flex="1">
<columns>
<column/>
......
if ("undefined" == typeof(cardbookDiscovery)) {
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("chrome://cardbook/content/cardbookRepository.js");
var cardbookDiscovery = {
gDiscoveryDescription : "Discovery module",
startDiscovery: function () {
var allURLs = [];
var cardbookPrefService = new cardbookPreferenceService();
allURLs = cardbookPrefService.getURLs();
if (allURLs.length == 0) {
cardbookRepository.cardbookSyncMode = "NOSYNC";
} else {
for (var i = 0; i < allURLs.length; i++) {
if (i == 0) {
cardbookSynchronization.initDiscovery();
cardbookUtils.formatStringForOutput("discoveryRunning", [cardbookDiscovery.gDiscoveryDescription]);
}
var dirPrefId = cardbookUtils.getUUID();
cardbookSynchronization.initDiscoveryWithPrefId(dirPrefId);
cardbookRepository.cardbookServerValidation[dirPrefId] = {length: 0, user: allURLs[i][1]};
cardbookRepository.cardbookServerSyncRequest[dirPrefId]++;
var connection = {connUser: allURLs[i][1], connPrefId: dirPrefId, connUrl: allURLs[i][0], connDescription: cardbookDiscovery.gDiscoveryDescription};
var params = {aDirPrefIdType: "CARDDAV"};
cardbookSynchronization.discoverPhase1(connection, "GETDISPLAYNAME", params);
cardbookDiscovery.waitForDiscoveryFinished(dirPrefId);
}
}
},
stopDiscovery: function (aDirPrefId, aState) {
cardbookSynchronization.finishMultipleOperations(aDirPrefId);
var total = cardbookSynchronization.getRequest() + cardbookSynchronization.getTotal() + cardbookSynchronization.getResponse() + cardbookSynchronization.getDone();
if (total === 0) {
cardbookRepository.cardbookSyncMode = "NOSYNC";
if (aState) {
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerValidation : ", cardbookRepository.cardbookServerValidation);
// find all current CARDDAV accounts
var myCurrentAccounts = [];
myCurrentAccounts = JSON.parse(JSON.stringify(cardbookRepository.cardbookAccounts));
function onlyCardDAV(element) {
return (element[6] == "CARDDAV");
}
myCurrentAccounts = myCurrentAccounts.filter(onlyCardDAV);
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : myCurrentAccounts : ", myCurrentAccounts);
// find all accounts that should be added and removed
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
if (cardbookRepository.cardbookServerValidation[dirPrefId].length != 0) {
for (var url in cardbookRepository.cardbookServerValidation[dirPrefId]) {
if (url == "length" || url == "user") {
continue;
}
for (var i = 0; i < myCurrentAccounts.length; i++) {
var cardbookPrefService = new cardbookPreferenceService(myCurrentAccounts[i][4]);
var myCurrentUrl = cardbookPrefService.getUrl();
var myCurrentUser = cardbookPrefService.getUser();
if ((myCurrentUser == cardbookRepository.cardbookServerValidation[dirPrefId].user) && (myCurrentUrl == cardbookUtils.decodeURL(url))) {
cardbookRepository.cardbookServerValidation[dirPrefId].length--;
cardbookRepository.cardbookServerValidation[dirPrefId][url].forget = true;
myCurrentAccounts[i][6] = "CARDDAVFOUND";
break;
}
}
}
// add accounts
if (cardbookRepository.cardbookServerValidation[dirPrefId].length > 0) {
cardbookDiscovery.addAddressbook("discovery", dirPrefId);
}
}
}
// remove accounts
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 myCurrentShortUrl = cardbookSynchronization.getShortUrl(myCurrentUrl);
for (var dirPrefId in cardbookRepository.cardbookServerValidation) {
for (var url in cardbookRepository.cardbookServerValidation[dirPrefId]) {
if (url == "length" || url == "user") {
continue;
}
if ((myCurrentUser == cardbookRepository.cardbookServerValidation[dirPrefId].user) && (myCurrentShortUrl == cardbookSynchronization.getShortUrl(cardbookUtils.decodeURL(url)))) {
cardbookDiscovery.removeAddressbook(myCurrentAccountsNotFound[i][4], "DISCOVERY");
break;
}
}
}
}
}
}
},
addAddressbook: function (aAction, aDirPrefId) {
if ((aDirPrefId != null && aDirPrefId !== undefined && aDirPrefId != "") || (cardbookRepository.cardbookSyncMode === "NOSYNC")) {
cardbookRepository.cardbookSyncMode = "SYNC";
var xulRuntime = Services.appinfo;
var myArgs = {action: aAction, dirPrefId: aDirPrefId};
var myWindow = window.openDialog("chrome://cardbook/content/addressbooksconfiguration/wdw_addressbooksAdd.xul", "",
// Workaround for Bug 1151440 - the HTML color picker won't work
// in linux when opened from modal dialog
(xulRuntime.OS == 'Linux') ? "chrome,resizable,centerscreen" : "modal,chrome,resizable,centerscreen"
, myArgs);
}
},
// 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 stringBundleService = Services.strings;
var strBundle = stringBundleService.createBundle("chrome://cardbook/locale/cardbook.properties");
var prompts = Services.prompt;
var confirmTitle = strBundle.GetStringFromName("confirmTitle");
var confirmMsg = strBundle.formatStringFromName("accountDeletionDiscoveryConfirmMessage", [myDirPrefIdName], 1);
var returnFlag = false;
returnFlag = prompts.confirm(window, confirmTitle, confirmMsg);
if (returnFlag) {
cardbookRepository.removeAccountFromComplexSearch(aDirPrefId);
cardbookRepository.removeAccountFromRepository(aDirPrefId);
// cannot be launched from cardbookRepository
cardbookIndexedDB.removeAccount(aDirPrefId, myDirPrefIdName);
let cardbookPrefService = new cardbookPreferenceService(aDirPrefId);
cardbookPrefService.delBranch();
wdw_cardbook.loadCssRules();
cardbookUtils.formatStringForOutput("addressbookClosed", [myDirPrefIdName]);
wdw_cardbooklog.addActivity("addressbookClosed", [myDirPrefIdName], "deleteMail");
cardbookUtils.notifyObservers("cardbook.ABRemovedDirect");
}
}
catch (e) {
wdw_cardbooklog.updateStatusProgressInformation("cardbookRepository.removeAddressbook error : " + e, "Error");
}
},
waitForDiscoveryFinished: function (aDirPrefId) {
cardbookRepository.lTimerSyncAll[aDirPrefId] = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
var lTimerSync = cardbookRepository.lTimerSyncAll[aDirPrefId];
lTimerSync.initWithCallback({ notify: function(lTimerSync) {
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerDiscoveryRequest : ", cardbookRepository.cardbookServerDiscoveryRequest[aDirPrefId]);
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerDiscoveryResponse : ", cardbookRepository.cardbookServerDiscoveryResponse[aDirPrefId]);
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerDiscoveryError : ", cardbookRepository.cardbookServerDiscoveryError[aDirPrefId]);
wdw_cardbooklog.updateStatusProgressInformationWithDebug1(cardbookDiscovery.gDiscoveryDescription + " : debug mode : cardbookRepository.cardbookServerValidation : ", cardbookRepository.cardbookServerValidation[aDirPrefId]);
if (cardbookRepository.cardbookServerDiscoveryError[aDirPrefId] >= 1) {
cardbookDiscovery.stopDiscovery(aDirPrefId, false);
lTimerSync.cancel();
} else if (cardbookRepository.cardbookServerDiscoveryRequest[aDirPrefId] == cardbookRepository.cardbookServerDiscoveryResponse[aDirPrefId] && cardbookRepository.cardbookServerDiscoveryResponse[aDirPrefId] != 0) {
cardbookDiscovery.stopDiscovery(aDirPrefId, true);
lTimerSync.cancel();
}
}
}, 1000, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
}
};
var loader = Services.scriptloader;
loader.loadSubScript("chrome://cardbook/content/preferences/cardbookPreferences.js");
loader.loadSubScript("chrome://cardbook/content/cardbookUtils.js");
loader.loadSubScript("chrome://cardbook/content/cardbookSynchronization.js");
};
This diff is collapsed.
......@@ -2793,6 +2793,20 @@ if ("undefined" == typeof(cardbookUtils)) {
return uuidGen.generateUUID().toString().replace(/[{}]/g, '');
},
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;
}
},
notifyObservers: function (aTopic, aParam) {
if (aTopic != null && aTopic !== undefined && aTopic != "") {
Services.obs.notifyObservers(null, aTopic, aParam);
......
......@@ -12,6 +12,7 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
allOrg: [],
allRestrictions: [],
allEmailsCollections: [],
allURLs: [],
allVCards: [],
preferEmailPrefOld: false,
......@@ -82,6 +83,12 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
case "emailsCollectionIncludeName":
columnArray=8;
break;
case "discoveryURL":
columnArray=0;
break;
case "discoveryUsername":
columnArray=1;
break;
case "accountsVCardsMailName":
columnArray=2;
break;
......@@ -110,7 +117,9 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
columnArray=2;
break;
}
if (aTreeName == "accountsVCardsTree") {
if (aTreeName == "discoveryTree") {
var myData = wdw_cardbookConfiguration.allURLs;
} else if (aTreeName == "accountsVCardsTree") {
var myData = wdw_cardbookConfiguration.allVCards;
} else if (aTreeName == "accountsRestrictionsTree") {
var myData = wdw_cardbookConfiguration.allRestrictions;
......@@ -136,7 +145,9 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
myTree.setAttribute("sortDirection", order == 1 ? "ascending" : "descending");
myTree.setAttribute("sortResource", columnName);
if (aTreeName == "accountsVCardsTree") {
if (aTreeName == "discoveryTree") {
wdw_cardbookConfiguration.displayURLs();
} else if (aTreeName == "accountsVCardsTree") {
wdw_cardbookConfiguration.displayVCards();
} else if (aTreeName == "accountsRestrictionsTree") {
wdw_cardbookConfiguration.displayRestrictions();
......@@ -176,7 +187,9 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
var row = { }, col = { }, child = { };
myTree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, child);
if (row.value != -1) {
if (aTreeName == "accountsVCardsTree") {
if (aTreeName == "discoveryTree") {
wdw_cardbookConfiguration.renameURL();
} else if (aTreeName == "accountsVCardsTree") {
wdw_cardbookConfiguration.renameVCard();
} else if (aTreeName == "accountsRestrictionsTree") {
wdw_cardbookConfiguration.renameRestriction();
......@@ -726,6 +739,102 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
return cardbookUtils.getPrefNameFromPrefId(dirPrefId);
},
selectURL: function() {
var btnEdit = document.getElementById("renameURLLabel");
var myTree = document.getElementById("discoveryTree");
if (myTree.view.selection.getRangeCount() > 0) {
btnEdit.disabled = false;
} else {
btnEdit.disabled = true;
}
document.getElementById("deleteURLLabel").disabled = btnEdit.disabled;
},
loadURLs: function () {
var cardbookPrefService = new cardbookPreferenceService();
wdw_cardbookConfiguration.allURLs = cardbookPrefService.getURLs();
},
displayURLs: function () {
var URLsTreeView = {
get rowCount() { return wdw_cardbookConfiguration.allURLs.length; },
isContainer: function(idx) { return false },
cycleHeader: function(idx) { return false },
isEditable: function(idx, column) { return false },
getCellText: function(idx, column) {
if (column.id == "discoveryURL") return wdw_cardbookConfiguration.allURLs[idx][0];
else if (column.id == "discoveryUsername") return wdw_cardbookConfiguration.allURLs[idx][1];
}
}
document.getElementById('discoveryTree').view = URLsTreeView;
wdw_cardbookConfiguration.selectURL();
},
addURL: function () {
var myArgs = {site: "", username: "", password: "", context: "New", action: ""};
var myWindow = window.openDialog("chrome://cardbook/content/wdw_password.xul", "", cardbookRepository.modalWindowParams, myArgs);
if (myArgs.action == "SAVE") {
var myUrl = cardbookSynchronization.getRootUrl(myArgs.site);
cardbookPasswordManager.removeAccount(myArgs.username, myUrl);
cardbookPasswordManager.addAccount(myArgs.username, myUrl, myArgs.password);
wdw_cardbookConfiguration.allURLs.push([myArgs.site, myArgs.username]);
wdw_cardbookConfiguration.allURLs = cardbookUtils.sortArrayByString(wdw_cardbookConfiguration.allURLs,1,1);
wdw_cardbookConfiguration.sortTrees(null, "discoveryTree");
}
},
renameURL: function () {
var myTree = document.getElementById('discoveryTree');
if (myTree.currentIndex == -1) {
return;
} else {
var myURL = myTree.view.getCellText(myTree.currentIndex, {id: "discoveryURL"});
var myUsername = myTree.view.getCellText(myTree.currentIndex, {id: "discoveryUsername"});
var myPassword = cardbookPasswordManager.getPassword(myUsername, cardbookSynchronization.getRootUrl(myURL));
var myArgs = {site: myURL, username: myUsername, password: myPassword, context: "New", action: ""};
var myWindow = window.openDialog("chrome://cardbook/content/wdw_password.xul", "", cardbookRepository.modalWindowParams, myArgs);
if (myArgs.action == "SAVE") {
var myUrl = cardbookSynchronization.getRootUrl(myArgs.site);
cardbookPasswordManager.removeAccount(myArgs.username, myUrl);
cardbookPasswordManager.addAccount(myArgs.username, myUrl, myArgs.password);
var result = [];
for (let i = 0; i < wdw_cardbookConfiguration.allURLs.length; i++) {
if (i === myTree.currentIndex) {
result.push([myArgs.site, myArgs.username]);
} else {
result.push(wdw_cardbookConfiguration.allURLs[i]);
}
}
wdw_cardbookConfiguration.allURLs = JSON.parse(JSON.stringify(result));
wdw_cardbookConfiguration.allURLs = cardbookUtils.sortArrayByString(wdw_cardbookConfiguration.allURLs,1,1);
wdw_cardbookConfiguration.sortTrees(null, "discoveryTree");
}
}
},
deleteURL: function () {
var myTree = document.getElementById('discoveryTree');
if (myTree.currentIndex == -1) {
return;
} else {
var myId = myTree.view.getCellText(myTree.currentIndex, {id: "discoveryURL"});
var result = [];
for (let i = 0; i < wdw_cardbookConfiguration.allURLs.length; i++) {
if (i != myTree.currentIndex) {
result.push(wdw_cardbookConfiguration.allURLs[i]);
}
}
wdw_cardbookConfiguration.allURLs = JSON.parse(JSON.stringify(result));
wdw_cardbookConfiguration.sortTrees(null, "discoveryTree");
}
},
validateURLs: function () {
var cardbookPrefService = new cardbookPreferenceService();
cardbookPrefService.setURLs(wdw_cardbookConfiguration.allURLs);
},
selectVCard: function() {
var btnEdit = document.getElementById("renameVCardLabel");
var myTree = document.getElementById("accountsVCardsTree");
......@@ -1729,6 +1838,8 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
wdw_cardbookConfiguration.loadInitialSyncDelay();
wdw_cardbookConfiguration.loadPeriodicSync();
wdw_cardbookConfiguration.loadAddressBooks("addressBooksNameList", false);
wdw_cardbookConfiguration.loadURLs();
wdw_cardbookConfiguration.sortTrees(null, "discoveryTree");
wdw_cardbookConfiguration.loadVCards();
wdw_cardbookConfiguration.sortTrees(null, "accountsVCardsTree");
wdw_cardbookConfiguration.loadRestrictions();
......@@ -1750,6 +1861,7 @@ if ("undefined" == typeof(wdw_cardbookConfiguration)) {
wdw_cardbookConfiguration.validateTypes();
wdw_cardbookConfiguration.validateIMPPs();
wdw_cardbookConfiguration.validateOrg();
wdw_cardbookConfiguration.validateURLs();
wdw_cardbookConfiguration.validateVCards();
wdw_cardbookConfiguration.validateRestrictions();
wdw_cardbookConfiguration.validateEmailsCollection();
......
......@@ -8,6 +8,7 @@
<!ENTITY % configurationDTD SYSTEM "chrome://cardbook/locale/wdw_cardbookConfiguration.dtd"> %configurationDTD;
<!ENTITY % namesDTD SYSTEM "chrome://cardbook/locale/wdw_nameEdition.dtd"> %namesDTD;
<!ENTITY % orgDTD SYSTEM "chrome://cardbook/locale/wdw_orgEdition.dtd"> %orgDTD;
<!ENTITY % passwordDTD SYSTEM "chrome://cardbook/locale/wdw_password.dtd"> %passwordDTD;
]>
<prefwindow xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
......@@ -26,6 +27,7 @@
<script src="chrome://cardbook/content/wdw_log.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
<script src="chrome://cardbook/content/cardbookSynchronization.js"/>
<script src="chrome://cardbook/content/cardbookPasswordManager.js"/>
<script src="chrome://cardbook/content/birthdays/cardbookBirthdaysUtils.js"/>
<script src="chrome://cardbook/content/cardbookElementTools.js"/>
......@@ -663,6 +665,34 @@
</hbox>
</groupbox>
<groupbox flex="1">
<caption label="&discoveryGroupboxLabel;"/>
<separator class="thin"/>
<description>&discoveryWarn;</description>
<separator class="thin"/>
<hbox flex="1">
<vbox flex="1">
<hbox flex="1">
<tree id="discoveryTree" class="cardbookTreeChildrenConfigClass" hidecolumnpicker="true" flex="1" seltype="single" enableColumnDrag="false" editable="true" onselect="wdw_cardbookConfiguration.selectURL();" sortDirection="ascending" sortResource="discoveryURL">
<treecols id="discoveryTreeCols">
<treecol id="discoveryURL" label="&discoveryURLLabel;" flex="1" persist="width ordinal hidden" onclick="wdw_cardbookConfiguration.sortTreesFromCol(event, this, 'discoveryTree');" style="text-align:left" editable="false"/>
<splitter class="tree-splitter"/>
<treecol id="discoveryUsername" label="&usernameLabel;" flex="1" persist="width ordinal hidden" onclick="wdw_cardbookConfiguration.sortTreesFromCol(event, this, 'discoveryTree');" style="text-align:left" editable="false"/>
</treecols>
<treechildren id="discoveryTreeChildren" ondblclick="wdw_cardbookConfiguration.doubleClickTree(event, 'discoveryTree');"/>
</tree>
</hbox>
</vbox>
<hbox align="top">
<vbox flex="1">
<button id="addURLLabel" label="&addURLLabel;" accesskey="&addURLAccesskey;" oncommand="wdw_cardbookConfiguration.addURL();"/>
<button id="renameURLLabel" label="&renameURLLabel;" accesskey="&renameURLAccesskey;" oncommand="wdw_cardbookConfiguration.renameURL();" disabled="true"/>
<button id="deleteURLLabel" label="&deleteURLLabel;" accesskey="&deleteURLAccesskey;" oncommand="wdw_cardbookConfiguration.deleteURL();" disabled="true"/>
</vbox>
</hbox>
</hbox>
</groupbox>
<groupbox>
<caption label="&advancedSyncGroupboxLabel;"/>
<hbox align="center">
......@@ -697,9 +727,9 @@
</groupbox>
<separator class="thin"/>
<groupbox flex="1">
<caption label="&attachvCardGroupboxLabel;"/>
<caption label="&attachVCardGroupboxLabel;"/>
<separator class="thin"/>
<description>&attachvCardWarn;</description>
<description>&attachVCardWarn;</description>
<separator class="thin"/>
<hbox flex="1">
<vbox flex="1">
......@@ -791,8 +821,7 @@
preference="extensions.cardbook.showPeriodicPopup"
oncommand="wdw_cardbookConfiguration.remindViaPopup();"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<hbox align="center" class="indent">
<label value="&periodicPopupTimeLabel;"
accesskey="&periodicPopupTimeAccesskey;"
control="periodicPopupTimeTextBox"
......
......@@ -14,7 +14,7 @@
<script src="cardbookUtils.js"/>
<script src="cardbookSynchronization.js"/>
<script src="cardbookIndexedDB.js"/>
<script src="ovl_synchro.js"/>
<script src="ovl_init.js"/>
<script src="cardbookMailPopularity.js"/>
<script src="ovl_mailPopularity.js"/>
<script src="chrome://cardbook/content/preferences/cardbookPreferences.js"/>
......
......@@ -5,6 +5,82 @@ if ("undefined" == typeof(ovl_synchro)) {
lTimerSync: null,
initPrefs: function () {
var prefs = Services.prefs.getDefaultBranch("extensions.cardbook.");
prefs.setBoolPref("autocompletion", true);
prefs.setBoolPref("autocompleteSortByPopularity", true);
prefs.setBoolPref("autocompleteShowAddressbook", false);
prefs.setBoolPref("autocompleteWithColor", true);
prefs.setCharPref("useColor", "background");
prefs.setBoolPref("exclusive", false);
prefs.setCharPref("requestsTimeout", "120");
prefs.setCharPref("statusInformationLineNumber", "250");
prefs.setBoolPref("debugMode", false);
prefs.setBoolPref("preferEmailEdition", true);
prefs.setBoolPref("mailPopularityTabView", false);
prefs.setBoolPref("technicalTabView", false);
prefs.setBoolPref("vcardTabView", false);
prefs.setBoolPref("advancedTabView", false);
prefs.setCharPref("panesView", "modern");
prefs.setBoolPref("initialSync", true);
prefs.setCharPref("initialSyncDelay", "0");
prefs.setCharPref("solveConflicts", "User");
prefs.setBoolPref("autoSync", true);
prefs.setCharPref("autoSyncInterval", "30");
prefs.setCharPref("multiget", "40");
prefs.setBoolPref("decodeReport", true);
prefs.setBoolPref("preferEmailPref", true);
prefs.setBoolPref("preferIMPPPref", true);
prefs.setBoolPref("warnEmptyEmails", true);
prefs.setBoolPref("useOnlyEmail", false);
prefs.setBoolPref("usePreferenceValue", false);
prefs.setCharPref("preferenceValueLabel", "");
prefs.setBoolPref("firstRun", true);
prefs.setBoolPref("firstOpen", true);
prefs.setBoolPref("firstOpenModern", true);
prefs.setBoolPref("iconsMigrated", false);
prefs.setCharPref("kindCustom", "X-ADDRESSBOOKSERVER-KIND");
prefs.setCharPref("memberCustom", "X-ADDRESSBOOKSERVER-MEMBER");
prefs.setCharPref("customColumnsShown", "");
prefs.setCharPref("orgStructure", "");
prefs.setCharPref("localizeEngine", "OpenStreetMap");
prefs.setCharPref("localizeTarget", "out");
prefs.setCharPref("showNameAs", "LF");
prefs.setCharPref("fnFormula", "({{1}} |)({{2}} |)({{3}} |)({{4}} |)({{5}} |)({{6}} |)");
prefs.setCharPref("addressBooksNameList", "allAddressBooks");
prefs.setCharPref("calendarsNameList", "");
prefs.setBoolPref("searchInNote", true);
prefs.setCharPref("numberOfDaysForSearching", "30");
prefs.setBoolPref("showPopupOnStartup", false);
prefs.setBoolPref("showPeriodicPopup", false);
prefs.setCharPref("periodicPopupIime", "08:00");
prefs.setBoolPref("showPopupEvenIfNoBirthday", true);
prefs.setBoolPref("syncWithLightningOnStartup", false);
prefs.setCharPref("numberOfDaysForWriting", "30");
prefs.setCharPref("eventEntryTitle", "");
prefs.setCharPref("eventEntryTime", "00:00");
prefs.setBoolPref("eventEntryWholeDay", false);
prefs.setCharPref("calendarEntryAlarm", "7");
prefs.setCharPref("calendarEntryCategories", "");
prefs.setBoolPref("viewABPane", true);
prefs.setBoolPref("viewABContact", true);
prefs.setCharPref("accountsShown", "all");
prefs.setCharPref("uncategorizedCards", "");
prefs.setCharPref("addonVersion", "23.8");
},
lEventTimerSync : { notify: function(lTimerSync) {
if (!cardbookRepository.firstLoad) {
// setting uncategorizedCards
......@@ -63,6 +139,9 @@ if ("undefined" == typeof(ovl_synchro)) {
};
// need to launch it a bit later
if (!cardbookRepository.firstLoad) {
ovl_synchro.initPrefs();
}
ovl_synchro.runBackgroundSync();
};
......@@ -9,6 +9,7 @@ if ("undefined" == typeof(cardbookPreferenceService)) {
this.prefCardBookTels = this.prefCardBookRoot + "tels.";
this.prefCardBookIMPPs = this.prefCardBookRoot + "impps.";
this.prefCardBookCustomFields = this.prefCardBookRoot + "customFields.";
this.prefCardBookAccountURLs = this.prefCardBookRoot + "URLs";
this.prefCardBookAccountVCards = this.prefCardBookRoot + "vcards.";
this.prefCardBookAccountRestrictions = this.prefCardBookRoot + "accountsRestrictions.";
this.prefCardBookEmailsCollection = this.prefCardBookRoot + "emailsCollection.";
......@@ -422,6 +423,38 @@ if ("undefined" == typeof(cardbookPreferenceService)) {
}
},
getURLs: function () {
try {
let result = [];
let finalResult = [];
result = this.mPreferencesService.getComplexValue(this.prefCardBookAccountURLs, Components.interfaces.nsISupportsString).data.split(',');
for (let i = 0; i < result.length; i++) {
if (result[i] != "") {
finalResult.push(result[i].split('::'));
}
}
return finalResult;
}
catch(e) {
return [];
}
},
setURLs: function (aURLArray) {
try {
var tmpArray = [];
for (let i = 0; i < aURLArray.length; i++) {
tmpArray.push(aURLArray[i].join('::'));
}
var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
str.data = tmpArray.join(',');
this.mPreferencesService.setComplexValue(this.prefCardBookAccountURLs, Components.interfaces.nsISupportsString, str);
}
catch(e) {
dump("cardbookPreferenceService.setURLs : failed to set" + this.prefCardBookAccountURLs + "\n" + e + "\n");
}
},
getAllVCards: function () {
try {
let count = {};
......
This diff is collapsed.
......@@ -2,7 +2,7 @@ if ("undefined" == typeof(wdw_password)) {
var wdw_password = {
checkRequired: function () {
if (document.getElementById('passwordTextBox').value != "") {
if (document.getElementById('siteTextBox').value.trim() != "" && document.getElementById('usernameTextBox').value.trim() != "" && document.getElementById('passwordTextBox').value.trim() != "" ) {
document.getElementById('saveEditionLabel').disabled = false;
} else {
document.getElementById('saveEditionLabel').disabled = true;
......@@ -23,13 +23,30 @@ if ("undefined" == typeof(wdw_password)) {
document.title = strBundle.getString("wdw_password" + window.arguments[0].context + "Title");
document.getElementById('siteTextBox').value = window.arguments[0].site;
document.getElementById('usernameTextBox').value = window.arguments[0].username;
document.getElementById('passwordTextBox').focus();
document.getElementById('passwordTextBox').value = window.arguments[0].password;
if (window.arguments[0].context == "New") {
document.getElementById('siteTextBox').disabled = false;
document.getElementById('usernameTextBox').disabled = false;
document.getElementById('siteTextBox').focus();
} else {
document.getElementById('siteTextBox').disabled = true;
document.getElementById('usernameTextBox').disabled = true;
document.getElementById('passwordTextBox').focus();
}
wdw_password.checkRequired();
},
save: function () {
window.arguments[0].password = document.getElementById('passwordTextBox').value;
window.arguments[0].action="SAVE";
close();
myURL = document.getElementById('siteTextBox').value.trim();
if (cardbookSynchronization.getRootUrl(myURL) == "") {
cardbookNotifications.setNotification("errorNotifications", "ValidatingURLFailedLabel");