multimediacommsengine/tsrc/MCETestUI/MCETestUIEngine/src/TMCETestUIEngineCmdTerminateEvent.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 "TMCETestUIEngineCmdTerminateEvent.h"
       
    24 #include "CMCETestUIEngineEvent.h"
       
    25 #include "CMCETestUIQuestionSingleSelection.h"
       
    26 #include "CMCETestUIQuestionDataQuery.h"
       
    27 #include "MCETestUIDebug.h"
       
    28 #include <MCEEvent.h>
       
    29 
       
    30 
       
    31 // -----------------------------------------------------------------------------
       
    32 // TMCETestUIEngineCmdTerminateEvent::TMCETestUIEngineCmdTerminateEvent
       
    33 // -----------------------------------------------------------------------------
       
    34 //
       
    35 TMCETestUIEngineCmdTerminateEvent::TMCETestUIEngineCmdTerminateEvent( 
       
    36 		            CMCETestUIEngine& aEngine,
       
    37 		            CMCETestUIEngineEvent& aEvent )
       
    38     : TMCETestUIEngineCmdBase( aEngine ),
       
    39       iEvent( aEvent )
       
    40     {
       
    41     }
       
    42 
       
    43 // -----------------------------------------------------------------------------
       
    44 // TMCETestUIEngineCmdTerminateEvent::ExecuteL
       
    45 // -----------------------------------------------------------------------------
       
    46 //
       
    47 EXPORT_C void TMCETestUIEngineCmdTerminateEvent::ExecuteL()
       
    48 	{
       
    49 	TNotifyValues notifyValues;
       
    50     if( iEngine.NotifyValues( notifyValues) )
       
    51     	{
       
    52     	CDesC8Array* headers;
       
    53     	headers = new (ELeave) CDesC8ArrayFlat( 1 );
       
    54     	CleanupStack::PushL( headers );
       
    55 
       
    56 		CMCETestUIQuestionDataQuery* question = 
       
    57     			CMCETestUIQuestionDataQuery::NewLC();
       
    58 		question->SetCaptionL( KUserQuestionInputEventHeader );
       
    59 		question->SetDefaultValueL(notifyValues.headers  );
       
    60 		question->SetAnswerL( notifyValues.headers );
       
    61 		TBufC8<100> headersbuffer( question->Answer8() );
       
    62 		CleanupStack::PopAndDestroy( question );
       
    63 		headers->AppendL( headersbuffer );
       
    64 
       
    65 /*
       
    66         CMCETestUIQuestionDataQuery* question2 = 
       
    67 		    CMCETestUIQuestionDataQuery::NewLC();
       
    68 		    
       
    69         question2->SetCaptionL( KUserQuestionInputEventContentType );
       
    70     	question2->SetDefaultValueL(notifyValues.contentType  );
       
    71     	question2->SetAnswerL( notifyValues.contentType  );
       
    72     	
       
    73     	HBufC8 *contentType = HBufC8::NewLC( question2->Answer8().Length() );
       
    74     	contentType->Des().Copy( question2->Answer8() );
       
    75     	    	
       
    76     	CleanupStack::PopAndDestroy( question2 );
       
    77 
       
    78         CMCETestUIQuestionDataQuery* question3 = 
       
    79 		    CMCETestUIQuestionDataQuery::NewLC();
       
    80 		    
       
    81         question3->SetCaptionL( KUserQuestionInputEventContent );
       
    82     	question3->SetDefaultValueL(notifyValues.contentType  );
       
    83     	question3->SetAnswerL( notifyValues.contentType  );
       
    84     	HBufC8 *content = HBufC8::NewLC( question3->Answer8().Length() );
       
    85     	content->Des().Copy( question3->Answer8() );
       
    86     	
       
    87     	
       
    88     	CleanupStack::PopAndDestroy( question3 );
       
    89     	
       
    90     	CleanupStack::Pop( content );
       
    91     	CleanupStack::Pop( contentType );
       
    92    */
       
    93     	
       
    94     	
       
    95     	
       
    96     	HBufC8 *contentType = HBufC8::NewLC( KNotifyContentType().Length() );
       
    97     	contentType->Des().Copy( KNotifyContentType );
       
    98     	
       
    99     	HBufC8 *content = HBufC8::NewLC( KNotifyContent().Length() );
       
   100     	content->Des().Copy( KNotifyContent );
       
   101     	
       
   102     	CleanupStack::Pop( content );
       
   103     	CleanupStack::Pop( contentType );
       
   104     	CleanupStack::Pop( headers );
       
   105     	
       
   106     	if( headers == 0 )
       
   107     	    {
       
   108     	    MCE_TESTUI_DEBUG1( "Terminate Event with values");
       
   109     	    iEvent.Event().TerminateL( headers, contentType, content );
       
   110     	    }
       
   111     	else
       
   112     	    {
       
   113     	    MCE_TESTUI_DEBUG1( "Terminate Event without values");
       
   114     	    iEvent.Event().TerminateL( );
       
   115     	    }
       
   116     	
       
   117     	iEngine.EngineStateChangedL();
       
   118     	}
       
   119 	}
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // TMCETestUIEngineCmdTerminateEvent::Caption
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C const TDesC& TMCETestUIEngineCmdTerminateEvent::Caption() const
       
   126 	{
       
   127 	return KCommandCaptionTerminateEvent;
       
   128 	}
       
   129 
       
   130 
       
   131 // End of File