/*! \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(); }
/*! 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 ); }