phoneapp/phoneuistates/src/cphonegeneralgsmmessageshandler.cpp
branchRCL_3
changeset 61 41a7f70b3818
parent 58 40a3f856b14d
child 62 5266b1f337bd
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
    98         "CPhoneGeneralGsmMessagesHandler::HandlePhoneEngineMessageL()" );
    98         "CPhoneGeneralGsmMessagesHandler::HandlePhoneEngineMessageL()" );
    99 
    99 
   100     switch ( aMessage )
   100     switch ( aMessage )
   101         {
   101         {
   102         case MEngineMonitor::EPEMessageCallBarred:
   102         case MEngineMonitor::EPEMessageCallBarred:
   103             SendGlobalInfoNoteL( EPhoneActiveBarrings );
   103             SendGlobalInfoNoteL( EPhoneActiveBarrings, ETrue );
   104             break;
   104             break;
   105         
   105         
   106         case MEngineMonitor::EPEMessageIncCallIsForw:
   106         case MEngineMonitor::EPEMessageIncCallIsForw:
   107             HandleIncomingCallForwardedL();
   107             HandleIncomingCallForwardedL();
   108             break;
   108             break;
   109             
   109             
   110         case MEngineMonitor::EPEMessageIncCallForwToC:
   110         case MEngineMonitor::EPEMessageIncCallForwToC:
   111             SendGlobalInfoNoteL( EPhoneMtCallDiverting );
   111             SendGlobalInfoNoteL( EPhoneMtCallDiverting, ETrue );
   112             break;
   112             break;
   113             
   113             
   114         case MEngineMonitor::EPEMessageOutCallForwToC:
   114         case MEngineMonitor::EPEMessageOutCallForwToC:
   115             SendGlobalInfoNoteL( EPhoneDiverting );
   115             SendGlobalInfoNoteL( EPhoneDiverting, ETrue );
   116             break;
   116             break;
   117 
   117 
   118         case MEngineMonitor::EPEMessageShowVersion:
       
   119             HandleShowVersionL();
       
   120             break;
       
   121             
       
   122         case MEngineMonitor::EPEMessageIssuedSSRequest:
   118         case MEngineMonitor::EPEMessageIssuedSSRequest:
   123             {
   119             {
   124             __PHONELOG(
   120             __PHONELOG(
   125                 EBasic, 
   121                 EBasic, 
   126                 EPhoneUIStates,
   122                 EPhoneUIStates,
   127                 "CPhoneGeneralGsmMessagesHandler::EPEMessageIssuedSSRequest" );
   123                 "CPhoneGeneralGsmMessagesHandler::EPEMessageIssuedSSRequest" );
   128 
       
   129             TPhoneCmdParamBoolean booleanParam;
       
   130             booleanParam.SetBoolean( EFalse );
       
   131             iViewCommandHandle.ExecuteCommandL( 
       
   132                 EPhoneViewSetBlockingDialogStatus, 
       
   133                 &booleanParam );
       
   134             break;
   124             break;
   135             }
   125             }
   136             
   126             
   137         case MEngineMonitor::EPEMessageIssuingSSRequest:
   127         case MEngineMonitor::EPEMessageIssuingSSRequest:
   138             {
   128             {
   163             globalNotifierParam.SetBoolean( EFalse );
   153             globalNotifierParam.SetBoolean( EFalse );
   164             iViewCommandHandle.ExecuteCommandL( 
   154             iViewCommandHandle.ExecuteCommandL( 
   165                 EPhoneViewSetGlobalNotifiersDisabled,
   155                 EPhoneViewSetGlobalNotifiersDisabled,
   166                 &globalNotifierParam );
   156                 &globalNotifierParam );
   167             
   157             
   168             TPhoneCmdParamBoolean booleanParam;
       
   169             booleanParam.SetBoolean( ETrue );
       
   170             iViewCommandHandle.ExecuteCommandL( 
       
   171                 EPhoneViewSetBlockingDialogStatus, 
       
   172                 &booleanParam );
       
   173             
       
   174             // Get active call count
   158             // Get active call count
   175             TPhoneCmdParamInteger activeCallCount;
   159             TPhoneCmdParamInteger activeCallCount;
   176             iViewCommandHandle.ExecuteCommandL(
   160             iViewCommandHandle.ExecuteCommandL(
   177                 EPhoneViewGetCountOfActiveCalls, &activeCallCount );
   161                 EPhoneViewGetCountOfActiveCalls, &activeCallCount );
   178             
   162             
   179             if( !activeCallCount.Integer() )
       
   180                 {
       
   181                 __PHONELOG(
       
   182                     EBasic, 
       
   183                     EPhoneUIStates,
       
   184                     "CPhoneGeneralGsmMessagesHandler::EPEMessageIssuingSSRequest no active call" );
       
   185                 // Ensure that the dialer is activated to display local notes and dialogs properly.
       
   186                 TPhoneCmdParamAppInfo param;
       
   187                 param.SetAppUid( KUidPhoneApplication );
       
   188                 param.SetViewUid( KUidViewId );
       
   189                 param.SetCustomMessageId( TUid::Uid( KTouchDiallerViewCommand ) );
       
   190                 iViewCommandHandle.ExecuteCommandL( 
       
   191                     EPhoneViewActivateAppViewWithCustomMessage, 
       
   192                     &param );
       
   193                 }
       
   194             // Remove phoneumber query
   163             // Remove phoneumber query
   195             iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveQuery );
   164             iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveQuery );
   196             break;
   165             break;
   197             }
   166             }
   198 
   167 
   199         case MEngineMonitor::EPEMessageTempClirActivationUnsuccessful:
   168         case MEngineMonitor::EPEMessageTempClirActivationUnsuccessful:
   200             SendGlobalErrorNoteL( EPhoneSSNotifCLIRSupprReject );
   169             SendGlobalErrorNoteL( EPhoneSSNotifCLIRSupprReject, ETrue );
   201             break;
   170             break;
   202             
   171             
   203         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive:
   172         case MEngineMonitor::EPEMessageForwardUnconditionalModeActive:
   204             SendGlobalInfoNoteL( EPhoneAllIncomingCallsDiverted );
   173             SendGlobalInfoNoteL( EPhoneAllIncomingCallsDiverted, ETrue );
   205             break;
   174             break;
   206             
   175             
   207         case MEngineMonitor::EPEMessageForwardConditionallyModeActive:
   176         case MEngineMonitor::EPEMessageForwardConditionallyModeActive:
   208             SendGlobalInfoNoteL( EPhoneActiveDiverts );
   177             SendGlobalInfoNoteL( EPhoneActiveDiverts, ETrue );
   209             break;
   178             break;
   210 
   179 
   211         default:
   180         default:
   212             break;
   181             break;
   213         }
   182         }
   215 
   184 
   216 // ---------------------------------------------------------
   185 // ---------------------------------------------------------
   217 // CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL
   186 // CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL
   218 // ---------------------------------------------------------
   187 // ---------------------------------------------------------
   219 //
   188 //
   220 void CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL( TInt aResourceId )
   189 void CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL( 
       
   190         TInt aResourceId, TBool aNotificationDialog )
   221     {
   191     {
   222     __LOGMETHODSTARTEND( EPhoneUIStates, 
   192     __LOGMETHODSTARTEND( EPhoneUIStates, 
   223         "CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL()" );
   193         "CPhoneGeneralGsmMessagesHandler::SendGlobalInfoNoteL()" );
   224     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
   194     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
   225     if ( CPhonePubSubProxy::Instance()->Value( 
   195     if ( CPhonePubSubProxy::Instance()->Value( 
   230         globalNotifierParam.SetBoolean( EFalse );
   200         globalNotifierParam.SetBoolean( EFalse );
   231         iViewCommandHandle.ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   201         iViewCommandHandle.ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   232             &globalNotifierParam );
   202             &globalNotifierParam );
   233             
   203             
   234         TPhoneCmdParamGlobalNote globalNoteParam;
   204         TPhoneCmdParamGlobalNote globalNoteParam;
       
   205         PhoneNotificationType type = aNotificationDialog ? 
       
   206                 EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
   207         globalNoteParam.SetType( type );
   235       
   208       
   236         globalNoteParam.SetType( EAknGlobalInformationNote );
       
   237         globalNoteParam.SetTextResourceId( 
   209         globalNoteParam.SetTextResourceId( 
   238             CPhoneMainResourceResolver::Instance()->
   210             CPhoneMainResourceResolver::Instance()->
   239             ResolveResourceID( aResourceId ) );
   211             ResolveResourceID( aResourceId ) );
   240         globalNoteParam.SetTone( EAvkonSIDInformationTone );
   212         globalNoteParam.SetNotificationDialog( aNotificationDialog );
   241 
   213 
   242         iViewCommandHandle.ExecuteCommandL( 
   214         iViewCommandHandle.ExecuteCommandL( 
   243             EPhoneViewShowGlobalNote, &globalNoteParam );    
   215             EPhoneViewShowGlobalNote, &globalNoteParam );    
   244         }
   216         }
   245     }
   217     }
   250 //
   222 //
   251 void CPhoneGeneralGsmMessagesHandler::HandleIncomingCallForwardedL()
   223 void CPhoneGeneralGsmMessagesHandler::HandleIncomingCallForwardedL()
   252     {
   224     {
   253     __LOGMETHODSTARTEND( EPhoneUIStates, 
   225     __LOGMETHODSTARTEND( EPhoneUIStates, 
   254         "CPhoneGeneralGsmMessagesHandler::HandleIncomingCallForwardedL()" );
   226         "CPhoneGeneralGsmMessagesHandler::HandleIncomingCallForwardedL()" );
   255     }
       
   256 
       
   257 // -----------------------------------------------------------
       
   258 // CPhoneGeneralGsmMessagesHandler::HandleShowVersionL
       
   259 // -----------------------------------------------------------
       
   260 //
       
   261 void CPhoneGeneralGsmMessagesHandler::HandleShowVersionL()
       
   262     {
       
   263     __LOGMETHODSTARTEND( EPhoneUIStates, 
       
   264         "CPhoneGeneralGsmMessagesHandler::HandleShowVersionL()" );
       
   265     if ( FeatureManager::FeatureSupported( KFeatureIdOnScreenDialer )  )  
       
   266         {
       
   267         iViewCommandHandle.ExecuteCommandL( EPhoneViewClearNumberEntryContent );       
       
   268         }
       
   269     else
       
   270         {
       
   271         // Remove number entry from screen
       
   272         iViewCommandHandle.ExecuteCommandL( EPhoneViewRemoveNumberEntry );        
       
   273         } 
       
   274 
       
   275 
       
   276 #ifdef __SYNCML_DM
       
   277     // Launch DM UI 
       
   278     RWsSession sess = CCoeEnv::Static()->WsSession();
       
   279     RApaLsSession apaLsSession;        
       
   280   
       
   281     TApaTaskList appList( sess );
       
   282     TApaTask bring = appList.FindApp( KDeviceManagerUid );
       
   283 
       
   284     if ( bring.Exists() )
       
   285         {
       
   286         bring.BringToForeground();
       
   287         }
       
   288     else
       
   289         {
       
   290         if( !apaLsSession.Handle() )
       
   291             {
       
   292             User::LeaveIfError(apaLsSession.Connect());
       
   293             }
       
   294         CleanupClosePushL( apaLsSession );
       
   295         TThreadId thread;
       
   296         User::LeaveIfError( apaLsSession.StartDocument(KNullDesC, KDeviceManagerUid, thread) );
       
   297         CleanupStack::PopAndDestroy( &apaLsSession );  
       
   298         }
       
   299 
       
   300     // Stop dtmf tone. Long key press case key up event go to 
       
   301     // device manager application.
       
   302     iStateMachine.SendPhoneEngineMessage(
       
   303         MPEPhoneModel::EPEMessageEndDTMF );
       
   304     
   227     
   305 #else    
   228     iActiveState.SetDivertIndication( ETrue );
   306     // Fetch version number
       
   307     TPEPhoneIdentityParameters phoneIdentityParameters = iStateMachine.
       
   308         PhoneEngineInfo()->PhoneIdentityParameters();
       
   309 
       
   310     // Add it to the resource string
       
   311     HBufC* buf = HBufC::NewLC( KSysUtilVersionTextLength );
       
   312     buf->Des().Format( phoneIdentityParameters.iRevision );
       
   313         
       
   314     TPhoneCmdParamNote noteParam;
       
   315     noteParam.SetType( EPhoneNoteCustom );
       
   316     noteParam.SetResourceId( CPhoneMainResourceResolver::Instance()->
       
   317         ResolveResourceID( EPhoneInformationWaitNote ) );
       
   318     noteParam.SetText( *buf );
       
   319     
   229     
   320     // Display note
       
   321     iViewCommandHandle.ExecuteCommandL( EPhoneViewShowNote, &noteParam );
       
   322     
       
   323     CleanupStack::PopAndDestroy( buf );
       
   324 #endif
       
   325     }
   230     }
   326 
   231 
   327 // ---------------------------------------------------------
   232 // ---------------------------------------------------------
   328 //  CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL
   233 //  CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL
   329 // ---------------------------------------------------------
   234 // ---------------------------------------------------------
   330 //
   235 //
   331 void CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL( TInt aResourceId )
   236 void CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL( 
       
   237         TInt aResourceId, TBool aNotificationDialog )
   332     {
   238     {
   333     __LOGMETHODSTARTEND( EPhoneUIStates, 
   239     __LOGMETHODSTARTEND( EPhoneUIStates, 
   334         "CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL()" );
   240         "CPhoneGeneralGsmMessagesHandler::SendGlobalErrorNoteL()" );
   335     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
   241     __ASSERT_DEBUG( aResourceId, Panic( EPhoneCtrlParameterNotInitialized ) );
   336 
   242 
   342         globalNotifierParam.SetBoolean( EFalse );
   248         globalNotifierParam.SetBoolean( EFalse );
   343         iViewCommandHandle.ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   249         iViewCommandHandle.ExecuteCommandL( EPhoneViewSetGlobalNotifiersDisabled,
   344             &globalNotifierParam );
   250             &globalNotifierParam );
   345             
   251             
   346         TPhoneCmdParamGlobalNote globalNoteParam;
   252         TPhoneCmdParamGlobalNote globalNoteParam;
   347         globalNoteParam.SetType( EAknGlobalErrorNote );
   253         PhoneNotificationType type = aNotificationDialog ? 
       
   254                 EPhoneNotificationDialog : EPhoneMessageBoxInformation;
       
   255         globalNoteParam.SetType( type );
   348         globalNoteParam.SetTextResourceId( 
   256         globalNoteParam.SetTextResourceId( 
   349             CPhoneMainResourceResolver::Instance()->
   257             CPhoneMainResourceResolver::Instance()->
   350             ResolveResourceID( aResourceId ) );
   258             ResolveResourceID( aResourceId ) );
   351         globalNoteParam.SetTone( CAknNoteDialog::EErrorTone );
   259         globalNoteParam.SetNotificationDialog( aNotificationDialog );
   352 
   260         
   353         iViewCommandHandle.ExecuteCommandL( 
   261         iViewCommandHandle.ExecuteCommandL( 
   354             EPhoneViewShowGlobalNote, &globalNoteParam );
   262             EPhoneViewShowGlobalNote, &globalNoteParam );
   355         }
   263         }
   356     }
   264     }
   357 
   265