author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 19 | 989d2f495d90 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: ?Description |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "delete_message.h" |
26 |
//#include <senduiconsts.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
27 |
#include <cmsvattachment.h> |
19 | 28 |
#include "messagingservice.h" |
29 |
#include "messageheader.h" |
|
30 |
||
31 |
// EXTERNAL DATA STRUCTURES |
|
32 |
//extern ?external_data; |
|
33 |
||
34 |
// EXTERNAL FUNCTION PROTOTYPES |
|
35 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
36 |
||
37 |
// CONSTANTS |
|
38 |
//const ?type ?constant_var = ?constant; |
|
39 |
||
40 |
// MACROS |
|
41 |
//#define ?macro ?macro_def |
|
42 |
||
43 |
// LOCAL CONSTANTS AND MACROS |
|
44 |
//const ?type ?constant_var = ?constant; |
|
45 |
//#define ?macro_name ?macro_def |
|
46 |
||
47 |
// MODULE DATA STRUCTURES |
|
48 |
//enum ?declaration |
|
49 |
//typedef ?declaration |
|
50 |
||
51 |
// LOCAL FUNCTION PROTOTYPES |
|
52 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
53 |
||
54 |
// FORWARD DECLARATIONS |
|
55 |
//class ?FORWARD_CLASSNAME; |
|
56 |
||
57 |
// ============================= LOCAL FUNCTIONS =============================== |
|
58 |
||
59 |
// ----------------------------------------------------------------------------- |
|
60 |
// ?function_name ?description. |
|
61 |
// ?description |
|
62 |
// Returns: ?value_1: ?description |
|
63 |
// ?value_n: ?description_line1 |
|
64 |
// ?description_line2 |
|
65 |
// ----------------------------------------------------------------------------- |
|
66 |
// |
|
67 |
/* |
|
68 |
?type ?function_name( |
|
69 |
?arg_type arg, // ?description |
|
70 |
?arg_type arg) // ?description |
|
71 |
{ |
|
72 |
||
73 |
?code // ?comment |
|
74 |
||
75 |
// ?comment |
|
76 |
?code |
|
77 |
} |
|
78 |
*/ |
|
79 |
||
80 |
// ============================ MEMBER FUNCTIONS =============================== |
|
81 |
||
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// Cdelete_message::Delete |
|
84 |
// Delete here all resources allocated and opened from test methods. |
|
85 |
// Called from destructor. |
|
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// |
|
88 |
void Cdelete_message::Delete() |
|
89 |
{ |
|
90 |
||
91 |
} |
|
92 |
||
93 |
// ----------------------------------------------------------------------------- |
|
94 |
// Cdelete_message::RunMethodL |
|
95 |
// Run specified method. Contains also table of test mothods and their names. |
|
96 |
// ----------------------------------------------------------------------------- |
|
97 |
// |
|
98 |
TInt Cdelete_message::RunMethodL( |
|
99 |
CStifItemParser& aItem ) |
|
100 |
{ |
|
101 |
||
102 |
static TStifFunctionInfo const KFunctions[] = |
|
103 |
{ |
|
104 |
// Copy this line for every implemented function. |
|
105 |
// First string is the function name used in TestScripter script file. |
|
106 |
// Second is the actual implementation member function. |
|
107 |
ENTRY( "test_1", Cdelete_message::Test1L ), |
|
108 |
||
109 |
}; |
|
110 |
||
111 |
const TInt count = sizeof( KFunctions ) / |
|
112 |
sizeof( TStifFunctionInfo ); |
|
113 |
||
114 |
return RunInternalL( KFunctions, count, aItem ); |
|
115 |
||
116 |
} |
|
117 |
||
118 |
// ----------------------------------------------------------------------------- |
|
119 |
// Cdelete_message::ExampleL |
|
120 |
// Example test method function. |
|
121 |
// (other items were commented in a header). |
|
122 |
// ----------------------------------------------------------------------------- |
|
123 |
// |
|
124 |
||
125 |
TInt Cdelete_message::messageid_func(CStifItemParser& aItem,TInt& id) |
|
126 |
{ |
|
127 |
TInt err = aItem.GetNextInt(id); |
|
128 |
if(err) |
|
129 |
{ |
|
130 |
//iLog->Log(_L("Failed to Get message id")); |
|
131 |
return KErrGeneral; |
|
132 |
}; |
|
133 |
return KErrNone; |
|
134 |
} |
|
135 |
||
136 |
TInt Cdelete_message::flag_func(CStifItemParser& aItem,TInt& flag) |
|
137 |
{ |
|
138 |
TInt err = aItem.GetNextInt(flag); |
|
139 |
if(err) |
|
140 |
{ |
|
141 |
//iLog->Log(_L("Failed to Get err code")); |
|
142 |
return KErrGeneral; |
|
143 |
}; |
|
144 |
return KErrNone; |
|
145 |
} |
|
146 |
||
147 |
||
148 |
TInt Cdelete_message::Test1L( CStifItemParser& aItem ) |
|
149 |
{ |
|
150 |
||
151 |
__UHEAP_MARK; |
|
152 |
||
153 |
TInt id,flag; |
|
154 |
TMsvId iD; |
|
155 |
||
156 |
CMessagingService* service = (CMessagingService*)CMessagingService::NewL(); |
|
157 |
CleanupStack::PushL(service); |
|
158 |
||
159 |
TInt err1 = messageid_func(aItem,id); // get message id from cfg |
|
160 |
if(err1) |
|
161 |
{ |
|
162 |
return KErrGeneral; |
|
163 |
} |
|
164 |
||
165 |
if(id == 1) |
|
166 |
{ |
|
167 |
CMessagingService* mservice = (CMessagingService*)CMessagingService::NewL(); |
|
168 |
CleanupStack::PushL(mservice); |
|
169 |
CFilterParamInfo* mfilter = CFilterParamInfo::NewL(); |
|
170 |
CMsvEntrySelection* marray = NULL ; |
|
171 |
TRAPD(err,mservice->GetIdListL(mfilter,0,NULL ,marray)); |
|
172 |
TInt index = 0; |
|
173 |
CMessageHeader* headerarr = NULL; |
|
174 |
mservice->GetNextHeaderL(mfilter, marray, index, NULL, headerarr); |
|
175 |
TMsvId message_id; |
|
176 |
headerarr->GetMessageId(message_id); |
|
177 |
iD = message_id; |
|
178 |
delete headerarr; |
|
179 |
delete marray; |
|
180 |
delete mfilter; |
|
181 |
CleanupStack::PopAndDestroy(mservice); |
|
182 |
} |
|
183 |
else |
|
184 |
{ |
|
185 |
iD = id; // message id specified |
|
186 |
} |
|
187 |
||
188 |
TRAPD(err,service->DeleteMessageL(iD,NULL)); |
|
189 |
||
190 |
||
191 |
if(err == 0) |
|
192 |
{ |
|
193 |
||
194 |
CFilterParamInfo* filter = CFilterParamInfo::NewL(); |
|
195 |
filter->SetMessageIdFilter(iD); |
|
196 |
||
197 |
CMsvEntrySelection* array = NULL ; |
|
198 |
TRAPD(error,service->GetIdListL(filter,0,NULL ,array)); |
|
199 |
||
200 |
TInt index = 0; |
|
201 |
CMessageHeader* headers = NULL; |
|
202 |
service->GetNextHeaderL(filter, array, index, NULL, headers); |
|
203 |
||
204 |
delete array; |
|
205 |
delete filter; |
|
206 |
CleanupStack::PopAndDestroy(service); |
|
207 |
||
208 |
if(headers == NULL) |
|
209 |
{ |
|
210 |
__UHEAP_MARKEND; |
|
211 |
return KErrNone; |
|
212 |
} |
|
213 |
else |
|
214 |
{ |
|
215 |
__UHEAP_MARKEND; |
|
216 |
return KErrGeneral; |
|
217 |
} |
|
218 |
} |
|
219 |
else |
|
220 |
{ |
|
221 |
err1 = flag_func(aItem,flag); // get err code from cfg |
|
222 |
if(err1) |
|
223 |
{ |
|
224 |
return KErrGeneral; |
|
225 |
} |
|
226 |
||
227 |
CleanupStack::PopAndDestroy(service); |
|
228 |
if(err == flag) |
|
229 |
{ |
|
230 |
__UHEAP_MARKEND; |
|
231 |
return KErrNone; |
|
232 |
} |
|
233 |
else |
|
234 |
{ |
|
235 |
__UHEAP_MARKEND; |
|
236 |
return KErrGeneral; |
|
237 |
} |
|
238 |
} |
|
239 |
||
240 |
} |
|
241 |
||
242 |
// ----------------------------------------------------------------------------- |
|
243 |
// Cdelete_message::?member_function |
|
244 |
// ?implementation_description |
|
245 |
// (other items were commented in a header). |
|
246 |
// ----------------------------------------------------------------------------- |
|
247 |
// |
|
248 |
/* |
|
249 |
TInt Cdelete_message::?member_function( |
|
250 |
CItemParser& aItem ) |
|
251 |
{ |
|
252 |
||
253 |
?code |
|
254 |
||
255 |
} |
|
256 |
*/ |
|
257 |
||
258 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
259 |
// None |
|
260 |
||
261 |
// End of File |