mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-03 12:35:58 +00:00
fix for #168108. show icons in card preview pane, using screenname attribute.
if you happen to use NS 7.x, the place we look on disk (by default) is the buddy icon directory. r/sr=bienvenu
This commit is contained in:
parent
b815570db2
commit
b94abfcad0
@ -31,6 +31,11 @@ var gPrefs = Components.classes["@mozilla.org/preferences-service;1"];
|
||||
gPrefs = gPrefs.getService();
|
||||
gPrefs = gPrefs.QueryInterface(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
var gProfile = Components.classes["@mozilla.org/profile/manager;1"].getService(Components.interfaces.nsIProfileInternal);
|
||||
|
||||
var gProfileDirURL = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIFileURL);
|
||||
gProfileDirURL.file = gProfile.getProfileDir(gProfile.currentProfile);
|
||||
|
||||
var gMapItURLFormat = gPrefs.getComplexValue("mail.addr_book.mapit_url.format",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
|
||||
@ -92,6 +97,7 @@ function OnLoadCardView()
|
||||
cvData.cvEmail1 = doc.getElementById("cvEmail1");
|
||||
cvData.cvScreennameBox = doc.getElementById("cvScreennameBox");
|
||||
cvData.cvScreenname = doc.getElementById("cvScreenname");
|
||||
cvData.cvBuddyIcon = doc.getElementById("cvBuddyIcon");
|
||||
cvData.cvListNameBox = doc.getElementById("cvListNameBox");
|
||||
cvData.cvListName = doc.getElementById("cvListName");
|
||||
cvData.cvEmail2Box = doc.getElementById("cvEmail2Box");
|
||||
@ -252,14 +258,38 @@ function DisplayCardViewPane(card)
|
||||
visible = cvSetNodeWithLabel(data.cvCustom3, zCustom3, card.custom3) || visible;
|
||||
visible = cvSetNodeWithLabel(data.cvCustom4, zCustom4, card.custom4) || visible;
|
||||
visible = cvSetNode(data.cvNotes, card.notes) || visible;
|
||||
cvSetVisible(data.cvhOther, visible);
|
||||
cvSetVisible(data.cvbOther, visible);
|
||||
|
||||
// hide description section, not show for non-mailing lists
|
||||
cvSetVisible(data.cvbDescription, false);
|
||||
var iconURLStr = "";
|
||||
try {
|
||||
var myScreenName = gPrefs.getCharPref("aim.session.screenname");
|
||||
if (myScreenName && card.aimScreenName) {
|
||||
iconURLStr = gProfileDirURL.spec + "/NIM/" + myScreenName + "/picture/" + card.aimScreenName + ".gif";
|
||||
|
||||
// hide addresses section, not show for non-mailing lists
|
||||
cvSetVisible(data.cvbAddresses, false);
|
||||
// check if the file exists
|
||||
var iconFileURL = Components.classes["@mozilla.org/network/standard-url;1"].createInstance(Components.interfaces.nsIFileURL);
|
||||
iconFileURL.spec = iconURLStr;
|
||||
|
||||
if (iconFileURL.file.exists()) {
|
||||
data.cvBuddyIcon.setAttribute("src", iconURLStr);
|
||||
visible = true;
|
||||
}
|
||||
else {
|
||||
data.cvBuddyIcon.setAttribute("src", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ex) {
|
||||
dump("ex = " + ex + "\n");
|
||||
}
|
||||
|
||||
cvSetVisible(data.cvhOther, visible);
|
||||
cvSetVisible(data.cvbOther, visible);
|
||||
|
||||
// hide description section, not show for non-mailing lists
|
||||
cvSetVisible(data.cvbDescription, false);
|
||||
|
||||
// hide addresses section, not show for non-mailing lists
|
||||
cvSetVisible(data.cvbAddresses, false);
|
||||
}
|
||||
|
||||
// Phone section
|
||||
|
@ -85,6 +85,10 @@ Rights Reserved.
|
||||
<description class="CardViewText" id="cvCustom3"/>
|
||||
<description class="CardViewText" id="cvCustom4"/>
|
||||
<description class="CardViewText" id="cvNotes"/>
|
||||
|
||||
<hbox autostretch="never">
|
||||
<image id="cvBuddyIcon"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
||||
<vbox id="cvbDescription" class="cardViewGroup">
|
||||
|
@ -192,6 +192,11 @@ sidebarheader {
|
||||
min-width: 30px;
|
||||
}
|
||||
|
||||
#cvBuddyIcon {
|
||||
padding-left: 20px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.CardViewText,
|
||||
.CardViewLink {
|
||||
padding-left: 20px;
|
||||
|
@ -202,6 +202,11 @@ sidebarheader {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#cvBuddyIcon {
|
||||
padding-left: 20px;
|
||||
padding-top: 2px;
|
||||
}
|
||||
|
||||
.CardViewText,
|
||||
.CardViewLink {
|
||||
margin: 0px;
|
||||
|
Loading…
x
Reference in New Issue
Block a user