messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionMoveEntry.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 // MoveEntry
       
    17 // [Action Parameters]
       
    18 // Session   <input>: Reference to the session.
       
    19 // EntryId <input>: Value of the Entry id to be copied.
       
    20 // TargetId  <input>: Value of the target folder or service id.
       
    21 // [Action Description]
       
    22 // Moves the Entry to the target folder or service.
       
    23 // [APIs Used]
       
    24 // CMsvEntry::SetEntryL
       
    25 // CMsvEntry::MoveL
       
    26 // __ACTION_INFO_END__
       
    27 // 
       
    28 //
       
    29 
       
    30 /**
       
    31  @file
       
    32 */
       
    33 
       
    34 
       
    35 #include "CMtfTestActionMoveEntry.h"
       
    36 #include "CMtfTestCase.h"
       
    37 #include "CMtfTestActionParameters.h"
       
    38 #include "MtfTestActionUtilsUser.h"
       
    39 
       
    40 
       
    41 CMtfTestAction* CMtfTestActionMoveEntry::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters)
       
    42 	{
       
    43 	CMtfTestActionMoveEntry* self = new (ELeave) CMtfTestActionMoveEntry(aTestCase);
       
    44 	CleanupStack::PushL(self);
       
    45 	self->ConstructL(aActionParameters);
       
    46 	CleanupStack::Pop();
       
    47 	return self;
       
    48 	}
       
    49 	
       
    50 
       
    51 CMtfTestActionMoveEntry::CMtfTestActionMoveEntry(CMtfTestCase& aTestCase)
       
    52 	: CMtfTestAction(aTestCase)
       
    53 	{
       
    54 	}
       
    55 
       
    56 
       
    57 CMtfTestActionMoveEntry::~CMtfTestActionMoveEntry()
       
    58 	{
       
    59 	}
       
    60 
       
    61 
       
    62 void CMtfTestActionMoveEntry::ExecuteActionL()
       
    63 	{
       
    64 	TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionMoveEntry);
       
    65 	CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession>(TestCase(),ActionParameters().Parameter(0));
       
    66 	TMsvId paramEntryId = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(1));
       
    67 	TMsvId paramTargetId  = ObtainValueParameterL<TMsvId>(TestCase(),ActionParameters().Parameter(2));
       
    68 
       
    69 	CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramEntryId,TMsvSelectionOrdering());
       
    70 	CleanupStack::PushL(entry);
       
    71 	entry->SetEntryL(paramEntryId);
       
    72 	entry->SetEntryL(entry->Entry().Parent());
       
    73 	iOperation = entry->MoveL(paramEntryId,paramTargetId,iStatus);
       
    74 	CleanupStack::PopAndDestroy(entry);
       
    75 	CActiveScheduler::Add(this);
       
    76 	SetActive();
       
    77 	TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionMoveEntry);
       
    78 	}
       
    79 
       
    80 
       
    81 void CMtfTestActionMoveEntry::DoCancel()
       
    82 	{
       
    83 	iOperation->Cancel();
       
    84 	}
       
    85 
       
    86 
       
    87 void CMtfTestActionMoveEntry::RunL()
       
    88 	{
       
    89 	TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus);
       
    90 
       
    91 	delete iOperation;
       
    92 
       
    93 	User::LeaveIfError(err);
       
    94 	TestCase().ActionCompletedL(*this);
       
    95 	}
       
    96