multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/TMCETestUIEngineCmdAcceptSession.cpp
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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:    Implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDES
       
    22 #include "TMCETestUIEngineCmdAcceptSession.h"
       
    23 #include "CMCETestUIEngineInSession.h"
       
    24 #include "CMCETestUIQuestionDataQuery.h"
       
    25 #include "CMCETestUIQuestionSingleSelection.h"
       
    26 #include <MCEInSession.h>
       
    27 
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // TMCETestUIEngineCmdAcceptSession::TMCETestUIEngineCmdAcceptSession
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 TMCETestUIEngineCmdAcceptSession::TMCETestUIEngineCmdAcceptSession( 
       
    34 		            CMCETestUIEngine& aEngine,
       
    35 		            CMCETestUIEngineInSession& aInSession )
       
    36     : TMCETestUIEngineCmdBase( aEngine ),
       
    37       iInSession( aInSession )		            
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // TMCETestUIEngineCmdAcceptSession::ExecuteL
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C void TMCETestUIEngineCmdAcceptSession::ExecuteL()
       
    46 	{
       
    47 
       
    48 	iInSession.InSession().AcceptL();	    
       
    49 	iEngine.EngineStateChangedL();
       
    50 /*	CMCETestUIQuestionSingleSelection* question = 
       
    51 	    CMCETestUIQuestionSingleSelection::NewLC();
       
    52 	    
       
    53 	question->SetCaptionL( KMiscIncomingSession );
       
    54 	
       
    55 	question->AddChoiceL( KUserQuestionOptionAccept );
       
    56 	question->AddChoiceL( KUserQuestionOptionAcceptWithCustomReason );
       
    57 	
       
    58 	TInt index = iEngine.AskQuestionL( *question );
       
    59 	
       
    60 	CleanupStack::PopAndDestroy( question );
       
    61 	
       
    62 	if ( index == 0 ) // Accept now
       
    63 	    {
       
    64         iInSession.InSession().AcceptL();	    
       
    65 	    }
       
    66 	else if ( index == 1 )
       
    67 	    {
       
    68 	    User::Leave( KErrNotSupported ); // yet...
       
    69 	    }
       
    70 */	}
       
    71 
       
    72 // -----------------------------------------------------------------------------
       
    73 // TMCETestUIEngineCmdAcceptSession::Caption
       
    74 // -----------------------------------------------------------------------------
       
    75 //
       
    76 EXPORT_C const TDesC& TMCETestUIEngineCmdAcceptSession::Caption() const
       
    77 	{
       
    78 	return KCommandCaptionAcceptSession;
       
    79 	}
       
    80 
       
    81 
       
    82 // -----------------------------------------------------------------------------
       
    83 // TMCETestUIEngineCmdRespondSession::TMCETestUIEngineCmdRespondSession
       
    84 // -----------------------------------------------------------------------------
       
    85 //
       
    86 TMCETestUIEngineCmdRespondSession::TMCETestUIEngineCmdRespondSession( 
       
    87 		            CMCETestUIEngine& aEngine,
       
    88 		            CMCETestUIEngineInSession& aInSession )
       
    89     : TMCETestUIEngineCmdBase( aEngine ),
       
    90       iInSession( aInSession )		            
       
    91     {
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // TMCETestUIEngineCmdRespondSession::ExecuteL
       
    96 // -----------------------------------------------------------------------------
       
    97 //
       
    98 EXPORT_C void TMCETestUIEngineCmdRespondSession::ExecuteL()
       
    99 	{
       
   100 
       
   101 	TSessionResponseValues responseValues;
       
   102 	if(iEngine.SessionResponseValues( responseValues))
       
   103     	{
       
   104 		CMCETestUIQuestionDataQuery* question = 
       
   105     			CMCETestUIQuestionDataQuery::NewLC();
       
   106 		question->SetCaptionL( KUserQuestionInputRecipient );
       
   107 		question->SetDefaultValueL(responseValues.reason  );
       
   108 		question->SetAnswerL( responseValues.reason );
       
   109 		TBufC8<100> reason( question->Answer8() );
       
   110 		CleanupStack::PopAndDestroy( question );
       
   111 		iInSession.InSession().RespondL(reason,responseValues.code);
       
   112 	   	}
       
   113 	iEngine.EngineStateChangedL();
       
   114 	}
       
   115 
       
   116 // -----------------------------------------------------------------------------
       
   117 // TMCETestUIEngineCmdRespondSession::Caption
       
   118 // -----------------------------------------------------------------------------
       
   119 //
       
   120 EXPORT_C const TDesC& TMCETestUIEngineCmdRespondSession::Caption() const
       
   121 	{
       
   122 	return KCommandCaptionRespondSession;
       
   123 	}
       
   124 
       
   125 
       
   126 
       
   127 // End of File