voipplugins/svtcallmenu/src/svtcallstatehandler.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2008 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:  Settings handler class for svtcallmenu.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "svtcallstatehandler.h"
       
    20 
       
    21 
       
    22 // ======== MEMBER FUNCTIONS ========
       
    23 
       
    24 // ---------------------------------------------------------------------------
       
    25 // ---------------------------------------------------------------------------
       
    26 //
       
    27 void CSvtCallStateHandler::ConstructL( 
       
    28         const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
       
    29     {
       
    30     TInt arrayCount = aCallArray.Count();
       
    31     for ( TInt i=0; i < arrayCount; i++ )
       
    32         {
       
    33         iCallArray.AppendL( aCallArray[i] );
       
    34         }
       
    35     }
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 CSvtCallStateHandler::CSvtCallStateHandler()
       
    42     {
       
    43 
       
    44     }
       
    45 
       
    46   
       
    47 // ---------------------------------------------------------------------------
       
    48 // ---------------------------------------------------------------------------
       
    49 //
       
    50 CSvtCallStateHandler* CSvtCallStateHandler::NewL(
       
    51         const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
       
    52     {
       
    53     CSvtCallStateHandler* self = new ( ELeave ) CSvtCallStateHandler();
       
    54     CleanupStack::PushL( self );
       
    55     self->ConstructL( aCallArray );
       
    56     CleanupStack::Pop( self );
       
    57     return self;
       
    58     }
       
    59 
       
    60 
       
    61 // ---------------------------------------------------------------------------
       
    62 // ---------------------------------------------------------------------------
       
    63 //
       
    64 CSvtCallStateHandler::~CSvtCallStateHandler()
       
    65     {
       
    66     iCallArray.Close();    
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // Checks is feature supported
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 TBool CSvtCallStateHandler::FeatureSupported( 
       
    74     TFeature aFeature ) const
       
    75     {
       
    76     TBool ret( EFalse );
       
    77     
       
    78     switch( aFeature )
       
    79         {
       
    80         case ESvmFeatureUnattendedTransfer:
       
    81             {
       
    82             ret = UnattendedTransferPossible();
       
    83             break;
       
    84             }
       
    85         default:
       
    86             break;
       
    87         }
       
    88     
       
    89     return ret;
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // Checks is unattended transfer currently possible
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 TBool CSvtCallStateHandler::UnattendedTransferPossible() const
       
    98     {
       
    99     TBool ret( EFalse );
       
   100     TInt arrayCount = iCallArray.Count();
       
   101 
       
   102     for ( TInt i=0; i < arrayCount; i++ )
       
   103         {
       
   104         if ( iCallArray[i].iCallType == CTelMenuExtension::EPsVoice &&
       
   105              iCallArray[i].iCallState == CTelMenuExtension::EActive )
       
   106             {
       
   107             // Unattended transfer possible if there is active voip call
       
   108             ret = ETrue;
       
   109             }
       
   110         }
       
   111     return ret;
       
   112     }