messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionDeleteChildren.cpp
changeset 0 8e480a14352b
child 58 6c34d0baa0b1
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // __ACTION_INFO_BEGIN__ 
       
    15 // [Action Name]
       
    16 // DeleteChildren
       
    17 // [Action Parameters]
       
    18 // Session  <input>: Reference to the session.
       
    19 // ParentId <input>: Value of the parent id.
       
    20 // [Action Description]
       
    21 // Deletes all children of the entry. 
       
    22 // [APIs Used]
       
    23 // none.
       
    24 // __ACTION_INFO_END__
       
    25 // 
       
    26 //
       
    27 
       
    28 /**
       
    29  @file
       
    30 */
       
    31 
       
    32 
       
    33 #include "CMtfTestActionDeleteChildren.h"
       
    34 #include "CMtfTestCase.h"
       
    35 #include "CMtfTestActionParameters.h"
       
    36 
       
    37 #include <msvapi.h>
       
    38 
       
    39 
       
    40 CMtfTestAction* CMtfTestActionDeleteChildren::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    41 	{
       
    42 	CMtfTestActionDeleteChildren* self = new (ELeave) CMtfTestActionDeleteChildren(aTestCase);
       
    43 	CleanupStack::PushL(self);
       
    44 	self->ConstructL(aActionParameters);
       
    45 	CleanupStack::Pop();
       
    46 	return self;
       
    47 	}
       
    48 	
       
    49 
       
    50 CMtfTestActionDeleteChildren::CMtfTestActionDeleteChildren(CMtfTestCase& aTestCase)
       
    51 	: CMtfTestAction(aTestCase)
       
    52 	{
       
    53 	}
       
    54 
       
    55 
       
    56 CMtfTestActionDeleteChildren::~CMtfTestActionDeleteChildren()
       
    57 	{
       
    58 	}
       
    59 
       
    60 
       
    61 void CMtfTestActionDeleteChildren::ExecuteActionL()
       
    62 	{
       
    63 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionDeleteChildren);
       
    64 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    65 	TMsvId paramParentId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    66 
       
    67 	iDeleteAllChildren = new (ELeave) CMtfTestActionUtilsDeleteAllChildren(paramSession,paramParentId);
       
    68 	iDeleteAllChildren->StartL(iStatus);
       
    69 	CActiveScheduler::Add(this);
       
    70 	SetActive();
       
    71 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteChildren);
       
    72 	}
       
    73 
       
    74 
       
    75 void CMtfTestActionDeleteChildren::DoCancel()
       
    76 	{
       
    77 	iDeleteAllChildren->Cancel();
       
    78 	}
       
    79 
       
    80 
       
    81 void CMtfTestActionDeleteChildren::RunL()
       
    82 	{
       
    83 	TInt undeleted = iDeleteAllChildren->Undeleted();
       
    84 	delete iDeleteAllChildren;
       
    85 
       
    86 	User::LeaveIfError(iStatus.Int() || undeleted);
       
    87 
       
    88 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionDeleteChildren);
       
    89 	TestCase().ActionCompletedL(*this);
       
    90 	}
       
    91