phoneapp/phoneuivoipextension/src/cphonetransferdialercontroller.cpp
changeset 37 ba76fc04e6c2
child 51 f39ed5e045e0
child 78 baacf668fe89
equal deleted inserted replaced
36:2eacb6118286 37:ba76fc04e6c2
       
     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: Implementation of CPhoneTransferDialerController class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 #include <e32base.h>
       
    21 
       
    22 #include <akntoolbar.h>
       
    23 #include <AknsItemID.h>
       
    24 #include <StringLoader.h>
       
    25 #include "phoneresourceids.h"
       
    26 #include "phoneui.pan"
       
    27 #include "phonelogger.h"
       
    28 #include <data_caging_path_literals.hrh>
       
    29 #include "cphonetransferdialercontroller.h"
       
    30 #include "cphonemainresourceresolver.h"
       
    31 #include "phonerssvoip.h"
       
    32 #include "phoneappcommands.hrh"
       
    33 #include "phoneappvoipcommands.hrh"
       
    34 
       
    35 
       
    36 // CONSTANTS
       
    37 _LIT ( KPhoneMifFileName, "phoneui.mif" );
       
    38 
       
    39 // ================= MEMBER FUNCTIONS =======================
       
    40 
       
    41 // C++ default constructor can NOT contain any code, that
       
    42 // might leave.
       
    43 //  
       
    44 CPhoneTransferDialerController::CPhoneTransferDialerController()
       
    45     {
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------
       
    49 // CPhoneTransferDialerController::~CPhoneTransferDialerController()
       
    50 // Destructor
       
    51 // -----------------------------------------------------------
       
    52 //
       
    53 CPhoneTransferDialerController::~CPhoneTransferDialerController()
       
    54     {
       
    55     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
    56         "CPhoneTransferDialerController::~CPhoneTransferDialerController()");
       
    57     delete iNumberEntryPromptText;
       
    58     }
       
    59 
       
    60 // -----------------------------------------------------------
       
    61 // CPhoneTransferDialerController::NewL()
       
    62 // Constructor
       
    63 // -----------------------------------------------------------
       
    64 //
       
    65 CPhoneTransferDialerController* CPhoneTransferDialerController::NewL()
       
    66     {
       
    67     CPhoneTransferDialerController* self = new (ELeave) 
       
    68         CPhoneTransferDialerController();
       
    69   
       
    70     return self;
       
    71     }
       
    72 
       
    73 // -----------------------------------------------------------
       
    74 // CPhoneTransferDialerController::Initialize
       
    75 // -----------------------------------------------------------
       
    76 //
       
    77 void CPhoneTransferDialerController::InitializeL( CAknToolbar& aToolbar )
       
    78     {  
       
    79     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
    80         "CPhoneTransferDialerController::InitializeL()"); 
       
    81     
       
    82     if ( !iIsInitialized )
       
    83         {    
       
    84         __PHONELOG1( 
       
    85                 EAll, 
       
    86                 PhoneUIVoIPExtension, 
       
    87                 "Toolbar control count:=%d", 
       
    88                 aToolbar.CountComponentControls());
       
    89         iToolbar = &aToolbar;
       
    90         iIsInitialized = ETrue;
       
    91         }
       
    92    
       
    93     iNumberEntryIsEmpty = ETrue;
       
    94     }
       
    95 
       
    96 // -----------------------------------------------------------
       
    97 // CPhoneTransferDialerController::CbaResourceId
       
    98 // -----------------------------------------------------------
       
    99 //
       
   100 TInt CPhoneTransferDialerController::CbaResourceId() const
       
   101     {
       
   102     return EPhoneVoIPTransferDialerSoftkeys;
       
   103     }
       
   104 
       
   105 // -----------------------------------------------------------
       
   106 // CPhoneTransferDialerController::MenuResourceId
       
   107 // -----------------------------------------------------------
       
   108 //
       
   109 TInt CPhoneTransferDialerController::MenuResourceId() const
       
   110     {
       
   111     if ( iNumberEntryIsEmpty )
       
   112         {
       
   113         return EPhoneVoIPTransferDialerNumberEntryEmptyMenubar;
       
   114         }
       
   115     else
       
   116         {
       
   117         return EPhoneVoIPTransferDialerNumberEntryNotEmptyMenubar;
       
   118         }
       
   119     }
       
   120 
       
   121 // -----------------------------------------------------------
       
   122 // CPhoneTransferDialerController::NumberEntryPromptTextL
       
   123 // -----------------------------------------------------------
       
   124 //
       
   125 const TDesC& CPhoneTransferDialerController::NumberEntryPromptTextL()
       
   126     {
       
   127     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   128         "CPhoneTransferDialerController::NumberEntryPromptTextL()");
       
   129     if ( !iNumberEntryPromptText )
       
   130         {
       
   131         iNumberEntryPromptText = StringLoader::LoadL( 
       
   132             CPhoneMainResourceResolver::Instance()->
       
   133             ResolveResourceID( EPhoneVoIPTransferAddress ) );
       
   134         }  
       
   135     
       
   136     return *iNumberEntryPromptText;
       
   137     }
       
   138 
       
   139 // -----------------------------------------------------------
       
   140 // CPhoneTransferDialerController::HandleNumberEntryIsEmpty
       
   141 // -----------------------------------------------------------
       
   142 //
       
   143 void CPhoneTransferDialerController::HandleNumberEntryIsEmpty( TBool aIsEmpty )
       
   144     {
       
   145     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   146         "CPhoneTransferDialerController::HandleNumberEntryIsEmpty()");
       
   147     __ASSERT_DEBUG( iToolbar, Panic( EPhoneCtrlInvariant ) );
       
   148     iToolbar->SetItemDimmed( EPhoneCmdTransferDialerOk, aIsEmpty, EFalse );
       
   149     iToolbar->SetItemDimmed( EPhoneCmdTransferDialerSearch, !aIsEmpty, EFalse );
       
   150     iToolbar->SetItemDimmed( EPhoneDialerCmdClear, aIsEmpty, EFalse );
       
   151     iNumberEntryIsEmpty = aIsEmpty;
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------
       
   155 // CPhoneTransferDialerController::ShowButtons
       
   156 // -----------------------------------------------------------
       
   157 //
       
   158 void CPhoneTransferDialerController::ShowButtons( TBool aShow )
       
   159     {
       
   160     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   161         "CPhoneTransferDialerController::ShowButtons()");
       
   162     __ASSERT_DEBUG( iToolbar, Panic( EPhoneCtrlInvariant ) );
       
   163     if ( aShow )
       
   164         {
       
   165         iToolbar->SetItemDimmed( EPhoneCmdTransferDialerOk, ETrue, EFalse ); 
       
   166         iToolbar->SetItemDimmed( EPhoneCmdTransferDialerSearch, EFalse, EFalse ); 
       
   167         iToolbar->SetItemDimmed( EPhoneDialerCmdClear, ETrue, EFalse ); 
       
   168         }
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // PhoneTransferDialerController::CreateButtonLC
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 CAknButton* CPhoneTransferDialerController::CreateButtonLC( 
       
   176     TInt aNormalIconId,
       
   177     TInt aNormalMaskId,
       
   178     const TDesC& aTooltipText,
       
   179     const TAknsItemID& aSkinIconId ) const
       
   180     {   
       
   181     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   182         "CPhoneTransferDialerController::CreateButtonLC()");
       
   183     TFileName mifPath( KDriveZ );
       
   184     mifPath.Append( KDC_APP_BITMAP_DIR );
       
   185     mifPath.Append( KPhoneMifFileName );
       
   186 
       
   187     CAknButton* button = CAknButton::NewLC( 
       
   188         mifPath,
       
   189         aNormalIconId,
       
   190         aNormalMaskId,
       
   191         -1, -1, // dimmed
       
   192         -1, -1, // pressed
       
   193         -1, -1, // hover
       
   194         KNullDesC,
       
   195         aTooltipText, // help
       
   196         0, // flags
       
   197         0, // state flags
       
   198         aSkinIconId );
       
   199                                                                  
       
   200     button->SetFocusing( EFalse );
       
   201     button->SetBackground( iToolbar );
       
   202 
       
   203     return button;
       
   204     }
       
   205 
       
   206 // ---------------------------------------------------------------------------
       
   207 // CPhoneTransferDialerController::GetTooltipText
       
   208 //
       
   209 // Tooltip texts for toolbar buttons
       
   210 // ---------------------------------------------------------------------------
       
   211 //
       
   212 HBufC* CPhoneTransferDialerController::GetTooltipTextL( TInt aCommandId ) const
       
   213     {
       
   214     __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
       
   215         "CPhoneTransferDialerController::GetTooltipTextL()");
       
   216     TInt resourceId = 0;
       
   217     HBufC* tooltip = NULL;
       
   218     switch( aCommandId )
       
   219         {                            
       
   220         case EPhoneCmdTransferDialerOk:
       
   221             resourceId = R_VOIP_DIALER_TOOLTIP_ACCEPT;
       
   222             break;    
       
   223         case EPhoneCmdTransferDialerSearch:
       
   224             resourceId = R_VOIP_DIALER_TOOLTIP_SEARCH;
       
   225             break;                      
       
   226        default:
       
   227            tooltip = KNullDesC().Alloc();
       
   228            break;
       
   229        }
       
   230            
       
   231     if ( resourceId )
       
   232         {
       
   233         tooltip = StringLoader::LoadL( resourceId, CCoeEnv::Static() );
       
   234         }
       
   235     return tooltip;
       
   236     }
       
   237 
       
   238 // ---------------------------------------------------------------------------
       
   239 // CPhoneTransferDialerController::SkinId
       
   240 // ---------------------------------------------------------------------------
       
   241 //    
       
   242 TAknsItemID CPhoneTransferDialerController::SkinId( TInt /*aIconIndex*/ ) const
       
   243     {
       
   244     TAknsItemID skinId;
       
   245     skinId = KAknsIIDNone; 
       
   246     return skinId;  
       
   247     }