Shows the display name instead of address in call history. The address is still displayed in the tooltip.

cusax-fix
Yana Stamcheva 15 years ago
parent db1b05f262
commit 9b4c751f88

@ -84,6 +84,7 @@ service.gui.CALL_HISTORY_TOOL_TIP=Click here to show call history
service.gui.CALL_VIA=Call via:
service.gui.CALL_NAME_OR_NUMBER=Call name or number
service.gui.CALL_NOT_SUPPORTING_PARTICIPANT=This call only supports participants from the {0} network and your {1} account. {2} does not contain any address for this network or account.
service.gui.CALL_WITH=Call with
service.gui.CANCEL=&Cancel
service.gui.CHAT=Chat
service.gui.CHANGE_FONT=Change font

@ -106,11 +106,6 @@ private void initPeerDetails()
{
String peerAddress = recordsIter.next().getPeerAddress();
if (displayName.length() > 0)
displayName += "," + peerAddress;
else
displayName += peerAddress;
if (peerAddress != null)
{
ContactDetail contactDetail = new ContactDetail(peerAddress);
@ -129,17 +124,32 @@ private void initPeerDetails()
= new Hashtable<Class<? extends OperationSet>,
ProtocolProviderService>();
OperationSetContactCapabilities opSetCaps =
preferredProvider.getOperationSet(
OperationSetContactCapabilities.class);
OperationSetPresence opSetPres =
preferredProvider.getOperationSet(
OperationSetPresence.class);
Contact contact = opSetPres.findContactByID(peerAddress);
if (contact != null)
{
String contactDisplayName = contact.getDisplayName();
if (displayName == null || displayName.length() <= 0)
{
if (callRecord.getPeerRecords().size() > 1)
displayName
= "Conference " + contactDisplayName;
else
displayName = contactDisplayName;
}
}
OperationSetContactCapabilities opSetCaps =
preferredProvider.getOperationSet(
OperationSetContactCapabilities.class);
if(opSetCaps != null && opSetPres != null)
{
Contact contact = opSetPres.findContactByID(
peerAddress);
if(contact != null && opSetCaps.getOperationSet(
contact,
OperationSetBasicTelephony.class) != null)
@ -188,6 +198,13 @@ private void initPeerDetails()
contactDetail.setSupportedOpSets(supportedOpSets);
contactDetails.add(contactDetail);
// If no display name was found, set the peer address.
if (displayName == null || displayName.length() <= 0)
if (callRecord.getPeerRecords().size() > 1)
displayName = "Conference " + peerAddress;
else
displayName = peerAddress;
}
}
}
@ -285,9 +302,11 @@ public List<ContactDetail> getContactDetails(
* category
*/
public List<ContactDetail> getContactDetails(String category)
throws OperationNotSupportedException
{
// We don't support category for call history details, so we return null.
return null;
throw new OperationNotSupportedException(
"Categories are not supported for call history records.");
}
/**

@ -12,6 +12,7 @@
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.main.contactlist.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.contactsource.*;
@ -299,31 +300,47 @@ public ExtendedTooltip getToolTip()
tip.setTitle(sourceContact.getDisplayName());
List<ContactDetail> details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_PHONE);
String displayDetails = getDisplayDetails();
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_PHONE,
tip);
if (displayDetails != null)
tip.addLine(new JLabel[]{new JLabel(getDisplayDetails())});
details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_EMAIL);
try
{
List<ContactDetail> details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_PHONE);
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_PHONE + "s",
tip);
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_EMAIL,
tip);
details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_EMAIL);
details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_INSTANT_MESSAGING);
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_EMAIL + "s",
tip);
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_INSTANT_MESSAGING,
tip);
details = sourceContact.getContactDetails(
ContactDetail.CATEGORY_INSTANT_MESSAGING);
tip.setBottomText(getDisplayDetails());
if (details != null && details.size() > 0)
addDetailsToToolTip(details,
ContactDetail.CATEGORY_INSTANT_MESSAGING + "s",
tip);
}
catch (OperationNotSupportedException e)
{
// Categories aren't supported. This is the case for history
// records.
List<ContactDetail> allDetails = sourceContact.getContactDetails();
addDetailsToToolTip(allDetails,
GuiActivator.getResources()
.getI18NString("service.gui.CALL_WITH"), tip);
}
return tip;
}
@ -334,7 +351,7 @@ private void addDetailsToToolTip( List<ContactDetail> details,
{
ContactDetail contactDetail;
JLabel categoryLabel = new JLabel(category + "s", null, JLabel.LEFT);
JLabel categoryLabel = new JLabel(category, null, JLabel.LEFT);
categoryLabel.setFont(categoryLabel.getFont().deriveFont(Font.BOLD));
categoryLabel.setForeground(Color.DARK_GRAY);
@ -367,6 +384,5 @@ private void addDetailsToToolTip( List<ContactDetail> details,
toolTip.addLine(jLabels);
}
}
}

@ -48,7 +48,7 @@ public ExtendedTooltip(boolean isListViewEnabled)
this.setLayout(new BorderLayout());
JPanel mainPanel = new JPanel(new BorderLayout(5, 0));
JPanel mainPanel = new JPanel(new BorderLayout(5, 5));
JPanel centerPanel = new JPanel(new BorderLayout());
mainPanel.setOpaque(false);

@ -66,8 +66,12 @@ public List<ContactDetail> getContactDetails(
* @param category the <tt>OperationSet</tt> class we're looking for
* @return a list of all <tt>ContactDetail</tt>s corresponding to the given
* category
*
* @throws OperationNotSupportedException if categories aren't supported
* for call history records
*/
public List<ContactDetail> getContactDetails(String category);
public List<ContactDetail> getContactDetails(String category)
throws OperationNotSupportedException;
/**
* Returns the preferred <tt>ContactDetail</tt> for a given

Loading…
Cancel
Save