multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/TMCETestUIEngineCmdAnswerSession.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 
       
    23 #include "TMCETestUIEngineCmdAnswerSession.h"
       
    24 #include "CMCETestUIEngineInSession.h"
       
    25 #include "CMCETestUIQuestionSingleSelection.h"
       
    26 #include <MCEInSession.h>
       
    27 
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // TMCETestUIEngineCmdAnswerSession::TMCETestUIEngineCmdAnswerSession
       
    31 // -----------------------------------------------------------------------------
       
    32 //
       
    33 TMCETestUIEngineCmdAnswerSession::TMCETestUIEngineCmdAnswerSession( 
       
    34 		            CMCETestUIEngine& aEngine,
       
    35 		            CMCETestUIEngineInSession& aInSession )
       
    36     : TMCETestUIEngineCmdBase( aEngine ),
       
    37       iInSession( aInSession )		            
       
    38     {
       
    39     }
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // TMCETestUIEngineCmdAnswerSession::ExecuteL
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 EXPORT_C void TMCETestUIEngineCmdAnswerSession::ExecuteL()
       
    46 	{
       
    47 	
       
    48 	CMCETestUIQuestionSingleSelection* question = 
       
    49 	    CMCETestUIQuestionSingleSelection::NewLC();
       
    50 	    
       
    51 	question->SetCaptionL( KUserQuestionNewIncomingSession );
       
    52 	
       
    53 	question->AddChoiceL( KUserQuestionOptionAccept );
       
    54 	question->AddChoiceL( KUserQuestionOptionAcceptWithCustomReason );
       
    55 	question->AddChoiceL( KUserQuestionOptionReject );
       
    56 	question->AddChoiceL( KUserQuestionOptionRejectWithCustomReason );
       
    57 	question->AddChoiceL( KUserQuestionOptionHandleLater );
       
    58 			
       
    59 	TInt index = iEngine.AskQuestionL( *question );
       
    60 	
       
    61 	CleanupStack::PopAndDestroy( question );
       
    62 	
       
    63 	if ( index >= 0 &&  index <= 3 )
       
    64 	    {
       
    65 	    iInSession.InSession().UpdateL();
       
    66 	    }
       
    67 	
       
    68 	if ( index == 0 ) // Accept now
       
    69 	    {
       
    70         iInSession.InSession().AcceptL();
       
    71 	    }
       
    72 	else if ( index == 1 ) // Accept with with custom reason
       
    73 	    {
       
    74 	    User::Leave( KErrNotSupported ); // yet...
       
    75 	    }
       
    76 	else if ( index == 2 ) // Reject now
       
    77 	    {
       
    78         iInSession.InSession().RejectL();	    
       
    79 	    }
       
    80 	else if ( index == 3 ) // Reject with with custom reason
       
    81 	    {
       
    82 	    User::Leave( KErrNotSupported ); // yet...
       
    83 	    }
       
    84 
       
    85 	if ( index >= 0 &&  index <= 3 )
       
    86 	    {
       
    87 	    iEngine.EngineStateChangedL();	 
       
    88 	    }
       
    89 
       
    90 	}
       
    91 
       
    92 // -----------------------------------------------------------------------------
       
    93 // TMCETestUIEngineCmdAnswerSession::Caption
       
    94 // -----------------------------------------------------------------------------
       
    95 //
       
    96 EXPORT_C const TDesC& TMCETestUIEngineCmdAnswerSession::Caption() const
       
    97 	{
       
    98 	return KCommandCaptionAnswerSession;
       
    99 	}
       
   100 
       
   101 
       
   102 
       
   103 
       
   104 // End of File