Commit 0f45ed19 authored by CardBook's avatar CardBook

27.0

parent 4be64f16
......@@ -758,7 +758,7 @@ if ("undefined" == typeof(wdw_addressbooksAdd)) {
var vCardVersion = document.getElementById('vCardVersionPageName').value;
var readonly = document.getElementById('readonlyPageName').checked;
var dateFormat = document.getElementById('dateFormatMenuList').value;
var URL = document.getElementById('URLPageName').value;
var URL = wdw_addressbooksAdd.gAccountsFound[i][0];
var urnuuid = document.getElementById('urnuuidPageName').checked;
wdw_addressbooksAdd.gFinishParams.push({url: URL, name: name, username: username, color: color, vcard: vCardVersion, readonly: readonly, dirPrefId: aAddressbookId, dateFormat: dateFormat,
urnuuid: urnuuid, DBcached: true, firstAction: false});
......
......@@ -62,7 +62,7 @@ if ("undefined" == typeof(ovl_attachments)) {
OnStopRunningUrl: function (aUrl, aStatus) {
if (aStatus == 0) {
wdw_cardbooklog.updateStatusProgressInformationWithDebug2("debug mode : attachment successfully downloaded");
cardbookSynchronization.loadFile(this.mFile, this.myDirPrefId, "WINDOW", "NOIMPORT", "");
cardbookSynchronization.loadFile(this.mFile, this.myDirPrefId, "WINDOW", "IMPORT", "");
} else {
wdw_cardbooklog.updateStatusProgressInformationWithDebug2("debug mode : attachment not successfully downloaded, status : " + aStatus);
}
......
......@@ -624,6 +624,10 @@ if ("undefined" == typeof(wdw_cardEdition)) {
clearCard: function () {
cardbookUtils.clearCard();
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
cardbookElementTools.deleteRows(typesList[i] + 'Groupbox');
}
wdw_cardEdition.loadCategories([]);
},
......@@ -783,9 +787,8 @@ if ("undefined" == typeof(wdw_cardEdition)) {
var ABPopup = document.getElementById('addressbookMenupopup');
cardbookElementTools.loadAddressBooks(ABPopup, ABList, wdw_cardEdition.workingCard.dirPrefId, true, false,
(window.arguments[0].editionMode == "ViewContact" || window.arguments[0].editionMode == "ViewList"), false, false);
if (wdw_cardEdition.workingCard.dirPrefId == "") {
wdw_cardEdition.workingCard.dirPrefId = document.getElementById('addressbookMenulist').selectedItem.value;
}
// the dirPrefId may be different from the one loaded in case of a complex search
wdw_cardEdition.workingCard.dirPrefId = document.getElementById('addressbookMenulist').selectedItem.value;
wdw_cardEdition.loadSourceCategories(wdw_cardEdition.workingCard.dirPrefId);
cardbookElementTools.loadGender("genderMenupopup", "genderMenulist", wdw_cardEdition.workingCard.gender);
......
......@@ -4,11 +4,15 @@ if ("undefined" == typeof(cardbookElementTools)) {
var cardbookElementTools = {
deleteRowsType: function (aType) {
deleteRowsAllTypes: function (aType) {
cardbookElementTools.deleteRows(aType + 'classicalGroupbox');
cardbookElementTools.deleteRows(aType + 'modernGroupbox');
},
deleteRowsType: function (aType) {
cardbookElementTools.deleteRows(aType + 'Groupbox');
},
deleteRows: function (aObjectName) {
// for anonid this does not work
try {
......
......@@ -1552,18 +1552,16 @@ if ("undefined" == typeof(cardbookSynchronization)) {
}
cardbookRepository.cardbookServerDiscoveryResponse[aConnection.connPrefId]++;
} else if (responseXML && (status > 199 && status < 400)) {
var prefixs = ["x0", "card", "X0", "CARD"];
for (var i in prefixs) {
if (responseXML.getElementsByTagName(prefixs[i] + ":address-data-type")) {
var versions = responseXML.getElementsByTagName(prefixs[i] + ":address-data-type");
}
for (let j = 0; j < versions.length; j++) {
if (versions[j].getAttribute("content-type") == "text/vcard") {
if (versions[j].getAttribute("version")) {
var myVersion = versions[j].getAttribute("version");
wdw_cardbooklog.updateStatusProgressInformationWithDebug2(aConnection.connDescription + " : version found : " + myVersion + " (" + aConnection.connUrl + ")");
cardbookRepository.cardbookServerValidation[aConnection.connPrefId][aConnection.connUrl].version.push(myVersion);
}
var ns = "urn:ietf:params:xml:ns:carddav";
if (responseXML.getElementsByTagNameNS(ns, "address-data-type")) {
var versions = responseXML.getElementsByTagNameNS(ns, "address-data-type");
}
for (let j = 0; j < versions.length; j++) {
if (versions[j].getAttribute("content-type") == "text/vcard") {
if (versions[j].getAttribute("version")) {
var myVersion = versions[j].getAttribute("version");
wdw_cardbooklog.updateStatusProgressInformationWithDebug2(aConnection.connDescription + " : version found : " + myVersion + " (" + aConnection.connUrl + ")");
cardbookRepository.cardbookServerValidation[aConnection.connPrefId][aConnection.connUrl].version.push(myVersion);
}
}
}
......
......@@ -320,9 +320,6 @@ if ("undefined" == typeof(cardbookTypes)) {
for (var i = 0; i < aArray.length; i++) {
cardbookTypes.loadStaticTypes(aType, i, aArray[i][1], aArray[i][2], aArray[i][3], aArray[i][0], aVersion, aFollowLink);
}
if (aArray.length == 0) {
cardbookTypes.loadStaticTypes(aType, 0, [], "", [], [""], aVersion, aFollowLink);
}
},
display40: function (aVersion) {
......@@ -676,14 +673,7 @@ if ("undefined" == typeof(cardbookTypes)) {
cardbookElementTools.addCaption(aType, aOrigBox);
}
var aGrid = cardbookElementTools.addGrid(aType, aOrigBox);
var aGridColumns = cardbookElementTools.addGridColumns(aType, aGrid, {flex: '1'});
cardbookElementTools.addGridColumn(aType, 0, aGridColumns);
cardbookElementTools.addGridColumn(aType, 1, aGridColumns);
cardbookElementTools.addGridColumn(aType, 2, aGridColumns);
cardbookElementTools.addGridColumn(aType, 3, aGridColumns, {flex: '1'});
var aGridRows = cardbookElementTools.addGridRows(aType, aGrid);
var aRow = cardbookElementTools.addGridRow(aType, aIndex, aGridRows, {align: 'start'});
var aRow = cardbookElementTools.addGridRow(aType, aIndex, aOrigBox, {align: 'start'});
var myInputTypes = [];
myInputTypes = cardbookUtils.getOnlyTypesFromTypes(aInputTypes);
......
......@@ -268,7 +268,7 @@ if ("undefined" == typeof(cardbookUtils)) {
return aArray.sort(compare2);
}
},
sortArrayByString: 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());
......@@ -283,7 +283,7 @@ if ("undefined" == typeof(cardbookUtils)) {
return aArray.sort(compare2);
}
},
sortArrayByNumber: function (aArray, aIndex, aInvert) {
function compare1(a, b) { return (a[aIndex] - b[aIndex])*aInvert; };
function compare2(a, b) { return (a - b)*aInvert; };
......@@ -293,7 +293,7 @@ if ("undefined" == typeof(cardbookUtils)) {
return aArray.sort(compare2);
}
},
arrayUnique2D: function (aArray) {
for (var i=0; i<aArray.length; i++) {
var listI = aArray[i];
......@@ -309,7 +309,7 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return aArray;
},
splitLine: function (vString) {
var lLineLength = 75;
var lResult = "";
......@@ -324,7 +324,7 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return lResult;
},
undefinedToBlank: function (vString1) {
if (vString1 != null && vString1 !== undefined && vString1 != "") {
return vString1;
......@@ -367,7 +367,7 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return aResultValue;
},
appendToVcardData1: function (vString1, vString2, vBool1, vString3) {
var lResult = "";
if (vBool1) {
......@@ -390,7 +390,7 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return lResult;
},
appendToVcardData2: function (vString1, vString2, vBool1, vString3) {
var lResult = "";
if (vBool1) {
......@@ -408,15 +408,15 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return lResult;
},
escapeString: function (vString) {
return vString.replace(/\\;/g,"@ESCAPEDSEMICOLON@").replace(/\\,/g,"@ESCAPEDCOMMA@");
},
escapeString1: function (vString) {
return vString.replace(/\\\(/g,"@ESCAPEDLEFTPARENTHESIS@").replace(/\\\)/g,"@ESCAPEDRIGHTPARENTHESIS@").replace(/\\\|/g,"@ESCAPEDPIPE@");
return vString.replace(/\\\(/g,"@ESCAPEDLEFTPARENTHESIS@").replace(/\\\)/g,"@ESCAPEDRIGHTPARENTHESIS@").replace(/\\\|/g,"@ESCAPEDPIPE@");
},
escapeArray: function (vArray) {
for (let i = 0; i<vArray.length; i++){
if (vArray[i] && vArray[i] != ""){
......@@ -469,23 +469,23 @@ if ("undefined" == typeof(cardbookUtils)) {
}
return vArrayNew;
},
escapeStringSemiColon: function (vString) {
return vString.replace(/;/g,"@ESCAPEDSEMICOLON@");
},
unescapeStringSemiColon: function (vString) {
return vString.replace(/@ESCAPEDSEMICOLON@/g,"\\;");
},
unescapeString: function (vString) {
return vString.replace(/@ESCAPEDSEMICOLON@/g,";").replace(/\\;/g,";").replace(/@ESCAPEDCOMMA@/g,",").replace(/\\,/g,",");
},
unescapeString1: function (vString) {
return vString.replace(/@ESCAPEDLEFTPARENTHESIS@/g,"(").replace(/@ESCAPEDRIGHTPARENTHESIS@/g,")").replace(/@ESCAPEDPIPE@/g,"|");
},
unescapeArray: function (vArray) {
for (let i = 0; i<vArray.length; i++){
if (vArray[i] && vArray[i] != ""){
......@@ -809,11 +809,6 @@ if ("undefined" == typeof(cardbookUtils)) {
cardbookElementTools.deleteRows('orgRows');
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
cardbookElementTools.deleteRowsType(typesList[i]);
}
// need to remove the Custom from Pers
// for the Org, everything is cleared out
var aListRows = document.getElementById('persRows');
......@@ -890,7 +885,11 @@ if ("undefined" == typeof(cardbookUtils)) {
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
if (aReadOnly) {
cardbookTypes.constructStaticRows(typesList[i], aCard[typesList[i]], aCard.version, aFollowLink);
if (aCard[typesList[i]].length > 0) {
cardbookTypes.constructStaticRows(typesList[i], aCard[typesList[i]], aCard.version, aFollowLink);
} else {
cardbookElementTools.deleteRowsAllTypes(typesList[i]);
}
} else {
if (typesList[i] === "impp") {
cardbookTypes.loadIMPPs(aCard[typesList[i]]);
......@@ -1058,16 +1057,6 @@ if ("undefined" == typeof(cardbookUtils)) {
} else {
groupbox.setAttribute('hidden', 'true');
}
// test var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
// test for (var i in typesList) {
// test var box = document.getElementById(typesList[i] + panesView + 'Groupbox');
// test if (document.getElementById(typesList[i] + '_0_valueBox')) {
// test box.removeAttribute('hidden');
// test } else {
// test box.setAttribute('hidden', 'true');
// test }
// test }
},
setCalculatedFieldsWithoutRev: function(aCard) {
......
......@@ -257,9 +257,13 @@ if ("undefined" == typeof(cardbookWebDAV)) {
_sendHTTPRequest: function(method, body, headers, aOverrideMime, aCleanBody) {
try {
let httpChannel = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
httpChannel.loadFlags |= Components.interfaces.nsIRequest.LOAD_ANONYMOUS | Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE | Components.interfaces.nsIRequest.INHIBIT_PERSISTENT_CACHING;
httpChannel.notificationCallbacks = this;
if (Services.vc.compare(Services.appinfo.version, "59") >= 0) {
var httpChannel = new XMLHttpRequest();
} else {
var httpChannel = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
}
httpChannel.loadFlags |= Components.interfaces.nsIRequest.LOAD_ANONYMOUS | Components.interfaces.nsIRequest.LOAD_BYPASS_CACHE | Components.interfaces.nsIRequest.INHIBIT_PERSISTENT_CACHING;
httpChannel.notificationCallbacks = this;
if (this.timeout != null && this.timeout !== undefined && this.timeout != "") {
httpChannel.timeout = this.timeout;
......
......@@ -3,11 +3,13 @@ if ("undefined" == typeof(ovl_cardbookLayout)) {
var ovl_cardbookLayout = {
changeResizePanes: function(aPref, aValue) {
if (aValue) {
cardbookPreferences.setBoolPref("extensions.cardbook." + aPref, aValue);
changeResizePanes: function(aPref, aSplitter) {
if (aSplitter) {
// unpossible to fire a drag event on splitter
// don't know how to do
cardbookPreferences.setBoolPref("extensions.cardbook." + aPref, (aSplitter.getAttribute("state") == "open"));
} else {
cardbookPreferences.setBoolPref("extensions.cardbook." + aPref, !prefs.getBoolPref("extensions.cardbook." + aPref));
cardbookPreferences.setBoolPref("extensions.cardbook." + aPref, !cardbookPreferences.getBoolPref("extensions.cardbook." + aPref));
}
},
......
......@@ -94,7 +94,7 @@
</tree>
</vbox>
<splitter id="dirTreeSplitter" collapse="before" persist="state orient" class="cardbookVerticalSplitterClass" oncommand="ovl_cardbookLayout.changeResizePanes('viewABPane', true);"/>
<splitter id="dirTreeSplitter" collapse="before" persist="state orient" class="cardbookVerticalSplitterClass"/>
<box id="cardsBox" flex="1">
<hbox id="rightPaneUpHbox" flex="1" persist="width height collapsed">
......@@ -105,9 +105,9 @@
</tree>
</hbox>
<splitter id="resultsSplitterClassical" collapse="after" orient="horizontal" persist="state orient" class="cardbookVerticalSplitterClass" oncommand="ovl_cardbookLayout.changeResizePanes('viewABContact', true);"/>
<splitter id="resultsSplitterClassical" collapse="after" orient="horizontal" persist="state orient" class="cardbookVerticalSplitterClass"/>
<splitter id="resultsSplitterModern" collapse="after" orient="vertical" persist="state orient" class="cardbookHorizontalSplitterClass" oncommand="ovl_cardbookLayout.changeResizePanes('viewABContact', true);"/>
<splitter id="resultsSplitterModern" collapse="after" orient="vertical" persist="state orient" class="cardbookHorizontalSplitterClass"/>
<hbox id="rightPaneDownHbox" flex="1" context="" persist="width height collapsed" class="cardbookBackgroundColorClass">
<vbox flex="1">
......@@ -243,12 +243,22 @@
<image id="defaultCardImage"/>
</hbox>
</vbox>
<vbox align="center" flex="1">
<groupbox id="emailclassicalGroupbox" flex="1"/>
<groupbox id="telclassicalGroupbox" flex="1"/>
<groupbox id="adrclassicalGroupbox" flex="1"/>
<groupbox id="imppclassicalGroupbox" flex="1"/>
<groupbox id="urlclassicalGroupbox" flex="1"/>
<vbox flex="1">
<grid align="center" flex="1">
<columns>
<column/>
<column/>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<groupbox id="emailclassicalGroupbox" flex="1"/>
<groupbox id="telclassicalGroupbox" flex="1"/>
<groupbox id="adrclassicalGroupbox" flex="1"/>
<groupbox id="imppclassicalGroupbox" flex="1"/>
<groupbox id="urlclassicalGroupbox" flex="1"/>
</rows>
</grid>
</vbox>
</hbox>
<hbox align="center" flex="1">
......@@ -264,11 +274,21 @@
</hbox>
<hbox flex="1">
<vbox flex="1">
<groupbox id="emailmodernGroupbox" flex="1"/>
<groupbox id="telmodernGroupbox" flex="1"/>
<groupbox id="adrmodernGroupbox" flex="1"/>
<groupbox id="imppmodernGroupbox" flex="1"/>
<groupbox id="urlmodernGroupbox" flex="1"/>
<grid align="center" flex="1">
<columns>
<column/>
<column/>
<column flex="1"/>
<column flex="1"/>
</columns>
<rows>
<groupbox id="emailmodernGroupbox" flex="1"/>
<groupbox id="telmodernGroupbox" flex="1"/>
<groupbox id="adrmodernGroupbox" flex="1"/>
<groupbox id="imppmodernGroupbox" flex="1"/>
<groupbox id="urlmodernGroupbox" flex="1"/>
</rows>
</grid>
</vbox>
</hbox>
<hbox id="listGroupbox" flex="1">
......
......@@ -89,7 +89,7 @@ if ("undefined" == typeof(ovl_synchro)) {
prefs.setCharPref("accountsShown", "all");
prefs.setCharPref("accountShown", "");
prefs.setCharPref("uncategorizedCards", "");
prefs.setCharPref("addonVersion", "26.9");
prefs.setCharPref("addonVersion", "27.0");
},
lEventTimerSync : { notify: function(lTimerSync) {
......
......@@ -107,6 +107,7 @@ if ("undefined" == typeof(wdw_cardbook)) {
var accountShown = cardbookPreferences.getStringPref("extensions.cardbook.accountShown");
cardbookUtils.setColumnsStateForAccount(accountShown);
cardbookUtils.setSelectedAccount(accountShown, wdw_cardbook.currentFirstVisibleRow, wdw_cardbook.currentLastVisibleRow);
wdw_cardbook.refreshWindow();
},
syncAccountFromAccountsOrCats: function () {
......@@ -161,6 +162,10 @@ if ("undefined" == typeof(wdw_cardbook)) {
clearCard: function () {
cardbookUtils.clearCard();
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
cardbookElementTools.deleteRowsAllTypes(typesList[i]);
}
document.getElementById('categoriesclassicalTextBox').value = "";
document.getElementById('categoriesmodernTextBox').value = "";
cardbookUtils.adjustFields();
......
......@@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>cardbook@vigneau.philippe</em:id>
<em:name>CardBook</em:name>
<em:version>26.9</em:version>
<em:version>27.0</em:version>
<em:type>2</em:type>
<em:description>vCard Address Book</em:description>
<em:creator>Philippe Vigneau</em:creator>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment