|
1 // Copyright (c) 2004-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 // SetUserResponse |
|
17 // [Action Parameters] |
|
18 // UserResponse <input>: (optional)User response for confirmed send.Default value is 0 |
|
19 // [Action Description] |
|
20 // Sets the user response for confirmed send |
|
21 // [APIs Used] |
|
22 // TODO |
|
23 // __ACTION_INFO_END__ |
|
24 // |
|
25 // |
|
26 |
|
27 |
|
28 #include "CMtfTestActionSetUserResponse.h" |
|
29 #include "CMtfTestCase.h" |
|
30 #include "CMtfTestActionParameters.h" |
|
31 |
|
32 CMtfTestAction* CMtfTestActionSetUserResponse::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
33 { |
|
34 CMtfTestActionSetUserResponse* self = new(ELeave) CMtfTestActionSetUserResponse(aTestCase); |
|
35 CleanupStack::PushL(self); |
|
36 self->ConstructL(aActionParameters); |
|
37 CleanupStack::Pop(); |
|
38 return self; |
|
39 } |
|
40 |
|
41 |
|
42 CMtfTestActionSetUserResponse::CMtfTestActionSetUserResponse(CMtfTestCase& aTestCase) |
|
43 : CMtfSynchronousTestAction(aTestCase) |
|
44 { |
|
45 } |
|
46 |
|
47 |
|
48 CMtfTestActionSetUserResponse::~CMtfTestActionSetUserResponse() |
|
49 { |
|
50 } |
|
51 |
|
52 void CMtfTestActionSetUserResponse::ExecuteActionL() |
|
53 { |
|
54 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetUserResponse); |
|
55 CMsvSession* paramSession = ObtainParameterReferenceL<CMsvSession> (TestCase(),ActionParameters().Parameter(0)); |
|
56 TInt paramUserResponse = ObtainValueParameterL<TInt>(TestCase(),ActionParameters().Parameter(1),EFalse); |
|
57 |
|
58 CMsvEntry* cEntry = CMsvEntry::NewL(*paramSession, KMsvDraftEntryId, |
|
59 TMsvSelectionOrdering(KMsvNoGrouping,EMsvSortByNone,ETrue)); |
|
60 CleanupStack::PushL(cEntry); |
|
61 |
|
62 CMsvEntrySelection* selection = cEntry->ChildrenL(); |
|
63 CleanupStack::PushL(selection); |
|
64 |
|
65 TestCase().INFO_PRINTF2(_L("Count of Draft Folder's selection is %d"),selection->Count()); |
|
66 |
|
67 if (selection->Count() == 0) |
|
68 { |
|
69 User::Leave(KErrNotFound); |
|
70 } |
|
71 |
|
72 cEntry->SetEntryL((*selection)[0]); |
|
73 |
|
74 if (!paramUserResponse) |
|
75 { |
|
76 TMsvEntry entry = cEntry->Entry(); |
|
77 entry.iError = KErrCancel; |
|
78 cEntry->ChangeL(entry); |
|
79 } |
|
80 |
|
81 CleanupStack::PopAndDestroy(2); |
|
82 |
|
83 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetUserResponse); |
|
84 TestCase().ActionCompletedL(*this); |
|
85 } |
|
86 |