Corrects the visibility of the merge call button for the pre-call dialog and for the call panel. NB: Still need to correct merging call functionality (broken since r9870).

cusax-fix
Vincent Lucas 14 years ago
parent e3341bfeb5
commit ccbb6b2f45

@ -100,7 +100,7 @@ public void run()
.hasEnabledVideoFormat(sourceCall.getProtocolProvider());
final ReceivedCallDialog receivedCallDialog
= new ReceivedCallDialog(sourceCall, isVideoCall,
(CallManager.getActiveCalls().size() > 0));
(CallManager.getInProgressCalls().size() > 0));
receivedCallDialog.setVisible(true);
@ -279,7 +279,7 @@ private static void answerCall(Call call, Call existingCall, boolean video)
public static void answerCallInFirstExistingCall(Call call)
{
// Find the first existing call.
Iterator<Call> existingCallIter = getActiveCalls().iterator();
Iterator<Call> existingCallIter = getInProgressCalls().iterator();
Call existingCall
= existingCallIter.hasNext() ? existingCallIter.next() : null;
@ -1107,6 +1107,31 @@ public static Collection<Call> getActiveCalls()
return activeCalls.keySet();
}
/**
* Returns a collection of all currently in progress calls.
*
* @return a collection of all currently in progress calls.
*/
public static Collection<Call> getInProgressCalls()
{
Set<Call> calls = activeCalls.keySet();
ArrayList<Call> inProgressCalls = new ArrayList<Call>(calls.size());
Iterator<Call> it = calls.iterator();
Call tmpCall;
while(it.hasNext())
{
tmpCall = it.next();
if(tmpCall.getCallState() == CallState.CALL_IN_PROGRESS)
{
inProgressCalls.add(tmpCall);
}
}
//return calls;
return inProgressCalls;
}
/**
* Returns the <tt>CallContainer</tt> corresponding to the given
* <tt>call</tt>. If the call has been finished and no active

@ -337,6 +337,12 @@ public CallPanel(Call call, CallContainer callWindow)
// Adds a CallChangeListener that would receive events when a peer is
// added or removed, or the state of the call has changed.
call.addCallChangeListener(this);
Iterator<Call> calls = CallManager.getActiveCalls().iterator();
while(calls.hasNext())
{
calls.next().addCallChangeListener(this);
}
// Adds the CallPeerConferenceListener that would listen for changes in
// the focus state of each call peer.
@ -495,7 +501,7 @@ public void actionPerformed(ActionEvent evt)
if (buttonName.equals(MERGE_BUTTON))
{
Collection<Call> calls = CallManager.getActiveCalls();
Collection<Call> calls = CallManager.getInProgressCalls();
CallManager.mergeExistingCall(call, calls);
}
@ -922,7 +928,9 @@ public void callPeerRemoved(CallPeerEvent evt)
}
public void callStateChanged(CallChangeEvent evt)
{}
{
updateMergeButtonState();
}
/**
* Updates <tt>CallPeer</tt> related components to fit the new focus state.
@ -1699,6 +1707,7 @@ public void disposeCallInfoFrame()
public void incomingCallReceived(CallEvent event)
{
updateMergeButtonState();
event.getSourceCall().addCallChangeListener(this);
}
/**
@ -1707,6 +1716,7 @@ public void incomingCallReceived(CallEvent event)
public void outgoingCallCreated(CallEvent event)
{
updateMergeButtonState();
event.getSourceCall().addCallChangeListener(this);
}
/**
@ -1715,6 +1725,16 @@ public void outgoingCallCreated(CallEvent event)
public void callEnded(CallEvent event)
{
updateMergeButtonState();
Call evtCall = event.getSourceCall();
evtCall.removeCallChangeListener(this);
if(evtCall.equals(this.call))
{
Iterator<Call> calls = CallManager.getActiveCalls().iterator();
while(calls.hasNext())
{
calls.next().removeCallChangeListener(this);
}
}
}
/**
@ -1723,7 +1743,7 @@ public void callEnded(CallEvent event)
public void updateMergeButtonState()
{
Collection<Call> calls
= new ArrayList<Call>(CallManager.getActiveCalls());
= new ArrayList<Call>(CallManager.getInProgressCalls());
if (calls.size() == 1)
{

@ -394,7 +394,7 @@ private synchronized void startSendingDtmfTone(DTMFToneInfo info)
}
else
{
Collection<Call> activeCalls = CallManager.getActiveCalls();
Collection<Call> activeCalls = CallManager.getInProgressCalls();
if (activeCalls != null)
{
@ -459,7 +459,7 @@ public synchronized void stopSendingDtmfTone()
}
else
{
Collection<Call> activeCalls = CallManager.getActiveCalls();
Collection<Call> activeCalls = CallManager.getInProgressCalls();
if (activeCalls != null)
{

@ -107,7 +107,8 @@ private void transferCall()
private Collection<CallPeer> getTransferCallPeers()
{
Collection<CallPeer> transferCalls = null;
Iterator<Call> activeCalls = CallManager.getActiveCalls().iterator();
Iterator<Call> activeCalls
= CallManager.getInProgressCalls().iterator();
while (activeCalls.hasNext())
{
Call activeCall = activeCalls.next();

Loading…
Cancel
Save