voipplugins/svtcallmenu/src/svtcallmenu.cpp
branchRCL_3
changeset 22 d38647835c2e
parent 0 a4daefaec16c
equal deleted inserted replaced
21:f742655b05bf 22:d38647835c2e
       
     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:  Main class for svtcallmenu.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "svtcallmenu.h"
       
    20 #include "svtcallstatehandler.h"
       
    21 
       
    22 #include <eikmenup.h>
       
    23 #include <phoneappcommands.hrh>
       
    24 #include <phoneappvoipcommands.hrh>
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CSvtCallMenu::CSvtCallMenu()
       
    32     {
       
    33     }
       
    34 
       
    35   
       
    36 // ---------------------------------------------------------------------------
       
    37 // ---------------------------------------------------------------------------
       
    38 //
       
    39 CSvtCallMenu* CSvtCallMenu::NewL()
       
    40     {
       
    41     CSvtCallMenu* self = new ( ELeave ) CSvtCallMenu;
       
    42     return self;
       
    43     }
       
    44 
       
    45 
       
    46 // ---------------------------------------------------------------------------
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CSvtCallMenu::~CSvtCallMenu()
       
    50     {
       
    51     delete iCallStateHandler;
       
    52     }
       
    53       
       
    54        
       
    55 // ---------------------------------------------------------------------------
       
    56 // Modifys call menu
       
    57 // ---------------------------------------------------------------------------
       
    58 //
       
    59 void CSvtCallMenu::ModifyExtensionsCallMenuL( 
       
    60         const RArray<CTelMenuExtension::TCallInfo>& aCallArray,
       
    61         CEikMenuPane& aMenuPane )
       
    62     {
       
    63     CreateCallStateHandlerL( aCallArray );
       
    64     CEikMenuPane*  menuPane= &aMenuPane;
       
    65     RArray<TInt> menuItemArray;
       
    66     CleanupClosePushL( menuItemArray );
       
    67 
       
    68     // Menu items to array
       
    69     TInt menuItemCount = menuPane->NumberOfItemsInPane();
       
    70     for ( TInt i( 0 ); i < menuItemCount; i++ )
       
    71         {
       
    72         menuItemArray.AppendL( menuPane->MenuItemCommandId( i ) );
       
    73         }
       
    74 
       
    75     // Menu items to be deleted 
       
    76     for ( TInt i( 0 ); i < menuItemArray.Count(); i++ )
       
    77         {
       
    78         switch( menuItemArray[ i ] )
       
    79             {
       
    80             case EPhoneInCallCmdUnattendedTransfer:
       
    81                 {
       
    82                 if ( !iCallStateHandler->FeatureSupported( 
       
    83                        CSvtCallStateHandler::ESvmFeatureUnattendedTransfer ) )
       
    84                     {
       
    85                     menuPane->DeleteMenuItem( menuItemArray[ i ] ); 
       
    86                     }
       
    87                 break;
       
    88                 }
       
    89             case EPhoneInCallCmdSwitchToVideo:
       
    90             case EPhoneInCallCmdCreateConference:
       
    91             case EPhoneInCallCmdConferenceMenu:
       
    92             case EPhoneInCallCmdJoin:
       
    93             case EPhoneCallComingCmdSoftReject:
       
    94             case EPhoneInCallCmdSendToCallerMenu:
       
    95                     {
       
    96                     // SIP voip doesn't support above features
       
    97                     // Remove those items from the menu
       
    98                     menuPane->DeleteMenuItem( menuItemArray[ i ] ); 
       
    99                     }
       
   100                 break;
       
   101             default: 
       
   102                 break;
       
   103             }
       
   104         }
       
   105     
       
   106     CleanupStack::PopAndDestroy( &menuItemArray );    
       
   107 
       
   108     }
       
   109 
       
   110 // ---------------------------------------------------------------------------
       
   111 // Modifys touch pane
       
   112 // ---------------------------------------------------------------------------
       
   113 //
       
   114 void CSvtCallMenu::ModifyExtensionsTouchPaneButtonsL( 
       
   115         const RArray<CTelMenuExtension::TCallInfo>& /*aCallArray*/,
       
   116         MTelTouchPaneExtension& aTouchPane )
       
   117     {  
       
   118     TInt buttonCount = aTouchPane.NumberOfButtonsInPane();
       
   119         
       
   120     for ( TInt i=0; i < buttonCount; i++ )    
       
   121         {
       
   122         TInt commandId = aTouchPane.ButtonCommandId( i );
       
   123     
       
   124         switch ( commandId )
       
   125             {
       
   126             case EPhoneInCallCmdConferenceMenu:
       
   127             case EPhoneInCallCmdCreateConference:
       
   128             case EPhoneInCallCmdJoin:
       
   129                 {
       
   130                 // SIP VoIP not support conference -> set item dimmed
       
   131                 aTouchPane.SetButtonDimmed( commandId, ETrue );         
       
   132                 break;  
       
   133                 }
       
   134             default:
       
   135                 break;                    
       
   136             } // switch
       
   137         } // for        
       
   138     }
       
   139           
       
   140 // ---------------------------------------------------------------------------
       
   141 // Handles custom menu commands.
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 TBool CSvtCallMenu::HandleCommandL( TInt /*aCommand*/ )
       
   145     {        
       
   146     return EFalse;
       
   147     }
       
   148     
       
   149 // ---------------------------------------------------------------------------
       
   150 // Creates call state handler
       
   151 // ---------------------------------------------------------------------------
       
   152 //
       
   153 void CSvtCallMenu::CreateCallStateHandlerL(
       
   154         const RArray<CTelMenuExtension::TCallInfo>& aCallArray )
       
   155     {
       
   156     if ( iCallStateHandler )
       
   157         {
       
   158         delete iCallStateHandler;
       
   159         iCallStateHandler = NULL;
       
   160         }
       
   161     
       
   162     iCallStateHandler = CSvtCallStateHandler::NewL( aCallArray );
       
   163     }