contextframework/cfw/src/basicoperationsplugin/cfsourcecommandaction.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2008-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:  CCFSourceCommandAction class implementation.
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 // SYSTEM INCLUDES
       
    20 #include <cfoperationservices.h>
       
    21 #include <cfcontextsourcecommand.h>
       
    22 
       
    23 // USER INCLUDES
       
    24 #include "cfsourcecommandaction.h"
       
    25 #include "cfbasicoptrace.h"
       
    26 
       
    27 // ======== MEMBER FUNCTIONS ========
       
    28 
       
    29 // ---------------------------------------------------------------------------
       
    30 // C++ constructor.
       
    31 // ---------------------------------------------------------------------------
       
    32 //
       
    33 CCFSourceCommandAction::CCFSourceCommandAction(
       
    34     MCFOperationServices& aServices )
       
    35     :   CCFScriptAction( aServices, CCFScriptAction::ESourceCommand )
       
    36     {
       
    37     FUNC_LOG;
       
    38     }
       
    39 
       
    40 // ---------------------------------------------------------------------------
       
    41 // Symbian 2nd phase constructor.
       
    42 // ---------------------------------------------------------------------------
       
    43 //
       
    44 void CCFSourceCommandAction::ConstructL( CCFContextSourceCommand* aCommand )
       
    45     {
       
    46     FUNC_LOG;
       
    47 
       
    48     // Take ownership as the last step of construction to ensure that leaving
       
    49     // construction does not take the ownership.
       
    50     iCommand = aCommand;
       
    51     }
       
    52 
       
    53 // ---------------------------------------------------------------------------
       
    54 // Symbian two phased constructor.
       
    55 // ---------------------------------------------------------------------------
       
    56 //
       
    57 CCFSourceCommandAction* CCFSourceCommandAction::NewL(
       
    58     MCFOperationServices& aServices,
       
    59     CCFContextSourceCommand* aCommand )
       
    60     {
       
    61     FUNC_LOG;
       
    62 
       
    63     CCFSourceCommandAction* self = CCFSourceCommandAction::NewLC( aServices,
       
    64             aCommand );
       
    65     CleanupStack::Pop( self );
       
    66     return self;
       
    67     }
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // Symbian two phased constructor.
       
    71 // Leaves pointer in the cleanup stack.
       
    72 // ---------------------------------------------------------------------------
       
    73 //
       
    74 CCFSourceCommandAction* CCFSourceCommandAction::NewLC(
       
    75     MCFOperationServices& aServices,
       
    76     CCFContextSourceCommand* aCommand )
       
    77     {
       
    78     FUNC_LOG;
       
    79 
       
    80     CCFSourceCommandAction* self
       
    81             = new( ELeave ) CCFSourceCommandAction( aServices );
       
    82     CleanupStack::PushL( self );
       
    83     self->ConstructL( aCommand );
       
    84     return self;
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // C++ destructor.
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 CCFSourceCommandAction::~CCFSourceCommandAction()
       
    92     {
       
    93     FUNC_LOG;
       
    94 
       
    95     delete iCommand;
       
    96     }
       
    97 
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // CCFSourceCommandAction::ActL
       
   101 // -----------------------------------------------------------------------------
       
   102 //
       
   103 void CCFSourceCommandAction::ActL()
       
   104     {
       
   105     FUNC_LOG;
       
   106 
       
   107     if ( iCommand )
       
   108         {
       
   109         TPtrC commandName( iCommand->Name() );
       
   110         ACTION_INFO_3( "CCFSourceCommandAction::ActL - Script ID=[%d] Firing action: %S for source [%x]",
       
   111                 iServices.ScriptId(),
       
   112                 &commandName,
       
   113                 iCommand->SourceUid() );
       
   114 
       
   115         iServices.FireActionL( *iCommand );
       
   116         }
       
   117     else
       
   118         {
       
   119         ERROR_GEN_1( "CCFSourceCommandAction::ActL - Command is NULL for script ID=[%d]",
       
   120                 iServices.ScriptId() );
       
   121         }
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CCFSourceCommandAction::GetSecurityPolicy
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 TInt CCFSourceCommandAction::GetSecurityPolicy( TSecurityPolicy& aPolicy )
       
   129     {
       
   130     FUNC_LOG;
       
   131 
       
   132     TSecurityPolicy policy( TSecurityPolicy::EAlwaysPass );
       
   133     aPolicy = policy;
       
   134     return KErrNone; // Actual check not needed at the moment.
       
   135     }
       
   136 
       
   137 // End of file