diff -r 000000000000 -r 8e480a14352b messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionCreateFolder.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/msgtestfw/TestActions/Base/src/CMtfTestActionCreateFolder.cpp Mon Jan 18 20:36:02 2010 +0200 @@ -0,0 +1,152 @@ +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// __ACTION_INFO_BEGIN__ +// [Action Name] +// CreateFolder +// [Action Parameters] +// Session : Reference to the session. +// ParentId : Value of the parent id. +// MtmUid : Value of the MTM uid. +// ServiceId : Value of the the service id. +// (Priority) : Value of the entry priority. Default is medium priority. +// (ReadOnlyFlag) : Value of the read only flag. Default is false. +// (VisibleFlag) : Value of the visible flag. Default is true. +// (Description) : Name of the description. Default is blank. +// (Details) : Name of the details. Default is blank. +// FolderId : Value of the created folder id. +// [Action Description] +// Creates a folder on the specified parent. +// [APIs Used] +// TMsvEntry::iType +// TMsvEntry::SetPriority +// TMsvEntry::iMtm +// TMsvEntry::iServiceId +// TMsvEntry::SetReadOnly +// TMsvEntry::SetVisible +// TMsvEntry::iDescription +// TMsvEntry::iDetails +// TMsvEntry::iDate +// TMsvEntry::Id +// CMsvEntry::SetEntryL +// CMsvEntry::CreateL +// CMsvEntry::OwningService +// __ACTION_INFO_END__ +// +// + +/** + @file +*/ + + +#include "CMtfTestActionCreateFolder.h" +#include "CMtfTestCase.h" +#include "CMtfTestActionParameters.h" +#include "MtfTestActionUtilsUser.h" + +#include + + +CMtfTestAction* CMtfTestActionCreateFolder::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) + { + CMtfTestActionCreateFolder* self = new (ELeave) CMtfTestActionCreateFolder(aTestCase); + CleanupStack::PushL(self); + self->ConstructL(aActionParameters); + CleanupStack::Pop(); + return self; + } + + +CMtfTestActionCreateFolder::CMtfTestActionCreateFolder(CMtfTestCase& aTestCase) + : CMtfTestAction(aTestCase) + { + } + + +CMtfTestActionCreateFolder::~CMtfTestActionCreateFolder() + { + delete iBlank; + } + + +void CMtfTestActionCreateFolder::ExecuteActionL() + { + TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCreateFolder); + iBlank = KNullDesC().AllocL(); + + CMsvSession* paramSession = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(0)); + TMsvId paramParentId = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(1)); + TUid paramMtmUid = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(2)); + TMsvId paramServiceId = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(3)); + TMsvPriority paramPriority = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(4),EMsvMediumPriority); + TInt paramReadOnlyFlag = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(5),EFalse); + TInt paramVisibleFlag = ObtainValueParameterL(TestCase(),ActionParameters().Parameter(6),ETrue); + HBufC* paramDescription = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(7),iBlank); + HBufC* paramDetails = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(8),iBlank); + + iIndexEntry.iType = KUidMsvFolderEntry; + iIndexEntry.iMtm = paramMtmUid; + iIndexEntry.iServiceId = paramServiceId; + iIndexEntry.SetPriority(TMsvPriority(paramPriority)); + iIndexEntry.SetReadOnly(paramReadOnlyFlag); + iIndexEntry.SetVisible(paramVisibleFlag); + iIndexEntry.iDescription.Set(paramDescription->Des()); + iIndexEntry.iDetails.Set(paramDetails->Des()); + iIndexEntry.iDate.HomeTime(); + + CMsvEntry* entry = CMsvEntry::NewL(*paramSession,paramParentId,TMsvSelectionOrdering()); + CleanupStack::PushL(entry); + entry->SetEntryL(paramParentId); + if (entry->OwningService() == KMsvLocalServiceIndexEntryId) + { + entry->CreateL(iIndexEntry); + TMsvId paramFolderId; + paramFolderId = iIndexEntry.Id(); + + StoreParameterL(TestCase(),paramFolderId,ActionParameters().Parameter(9)); + + TestCase().ActionCompletedL(*this); + } + else + { + iOperation = entry->CreateL(iIndexEntry,iStatus); + SetActive(); + } + CleanupStack::PopAndDestroy(entry); + TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCreateFolder); + } + + +void CMtfTestActionCreateFolder::DoCancel() + { + iOperation->Cancel(); + } + + +void CMtfTestActionCreateFolder::RunL() + { + TInt err = MtfTestActionUtilsUser::FinalProgressStatus(*iOperation,iStatus); + delete iOperation; + User::LeaveIfError(err); + + TMsvId paramFolderId; + paramFolderId = iIndexEntry.Id(); + StoreParameterL(TestCase(),paramFolderId,ActionParameters().Parameter(9)); + + TestCase().ActionCompletedL(*this); + } + + + +