phoneapp/phoneuivoipextension/src/cphoneviewcustomizationvoip.cpp
changeset 0 5f000ab63145
child 65 2a5d4ab426d3
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     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: VoIP-specific view customization implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <cconvergedserviceselector.h>
       
    19 #include "cphoneviewcustomizationvoip.h"
       
    20 #include "mphoneviewblockingdialogobserver.h"
       
    21 #include "phonestatedefinitionsvoip.h"
       
    22 #include "tphonecmdparamselector.h"
       
    23 #include "tphonecommandparam.h"
       
    24 #include "cphonelogger.h"
       
    25 #include "mphonecustomization.h"
       
    26 #include "phoneappvoipcommands.hrh"
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // CPhoneViewCustomizationVoip::CPhoneViewCustomizationVoip
       
    32 // C++ constructor.
       
    33 // ---------------------------------------------------------------------------
       
    34 //
       
    35 CPhoneViewCustomizationVoip::CPhoneViewCustomizationVoip(
       
    36         MPhoneCustomization& aCustomization ) :
       
    37     iPhoneCustomization( aCustomization )
       
    38     {
       
    39 
       
    40     }
       
    41 
       
    42 
       
    43 // ---------------------------------------------------------------------------
       
    44 // CPhoneViewCustomizationVoip::ConstructL
       
    45 // ---------------------------------------------------------------------------
       
    46 //
       
    47 void CPhoneViewCustomizationVoip::ConstructL()
       
    48     {
       
    49     iServiceSelector = CConvergedServiceSelector::NewL();
       
    50     }
       
    51 
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // CPhoneViewCustomizationVoip::NewL
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CPhoneViewCustomizationVoip* CPhoneViewCustomizationVoip::NewL(
       
    58         MPhoneCustomization& aCustomization )
       
    59     {
       
    60     CPhoneViewCustomizationVoip* self = CPhoneViewCustomizationVoip::NewLC(
       
    61         aCustomization );
       
    62     CleanupStack::Pop( self );
       
    63     return self;
       
    64     }
       
    65 
       
    66 
       
    67 // ---------------------------------------------------------------------------
       
    68 // CPhoneViewCustomizationVoip::NewLC
       
    69 // ---------------------------------------------------------------------------
       
    70 //
       
    71 CPhoneViewCustomizationVoip* CPhoneViewCustomizationVoip::NewLC(
       
    72         MPhoneCustomization& aCustomization )
       
    73     {
       
    74     CPhoneViewCustomizationVoip* self = 
       
    75         new( ELeave ) CPhoneViewCustomizationVoip( aCustomization );
       
    76     CleanupStack::PushL( self );
       
    77     self->ConstructL();
       
    78     return self;
       
    79     }
       
    80 
       
    81 
       
    82 // ---------------------------------------------------------------------------
       
    83 // CPhoneViewCustomizationVoip::~CPhoneViewCustomizationVoip
       
    84 // Destructor.
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 CPhoneViewCustomizationVoip::~CPhoneViewCustomizationVoip()
       
    88     {
       
    89     delete iServiceSelector;
       
    90     }
       
    91 
       
    92 
       
    93 // ---------------------------------------------------------------------------
       
    94 // From class MPhoneViewCustomization.
       
    95 // CPhoneViewCustomizationVoip::HandleCommandL
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 TBool CPhoneViewCustomizationVoip::HandleCommandL(
       
    99         MPhoneViewBlockingDialogObserver& aBlockingObserver,
       
   100         TPhoneViewCommandId aCmdId,
       
   101         TPhoneCommandParam* aCommandParam )
       
   102     {
       
   103     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   104         "CPhoneViewCustomizationVoip::HandleCommandL" );
       
   105     
       
   106     TBool isCommandHandled( EFalse );
       
   107     
       
   108     switch ( aCmdId )
       
   109         {
       
   110         case EPhoneViewServiceSelection:
       
   111             {
       
   112             isCommandHandled = SelectVoipService( 
       
   113                 aBlockingObserver, aCommandParam );
       
   114             }
       
   115             break;
       
   116         case EPhoneViewOpenCallHandling:
       
   117             {
       
   118             // Close transfer dialer
       
   119             iPhoneCustomization.HandleCommandL( 
       
   120                 EPhoneCmdTransferDialerExit );
       
   121             isCommandHandled = ETrue;
       
   122             }
       
   123             break;
       
   124         default:
       
   125             break;
       
   126         }
       
   127     
       
   128     return isCommandHandled;
       
   129     }
       
   130 
       
   131 
       
   132 // ---------------------------------------------------------------------------
       
   133 // From class MPhoneViewCustomization.
       
   134 // CPhoneViewCustomizationVoip::RemoveDialog
       
   135 // ---------------------------------------------------------------------------
       
   136 //
       
   137 void CPhoneViewCustomizationVoip::RemoveDialog()
       
   138     {
       
   139     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   140         "CPhoneViewCustomizationVoip::RemoveDialog" );
       
   141     
       
   142     // Dismiss service selector queries, if necessary
       
   143     iServiceSelector->CancelSelection();
       
   144     }
       
   145 
       
   146 
       
   147 // ---------------------------------------------------------------------------
       
   148 // CPhoneViewCustomizationVoip::SelectVoipService
       
   149 // ---------------------------------------------------------------------------
       
   150 //
       
   151 TBool CPhoneViewCustomizationVoip::SelectVoipService(
       
   152         MPhoneViewBlockingDialogObserver& aBlockingObserver,
       
   153         TPhoneCommandParam* aCommandParam )
       
   154     {
       
   155     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   156         "CPhoneViewCustomizationVoip::SelectVoipService" );
       
   157     
       
   158     // Indicate that the service selection is blocking key events 
       
   159     // from the Phone.
       
   160     aBlockingObserver.SetBlockingDialogIsDisplayed( ETrue );
       
   161     
       
   162     CConvergedServiceSelector::TSsResult results;
       
   163     TInt selectionResult = iServiceSelector->GetCallingServiceByCallType( 
       
   164         results, CConvergedServiceSelector::ESsVoipCall, 0, EFalse );
       
   165     
       
   166     if ( KErrNone == selectionResult )
       
   167         {
       
   168         TPhoneCmdParamSelector* selectorContent =
       
   169             static_cast<TPhoneCmdParamSelector*>( aCommandParam );
       
   170         selectorContent->SetRegStatus( results.iServiceEnabled );
       
   171         selectorContent->SetServiceId( results.iServiceId );
       
   172         }
       
   173     
       
   174     // Reset the flag
       
   175     aBlockingObserver.SetBlockingDialogIsDisplayed( EFalse );
       
   176     
       
   177     return ( KErrNone == selectionResult );
       
   178     }