contextframework/cfw/src/basicoperationsplugin/cfnotifyaction.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2002-2007 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:  CCFNotifyAction class implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDES
       
    21 #include "cfnotifyaction.h"
       
    22 #include "cfscriptevent.h"
       
    23 #include "cfbasicoptrace.h"
       
    24 
       
    25 #include <cfoperationservices.h>
       
    26 
       
    27 // MEMBER FUNCTIONS
       
    28 
       
    29 // -----------------------------------------------------------------------------
       
    30 // CCFNotifyAction::CCFNotifyAction
       
    31 // C++ default constructor can NOT contain any code, that might leave.
       
    32 // -----------------------------------------------------------------------------
       
    33 //
       
    34 CCFNotifyAction::CCFNotifyAction( MCFOperationServices& aServices ) 
       
    35     :   CCFScriptAction( aServices, CCFScriptAction::ENotify )
       
    36     {
       
    37     FUNC_LOG;
       
    38     }
       
    39 
       
    40 // -----------------------------------------------------------------------------
       
    41 // CCFNotifyAction::ConstructL
       
    42 // Symbian 2nd phase constructor can leave.
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CCFNotifyAction::ConstructL( const TDesC& aActionId, 
       
    46     const RPointerArray< CCFKeyValuePair >& aParameters )
       
    47     {
       
    48     FUNC_LOG;
       
    49 
       
    50     iIdentifier = aActionId.AllocL();
       
    51     for ( TInt i = 0; i < aParameters.Count(); ++i )
       
    52         {
       
    53         iParameters.AppendL( CCFKeyValuePair::NewL( aParameters[ i ]->Key(), 
       
    54             aParameters[ i ]->Value() ) );
       
    55         }
       
    56     }
       
    57 
       
    58 // -----------------------------------------------------------------------------
       
    59 // CCFNotifyAction::NewL
       
    60 // Two-phased constructor.
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 CCFNotifyAction* CCFNotifyAction::NewL( MCFOperationServices& aServices, 
       
    64     const TDesC& aActionId, 
       
    65     const RPointerArray< CCFKeyValuePair >& aParameters )
       
    66     {
       
    67     FUNC_LOG;
       
    68 
       
    69     CCFNotifyAction* self = CCFNotifyAction::NewLC( aServices, 
       
    70             aActionId,
       
    71             aParameters );
       
    72     CleanupStack::Pop( self );
       
    73     return self;
       
    74     }
       
    75 
       
    76 // -----------------------------------------------------------------------------
       
    77 // CCFNotifyAction::NewLC
       
    78 // Two-phased constructor.
       
    79 // -----------------------------------------------------------------------------
       
    80 //
       
    81 CCFNotifyAction* CCFNotifyAction::NewLC( MCFOperationServices& aServices,
       
    82     const TDesC& aActionId, 
       
    83     const RPointerArray< CCFKeyValuePair >& aParameters )
       
    84     {
       
    85     FUNC_LOG;
       
    86 
       
    87     CCFNotifyAction* self = new( ELeave ) CCFNotifyAction( aServices );
       
    88     CleanupStack::PushL( self );
       
    89     self->ConstructL( aActionId, aParameters );
       
    90     return self;
       
    91     }
       
    92 
       
    93 // Destructor
       
    94 CCFNotifyAction::~CCFNotifyAction()
       
    95     {
       
    96     FUNC_LOG;
       
    97 
       
    98     iParameters.ResetAndDestroy();
       
    99     delete iIdentifier;
       
   100     }
       
   101 
       
   102 
       
   103 // -----------------------------------------------------------------------------
       
   104 // CCFNotifyAction::ActL
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CCFNotifyAction::ActL()
       
   108     {
       
   109     FUNC_LOG;
       
   110 
       
   111     CCFScriptEvent* newEvent = CCFScriptEvent::NewL( iServices.ScriptId(),
       
   112             iParameters,
       
   113             *iIdentifier );
       
   114     CleanupStack::PushL( newEvent );                // CLEANUP<< newEvent
       
   115     iServices.FireActionL( newEvent );
       
   116     CleanupStack::Pop( newEvent );                  // CLEANUP>> newEvent
       
   117 
       
   118     ACTION_INFO_2( "CCFNotifyAction::ActL - Script ID=[%d] Fired action: %S",
       
   119             iServices.ScriptId(),
       
   120             &( *iIdentifier ) );
       
   121     }
       
   122 
       
   123 // -----------------------------------------------------------------------------
       
   124 // CCFNotifyAction::GetSecurityPolicy
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CCFNotifyAction::GetSecurityPolicy( TSecurityPolicy& aPolicy )
       
   128 	{
       
   129     FUNC_LOG;
       
   130 
       
   131 	return iServices.GetActionSecurityPolicy( *iIdentifier, aPolicy );
       
   132 	}