diff options
author | Sebastien Vincent <seb@jitsi.org> | 2011-12-15 12:57:37 +0000 |
---|---|---|
committer | Sebastien Vincent <seb@jitsi.org> | 2011-12-15 12:57:37 +0000 |
commit | 9a549cc61d00caaee12eb60cdcd1f7e3869dde43 (patch) | |
tree | b193a5a222a78609910e6258099ad007e185e2f8 /src/net/java/sip | |
parent | 95de7f628fde4be02570a662ff1cd77df4ff2a12 (diff) | |
download | jitsi-9a549cc61d00caaee12eb60cdcd1f7e3869dde43.zip jitsi-9a549cc61d00caaee12eb60cdcd1f7e3869dde43.tar.gz jitsi-9a549cc61d00caaee12eb60cdcd1f7e3869dde43.tar.bz2 |
Does not display menu when there is only one phone number for the call button (on the contact and in the right button menu).
Diffstat (limited to 'src/net/java/sip')
3 files changed, 41 insertions, 11 deletions
diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java index 786ed93..3287313 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/ContactListTreeCellRenderer.java @@ -966,7 +966,6 @@ public class ContactListTreeCellRenderer // Adds additional phone numbers found in contact information ContactNode n = (ContactNode)treeNode; MetaContact metaContact = null; - boolean hasPhone = false; if(n.getContactDescriptor().getDescriptor() instanceof MetaContact) { @@ -1012,7 +1011,6 @@ public class ContactListTreeCellRenderer } }; telephonyContacts.add(cd); - hasPhone = true; } } } @@ -1022,7 +1020,7 @@ public class ContactListTreeCellRenderer ChooseCallAccountPopupMenu chooseAccountDialog = null; - if (telephonyContacts.size() == 1 && !hasPhone) + if (telephonyContacts.size() == 1) { UIContactDetail detail = telephonyContacts.get(0); @@ -1060,7 +1058,7 @@ public class ContactListTreeCellRenderer tree, detail.getAddress(), providers); } } - else if (telephonyContacts.size() > 1 || hasPhone) + else if (telephonyContacts.size() > 1) { chooseAccountDialog = new ChooseCallAccountPopupMenu(tree, telephonyContacts); diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java index 379c6c1..9641b63 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/MetaContactRightButtonMenu.java @@ -532,16 +532,24 @@ public class MetaContactRightButtonMenu sendSmsItem.setName("sendSms"); } - if (callContactMenu.getItemCount() > 1 || - (hasPhones && callContactMenu.getItemCount() > 0)) + if (callContactMenu.getItemCount() > 1) { this.add(callContactMenu); } else { - this.add(callItem); - this.callItem.setName("call"); + if((hasPhones && callContactMenu.getItemCount() > 0)) + { + JMenuItem item = callContactMenu.getItem(0); + this.callItem.setName(item.getName()); + } + else + { + this.callItem.setName("call"); + } + this.callItem.addActionListener(this); + this.add(callItem); } if (videoCallMenu.getItemCount() > 1) @@ -641,7 +649,7 @@ public class MetaContactRightButtonMenu this.sendFileItem.setEnabled(false); if (metaContact.getDefaultContact( - OperationSetBasicTelephony.class) == null) + OperationSetBasicTelephony.class) == null && !hasPhones) this.callItem.setEnabled(false); if (metaContact.getDefaultContact( diff --git a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java index 4dd200c..f1ca680 100644 --- a/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java +++ b/src/net/java/sip/communicator/impl/gui/main/contactlist/contactsource/MetaUIContact.java @@ -16,6 +16,7 @@ import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.OperationSetExtendedAuthorizations.SubscriptionStatus; +import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; import net.java.sip.communicator.util.*; /** @@ -253,7 +254,7 @@ public class MetaUIContact /** * Gets the avatar of a specific <tt>MetaContact</tt> in the form of an * <tt>ImageIcon</tt> value. - * + * * @param isSelected indicates if the contact is selected * @param width the desired icon width * @param height the desired icon height @@ -288,7 +289,7 @@ public class MetaUIContact = (Object[]) metaContact.getData(AVATAR_DATA_KEY); ImageIcon avatar = null; - if ((avatarCache != null) && (avatarCache[0] == avatarBytes)) + if ((avatarCache != null) && (avatarCache[0] == avatarBytes)) avatar = (ImageIcon) avatarCache[1]; // If the avatar isn't available or it's not up-to-date, create it. @@ -406,6 +407,29 @@ public class MetaUIContact //String statusMessage = protocolContact.getStatusMessage(); tip.addLine(protocolStatusIcon, contactAddress); + OperationSetServerStoredContactInfo infoOpSet = + protocolContact.getProtocolProvider().getOperationSet( + OperationSetServerStoredContactInfo.class); + + if(infoOpSet != null) + { + Iterator<GenericDetail> details = + infoOpSet.getAllDetailsForContact(protocolContact); + + while(details.hasNext()) + { + GenericDetail d = details.next(); + if(d instanceof PhoneNumberDetail) + { + PhoneNumberDetail pnd = (PhoneNumberDetail)d; + if(pnd.getNumber() != null && + pnd.getNumber().length() > 0) + { + tip.addLine(null, pnd.getNumber()); + } + } + } + } // Set the first found status message. if (statusMessage == null |