telutils/xqtelephonyservice/src/xqcallinfoimpl.cpp
branchRCL_3
changeset 19 7d48bed6ce0c
equal deleted inserted replaced
18:594d59766373 19:7d48bed6ce0c
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Provides implementation for XQCallInfo -class.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "xqcallinfoimpl.h"
       
    19 #include <ccallinformation.h>
       
    20 #include <ccallinfoiter.h>
       
    21 #include <mcall.h>
       
    22 
       
    23 XQCallInfoImpl::XQCallInfoImpl(): XQCallInfo(), m_CallInformation(0)
       
    24 {
       
    25     TRAPD( error, m_CallInformation = CCallInformation::NewL());
       
    26     qt_symbian_throwIfError(error);
       
    27     setCallInformationObserver();
       
    28 }
       
    29 
       
    30 XQCallInfoImpl::~XQCallInfoImpl()
       
    31 {
       
    32     delete m_CallInformation;
       
    33 }
       
    34 
       
    35 void XQCallInfoImpl::setCallInformationObserver()
       
    36 {
       
    37     m_CallInformation->NotifyCallInformationChanges(*this);
       
    38 }
       
    39 
       
    40 void XQCallInfoImpl::getCalls(QList<CallInfo> &calls)
       
    41 {
       
    42     TRAPD( error, m_Iter = &m_CallInformation->GetCallsL() );
       
    43     qt_symbian_throwIfError(error);
       
    44     
       
    45     for (m_Iter->First(); !m_Iter->IsDone(); m_Iter->Next()) {
       
    46         const MCall& call = m_Iter->Current();
       
    47         CallInfo callInfo;
       
    48         callInfo.m_Direction = call.CallDirection();
       
    49         callInfo.m_Index = call.CallIndex();
       
    50         callInfo.m_ServiceId = call.ServiceId();
       
    51         callInfo.m_Type = call.CallType();
       
    52         callInfo.m_State = call.CallState();
       
    53         calls.append(callInfo);
       
    54      }
       
    55 }
       
    56 
       
    57 bool XQCallInfoImpl::isCallInState(CCPCall::TCallState state) const
       
    58 {
       
    59     return m_CallInformation->IsCallInState(state);
       
    60 }
       
    61 
       
    62 void XQCallInfoImpl::CallInformationChanged()
       
    63 {
       
    64     XQCallInfo::sendCallInfoChangedSignal();
       
    65 }