コード例 #1
0
ファイル: dialup.cpp プロジェクト: Fale/qtmoko
void DialupImpl::phoneCallStateChanged( const QPhoneCall& call)
{
    if ( (int)call.state()  >= (int) QPhoneCall::HangupLocal  && !pppdProcessBlocked ) {
        //if the call hangs up/aborts w/o being stopped manually by the user we need to cleanup 
        //in order to prevent that pppdProcessBlocked blocks the interface forever
        if ( tidStateUpdate ) {
            killTimer( tidStateUpdate );
            tidStateUpdate = 0;
            state = Initialize;
            logIndex = 0;
        }
        pppIface = QString();
        netSpace->setAttribute( "NetDevice", QString() );
        ifaceStatus = QtopiaNetworkInterface::Down;
        status();
    }
    qLog(Network) << "Call state: " << call.state();
}
コード例 #2
0
ファイル: dialercontrol.cpp プロジェクト: muromec/qtopia-ezx
/*!
  Record the \a call in the call list.
 */
void DialerControl::recordCall( const QPhoneCall &call )
{
    QCallListItem::CallType ct;
    if( call.dialed() )
        ct = QCallListItem::Dialed;
    else if( call.hasBeenConnected() || call.state() == QPhoneCall::HangupLocal )
        ct = QCallListItem::Received;
    else {
        ct = QCallListItem::Missed;
        // increase missed call count
        missedCall( call );
    }

    // QPhoneCall::connectTime() in case call has been connected
    // QPhoneCall::startTime() in other cases
    QDateTime startTime = call.hasBeenConnected() ? call.connectTime() : call.startTime();

    QCallListItem listItem( ct, call.fullNumber(),
            startTime, call.endTime(), call.contact(), call.callType() );
    mCallList.record( listItem );

    removeCachedCall( call );
}
コード例 #3
0
ファイル: dialercontrol.cpp プロジェクト: muromec/qtopia-ezx
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();
}
コード例 #4
0
ファイル: dialercontrol.cpp プロジェクト: muromec/qtopia-ezx
/*!
    \internal
    Checks if the request to connect the \a call was successful.
*/
void DialerControl::checkConnectedState( const QPhoneCall &call )
{
    if ( call.state() == QPhoneCall::Connected )
        emit callControlSucceeded();
    call.disconnectStateChanged( this, SLOT(checkConnectedState(QPhoneCall)) );
}