contextframework/cfw/src/cfserver/cfactioncmd.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2008 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:  CCFActionCmd implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDES
       
    20 
       
    21 // USER INCLUDES
       
    22 #include "cfactioncmd.h"
       
    23 #include "cfactionhandler.h"
       
    24 #include "cftrace.h"
       
    25 
       
    26 #include <cfscriptevent.h>
       
    27 
       
    28 // ======== MEMBER FUNCTIONS ========
       
    29 
       
    30 // ---------------------------------------------------------------------------
       
    31 // C++ constructor.
       
    32 // ---------------------------------------------------------------------------
       
    33 //
       
    34 CCFActionCmd::CCFActionCmd( MCFActionHandler& aActionHandler,
       
    35     CCFScriptEvent* aEvent )
       
    36     :   iActionHandler( aActionHandler ),
       
    37         iEvent( aEvent )
       
    38     {
       
    39     FUNC_LOG;
       
    40     }
       
    41 
       
    42 // ---------------------------------------------------------------------------
       
    43 // Symbian two phased constructor.
       
    44 // ---------------------------------------------------------------------------
       
    45 //
       
    46 CCFActionCmd* CCFActionCmd::NewL( MCFActionHandler& aActionHandler,
       
    47     CCFScriptEvent* aEvent )
       
    48     {
       
    49     FUNC_LOG;
       
    50 
       
    51     CCFActionCmd* self = CCFActionCmd::NewLC( aActionHandler, aEvent );
       
    52     CleanupStack::Pop( self );
       
    53     return self;
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // Symbian two phased constructor.
       
    58 // Leaves pointer in the cleanup stack.
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 CCFActionCmd* CCFActionCmd::NewLC( MCFActionHandler& aActionHandler,
       
    62     CCFScriptEvent* aEvent )
       
    63     {
       
    64     FUNC_LOG;
       
    65 
       
    66     CCFActionCmd* self = new( ELeave ) CCFActionCmd( aActionHandler, aEvent );
       
    67     CleanupStack::PushL( self );
       
    68     return self;
       
    69     }
       
    70 
       
    71 // ---------------------------------------------------------------------------
       
    72 // C++ destructor.
       
    73 // ---------------------------------------------------------------------------
       
    74 //
       
    75 CCFActionCmd::~CCFActionCmd()
       
    76     {
       
    77     FUNC_LOG;
       
    78 
       
    79     delete iEvent;
       
    80     }
       
    81 
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CCFActionCmd::ExecuteL
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 void CCFActionCmd::ExecuteL()
       
    88     {
       
    89     FUNC_LOG;
       
    90 
       
    91     iActionHandler.FireActionL( iEvent );
       
    92     iEvent = NULL; // Ownership was transferred.
       
    93     }
       
    94 
       
    95 // ---------------------------------------------------------------------------
       
    96 // CCFActionCmd::LogError
       
    97 // ---------------------------------------------------------------------------
       
    98 //
       
    99 void CCFActionCmd::LogError( TInt aError )
       
   100     {
       
   101     FUNC_LOG;
       
   102 
       
   103     if( aError != KErrNone )
       
   104         {
       
   105         ERROR( aError, "CCFActionCmd::LogError - MCFActionHandler::FireActionL() execution failed." );
       
   106         }
       
   107     }
       
   108 
       
   109 // End of file