phoneapp/phoneuivoipextension/src/cphoneunattendedtransfercmdhandler.cpp
branchRCL_3
changeset 19 544e34b3255a
parent 4 c84cf270c54f
child 25 91c2fb4b78df
--- a/phoneapp/phoneuivoipextension/src/cphoneunattendedtransfercmdhandler.cpp	Wed Mar 31 21:30:06 2010 +0300
+++ b/phoneapp/phoneuivoipextension/src/cphoneunattendedtransfercmdhandler.cpp	Wed Apr 14 15:56:42 2010 +0300
@@ -17,6 +17,8 @@
 
 #include <featmgr.h>
 #include <mpeengineinfo.h>
+#include <StringLoader.h>
+
 #include "cphoneunattendedtransfercmdhandler.h"
 
 #include "cphonelogger.h"
@@ -32,6 +34,9 @@
 #include "tphonecmdparamquery.h"
 #include "tphonecmdparamglobalnote.h"
 #include "cphonemainresourceresolver.h"
+#include "cphonestatemachinevoip.h"
+#include "cphonestateutilsvoip.h"
+
 
 
 // ======== MEMBER FUNCTIONS ========
@@ -147,7 +152,23 @@
                 }
             }
             break;
-        
+        case EPhoneCmdUnattendedTransferCallBackOk:
+            {
+            MPEEngineInfo* info = iStateMachine.PhoneEngineInfo();
+            const TDesC& callBackToAddr = info->CallBackAddress();
+            // Service id used for last call is used to call back
+            TUint32 serviceId = info->ServiceIdCommand();
+            static_cast<CPhoneStateMachineVoIP&>( 
+                iStateMachine ).StateUtils().SelectServiceAndDialL( 
+                    callBackToAddr, serviceId );
+            }
+            break;
+        case EPhoneCmdUnattendedTransferCallBackCancel:
+            {
+            MPEEngineInfo* info = iStateMachine.PhoneEngineInfo();
+            info->SetCallBackAddress( KNullDesC );
+            }
+            break;
         default:
             __PHONELOG( EOnlyFatal, PhoneUIVoIPExtension, 
                 "CPhoneUnattendedTransferCmdHandler::HandleCommandL, DEFAULT" );    
@@ -322,3 +343,48 @@
     iViewCommandHandle.ExecuteCommandL( 
         EPhoneViewShowGlobalNote, &globalNoteParam );
     }
+
+// ---------------------------------------------------------------------------
+// CPhoneUnattendedTransferCmdHandler::LaunchCallBackQuery
+// ---------------------------------------------------------------------------
+//
+void CPhoneUnattendedTransferCmdHandler::LaunchCallBackQueryL()
+    {
+    __LOGMETHODSTARTEND( PhoneUIVoIPExtension, 
+          "CPhoneUnattendedTransferCmdHandler::LaunchCallBackQueryL() ")
+    MPEEngineInfo* info = iStateMachine.PhoneEngineInfo();
+    const TDesC& callBackToAddr = info->CallBackAddress();
+    // We cannot do call back if original call had private address
+    if ( callBackToAddr.Compare( KNullDesC ) == 0 )
+        {
+        return;
+        }
+          
+    TPhoneCmdParamQuery queryParam;
+    queryParam.SetQueryType( EPhoneGlobalMsgQuery );
+    
+    HBufC* msgHeader = 
+      StringLoader::LoadLC( CPhoneMainResourceResolver::Instance()->
+          ResolveResourceID( EPhoneVoIPTransferCallBackHeader ) );
+    queryParam.SetQueryPrompt( *msgHeader );
+         
+    HBufC* queryText = 
+      StringLoader::LoadLC( CPhoneMainResourceResolver::Instance()->
+          ResolveResourceID( 
+                  EPhoneVoIPTransferCallBackText ), callBackToAddr );
+    
+    queryParam.SetDataText( &queryText->Des() );
+    
+    queryParam.SetDefaultCba( R_AVKON_SOFTKEYS_OK_CANCEL );
+    
+    // configure custom command mappings for user responses
+    queryParam.SetCbaCommandMapping( 
+      EAknSoftkeyOk, EPhoneCmdUnattendedTransferCallBackOk );
+    queryParam.SetCbaCommandMapping( 
+      EAknSoftkeyCancel, EPhoneCmdUnattendedTransferCallBackCancel );
+    
+    iViewCommandHandle.ExecuteCommandL( EPhoneViewShowQuery, &queryParam );
+    
+    CleanupStack::PopAndDestroy( queryText );
+    CleanupStack::PopAndDestroy( msgHeader );
+    }