phoneapp/phoneuicontrol/src/cphonereconnectquery.cpp
changeset 0 5f000ab63145
child 21 92ab7f8d0eab
child 61 41a7f70b3818
equal deleted inserted replaced
-1:000000000000 0:5f000ab63145
       
     1 /*
       
     2 * Copyright (c) 2006-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: CPhoneReconnectQuery implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <mcauireconnectqueryobserver.h>
       
    21 #include <mpeengineinfo.h>
       
    22 
       
    23 #include "cphonereconnectquery.h"
       
    24 #include "phoneconstants.h"
       
    25 #include "phonelogger.h"
       
    26 #include "phonerssbase.h"
       
    27 #include "cphonetimer.h"
       
    28 #include "cphonestatehandle.h"
       
    29 #include "tphonecmdparamboolean.h"
       
    30 #include "tphonecmdparaminteger.h"
       
    31 #include "tphonecmdparammessageeditor.h"
       
    32 #include "tphonecmdparamreconnectquery.h"
       
    33 #include "cphonemainresourceresolver.h"
       
    34 
       
    35 // ================= MEMBER FUNCTIONS =======================
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CPhoneReconnectQuery::CPhoneReconnectQuery
       
    39 // C++ default constructor can NOT contain any code, that
       
    40 // might leave.
       
    41 // -----------------------------------------------------------------------------
       
    42 //
       
    43 CPhoneReconnectQuery::CPhoneReconnectQuery() : CCoeStatic( KUidReconnectQuerySingleton ),
       
    44     iReconQueryTimer ( NULL ),
       
    45     iIncludeVideo( EFalse )
       
    46     {
       
    47     }
       
    48 
       
    49 // Destructor
       
    50 CPhoneReconnectQuery::~CPhoneReconnectQuery()
       
    51     {
       
    52     CancelReconnectQueryTimer();
       
    53     }
       
    54 
       
    55 // ---------------------------------------------------------
       
    56 // CPhoneReconnectQuery::InstanceL
       
    57 // (other items were commented in a header).
       
    58 // ---------------------------------------------------------
       
    59 //
       
    60 EXPORT_C CPhoneReconnectQuery* CPhoneReconnectQuery::InstanceL()
       
    61     {
       
    62     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneReconnectQuery::InstanceL( ) ");
       
    63     CPhoneReconnectQuery* instance = static_cast<CPhoneReconnectQuery*>(
       
    64         CCoeEnv::Static( KUidReconnectQuerySingleton ) );
       
    65     if ( !instance )
       
    66         {
       
    67         instance = new ( ELeave ) CPhoneReconnectQuery;
       
    68         }
       
    69     return instance;
       
    70     }
       
    71 
       
    72 // ---------------------------------------------------------
       
    73 // CPhoneReconnectQuery::CancelReconnectQueryTimer
       
    74 // ---------------------------------------------------------
       
    75 //
       
    76 void CPhoneReconnectQuery::CancelReconnectQueryTimer()
       
    77     {
       
    78     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneReconnectQuery::CancelReconnectQueryTimer( ) ");
       
    79     if( iReconQueryTimer && iReconQueryTimer->IsActive() )
       
    80         {
       
    81         iReconQueryTimer->CancelTimer();
       
    82         }
       
    83     delete iReconQueryTimer;
       
    84     iReconQueryTimer = NULL;
       
    85     }
       
    86 
       
    87 // -----------------------------------------------------------
       
    88 // CPhoneReconnectQuery::ShowReconnectQueryL
       
    89 // -----------------------------------------------------------
       
    90 //
       
    91 EXPORT_C void CPhoneReconnectQuery::ShowReconnectQueryL( TBool aShowVideo )
       
    92     {
       
    93     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneReconnectQuery::ShowReconnectQueryL( ) ");
       
    94     iIncludeVideo = aShowVideo;
       
    95     if( !iReconQueryTimer )
       
    96         {
       
    97         iReconQueryTimer = CPhoneTimer::NewL();
       
    98         }
       
    99 
       
   100     iReconQueryTimer->After( KInformationNoteDisplayTime, this );
       
   101     }
       
   102 
       
   103 // -----------------------------------------------------------
       
   104 // CPhoneReconnectQuery::HandleTimeOutL
       
   105 // -----------------------------------------------------------
       
   106 //
       
   107 void CPhoneReconnectQuery::HandleTimeOutL()
       
   108     {
       
   109     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneReconnectQuery::HandleTimeOutL( ) ");
       
   110 
       
   111     TPhoneCmdParamReconnectQuery reconQueryParam( *this );
       
   112     // Recipient number to CallUIs reconnect query in case message selected
       
   113     TPtrC phoneNumber( CPhoneStateHandle::Instance()->StateMachine()->
       
   114         PhoneEngineInfo()->PhoneNumber() );
       
   115     reconQueryParam.SetPhoneNumber( phoneNumber );
       
   116     reconQueryParam.SetIncludeVideoOption( iIncludeVideo );
       
   117     // Display reconnect query
       
   118     CPhoneStateHandle::Instance()->ViewCommandHandle()->
       
   119         ExecuteCommandL( EPhoneViewShowQuery, &reconQueryParam );
       
   120     iDisplayingQuery = ETrue;
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------
       
   124 // CPhoneReconnectQuery::OptionSelected
       
   125 // -----------------------------------------------------------
       
   126 //
       
   127 void CPhoneReconnectQuery::OptionSelected(
       
   128     MCaUiReconnectQueryObserver::TCaUiReconType aReconType )
       
   129     {
       
   130     __LOGMETHODSTARTEND( EPhoneControl,
       
   131         "CPhoneReconnectQuery::HandleReconConfQueryResultL( ) ");
       
   132     __PHONELOG1( EBasic, EPhoneControl,
       
   133         "CPhoneReconnectQuery::HandleReconConfQueryResultL aReconType = %d",
       
   134         aReconType );
       
   135 
       
   136     iDisplayingQuery = EFalse;
       
   137 
       
   138     switch( aReconType )
       
   139         {
       
   140         case ECallUiReconTypeVoice:
       
   141             CPhoneStateHandle::Instance()->StateMachine()->PhoneEngine()
       
   142                 ->EngineInfo()->SetCallTypeCommand( EPECallTypeCSVoice );
       
   143             CPhoneStateHandle::Instance()->StateMachine()->PhoneEngine()
       
   144                 ->HandleMessage( MPEPhoneModel::EPEMessageDial );
       
   145             break;
       
   146 
       
   147         case ECallUiReconTypeVideo:
       
   148             CPhoneStateHandle::Instance()->StateMachine()->PhoneEngine()
       
   149                 ->EngineInfo()->SetCallTypeCommand( EPECallTypeVideo );
       
   150             CPhoneStateHandle::Instance()->StateMachine()->PhoneEngine()
       
   151                 ->HandleMessage( MPEPhoneModel::EPEMessageDial );
       
   152             break;
       
   153 
       
   154         case ECallUiReconTypeMsg:
       
   155             // CallUi launches message editor
       
   156             break;
       
   157 
       
   158 		default:
       
   159             // Do nothing
       
   160             break;
       
   161         }
       
   162     }
       
   163 
       
   164 // -----------------------------------------------------------
       
   165 // CPhoneReconnectQuery::ShowNumberEntryL
       
   166 // -----------------------------------------------------------
       
   167 //
       
   168 void CPhoneReconnectQuery::ShowNumberEntryL()
       
   169     {
       
   170     __LOGMETHODSTARTEND( EPhoneControl, "CPhoneReconnectQuery::ShowNumberEntryL( ) ");
       
   171     // Show number entry
       
   172     TPhoneCmdParamBoolean booleanParam;
       
   173     booleanParam.SetBoolean( ETrue );
       
   174     CPhoneStateHandle::Instance()->ViewCommandHandle()->
       
   175     	ExecuteCommandL( EPhoneViewSetNumberEntryVisible, &booleanParam );
       
   176 
       
   177     // Set Number Entry CBA
       
   178     TPhoneCmdParamInteger integerParam;
       
   179     integerParam.SetInteger( CPhoneMainResourceResolver::Instance()->
       
   180         ResolveResourceID( EPhoneNumberAcqCBA ) );
       
   181     CPhoneStateHandle::Instance()->ViewCommandHandle()->
       
   182         ExecuteCommandL( EPhoneViewUpdateCba, &integerParam );
       
   183     }
       
   184 
       
   185 // -----------------------------------------------------------
       
   186 // CPhoneReconnectQuery::IsDisplayingQuery
       
   187 // -----------------------------------------------------------
       
   188 //
       
   189 TBool CPhoneReconnectQuery::IsDisplayingQuery()
       
   190     {
       
   191     return iDisplayingQuery;
       
   192     }
       
   193 
       
   194 
       
   195 // End of File