/*! 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(); } } } }
void DialerControl::callStateChanged( const QPhoneCall& call ) { // Set value space appropriately // XXX Optimize for redundancy! if(hasIncomingCall()) { QPhoneCall icall = incomingCall(); QString number = icall.number(); QString name; QUniqueId contact = icall.contact(); QContactModel *m = ServerContactModel::instance(); if(!contact.isNull()) { QContact cnt = m->contact(contact); if (!cnt.uid().isNull()) name = cnt.label(); } else if(!number.isEmpty()) { QContact cnt = m->matchPhoneNumber(number); if (!cnt.uid().isNull()) name = cnt.label(); } else { number = tr("Unknown", "Unknown caller"); } phoneValueSpace.setAttribute("Incoming/Number", QVariant(number.trimmed())); phoneValueSpace.setAttribute("Incoming/Name", QVariant(name)); if(!aaTid && mProfiles->activeProfile().autoAnswer()) aaTid = startTimer(auto_answer_gap); } else { if(aaTid) killTimer(aaTid); phoneValueSpace.removeAttribute("Incoming"); } // emit useful signals if( call.state() == QPhoneCall::Connected ) { emit callConnected( call ); // update cached call info. updateCachedCall( call ); } else if( call.state() == QPhoneCall::Hold ) { emit callPutOnHold( call ); } else if( call.dialing() ) { emit callDialing( call ); } else if( call.incoming() ) { // Turn off screen saver so the incoming call will be visible. QtopiaPowerManager::setActive(false); emit callIncoming( call ); } else if ( call.dropped() ) { emit callDropped( call ); } doActiveCalls(); // Disable screen saver if in a call if (hasIncomingCall() || hasActiveCalls() || hasCallsOnHold()) QtopiaApplication::setPowerConstraint(QtopiaApplication::DisableLightOff); else QtopiaApplication::setPowerConstraint(QtopiaApplication::Enable); emit stateChanged(); }