|
1 // Copyright (c) 2006-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 the License "Symbian Foundation License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // [TestStep Name] |
|
15 // DeleteAllPopChildren |
|
16 // [Paramaters] |
|
17 // PopAccountName : Name of the Pop Account |
|
18 // [Action Description] |
|
19 // Deletes all children entries for the remote Pop account |
|
20 // [APIs Used] |
|
21 // |
|
22 // |
|
23 |
|
24 |
|
25 |
|
26 /** |
|
27 @file |
|
28 */ |
|
29 |
|
30 |
|
31 //User Includes |
|
32 #include "T_DeleteAllPopChildren.h" |
|
33 #include <t_utilsdeleteallchildren.h> |
|
34 #include <t_utilscentralrepository.h> |
|
35 #include "T_MsgSharedDataPop.h" |
|
36 |
|
37 |
|
38 //epoc includes |
|
39 #include <barsc.h> |
|
40 #include <bautils.h> |
|
41 #include <msgs.rsg> |
|
42 |
|
43 |
|
44 // Literals Used |
|
45 _LIT(KPopAccountName,"PopAccountName"); |
|
46 _LIT(KBlockDelete, "BlockDelete"); |
|
47 |
|
48 |
|
49 /** |
|
50 CT_MsgDeleteAllPopChildren() |
|
51 Sets the teststep name to KDeleteAllPopChildren |
|
52 |
|
53 @param aSharedDataPOP |
|
54 Data shared across the POP test steps. Ex. Session |
|
55 */ |
|
56 CT_MsgDeleteAllPopChildren::CT_MsgDeleteAllPopChildren(CT_MsgSharedDataPop& aSharedDataPOP) |
|
57 : CT_MsgAsyncStepPOP(aSharedDataPOP) |
|
58 , iUtil(NULL) |
|
59 { |
|
60 SetTestStepName(KDeleteAllPopChildren); |
|
61 } |
|
62 |
|
63 |
|
64 /** |
|
65 NewL() |
|
66 Allocates and creates a new CT_MsgDeleteAllPopChildren object |
|
67 |
|
68 @param aSharedDataPOP |
|
69 Data shared across the POP test steps. Ex. Session |
|
70 |
|
71 @return |
|
72 Returns pointer to an object of CT_MsgDeleteAllPopChildren |
|
73 */ |
|
74 CT_MsgDeleteAllPopChildren* CT_MsgDeleteAllPopChildren::NewL(CT_MsgSharedDataPop& aSharedDataPOP) |
|
75 { |
|
76 CT_MsgDeleteAllPopChildren* self = new(ELeave) CT_MsgDeleteAllPopChildren(aSharedDataPOP); |
|
77 CleanupStack::PushL(self); |
|
78 self->ConstructL(); // Call CT_AsyncStep::ConstructL() |
|
79 CleanupStack::Pop(self); |
|
80 return self; |
|
81 } |
|
82 |
|
83 |
|
84 /** |
|
85 ~CT_MsgDeleteAllPopChildren() |
|
86 Destructor |
|
87 */ |
|
88 CT_MsgDeleteAllPopChildren::~CT_MsgDeleteAllPopChildren() |
|
89 { |
|
90 if(iUtil!=NULL) |
|
91 { |
|
92 delete iUtil; |
|
93 iUtil=NULL; |
|
94 } |
|
95 } |
|
96 |
|
97 |
|
98 /** |
|
99 ProgressL() |
|
100 |
|
101 @param |
|
102 */ |
|
103 void CT_MsgDeleteAllPopChildren::ProgressL(TBool bFinal) |
|
104 { |
|
105 // TODO |
|
106 if (bFinal) |
|
107 { |
|
108 // Display final progress iUtil |
|
109 } |
|
110 else |
|
111 { |
|
112 // Display current progress iUtil |
|
113 } |
|
114 } |
|
115 |
|
116 |
|
117 /** |
|
118 CancelStep() |
|
119 |
|
120 @param |
|
121 */ |
|
122 void CT_MsgDeleteAllPopChildren::CancelStep() |
|
123 { |
|
124 // TODO cancel iUtil |
|
125 } |
|
126 |
|
127 |
|
128 /** |
|
129 doTestStepL() |
|
130 Reads the Pop account name from the ini file. It obtains a selection of the |
|
131 enries under the account and calls theT_UtilsDeleteAllChildren to delete them |
|
132 |
|
133 @return |
|
134 Returns the test step result |
|
135 */ |
|
136 TVerdict CT_MsgDeleteAllPopChildren::doTestStepL() |
|
137 { |
|
138 INFO_PRINTF1(_L("Test Step : DeleteAllChildren ")); |
|
139 // Read the POP account name from the ini file |
|
140 TPtrC popAccountName; |
|
141 if(!GetStringFromConfig(ConfigSection(), KPopAccountName, popAccountName)) |
|
142 { |
|
143 ERR_PRINTF1(_L("Pop Account Name is not specified")); |
|
144 SetTestStepResult(EFail); |
|
145 } |
|
146 else |
|
147 { |
|
148 // Retrieving the Pop service Id for the given Pop account |
|
149 TMsvId popServiceId = CT_MsgUtilsCentralRepository::GetPopServiceIdL((TDes&)popAccountName); |
|
150 INFO_PRINTF2(_L("Pop service id is %d"),popServiceId); |
|
151 if(popServiceId == KMsvNullIndexEntryId) |
|
152 { |
|
153 ERR_PRINTF1(_L("Invalid POP account name specified")); |
|
154 SetTestStepResult(EFail); |
|
155 } |
|
156 else |
|
157 { |
|
158 if(iUtil==NULL) |
|
159 { |
|
160 iUtil = new (ELeave) CT_MsgUtilsDeleteAllChildren(iSharedDataPOP.iSession,popServiceId); |
|
161 } |
|
162 |
|
163 CT_MsgActive& active=Active(); |
|
164 // Deletes all the entries under the remote folder |
|
165 |
|
166 TBool blockDelete = EFalse; |
|
167 GetBoolFromConfig(ConfigSection(), KBlockDelete, blockDelete); |
|
168 if (blockDelete) |
|
169 { |
|
170 INFO_PRINTF1(_L("Using block delete")); |
|
171 } |
|
172 |
|
173 iUtil->StartL(blockDelete, active.iStatus); |
|
174 active.Activate(); |
|
175 CActiveScheduler::Start(); |
|
176 delete iUtil; |
|
177 iUtil=NULL; |
|
178 |
|
179 TInt err = active.Result(); |
|
180 if (err != KErrNone) |
|
181 { |
|
182 SetTestStepResult(EFail); |
|
183 SetTestStepError(err); |
|
184 } |
|
185 } |
|
186 } |
|
187 return TestStepResult(); |
|
188 } |