phoneapp/phoneuiview/src/cphoneeasydialingcontroller.cpp
branchRCL_3
changeset 9 8871b09be73b
child 14 24062c24fe38
equal deleted inserted replaced
4:c84cf270c54f 9:8871b09be73b
       
     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: Class handles Easy dialing specific commands
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cphoneeasydialingcontroller.h"
       
    19 
       
    20 #include "cdialer.h"
       
    21 #include "tphonecommandparam.h"
       
    22 #include "tphonecmdparaminteger.h"
       
    23 #include "tphonecmdparamdynmenu.h"
       
    24 #include "dialingextensioninterface.h"
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 
       
    28 // ---------------------------------------------------------------------------
       
    29 // CPhoneEasyDialingController::CPhoneEasyDialingController
       
    30 // ---------------------------------------------------------------------------
       
    31 //
       
    32 CPhoneEasyDialingController::CPhoneEasyDialingController(
       
    33          CDialer& aDialer )
       
    34    : iDialer ( aDialer )
       
    35     {
       
    36     // Get Easydialing interface. This can be NULL if easydialing is not
       
    37     // present in current device configuration.
       
    38     iEasyDialing = iDialer.GetEasyDialingInterface();
       
    39     }
       
    40 
       
    41  // ---------------------------------------------------------------------------
       
    42  // CPhoneEasyDialingController::NewL
       
    43  // ---------------------------------------------------------------------------
       
    44  //
       
    45 CPhoneEasyDialingController* CPhoneEasyDialingController::NewL( 
       
    46         CDialer& aDialer )
       
    47      {
       
    48      return new (ELeave) CPhoneEasyDialingController( aDialer );
       
    49      }
       
    50 
       
    51 // ---------------------------------------------------------------------------
       
    52 //  CPhoneEasyDialingController::~CPhoneEasyDialingController
       
    53 // ---------------------------------------------------------------------------
       
    54 //
       
    55 CPhoneEasyDialingController::~CPhoneEasyDialingController()
       
    56      {
       
    57      }
       
    58  
       
    59 // ---------------------------------------------------------------------------
       
    60 //  CPhoneEasyDialingController::ExecuteCommandL
       
    61 // ---------------------------------------------------------------------------
       
    62 //
       
    63 void CPhoneEasyDialingController::ExecuteCommandL(
       
    64         TPhoneViewCommandId aCmdId,
       
    65         TPhoneCommandParam* aCommandParam )
       
    66     {
       
    67     if ( iEasyDialing )
       
    68         {
       
    69         switch ( aCmdId )
       
    70             {
       
    71             case EPhoneViewGetEasyDialingMenuId:
       
    72                 {
       
    73                 TPhoneCmdParamInteger* paramInt = 
       
    74                     static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
    75                 paramInt->SetInteger( iEasyDialing->MenuResourceId() );            
       
    76                 }
       
    77                 break;
       
    78                     
       
    79             case EPhoneViewGetEasyDialingCbaId:
       
    80                 {
       
    81                 TPhoneCmdParamInteger* paramInt = 
       
    82                     static_cast<TPhoneCmdParamInteger*>( aCommandParam );
       
    83                 paramInt->SetInteger( iEasyDialing->CbaResourceId() );            
       
    84                 }
       
    85                 break;
       
    86                 
       
    87             default:
       
    88                 break;
       
    89             }
       
    90         }
       
    91     }
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 //  CPhoneEasyDialingController::HandleCommandL
       
    95 // ---------------------------------------------------------------------------
       
    96 //
       
    97 TPhoneViewResponseId CPhoneEasyDialingController::HandleCommandL(
       
    98         TPhoneViewCommandId aCmdId )
       
    99     {
       
   100     TPhoneViewResponseId viewResponse = EPhoneViewResponseFailed;
       
   101 
       
   102     switch ( aCmdId )
       
   103         {
       
   104         // commands defined in easydialingcommands.hrh are forwarded to
       
   105         // easydialing plugin
       
   106         case EEasyDialingVoiceCall:
       
   107         case EEasyDialingVideoCall:
       
   108         case EEasyDialingSendMessage:
       
   109         case EEasyDialingOpenContact:
       
   110         case EEasyDialingCallHandlingActivated:
       
   111         case EEasyDialingEnterKeyAction:
       
   112         case EEasyDialingOn:
       
   113         case EEasyDialingOff:
       
   114             {
       
   115             if( iEasyDialing && iEasyDialing->HandleCommandL( aCmdId ) )
       
   116                 {
       
   117                 viewResponse = EPhoneViewResponseSuccess;
       
   118                 }
       
   119             }
       
   120             break;
       
   121             
       
   122         case EPhoneViewGetEasyDialingInFocusStatus:
       
   123             {
       
   124             if ( iEasyDialing && iEasyDialing->IsFocused() )
       
   125                 {
       
   126                 viewResponse = EPhoneViewResponseSuccess;
       
   127                 }
       
   128             }
       
   129             break;
       
   130         }
       
   131     
       
   132     return viewResponse;
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 //  CPhoneEasyDialingController::InitializeEasyDialingMenuL
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 TBool CPhoneEasyDialingController::InitializeEasyDialingMenuL( 
       
   140         TPhoneCommandParam* aCommandParam )
       
   141     {
       
   142     TBool retVal( EFalse );
       
   143     if ( iEasyDialing )
       
   144         {
       
   145         TPhoneCmdParamDynMenu* menu = static_cast<TPhoneCmdParamDynMenu*>( aCommandParam );
       
   146     
       
   147        // TInt resourceId = menu->ResourceId();
       
   148         CEikMenuPane*  menuPane = reinterpret_cast<CEikMenuPane*>( menu->DynMenu() );
       
   149         
       
   150         retVal = iEasyDialing->InitializeMenuPaneL( *menuPane, menu->ResourceId() );
       
   151         }
       
   152     return retVal;
       
   153     }