phoneapp/phoneuiview/src/cphonedialercontroller.cpp
branchRCL_3
changeset 4 24062c24fe38
parent 3 8871b09be73b
child 6 38529f706030
equal deleted inserted replaced
3:8871b09be73b 4:24062c24fe38
    41 
    41 
    42 
    42 
    43 /** States for Call button. */
    43 /** States for Call button. */
    44 enum TCallButtonState
    44 enum TCallButtonState
    45     {
    45     {
    46     ECallButtonCallStateIndex = 0,
    46     ECallButtonCallState = 0,
    47     ECallButtonLogStateIndex,
    47     ECallButtonLogState,
    48     ECallButtonSendStateIndex
    48     ECallButtonSendState
    49     };
    49     };
    50 static const CPhoneDialerController::TLocalButtonData KCallButtonDataTable[] =
    50 static const CPhoneDialerController::TLocalButtonData KCallButtonDataTable[] =
    51     {
    51     {
    52         { EPhoneNumberAcqCmdSendCommand, 
    52         { EPhoneNumberAcqCmdSendCommand, 
    53           EAknsMinorGenericQgnIndiButtonAnswerWhite,
    53           EAknsMinorGenericQgnIndiButtonAnswerWhite,
    73 
    73 
    74 
    74 
    75 /** States for Phonebook button */
    75 /** States for Phonebook button */
    76 enum TPhonebookButtonState
    76 enum TPhonebookButtonState
    77     {
    77     {
    78     EPhonebookButtonContactsIndex = 0,
    78     EPhonebookButtonContactsState = 0,
    79     EPhonebookButtonAddContactIndex
    79     EPhonebookButtonAddContactState
    80     };
    80     };
    81 static const CPhoneDialerController::TLocalButtonData KPhonebookButtonDataTable[] =
    81 static const CPhoneDialerController::TLocalButtonData KPhonebookButtonDataTable[] =
    82     {
    82     {
    83         { EPhoneDialerCmdContacts,
    83         { EPhoneDialerCmdContacts,
    84           EAknsMinorGenericQgnIndiDialerContacts,
    84           EAknsMinorGenericQgnIndiDialerContacts,
    98 
    98 
    99 
    99 
   100 /** States for Clear button */
   100 /** States for Clear button */
   101 enum TClearButtonState
   101 enum TClearButtonState
   102     {
   102     {
   103     EClearButtonClearIndex = 0
   103     EClearButtonClearState = 0
   104     };
   104     };
   105 static const CPhoneDialerController::TLocalButtonData KClearButtonDataTable[] =
   105 static const CPhoneDialerController::TLocalButtonData KClearButtonDataTable[] =
   106     {
   106     {
   107         { EPhoneDialerCmdClear,
   107         { EPhoneDialerCmdClear,
   108           EAknsMinorGenericQgnIndiDialerClear,
   108           EAknsMinorGenericQgnIndiDialerClear,
   299 // ButtonState
   299 // ButtonState
   300 // ---------------------------------------------------------------------------
   300 // ---------------------------------------------------------------------------
   301 //
   301 //
   302 EXPORT_C TInt CPhoneDialerController::ButtonState( TButtonIndex aIndex ) const
   302 EXPORT_C TInt CPhoneDialerController::ButtonState( TButtonIndex aIndex ) const
   303     {
   303     {
   304     TInt state = 0;
   304     TInt state( KErrNotFound );
   305     // Figure out correct state for each key
   305     // Figure out correct state for each key
   306     switch ( aIndex )
   306     switch ( aIndex )
   307         {
   307         {
   308         case ECallButton:
   308         case ECallButton:
   309             {
   309             {
   310             state = ECallButtonCallStateIndex;
       
   311             if ( !iNumberAvailable )
   310             if ( !iNumberAvailable )
   312                 {
   311                 {
   313                 state = ECallButtonLogStateIndex;
   312                 // Show "Recent calls" when no number available
   314                 }
   313                 state = ECallButtonLogState;
   315             else if ( iServiceCodeFlag )
   314                 }
   316                 {
   315             else if ( iServiceCodeFlag && !EasyDialingFocused() )
   317                 // Set "Send" state unless Easy dialing is focused
   316                 {
   318                 TBool edFocused = EFalse;
   317                 // Show "Send" if service code entered and contact list
   319                 if ( iEasyDialingController )
   318                 // is not focused.
   320                     {
   319                 state = ECallButtonSendState;
   321                     TInt commandResponse( EPhoneViewResponseFailed );
   320                 }
   322                     TRAP_IGNORE( commandResponse = iEasyDialingController->HandleCommandL(
   321             else
   323                             EPhoneViewGetEasyDialingInFocusStatus) );
   322                 {
   324                     edFocused = ( commandResponse == EPhoneViewResponseSuccess );
   323                 // Show "Call" in all other cases
   325                     }
   324                 state = ECallButtonCallState;
   326                 if ( !edFocused )
       
   327                     {
       
   328                     state = ECallButtonSendStateIndex;
       
   329                     }
       
   330                 }
   325                 }
   331             }
   326             }
   332             break;
   327             break;
   333         case EPhonebookButton:
   328         case EPhonebookButton:
   334             {
   329             {
   335             if ( !iNumberAvailable )
   330             if ( !iNumberAvailable )
   336                 {
   331                 {
   337                 state = EPhonebookButtonContactsIndex;
   332                 state = EPhonebookButtonContactsState;
   338                 }
   333                 }
   339             else
   334             else
   340                 {
   335                 {
   341                 state = EPhonebookButtonAddContactIndex;
   336                 state = EPhonebookButtonAddContactState;
   342                 }
   337                 }
   343             }
   338             }
   344             break;
   339             break;
   345         case EClearButton:
   340         case EClearButton:
   346             {
   341             {
   347             state = EClearButtonClearIndex;
   342             state = EClearButtonClearState;
   348             }
   343             }
   349             break;
   344             break;
   350         default:
   345         default:
   351             break;
   346             break;
   352         }
   347         }
   409         }
   404         }
   410     return ret;
   405     return ret;
   411     }
   406     }
   412 
   407 
   413 // ---------------------------------------------------------------------------
   408 // ---------------------------------------------------------------------------
       
   409 // EasyDialingFocused
       
   410 // ---------------------------------------------------------------------------
       
   411 //
       
   412 TBool CPhoneDialerController::EasyDialingFocused() const
       
   413     {
       
   414     TBool edFocused = EFalse;
       
   415     if ( iEasyDialingController )
       
   416         {
       
   417         TInt commandResponse( EPhoneViewResponseFailed );
       
   418         TRAP_IGNORE( commandResponse = iEasyDialingController->HandleCommandL(
       
   419                 EPhoneViewGetEasyDialingInFocusStatus) );
       
   420         edFocused = ( commandResponse == EPhoneViewResponseSuccess );
       
   421         }
       
   422     return edFocused;
       
   423     }
       
   424 
       
   425 // ---------------------------------------------------------------------------
   414 // CreateButtonDataL
   426 // CreateButtonDataL
   415 // ---------------------------------------------------------------------------
   427 // ---------------------------------------------------------------------------
   416 //
   428 //
   417 MPhoneDialerController::CButtonData* CPhoneDialerController::CreateButtonDataL( 
   429 MPhoneDialerController::CButtonData* CPhoneDialerController::CreateButtonDataL( 
   418         const TLocalButtonData& aSourceData, 
   430         const TLocalButtonData& aSourceData,