Commit 6af22fae authored by CardBook's avatar CardBook

version 28.1

parent 5b9c3de9
......@@ -41,9 +41,9 @@ skin cardbook-config classic/1.0 chrome/skin/configuration/
skin cardbook-pref classic/1.0 chrome/skin/osversion/unix/ os=Linux
skin cardbook-pref classic/1.0 chrome/skin/osversion/windows/ os=WINNT
skin cardbook-pref classic/1.0 chrome/skin/osversion/mac/ os=Darwin
skin cardbook-pref classic/1.0 chrome/skin/osversion/unix61/ os=Linux appversion>=61.0a1
skin cardbook-pref classic/1.0 chrome/skin/osversion/windows61/ os=WINNT appversion>=61.0a1
skin cardbook-pref classic/1.0 chrome/skin/osversion/mac61/ os=Darwin appversion>=61.0a1
skin cardbook-pref classic/1.0 chrome/skin/osversion/unix61/ os=Linux appversion>=60.0
skin cardbook-pref classic/1.0 chrome/skin/osversion/windows61/ os=WINNT appversion>=60.0
skin cardbook-pref classic/1.0 chrome/skin/osversion/mac61/ os=Darwin appversion>=60.0
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/unix/ os=Linux
skin cardbook-toolbar classic/1.0 chrome/skin/osversion/windows/ os=WINNT
......
......@@ -22,7 +22,8 @@ if ("undefined" == typeof(wdw_addressbooksEdit)) {
document.getElementById('fnFormulaDescriptionLabel1').value = myLabel.trim();
myLabel = "";
myLabel = myLabel + "{{5}} : " + strBundle.getString("suffixnameLabel") + " ";
var count = 6;
myLabel = myLabel + "{{6}} : " + strBundle.getString("nicknameLabel") + " ";
var count = 7;
if (allOrg.length === 0) {
myLabel = myLabel + "{{" + count + "}} : " + strBundle.getString("orgLabel");
count++;
......
......@@ -674,11 +674,12 @@ if ("undefined" == typeof(wdw_cardEdition)) {
setDisplayName: function () {
var myNewOrg = wdw_cardEdition.getOrg(false);
var myNewFn = cardbookUtils.getDisplayedName(document.getElementById('dirPrefIdTextBox').value, [document.getElementById('prefixnameTextBox').value.trim(),
var myNewFn = cardbookUtils.getDisplayedNameFromFormula(document.getElementById('dirPrefIdTextBox').value, [document.getElementById('prefixnameTextBox').value.trim(),
document.getElementById('firstnameTextBox').value.trim(),
document.getElementById('othernameTextBox').value.trim(),
document.getElementById('lastnameTextBox').value.trim(),
document.getElementById('suffixnameTextBox').value.trim()],
document.getElementById('suffixnameTextBox').value.trim(),
document.getElementById('nicknameTextBox').value.trim()],
[myNewOrg,
document.getElementById('titleTextBox').value.trim(),
document.getElementById('roleTextBox').value.trim()]);
......@@ -688,6 +689,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
wdw_cardEdition.workingCard.othername = document.getElementById('othernameTextBox').value.trim();
wdw_cardEdition.workingCard.suffixname = document.getElementById('suffixnameTextBox').value.trim();
wdw_cardEdition.workingCard.prefixname = document.getElementById('prefixnameTextBox').value.trim();
wdw_cardEdition.workingCard.nickname = document.getElementById('nicknameTextBox').value.trim();
wdw_cardEdition.workingCard.org = myNewOrg;
wdw_cardEdition.workingCard.fn = myNewFn;
},
......@@ -909,6 +911,7 @@ if ("undefined" == typeof(wdw_cardEdition)) {
aCard.role = document.getElementById('roleTextBox').value.trim();
aCard.fn = document.getElementById('fnTextBox').value.trim();
aCard.lastname = document.getElementById('lastnameTextBox').value.trim();
aCard.firstname = document.getElementById('firstnameTextBox').value.trim();
aCard.othername = document.getElementById('othernameTextBox').value.trim();
......@@ -956,6 +959,19 @@ if ("undefined" == typeof(wdw_cardEdition)) {
}
aCard.others = othersTemp1.concat(othersTemp3);
// trying desesperately to find a Fn
if (aCard.fn == "") {
cardbookUtils.getDisplayedName(aCard, document.getElementById('dirPrefIdTextBox').value, [document.getElementById('prefixnameTextBox').value.trim(),
document.getElementById('firstnameTextBox').value.trim(),
document.getElementById('othernameTextBox').value.trim(),
document.getElementById('lastnameTextBox').value.trim(),
document.getElementById('suffixnameTextBox').value.trim(),
document.getElementById('nicknameTextBox').value.trim()],
[wdw_cardEdition.getOrg(false),
document.getElementById('titleTextBox').value.trim(),
document.getElementById('roleTextBox').value.trim()]);
}
cardbookUtils.setCalculatedFields(aCard);
var myMembers = [];
......
......@@ -173,7 +173,7 @@
</row>
<row align="center">
<label id="nicknameLabel" value="&nicknameLabel;" control="nicknameTextBox" class="header"/>
<textbox id="nicknameTextBox"/>
<textbox id="nicknameTextBox" oninput="wdw_cardEdition.setDisplayName();"/>
</row>
<row align="center">
<hbox flex="1" align="center">
......
......@@ -439,7 +439,7 @@ if ("undefined" == typeof(cardbookCardParser)) {
}
if (this.fn == "") {
this.fn = cardbookUtils.getDisplayedName(this.dirPrefId, [this.prefixname, this.firstname, this.othername, this.lastname, this.suffixname],
cardbookUtils.getDisplayedName(this, this.dirPrefId, [this.prefixname, this.firstname, this.othername, this.lastname, this.suffixname, this.nickname],
[this.org, this.title, this.role]);
}
......
......@@ -31,7 +31,7 @@ var cardbookRepository = {
defaultDisplayedColumns : "cardIcon,fn,email.0.all,tel.0.all,bday,rev",
defaultAutocompleteRestrictSearchFields : "firstname|lastname",
defaultFnFormula : "({{1}} |)({{2}} |)({{3}} |)({{4}} |)({{5}} |)({{6}} |)",
defaultFnFormula : "({{1}} |)({{2}} |)({{3}} |)({{4}} |)({{5}} |)({{6}} |)({{7}}|)",
defaultAdrFormula : "",
defaultKindCustom : "X-ADDRESSBOOKSERVER-KIND",
defaultMemberCustom : "X-ADDRESSBOOKSERVER-MEMBER",
......@@ -398,6 +398,35 @@ var cardbookRepository = {
}
},
migrateFnFormula: function() {
try {
// for file opened with version <= 28.0
var fnFormulaMigrated = cardbookPreferences.getBoolPref("extensions.cardbook.fnFormulaMigrated");
if (!fnFormulaMigrated) {
var result = [];
result = cardbookPreferences.getAllPrefIds();
for (let i = 0; i < result.length; i++) {
var myFnFormula = cardbookPreferences.getFnFormula(result[i]);
if (myFnFormula == "({{1}} |)({{2}} |)({{3}} |)({{4}} |)({{5}} |)({{6}} |)") {
cardbookPreferences.setFnFormula(result[i], cardbookRepository.defaultFnFormula);
} else {
for (var j = 30; j >= 6; j--) {
var k = j + 1;
if (myFnFormula.includes("{{" + j + "}}")) {
myFnFormula = myFnFormula.replace("{{" + j + "}}", "{{" + k + "}}");
}
}
cardbookPreferences.setFnFormula(result[i], myFnFormula);
}
}
cardbookPreferences.setBoolPref("extensions.cardbook.fnFormulaMigrated", true);
}
}
catch (e) {
return "";
}
},
setEventEntryTitle: function() {
try {
// for file opened with version <= 25.4
......
......@@ -2511,8 +2511,9 @@ if ("undefined" == typeof(cardbookSynchronization)) {
cardbookUtils.setCardUUID(myCard);
cardbookUtils.setCalculatedFields(myCard);
if (myCard.fn == "") {
myCard.fn = cardbookUtils.getDisplayedName(myCard.dirPrefId, [myCard.prefixname, myCard.firstname, myCard.othername, myCard.lastname, myCard.suffixname],
[myCard.org, myCard.title, myCard.role]);
cardbookUtils.getDisplayedName(myCard, myCard.dirPrefId,
[myCard.prefixname, myCard.firstname, myCard.othername, myCard.lastname, myCard.suffixname, myCard.nickname],
[myCard.org, myCard.title, myCard.role]);
}
}
catch (e) {
......
......@@ -688,7 +688,35 @@ if ("undefined" == typeof(cardbookUtils)) {
}
},
getDisplayedName: function(aDirPrefId, aNewN, aNewOrg) {
getDisplayedName: function(aCard, aDirPrefId, aNewN, aNewOrg) {
aCard.fn = cardbookUtils.getDisplayedNameFromFormula(aDirPrefId, aNewN, aNewOrg);
if (aCard.fn == "") {
cardbookUtils.getDisplayedNameFromRest(aCard);
}
},
getDisplayedNameFromRest: function(aCard) {
var typesList = [ 'email', 'tel', 'impp', 'url', 'adr' ];
for (var i in typesList) {
if (aCard[typesList[i]][0]) {
aCard.fn = aCard[typesList[i]][0][0][0];
if (aCard.fn != "") {
return;
}
}
}
var fieldsList = [ 'personal', 'org' ];
for (var i in fieldsList) {
for (var j in cardbookRepository.allColumns[fieldsList[i]]) {
if (aCard[cardbookRepository.allColumns[fieldsList[i]][j]] && aCard[cardbookRepository.allColumns[fieldsList[i]][j]] != "") {
aCard.fn = aCard[cardbookRepository.allColumns[fieldsList[i]][j]];
return;
}
}
}
},
getDisplayedNameFromFormula: function(aDirPrefId, aNewN, aNewOrg) {
var result = "";
var myFnFormula = cardbookPreferences.getFnFormula(aDirPrefId);
var orgStructure = cardbookPreferences.getStringPref("extensions.cardbook.orgStructure");
......
......@@ -37,6 +37,7 @@
<keyset id="viewZoomKeys">
<key id="CardBookKey" key="&cardbookMenuItemKey;" modifiers="accel, shift" oncommand="ovl_cardbook.open();"/>
<key id="CardBookNewContactKey" key="&newCardBookCardMenuKey;" modifiers="accel, shift" oncommand="wdw_cardbook.newKey();"/>
<key id="CardBookMenuKey" keycode="VK_F9" oncommand="wdw_cardbook.F9Key();"/>
</keyset>
<menupopup id="menu_NewPopup">
......
......@@ -56,7 +56,7 @@ if ("undefined" == typeof(ovl_synchro)) {
prefs.setCharPref("localizeEngine", "OpenStreetMap");
prefs.setCharPref("localizeTarget", "out");
prefs.setCharPref("showNameAs", "LF");
prefs.setCharPref("fnFormula", "({{1}} |)({{2}} |)({{3}} |)({{4}} |)({{5}} |)({{6}} |)");
prefs.setBoolPref("fnFormulaMigrated", false);
// localized
cardbookRepository.defaultAdrFormula = strBundle.GetStringFromName("addressFormatFormula");
......@@ -89,7 +89,7 @@ if ("undefined" == typeof(ovl_synchro)) {
prefs.setCharPref("accountsShown", "all");
prefs.setCharPref("accountShown", "");
prefs.setCharPref("uncategorizedCards", "");
prefs.setCharPref("addonVersion", "28.0");
prefs.setCharPref("addonVersion", "28.1");
},
lEventTimerSync : { notify: function(lTimerSync) {
......@@ -129,6 +129,7 @@ if ("undefined" == typeof(ovl_synchro)) {
cardbookRepository.loadCustoms();
cardbookRepository.setCalendarEntryAlarm();
cardbookRepository.setEventEntryTitle();
cardbookRepository.migrateFnFormula();
// observers are needed not only UI but also for synchro
// there is no unregister launched
......
......@@ -511,10 +511,11 @@ if ("undefined" == typeof(wdw_cardbook)) {
var myCard = myCards[i];
var myOutCard = new cardbookCardParser();
cardbookUtils.cloneCard(myCard, myOutCard);
var myFn = cardbookUtils.getDisplayedName(myOutCard.dirPrefId, [myOutCard.prefixname, myOutCard.firstname, myOutCard.othername, myOutCard.lastname, myOutCard.suffixname],
[myOutCard.org, myOutCard.title, myOutCard.role]);
if (myFn != "" && myFn != myOutCard.fn) {
myOutCard.fn = myFn;
var myFn = myOutCard.fn;
cardbookUtils.getDisplayedName(myOutCard, myOutCard.dirPrefId,
[myOutCard.prefixname, myOutCard.firstname, myOutCard.othername, myOutCard.lastname, myOutCard.suffixname, myOutCard.nickname],
[myOutCard.org, myOutCard.title, myOutCard.role]);
if (myFn != myOutCard.fn && myOutCard.fn != "") {
cardbookRepository.saveCard(myCard, myOutCard, "cardbook.cardModifiedDirect");
}
}
......
......@@ -264,8 +264,8 @@ tzLabel=Tidszone
geoLabel=Geo
prodidLabel=Prodid
sortstringLabel=Sorteringsstreng
uidLabel=Uid
cbidLabel=CardBook id
uidLabel=Kontakt-id
cbidLabel=CardBook-id
class1Label=Klasse
dirPrefIdLabel=DirPrefId
kindLabel=Type
......
......@@ -13,4 +13,4 @@
<!ENTITY anniversaryLabel "Mærkedag">
<!ENTITY deathdateLabel "Død dato">
<!ENTITY deathplaceLabel "Død sted">
<!ENTITY uidLabel "Uid">
<!ENTITY uidLabel "Kontakt-id">
......@@ -6,7 +6,7 @@
<Description about="urn:mozilla:install-manifest">
<em:id>cardbook@vigneau.philippe</em:id>
<em:name>CardBook</em:name>
<em:version>28.0</em:version>
<em:version>28.1</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