/*! Accepts an incoming call. Has no effect if there is no incoming call. */ void DialerControl::accept() { QList<QPhoneCall> incomingCalls = findCalls( QPhoneCall::Incoming ); if( incomingCalls.count() ) { QPhoneCall incoming = incomingCalls.first(); if ( incoming.incoming() ) { //put active calls on hold if ( incoming.callType() == "Voice" ) { // No tr // GSM calls will be put on hold automatically by the accept(). // Other call types need to be put on hold explicitly. if( hasActiveCalls() ) { if ( activeCalls().first().callType() == "Voice" ) { // No tr incoming.accept(); } else { hold(); incoming.accept(); } } else { incoming.accept(); } } else { if( hasActiveCalls() ) hold(); incoming.accept(); incoming.activate(); } } } }
/*! Returns the incoming call. If there is no incoming call, a null QPhoneCall is returned. */ QPhoneCall DialerControl::incomingCall() const { QList<QPhoneCall> ic = findCalls( QPhoneCall::Incoming ); if( ic.count() ) return ic.first(); return QPhoneCall(); }
// must be locked void CallManager::updateCallState(vector<Translator> &tlist, int client) { vector<unsigned int>calls = findCalls(client); for (int i=0; i<tlist.size(); i++) { tlist[i].setAwait(false); tlist[i].setConfirmed(false); tlist[i].setRejected(false); for (int j=0; j<calls.size(); j++) { PhoneCall *c = dynamic_cast<PhoneCall *>(getCall(calls[j])); if (!c) continue; if (c->getTranslator() == tlist[i].getID()) { switch (c->getState()) { case INIT: break; case AWAIT: tlist[i].setAwait(true); break; case CONFIRMED: tlist[i].setConfirmed(true); break; case REJECTED: tlist[i].setRejected(true); break; case ACTIVE: break; case ERROR: tlist[i].setError(true); break; } break; } } } }
/*! Makes calls on hold active. */ void DialerControl::unhold() { QList<QPhoneCall> hc = findCalls( QPhoneCall::Hold ); if( hc.count() ) { emit callControlRequested(); hc.first().connectStateChanged( this, SLOT(checkConnectedState(QPhoneCall)) ); hc.first().activate(); } }
/*! Returns true if there is an incoming call (i.e. not yet answered). */ bool DialerControl::hasIncomingCall() const { return ( findCalls( QPhoneCall::Incoming ).count() != 0 ); }
/*! Returns the list of calls on hold. */ QList<QPhoneCall> DialerControl::callsOnHold() const { return findCalls( QPhoneCall::Hold ); }