...
 
Commits (3)
......@@ -112,13 +112,8 @@ mivExchangeAutoCompleteResult.prototype = {
*/
//readonly attribute long defaultIndex;
get defaultIndex() {
var defaultId = this._idcards.length;
if (defaultId == 0) {
return -1;
}
return 0;
// by default index is always 0 if the _idcards contains at least one element
return this._idcards.length > 0 ? 0 : -1;
},
/**
......@@ -151,6 +146,7 @@ mivExchangeAutoCompleteResult.prototype = {
* Get the value of the result at the given index
*/
//AString getValueAt(in long index);
// The returned value is used to fill the publicly readable "TO:" mail header
getValueAt: function _getValueAt(aIndex) {
var localid = this._idcards[aIndex];
......@@ -175,13 +171,13 @@ mivExchangeAutoCompleteResult.prototype = {
result = emailList;
}
}
else if (card.displayName != "") {
result = card.displayName + " <" + card.primaryEmail + ">";
}
else if (card.firstName != ""
|| card.lastName != "") {
result = card.firstName + " " + card.lastName + " <" + card.primaryEmail + ">";
}
else if (card.displayName != "") {
result = card.displayName + " <" + card.primaryEmail + ">";
}
else {
result = card.primaryEmail;
}
......@@ -204,11 +200,32 @@ mivExchangeAutoCompleteResult.prototype = {
getCommentAt: function _getCommentAt(aIndex) {
var localid = this._idcards[aIndex];
var card = this._cards[localid];
var comment = "Exchange Calendar";
var comment = "";
if (card.isMailList && card.primaryEmail.indexOf("@") == -1) {
comment = card.displayName;
}
else if (card.displayName != "") {
// Add first name and / or last name to comment if display name is used in the "TO:" header
if (card.firstName != "") {
comment += card.firstName;
}
if (card.lastName != "") {
if (comment != "")
{
comment += " "
}
comment += card.lastName
}
}
if (comment != "")
{
comment += ", "
}
comment += "Exchange Calendar";
return comment;
},
......@@ -259,8 +276,8 @@ mivExchangeAutoCompleteResult.prototype = {
// Before really adding the result, check the card is a mailing list
// and, otherwise, check it's primary email has at least a "@"
if ((aCard.primaryEmail != "" && aCard.primaryEmail.indexOf("@") > -1)
|| (aCard.isMailList)) {
if (aCard.isMailList
|| aCard.primaryEmail.indexOf("@") > -1) {
this._cards[aCard.localId] = aCard;
this._idcards.push(aCard.localId);
}
......