choose automatically the selected telephony account depending on the selected contact - patch created by Symphorien

cusax-fix
Yana Stamcheva 19 years ago
parent bb5c1008a3
commit c03769c3f5

@ -462,6 +462,21 @@ private Contact getTelephonyContact(MetaContact metaContact)
return null;
}
/**
* Returns the account selector box.
*
* @return the account selector box.
*/
public AccountSelectorBox getAccountSelectorBox()
{
return accountSelectorBox;
}
/**
* Sets the protocol provider to use for a call.
*
* @param provider the protocol provider to use for a call.
*/
public void setCallProvider(ProtocolProviderService provider)
{
this.selectedCallProvider = provider;
@ -592,7 +607,38 @@ public void valueChanged(ListSelectionEvent e)
&& (o instanceof MetaContact))
{
setCallMetaContact(true);
callButton.setEnabled(true);
// Switch automatically to the appropriate pps in account selector
// box and enable callButton if telephony is supported by one of
// accounts owning contact(s) enclosed in this metacontact.
MetaContact mContact = (MetaContact) o;
Iterator contacts = mContact.getContacts();
boolean telephonySupported = false;
while (contacts.hasNext())
{
Contact contact = (Contact) contacts.next();
ProtocolProviderService pps = contact.getProtocolProvider();
if (pps.getOperationSet(OperationSetBasicTelephony.class)
!= null)
{
mainFrame.getCallManager().getAccountSelectorBox().
setSelected(pps);
telephonySupported = true;
break;
}
}
if (telephonySupported)
{
callButton.setEnabled(true);
}
else
{
callButton.setEnabled(false);
}
}
else if (phoneNumberCombo.isComboFieldEmpty())
{

Loading…
Cancel
Save