phoneapp/phoneuistates/src/cphonesingleandcallsetup.cpp
changeset 78 baacf668fe89
parent 76 cfea66083b62
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
    21 #include <cpephonemodelif.h>
    21 #include <cpephonemodelif.h>
    22 #include "cphonesingleandcallsetup.h"
    22 #include "cphonesingleandcallsetup.h"
    23 #include "mphonestatemachine.h"
    23 #include "mphonestatemachine.h"
    24 #include "phoneviewcommanddefinitions.h"
    24 #include "phoneviewcommanddefinitions.h"
    25 #include "tphonecmdparamcallheaderdata.h"
    25 #include "tphonecmdparamcallheaderdata.h"
    26 #include "tphonecmdparamcallstatedata.h"
       
    27 #include "tphonecmdparamboolean.h"
    26 #include "tphonecmdparamboolean.h"
    28 #include "tphonecmdparaminteger.h"
    27 #include "tphonecmdparaminteger.h"
    29 #include "phonestatedefinitionsgsm.h"
    28 #include "phonestatedefinitionsgsm.h"
    30 #include "phonelogger.h"
    29 #include "phonelogger.h"
    31 #include "phonerssbase.h"
    30 #include "phonerssbase.h"
    32 #include "phoneui.hrh"
    31 #include "phoneui.hrh"
    33 #include "tphonecmdparamglobalnote.h"
    32 #include "tphonecmdparamglobalnote.h"
    34 #include "cphonemainresourceresolver.h"
    33 #include "cphonemainresourceresolver.h"
       
    34 #include "phonecallutil.h"
    35 
    35 
    36 // ================= MEMBER FUNCTIONS =======================
    36 // ================= MEMBER FUNCTIONS =======================
    37 
    37 
    38 // C++ default constructor can NOT contain any code, that
    38 // C++ default constructor can NOT contain any code, that
    39 // might leave.
    39 // might leave.
   153                 iStateMachine->SendPhoneEngineMessage(
   153                 iStateMachine->SendPhoneEngineMessage(
   154                     CPEPhoneModelIF::EPEMessageTerminateAllConnections );        
   154                     CPEPhoneModelIF::EPEMessageTerminateAllConnections );        
   155                 }
   155                 }
   156             else
   156             else
   157                 {
   157                 {
   158                 // Fetch active call's id from view
       
   159                 TPhoneCmdParamCallStateData callStateData;
       
   160                 // Find the dialing call
   158                 // Find the dialing call
   161                 callStateData.SetCallState( EPEStateDialing );
   159                 TInt callId = PhoneCallUtil::CallIdByState( EPEStateDialing ); 
   162                 iViewCommandHandle->HandleCommandL(
   160                 if( callId > KErrNotFound )
   163                     EPhoneViewGetCallIdByState, &callStateData ); 
       
   164             
       
   165                 if( callStateData.CallId() > KErrNotFound )
       
   166                     {
   161                     {
   167                     // Release the call
   162                     // Release the call
   168                     iStateMachine->SetCallId( 
   163                     iStateMachine->SetCallId( callId );
   169                         callStateData.CallId() );
       
   170                     iStateMachine->SendPhoneEngineMessage( 
   164                     iStateMachine->SendPhoneEngineMessage( 
   171                         MPEPhoneModel::EPEMessageRelease );
   165                         MPEPhoneModel::EPEMessageRelease );
   172                     }
   166                     }
   173                 else
   167                 else
   174                     {
   168                     {
   175                     callStateData.SetCallState( EPEStateDisconnecting );
   169                     callId = PhoneCallUtil::CallIdByState( EPEStateDisconnecting );
   176                     iViewCommandHandle->HandleCommandL(
   170                     if ( callId > KErrNotFound )
   177                         EPhoneViewGetCallIdByState, &callStateData );
       
   178                     
       
   179                      if ( callStateData.CallId() > KErrNotFound )
       
   180                         {    
   171                         {    
   181                         // Release the call
   172                         // Release the call
   182                         iStateMachine->SetCallId( 
   173                         iStateMachine->SetCallId( callId );
   183                             callStateData.CallId() );
       
   184                         iStateMachine->SendPhoneEngineMessage( 
   174                         iStateMachine->SendPhoneEngineMessage( 
   185                             MPEPhoneModel::EPEMessageRelease );   
   175                             MPEPhoneModel::EPEMessageRelease );   
   186                         }
   176                         }
   187                     }          
   177                     }          
   188                 }
   178                 }
   292     switch( aCommand )
   282     switch( aCommand )
   293         {
   283         {
   294         case EPhoneInCallCmdEndThisOutgoingCall:
   284         case EPhoneInCallCmdEndThisOutgoingCall:
   295             {
   285             {
   296             // Fetch  call's id from view
   286             // Fetch  call's id from view
   297             TPhoneCmdParamCallStateData callStateData;
   287             TInt callId = PhoneCallUtil::CallIdByState( EPEStateDialing );
   298             callStateData.SetCallState( EPEStateDialing );
   288             if ( callId > KErrNotFound )
   299             iViewCommandHandle->HandleCommandL(
       
   300                 EPhoneViewGetCallIdByState, &callStateData );
       
   301                 
       
   302             if ( callStateData.CallId() > KErrNotFound )
       
   303                 {
   289                 {
   304                 // Release the call
   290                 // Release the call
   305                 iStateMachine->SetCallId( 
   291                 iStateMachine->SetCallId( callId );
   306                     callStateData.CallId() );
       
   307                 iStateMachine->SendPhoneEngineMessage( 
   292                 iStateMachine->SendPhoneEngineMessage( 
   308                     MPEPhoneModel::EPEMessageRelease );    
   293                     MPEPhoneModel::EPEMessageRelease );    
   309                 }
   294                 }
   310             else
   295             else
   311                 {
   296                 {
   312                 callStateData.SetCallState( EPEStateDisconnecting );
   297                 callId = PhoneCallUtil::CallIdByState( EPEStateDisconnecting );
   313                 iViewCommandHandle->HandleCommandL(
   298                 if ( callId > KErrNotFound )
   314                     EPhoneViewGetCallIdByState, &callStateData );
       
   315                 
       
   316                  if ( callStateData.CallId() > KErrNotFound )
       
   317                     {    
   299                     {    
   318                     // Release the call
   300                     // Release the call
   319                     iStateMachine->SetCallId( 
   301                     iStateMachine->SetCallId( callId );
   320                         callStateData.CallId() );
       
   321                     iStateMachine->SendPhoneEngineMessage( 
   302                     iStateMachine->SendPhoneEngineMessage( 
   322                         MPEPhoneModel::EPEMessageRelease );   
   303                         MPEPhoneModel::EPEMessageRelease );   
   323                     }
   304                     }
   324                 __PHONELOG( EOnlyFatal, EPhoneUIStates, 
   305                 __PHONELOG( EOnlyFatal, EPhoneUIStates, 
   325                     "CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" );   
   306                     "CPhoneSingleAndCallSetup::HandleCommandL EPhoneInCallCmdEndThisOutgoingCall has negative call id!" );