diff -r 9f5ae1728557 -r db3f5fa34ec7 messagingfw/msgtestfw/TestActions/Email/Common/src/CMtfTestActionCheckAttachmentPathFromEntrySelection.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/messagingfw/msgtestfw/TestActions/Email/Common/src/CMtfTestActionCheckAttachmentPathFromEntrySelection.cpp Wed Nov 03 22:41:46 2010 +0530 @@ -0,0 +1,103 @@ +// Copyright (c) 2005-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] +// CheckAttachmentPathFromEntrySelection +// [Action Parameters] +// Session : Reference to the session. +// EntrySelection : Reference to the entry selection +// [Action Description] +// Checks the attachment paths from an email message in an entry selection. +// [APIs Used] +// __ACTION_INFO_END__ +// +// + + +#include "CMtfTestActionCheckAttachmentPathFromEntrySelection.h" +#include "CMtfTestCase.h" +#include "CMtfTestActionParameters.h" +#include "MtfTestActionUtilsUser.h" + +#include +#include +#include + +CMtfTestAction* CMtfTestActionCheckAttachmentPathFromEntrySelection::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) + { + CMtfTestActionCheckAttachmentPathFromEntrySelection* self = new(ELeave) CMtfTestActionCheckAttachmentPathFromEntrySelection(aTestCase); + CleanupStack::PushL(self); + self->ConstructL(aActionParameters); + CleanupStack::Pop(); + return self; + } + +CMtfTestActionCheckAttachmentPathFromEntrySelection::CMtfTestActionCheckAttachmentPathFromEntrySelection(CMtfTestCase& aTestCase) + : CMtfSynchronousTestAction(aTestCase) + { + } + +CMtfTestActionCheckAttachmentPathFromEntrySelection::~CMtfTestActionCheckAttachmentPathFromEntrySelection() + { + } + +void CMtfTestActionCheckAttachmentPathFromEntrySelection::ExecuteActionL() + { + TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionCheckAttachmentPathFromEntrySelection); + CMsvSession* paramSession = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(0)); + CMsvEntrySelection* paramSelection = ObtainParameterReferenceL(TestCase(),ActionParameters().Parameter(1)); + + if( paramSelection->Count()==0 ) + { + User::Leave(KErrArgument); + } + + TMsvId entryId = (*paramSelection)[0]; + CMsvEntry* entry = paramSession->GetEntryL(entryId); + CleanupStack::PushL(entry); + + CImEmailMessage* emailMsg = CImEmailMessage::NewL(*entry); + CleanupStack::PushL(emailMsg); + + MMsvAttachmentManager& attManager = emailMsg->AttachmentManager(); + TInt attachmentCount = attManager.AttachmentCount(); + if( attachmentCount==0 ) + { + User::Leave(KErrArgument); + } + + for( TInt ii=0; iiFileSession()); + TUint fileAttributes; + TInt err = fs.Att(attachInfo->FilePath(), fileAttributes); + User::LeaveIfError(err); + + CleanupStack::PopAndDestroy(attachInfo); + } + + CleanupStack::PopAndDestroy(2, entry); // emailMsg, entry + + TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionCheckAttachmentPathFromEntrySelection); + TestCase().ActionCompletedL(*this); + } + + +