Does not display menu when there is only one phone number for the call button (on the contact and in the right button menu).

cusax-fix
Sebastien Vincent 14 years ago
parent 95de7f628f
commit 9a549cc61d

@ -966,7 +966,6 @@ private void call(TreeNode treeNode)
// 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 PresenceStatus getPresenceStatus()
}
};
telephonyContacts.add(cd);
hasPhone = true;
}
}
}
@ -1022,7 +1020,7 @@ public PresenceStatus getPresenceStatus()
ChooseCallAccountPopupMenu chooseAccountDialog = null;
if (telephonyContacts.size() == 1 && !hasPhone)
if (telephonyContacts.size() == 1)
{
UIContactDetail detail = telephonyContacts.get(0);
@ -1060,7 +1058,7 @@ else if (providersCount > 1)
tree, detail.getAddress(), providers);
}
}
else if (telephonyContacts.size() > 1 || hasPhone)
else if (telephonyContacts.size() > 1)
{
chooseAccountDialog
= new ChooseCallAccountPopupMenu(tree, telephonyContacts);

@ -532,16 +532,24 @@ private void init()
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 @@ else if (authRequestItemCount == 1
this.sendFileItem.setEnabled(false);
if (metaContact.getDefaultContact(
OperationSetBasicTelephony.class) == null)
OperationSetBasicTelephony.class) == null && !hasPhones)
this.callItem.setEnabled(false);
if (metaContact.getDefaultContact(

@ -16,6 +16,7 @@
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 List<UIContactDetail> getContactDetailsForOperationSet(
/**
* 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 ImageIcon getAvatar(
= (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 ExtendedTooltip getToolTip()
//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

Loading…
Cancel
Save