示例#1
0
/*!
  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();
            }
        }
    }
}
示例#2
0
/*! \internal */
void DialerControl::cacheCall( const QPhoneCall &call )
{
    // cache call info to perserve data when battery runs out
    QSettings setting( "Trolltech", "qpe" );
    setting.beginGroup( "CallControl" );
    setting.beginGroup( call.identifier() );
    setting.setValue( "CallType", call.dialing() ? QCallListItem::Dialed : QCallListItem::Missed );
    setting.setValue( "FullNumber", call.fullNumber() );
    setting.setValue( "StartTime", call.startTime() );
    setting.setValue( "EndTime", QDateTime() );
    setting.setValue( "Contact", call.contact().toString() );
    setting.setValue( "ServiceType", call.callType() );
    setting.endGroup();
    setting.endGroup();
    setting.sync();
    // make sure the data is written to disk
    ::sync();
}
示例#3
0
/*!
  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 );
}