diff --git a/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java b/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java
index 2ec710b89..1d85ce574 100644
--- a/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java
+++ b/src/net/java/sip/communicator/impl/gui/main/call/ChooseCallAccountPopupMenu.java
@@ -8,11 +8,13 @@
import java.awt.*;
import java.awt.event.*;
+import java.awt.image.*;
import java.util.List;
import javax.swing.*;
import net.java.sip.communicator.impl.gui.*;
+import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.service.protocol.*;
/**
@@ -61,8 +63,7 @@ public ChooseCallAccountPopupMenu( JComponent invoker,
for (Contact contact : telephonyContacts)
{
- this.addTelephonyProviderItem( contact.getProtocolProvider(),
- contact.getAddress());
+ this.addTelephonyContactItem(contact);
}
}
@@ -79,7 +80,7 @@ private void init()
}
/**
- * Adds the given telephonyProvider in the list of available
+ * Adds the given telephonyProvider to the list of available
* telephony providers.
* @param telephonyProvider the provider to add.
* @param contactString the contact to call when the provider is selected
@@ -104,6 +105,29 @@ public void actionPerformed(ActionEvent e)
this.add(providerItem);
}
+ /**
+ * Adds the given telephonyContact to the list of available
+ * telephony contact.
+ * @param telephonyContact the telephony contact to add
+ */
+ private void addTelephonyContactItem(final Contact telephonyContact)
+ {
+ final ContactMenuItem contactItem
+ = new ContactMenuItem(telephonyContact);
+
+ contactItem.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ CallManager.createCall( telephonyContact.getProtocolProvider(),
+ telephonyContact);
+ ChooseCallAccountPopupMenu.this.setVisible(false);
+ }
+ });
+
+ this.add(contactItem);
+ }
+
/**
* Shows the dialog at the given location.
* @param x the x coordinate
@@ -145,7 +169,8 @@ private Component createInfoLabel()
}
/**
- * A custom radio button corresponding to a ProtocolProviderService.
+ * A custom menu item corresponding to a specific
+ * ProtocolProviderService.
*/
private class ProviderMenuItem extends JMenuItem
{
@@ -169,4 +194,29 @@ public ProtocolProviderService getProtocolProvider()
return protocolProvider;
}
}
+
+ /**
+ * A custom menu item corresponding to a specific protocol Contact.
+ */
+ private class ContactMenuItem extends JMenuItem
+ {
+ private final Contact contact;
+
+ public ContactMenuItem(Contact contact)
+ {
+ this.contact = contact;
+ this.setText(contact.getDisplayName());
+
+ BufferedImage contactIcon
+ = Constants.getStatusIcon(contact.getPresenceStatus());
+
+ if (contactIcon != null)
+ this.setIcon(new ImageIcon(contactIcon));
+ }
+
+ public Contact getContact()
+ {
+ return contact;
+ }
+ }
}