diff --git a/resources/languages/resources.properties b/resources/languages/resources.properties index d63e70d8d..545fdb623 100644 --- a/resources/languages/resources.properties +++ b/resources/languages/resources.properties @@ -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 diff --git a/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java b/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java index 7c40dfff9..4970fedf3 100644 --- a/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java +++ b/src/net/java/sip/communicator/impl/callhistory/CallHistorySourceContact.java @@ -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, 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 getContactDetails( * category */ public List 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."); } /** diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java index c903f51ce..5dc929f24 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/SourceUIContact.java @@ -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 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 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 allDetails = sourceContact.getContactDetails(); + + addDetailsToToolTip(allDetails, + GuiActivator.getResources() + .getI18NString("service.gui.CALL_WITH"), tip); + } return tip; } @@ -334,7 +351,7 @@ private void addDetailsToToolTip( List 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 details, toolTip.addLine(jLabels); } - } } diff --git a/src/net/java/sip/communicator/impl/gui/utils/ExtendedTooltip.java b/src/net/java/sip/communicator/impl/gui/utils/ExtendedTooltip.java index 4889ad888..b615156c6 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/ExtendedTooltip.java +++ b/src/net/java/sip/communicator/impl/gui/utils/ExtendedTooltip.java @@ -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); diff --git a/src/net/java/sip/communicator/service/contactsource/SourceContact.java b/src/net/java/sip/communicator/service/contactsource/SourceContact.java index 2f7180654..a35a26e8a 100644 --- a/src/net/java/sip/communicator/service/contactsource/SourceContact.java +++ b/src/net/java/sip/communicator/service/contactsource/SourceContact.java @@ -66,8 +66,12 @@ public List getContactDetails( * @param category the OperationSet class we're looking for * @return a list of all ContactDetails corresponding to the given * category + * + * @throws OperationNotSupportedException if categories aren't supported + * for call history records */ - public List getContactDetails(String category); + public List getContactDetails(String category) + throws OperationNotSupportedException; /** * Returns the preferred ContactDetail for a given