|
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 // SetImap4PartialDownloadLimits |
|
17 // [Action Parameters] |
|
18 // TInt TotalSizeLimit <input>: Value of the total size limit |
|
19 // Default value is KMaxTInt |
|
20 // TInt BodyTextSizeLimit <input>: Value of the body text limit |
|
21 // Default value is KMaxTInt |
|
22 // TInt AttachmentSizeLimit <input>: Value of the attachment size limit |
|
23 // Default value is KMaxTInt |
|
24 // TInt PartialMailSizeOptions <input>: Enumerated values defined in |
|
25 // TImImap4PartialDownloadMailSizeOptions |
|
26 // Default value is ENoSizeLimits |
|
27 // TMsvId DestinationFolder <input>: Value of the destination folder ID |
|
28 // TMsvId ServiceId <input>: Value of the Imap service Id to use |
|
29 // TImImap4GetMailInfo Imap4GetMailInfo <output-initiation>: Partial Download limits |
|
30 // [Action Description] |
|
31 // Sets the member variables of TImImap4GetPartialDownloadInfo, creates a package of |
|
32 // of the object. The package is stored in a Heap Buffer and provided as an output |
|
33 // of this Test Action. |
|
34 // [APIs Used] |
|
35 // None |
|
36 // __ACTION_INFO_END__ |
|
37 // |
|
38 // |
|
39 |
|
40 /** |
|
41 @file |
|
42 @internalTechnology |
|
43 */ |
|
44 |
|
45 // User inlcude |
|
46 #include <cemailaccounts.h> |
|
47 #include <iapprefs.h> |
|
48 |
|
49 #include <imapset.h> |
|
50 |
|
51 #include "CMtfTestActionSetImap4PartialDownloadLimits.h" |
|
52 #include "CMtfTestCase.h" |
|
53 #include "CMtfTestActionParameters.h" |
|
54 |
|
55 // EPOC inlcude |
|
56 |
|
57 |
|
58 /** |
|
59 NewL() |
|
60 Constructs a CMtfTestActionSetImap4PartialDownloadLimits object. |
|
61 Uses two phase construction and leaves nothing on the CleanupStack. |
|
62 @internalTechnology |
|
63 @param aTestCase Test Case to which this Test Action belongs |
|
64 @param aActionParameters Action parameters, must not be NULL |
|
65 @return Created object of type CMtfTestActionSetImap4PartialDownloadLimits |
|
66 @pre None |
|
67 @post CMtfTestActionSetImap4PartialDownloadLimits object is created |
|
68 */ |
|
69 CMtfTestAction* CMtfTestActionSetImap4PartialDownloadLimits::NewL(CMtfTestCase& aTestCase,CMtfTestActionParameters* aActionParameters) |
|
70 { |
|
71 CMtfTestActionSetImap4PartialDownloadLimits* self = new (ELeave) CMtfTestActionSetImap4PartialDownloadLimits(aTestCase); |
|
72 CleanupStack::PushL(self); |
|
73 self->ConstructL(aActionParameters); |
|
74 CleanupStack::Pop(self); |
|
75 return self; |
|
76 } |
|
77 |
|
78 /** |
|
79 CMtfTestActionSetImap4PartialDownloadLimits constructor |
|
80 Calls the base class' constructor |
|
81 @internalTechnology |
|
82 @param aTestCase Test Case to which this Test Action belongs |
|
83 @pre None |
|
84 @post None |
|
85 */ |
|
86 CMtfTestActionSetImap4PartialDownloadLimits::CMtfTestActionSetImap4PartialDownloadLimits(CMtfTestCase& aTestCase) |
|
87 : CMtfSynchronousTestAction(aTestCase) |
|
88 { |
|
89 } |
|
90 |
|
91 /** |
|
92 Function : ExecuteActionL |
|
93 Sets the members variables of TImImap4GetPartialMailInfo and packages the |
|
94 object into a modifiable buffer descriptor. The package is stored in a HBufC8 descriptor. |
|
95 The heap descriptor is then stored an output parameter of the Test Action. |
|
96 @internalTechnology |
|
97 @return None |
|
98 @pre None |
|
99 @post None |
|
100 @leave System wide errors |
|
101 */ |
|
102 |
|
103 |
|
104 |
|
105 void CMtfTestActionSetImap4PartialDownloadLimits::ExecuteActionL() |
|
106 { |
|
107 TestCase().INFO_PRINTF2(_L("Test Action %S start..."), &KTestActionSetImap4PartialDownloadLimits); |
|
108 |
|
109 TInt paramTotalSizeLimit = ObtainValueParameterL<TInt>(TestCase(), |
|
110 ActionParameters().Parameter(0),KMaxTInt); |
|
111 |
|
112 |
|
113 TInt paramBodyTextSizeLimit = ObtainValueParameterL<TInt>(TestCase(), |
|
114 ActionParameters().Parameter(1),KMaxTInt); |
|
115 |
|
116 |
|
117 TInt paramAttachmentSizeLimit = ObtainValueParameterL<TInt>(TestCase(), |
|
118 ActionParameters().Parameter(2),KMaxTInt); |
|
119 |
|
120 |
|
121 TImImap4PartialMailOptions paramPartialMailOptions = |
|
122 ObtainValueParameterL<TImImap4PartialMailOptions>(TestCase(), |
|
123 ActionParameters().Parameter(3),ENoSizeLimits); |
|
124 |
|
125 |
|
126 TMsvId paramDestinationFolder = ObtainValueParameterL<TMsvId>(TestCase(), |
|
127 ActionParameters().Parameter(4)); |
|
128 |
|
129 TMsvId paramServiceId = ObtainValueParameterL<TMsvId>(TestCase(), |
|
130 ActionParameters().Parameter(5)); |
|
131 |
|
132 //Store the partial donwload limit values |
|
133 TImImap4GetPartialMailInfo imap4GetPartialMailInfo; |
|
134 |
|
135 imap4GetPartialMailInfo.iBodyTextSizeLimit = paramBodyTextSizeLimit; |
|
136 imap4GetPartialMailInfo.iAttachmentSizeLimit = paramAttachmentSizeLimit; |
|
137 imap4GetPartialMailInfo.iTotalSizeLimit = paramTotalSizeLimit; |
|
138 imap4GetPartialMailInfo.iPartialMailOptions = paramPartialMailOptions; |
|
139 imap4GetPartialMailInfo.iDestinationFolder = paramDestinationFolder; |
|
140 |
|
141 // Get the Imap settings and save the partial download limits |
|
142 CEmailAccounts* emailAccounts = CEmailAccounts::NewLC(); |
|
143 CImImap4Settings* imapSettings = new(ELeave) CImImap4Settings(); |
|
144 CleanupStack::PushL(imapSettings); |
|
145 |
|
146 TImapAccount imapAccount; |
|
147 emailAccounts->GetImapAccountL(paramServiceId, imapAccount); |
|
148 emailAccounts->LoadImapSettingsL(imapAccount, *imapSettings); |
|
149 |
|
150 imapSettings->SetBodyTextSizeLimitL( imap4GetPartialMailInfo.iBodyTextSizeLimit ); |
|
151 imapSettings->SetAttachmentSizeLimitL( imap4GetPartialMailInfo.iAttachmentSizeLimit ); |
|
152 imapSettings->SetMaxEmailSize( imap4GetPartialMailInfo.iTotalSizeLimit ); |
|
153 imapSettings->SetPartialMailOptionsL( imap4GetPartialMailInfo.iPartialMailOptions ); |
|
154 |
|
155 emailAccounts->SaveImapSettingsL(imapAccount, *imapSettings); |
|
156 |
|
157 CleanupStack::PopAndDestroy(2, emailAccounts ); // imapSettings, emailAccounts |
|
158 |
|
159 // Provide TImImap4GetPartialMailInfo as output of the Test Action |
|
160 StoreParameterL<TImImap4GetPartialMailInfo>(TestCase(),imap4GetPartialMailInfo, |
|
161 ActionParameters().Parameter(6)); |
|
162 TestCase().INFO_PRINTF2(_L("Test Action %S completed."), &KTestActionSetImap4PartialDownloadLimits); |
|
163 TestCase().ActionCompletedL(*this); |
|
164 } |