meetingui/attendeeview/UiSrc/CAttendeeOldCaller.cpp
changeset 89 b57382753122
parent 0 f979ecb2b13e
equal deleted inserted replaced
83:5aadd1120515 89:b57382753122
       
     1 /*
       
     2 * Copyright (c) 2004-2006 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:  Provides methods for CAttendeeCaller class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "cattendeecaller.h"
       
    22 #include "attendeeview.hrh"
       
    23 #include <attendeeview_res.rsg>
       
    24 #include <aiwcommon.hrh>
       
    25 #include <eikmenub.h>
       
    26 #include <cpbkphonenumberselect.h>
       
    27 #include <cpbkcontactitem.h>
       
    28 #include <cpbkfieldinfo.h>
       
    29 #include <aiwdialdatatypes.h>
       
    30 
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CAttendeeCaller::CAttendeeCaller
       
    36 // C++ default constructor can NOT contain any code, that
       
    37 // might leave.
       
    38 // -----------------------------------------------------------------------------
       
    39 //
       
    40 CAttendeeCaller::CAttendeeCaller()
       
    41     {
       
    42     }
       
    43 
       
    44 // ----------------------------------------------------
       
    45 // CAttendeeCaller::ConstructL
       
    46 // ----------------------------------------------------
       
    47 //
       
    48 void CAttendeeCaller::ConstructL()
       
    49     {
       
    50 	//Create service handler
       
    51 	iServiceHandler = CAiwServiceHandler::NewL();
       
    52 
       
    53 	//Atttach menu
       
    54 	iServiceHandler->AttachMenuL( R_ATTENDEEVIEW_CALL_MENU,
       
    55 							      R_ATTENDEEVIEW_CALL_AIW_INTEREST );
       
    56 
       
    57     // Attach also base interest
       
    58     iServiceHandler->AttachL( R_ATTENDEEVIEW_CALL_AIW_INTEREST );       
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CAttendeeCaller::NewL
       
    63 // Two-phased constructor.
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 CAttendeeCaller* CAttendeeCaller::NewL()
       
    67     {
       
    68     CAttendeeCaller* self = new(ELeave)CAttendeeCaller;
       
    69     CleanupStack::PushL( self );
       
    70     self->ConstructL();
       
    71     CleanupStack::Pop( self );
       
    72     return self;
       
    73     }
       
    74 
       
    75 // ----------------------------------------------------
       
    76 // CAttendeeCaller::~CAttendeeCaller
       
    77 // ----------------------------------------------------
       
    78 //
       
    79 CAttendeeCaller::~CAttendeeCaller()
       
    80     {
       
    81     delete iServiceHandler;
       
    82     }
       
    83 
       
    84 // ---------------------------------------------------------
       
    85 // CAttendeeCaller::InitializeServiceHandlerL
       
    86 // ---------------------------------------------------------
       
    87 //
       
    88 void CAttendeeCaller::InitializeServiceHandlerL( CEikMenuPane& aMenuPane,
       
    89                                                  TBool aVisible ) const
       
    90     {
       
    91     if ( aVisible )
       
    92         {
       
    93 
       
    94         iServiceHandler->InitializeMenuPaneL(
       
    95                     aMenuPane,
       
    96                     R_ATTENDEEVIEW_CALL_MENU,
       
    97                     KAiwCmdCall,
       
    98                     iServiceHandler->InParamListL() );
       
    99                     
       
   100         }
       
   101     else
       
   102         {
       
   103         aMenuPane.SetItemDimmed( KAiwCmdCall, ETrue );
       
   104         }
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------
       
   108 // CAttendeeCaller::CallCmdL
       
   109 // ---------------------------------------------------------
       
   110 //
       
   111 void CAttendeeCaller::CallCmdL( TInt aCommandId, CPbkContactItem& aPbkItem )
       
   112     {
       
   113     
       
   114     if ( iServiceHandler->ServiceCmdByMenuCmd( aCommandId ) == KAiwCmdNone &&
       
   115            aCommandId != EAttCallCmd )
       
   116         {
       
   117         return;
       
   118         }
       
   119         
       
   120     TAiwDialDataV1 dialData;
       
   121 
       
   122     // Set basic dial data
       
   123     dialData.SetWindowGroup( CCoeEnv::Static()->RootWin().Identifier() );
       
   124     dialData.SetContactId( aPbkItem.Id() );
       
   125 
       
   126     const TPbkContactItemField* field = SelectPhoneNumberL( aPbkItem );
       
   127     if ( !field )
       
   128         {
       
   129         return;
       
   130         }
       
   131 
       
   132     dialData.SetNumberType( field->FieldInfo().FieldId() );
       
   133     TAiwTelephoneNumber phoneNumber( 
       
   134         field->Text().Left( KAiwTelephoneNumberLength ) );
       
   135     dialData.SetTelephoneNumber( phoneNumber );
       
   136     dialData.SetRemoveInvalidChars( ETrue );
       
   137 
       
   138     // If the command was not launched via menu but the send key
       
   139     // (which is the case when iCommandId is EAttCallCmd), we
       
   140     // need to deduct whether to launch voice or video call
       
   141     if ( aCommandId == EAttCallCmd )
       
   142         {
       
   143         // Default to voice call
       
   144         dialData.SetCallType( EAiwVoice );
       
   145         
       
   146         // CASE A:
       
   147         // If there is a no default phone number field, but there
       
   148         // is a default video number field, launch video call
       
   149         if ( !aPbkItem.DefaultPhoneNumberField() &&
       
   150               aPbkItem.DefaultVideoNumberField() )
       
   151             {
       
   152             dialData.SetCallType( EAiwForcedVideo );
       
   153             }
       
   154 
       
   155         // CASE B:
       
   156         // No default fields at all. This means that the user
       
   157         // was shown a number selection list, or there was just
       
   158         // one number
       
   159         else if ( !aPbkItem.DefaultPhoneNumberField() &&
       
   160                   !aPbkItem.DefaultVideoNumberField() )
       
   161             {
       
   162             // If the selected field was a video field, launch video call
       
   163             if ( field->FieldInfo().FieldId() == EPbkFieldIdPhoneNumberVideo )
       
   164                 {
       
   165                 dialData.SetCallType( EAiwForcedVideo );
       
   166                 }
       
   167             }         
       
   168         }
       
   169 
       
   170     TAiwDialDataV1Pckg dialDataPckg( dialData );
       
   171     CAiwGenericParamList& paramList = iServiceHandler->InParamListL();
       
   172     TPtrC8 ptr;
       
   173     ptr.Set( dialDataPckg );
       
   174     TAiwVariant variant( ptr );
       
   175 
       
   176     TAiwGenericParam param( EGenericParamCallDialDataV1,
       
   177                             variant );
       
   178     paramList.AppendL( param );
       
   179 
       
   180     if ( aCommandId == EAttCallCmd )
       
   181        {
       
   182        iServiceHandler->ExecuteServiceCmdL( KAiwCmdCall,
       
   183                                     paramList,
       
   184                                     iServiceHandler->OutParamListL(), 
       
   185                                     0,
       
   186                                     NULL );
       
   187        }
       
   188     else
       
   189         {
       
   190         iServiceHandler->ExecuteMenuCmdL( aCommandId,
       
   191                                       paramList,
       
   192                                       iServiceHandler->OutParamListL(),
       
   193                                       0,
       
   194                                       NULL );   
       
   195         }
       
   196     }
       
   197 
       
   198 // ---------------------------------------------------------
       
   199 // CAttendeeCaller::HandleSubmenuL
       
   200 // ---------------------------------------------------------
       
   201 //
       
   202 TBool CAttendeeCaller::HandleSubmenuL( CEikMenuPane& aPane )
       
   203     {
       
   204     return iServiceHandler->HandleSubmenuL( aPane );
       
   205     }
       
   206 
       
   207 // ---------------------------------------------------------
       
   208 // CAttendeeCaller::SelectPhoneNumberL
       
   209 // ---------------------------------------------------------
       
   210 //
       
   211 const TPbkContactItemField* CAttendeeCaller::SelectPhoneNumberL( 
       
   212                                   CPbkContactItem& aContactItem )
       
   213     {    
       
   214     CPbkPhoneNumberSelect::TParams params( aContactItem );    
       
   215 	    
       
   216     CPbkPhoneNumberSelect* dlg = new(ELeave)CPbkPhoneNumberSelect;
       
   217     dlg->ExecuteLD( params );
       
   218     
       
   219     return params.SelectedField();       
       
   220     }
       
   221     
       
   222 //  End of File