- Stop the call duration timer when the last peer is removed.

- Fix calling a meta contact, which was broken from my last commit introducing call conferencing code.
cusax-fix
Yana Stamcheva 17 years ago
parent 640e6d5225
commit 968d7410db

@ -60,7 +60,7 @@ public class CallDialog
private boolean isCallTimerStarted = false;
private Timer timer;
private Timer callDurationTimer;
/**
* Creates a <tt>CallDialog</tt> by specifying the underlying call panel.
@ -152,8 +152,8 @@ public CallDialog(Call call)
buttonsPanel.setBorder(
new ExtendedEtchedBorder(EtchedBorder.LOWERED, 1, 0, 0, 0));
this.timer = new Timer(1000, new CallTimerListener());
this.timer.setRepeats(true);
this.callDurationTimer = new Timer(1000, new CallTimerListener());
this.callDurationTimer.setRepeats(true);
}
@ -411,6 +411,12 @@ public void callPeerRemoved(CallPeerEvent evt)
timer.setRepeats(false);
timer.start();
// The call is finished when that last peer is removed.
if (call.getCallPeerCount() == 0)
{
this.stopCallTimer();
}
}
}
@ -449,7 +455,7 @@ private boolean isConference()
public void startCallTimer()
{
this.callStartDate = new Date();
this.timer.start();
this.callDurationTimer.start();
this.isCallTimerStarted = true;
}
@ -458,7 +464,7 @@ public void startCallTimer()
*/
public void stopCallTimer()
{
this.timer.stop();
this.callDurationTimer.stop();
}
/**

@ -174,46 +174,37 @@ public void actionPerformed(ActionEvent evt)
// call button is pressed when a meta contact is selected
if (isCallMetaContact)
{
Object[] selectedContacts = mainFrame.getContactListPanel()
.getContactList().getSelectedValues();
java.util.List<String> telephonyContacts =
new Vector<String>();
// We don't support conferencing from multiple selection for
// now. That would suppose to make choices on which protocol
// provider should be used to establish the call, so until we're
// not able to fully implement the feature we'll consider only
// one selected contact.
Object selectedContact = mainFrame.getContactListPanel()
.getContactList().getSelectedValue();
for (Object o : selectedContacts)
if (selectedContact instanceof MetaContact)
{
if (o instanceof MetaContact)
Contact contact = ((MetaContact) selectedContact)
.getDefaultContact(OperationSetBasicTelephony.class);
if (contact != null)
{
Contact contact = ((MetaContact) o)
.getDefaultContact(
OperationSetBasicTelephony.class);
if (contact != null)
telephonyContacts.add(contact.getAddress());
else
{
new ErrorDialog(
this.mainFrame,
GuiActivator.getResources()
.getI18NString("service.gui.WARNING"),
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NOT_SUPPORTING_TELEPHONY",
new String[]
{ ((MetaContact) o).getDisplayName() }))
.showDialog();
}
CallManager.createCall(
contact.getProtocolProvider(), contact);
}
else
{
new ErrorDialog(
this.mainFrame,
GuiActivator.getResources()
.getI18NString("service.gui.WARNING"),
GuiActivator.getResources().getI18NString(
"service.gui.CONTACT_NOT_SUPPORTING_TELEPHONY",
new String[]
{ ((MetaContact) selectedContact)
.getDisplayName() }))
.showDialog();
}
}
if (telephonyContacts.size() > 0)
{
String[] contactAddressStrings
= new String[telephonyContacts.size()];
contactAddressStrings
= telephonyContacts.toArray(contactAddressStrings);
CallManager.createConferenceCall(
contactAddressStrings, protocolProvider);
}
}
else if (!phoneNumberCombo.isComboFieldEmpty())

Loading…
Cancel
Save