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 |
|
26 |
#include "calendarheader.h" |
|
27 |
#include "calendarservice.h" |
|
28 |
#include "entryattributes.h" |
|
29 |
#include <caluser.h> |
|
30 |
#include <calalarm.h> |
|
31 |
#include <calrrule.h> |
|
32 |
#include "calendarconstants.h" |
|
33 |
#include "tcalendaraddtest.h" |
|
34 |
#include "teststartconsolealarmserver.h" |
|
35 |
_LIT(KTestCal1File ,"C:updatecalfile1"); |
|
36 |
_LIT(KTestCal2File ,"C:updatecalfile2"); |
|
37 |
_LIT(KString1 ,"New reminder"); |
|
38 |
||
39 |
// ============================ MEMBER FUNCTIONS =============================== |
|
40 |
||
41 |
// ----------------------------------------------------------------------------- |
|
42 |
// CTChangeStatusTest::Delete |
|
43 |
// Delete here all resources allocated and opened from test methods. |
|
44 |
// Called from destructor. |
|
45 |
// ----------------------------------------------------------------------------- |
|
46 |
// |
|
47 |
void CTCalendarAddTest::Delete() |
|
48 |
{ |
|
49 |
||
50 |
} |
|
51 |
||
52 |
// ----------------------------------------------------------------------------- |
|
53 |
// CTChangeStatusTest::RunMethodL |
|
54 |
// Run specified method. Contains also table of test mothods and their names. |
|
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
TInt CTCalendarAddTest::RunMethodL( |
|
58 |
CStifItemParser& aItem ) |
|
59 |
{ |
|
60 |
||
61 |
static TStifFunctionInfo const KFunctions[] = |
|
62 |
{ |
|
63 |
// Copy this line for every implemented function. |
|
64 |
// First string is the function name used in TestScripter script file. |
|
65 |
// Second is the actual implementation member function. |
|
66 |
||
67 |
ENTRY( "AddAppointmentEntry", CTCalendarAddTest::AddAppointmentEntryL), |
|
68 |
ENTRY( "AddTodoEntry", CTCalendarAddTest::AddTodoEntryL), |
|
69 |
ENTRY( "AddAnniversary", CTCalendarAddTest::AddAnniversaryL), |
|
70 |
ENTRY( "AddDayEvent", CTCalendarAddTest::AddDayEventL), |
|
71 |
ENTRY( "AddReminder", CTCalendarAddTest::AddReminderL), |
|
72 |
ENTRY( "AddDailyAppointmentEntry", CTCalendarAddTest::AddDailyAppointmentEntryL), |
|
73 |
ENTRY( "AddWeeklyAppointmentEntry", CTCalendarAddTest::AddWeeklyAppointmentEntryL), |
|
74 |
ENTRY( "AddMonthlyAppointmentEntry", CTCalendarAddTest::AddMonthlyAppointmentEntryL), |
|
75 |
//ENTRY( "AddYearlyAppointmentEntry", CTCalendarAddTest::AddYearlyAppointmentEntryL), |
|
76 |
ENTRY( "AddAppointmentEntryWithAttendees", CTCalendarAddTest::AddAppointmentEntryWithAttendeesL), |
|
77 |
}; |
|
78 |
||
79 |
const TInt count = sizeof( KFunctions ) / |
|
80 |
sizeof( TStifFunctionInfo ); |
|
81 |
||
82 |
return RunInternalL( KFunctions, count, aItem ); |
|
83 |
||
84 |
} |
|
85 |
/* |
|
86 |
1. Add entries of all types |
|
87 |
2. Add repeating appt |
|
88 |
3. Add repeating appt with exception date and repeat date |
|
89 |
||
90 |
*/ |
|
91 |
||
92 |
||
93 |
TInt CTCalendarAddTest::AddDailyAppointmentEntryL(CStifItemParser &aItem ) |
|
94 |
{ |
|
95 |
/*__UHEAP_MARK; |
|
96 |
||
97 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
98 |
||
99 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
100 |
entryObj->SetLocationL(_L("Hara")); |
|
101 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
102 |
||
103 |
entryObj->SetMethodL(KMethodNone); |
|
104 |
//CleanupStack::PopAndDestroy(organizer); |
|
105 |
//CCalUser* owner = CCalUser::NewL(_L("")); |
|
106 |
||
107 |
entryObj->SetPriority(5); |
|
108 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
109 |
||
110 |
TTime stTime(TDateTime(2007, ESeptember, 15, 9, 0, 0, 0)); |
|
111 |
entryObj->SetStartTimeL(stTime); |
|
112 |
||
113 |
TTime endTime(TDateTime(2007, ESeptember, 15, 9, 30, 0, 0)); |
|
114 |
entryObj->SetEndTimeL(endTime); |
|
115 |
||
116 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
117 |
TTime alarmTime(TDateTime(2007,ESeptember, 15, 7, 30, 0, 0)); |
|
118 |
//entryObj->SetAlarm(alarmTime); |
|
119 |
delete alarm; |
|
120 |
||
121 |
TCalRRule rrule(TCalRRule::EMonthly); |
|
122 |
rrule.SetDtStart(stTime); |
|
123 |
TCalTime uTime; |
|
124 |
uTime.SetTimeLocalL(TTime(TDateTime(2007, EDecember, 30, 0, 0, 0, 0))); |
|
125 |
rrule.SetUntil(uTime); |
|
126 |
||
127 |
TCalRRule::TDayOfMonth day1(EMonday,1); |
|
128 |
TCalRRule::TDayOfMonth day2(EWednesday,3); |
|
129 |
||
130 |
||
131 |
||
132 |
RArray<TCalRRule::TDayOfMonth> monthDays; |
|
133 |
monthDays.Append(day1); |
|
134 |
monthDays.Append(day2); |
|
135 |
rrule.SetByDay(monthDays); |
|
136 |
||
137 |
entryObj->SetRepeatRule(rrule); |
|
138 |
monthDays.Close(); |
|
139 |
||
140 |
CRepeatInfo* rrule = CRepeatInfo::NewL(1); |
|
141 |
rrule->SetStartTimeL(stTime); |
|
142 |
TTime uTime(TDateTime(2007, ESeptember, 29, 0, 0, 0, 0)); |
|
143 |
rrule->SetUntilTimeL(uTime); |
|
144 |
rrule->SetWeekStart(2); |
|
145 |
entryObj->SetRepeatRule(rrule); |
|
146 |
delete rrule; |
|
147 |
||
148 |
TTime exDate(TDateTime(2007, ESeptember, 20, 0, 0, 0, 0)); |
|
149 |
entryObj->AddExceptionDateL(exDate); |
|
150 |
||
151 |
TTime rDate(TDateTime(2007, EOctober, 0, 9, 0, 0, 0)); |
|
152 |
entryObj->AddRepeatDateL(exDate); |
|
153 |
||
154 |
||
155 |
CCalendarService* service; |
|
156 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
157 |
||
158 |
TUIDSet* uids = NULL; |
|
159 |
||
160 |
TRAPD( errno, service->AddL(KNullDesC,entryObj,uids) ); |
|
161 |
||
162 |
delete uids; |
|
163 |
delete entryObj; |
|
164 |
delete service; |
|
165 |
__UHEAP_MARKEND; |
|
166 |
return errno;*/ |
|
167 |
||
168 |
||
169 |
__UHEAP_MARK; |
|
170 |
||
171 |
CCalendarService* service = CCalendarService::NewL(); |
|
172 |
||
173 |
||
174 |
||
175 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
176 |
||
177 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
178 |
entryObj->SetLocationL(_L("Hara")); |
|
179 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
180 |
||
181 |
entryObj->SetMethodL(KMethodNone); |
|
182 |
//CleanupStack::PopAndDestroy(organizer); |
|
183 |
//CCalUser* owner = CCalUser::NewL(_L("")); |
|
184 |
||
185 |
entryObj->SetPriority(5); |
|
186 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
187 |
||
188 |
TTime stTime(TDateTime(2007, EJune, 15, 9, 0, 0, 0)); |
|
189 |
entryObj->SetStartTimeL(stTime); |
|
190 |
||
191 |
TTime endTime(TDateTime(2007, EJune, 15, 9, 30, 0, 0)); |
|
192 |
entryObj->SetEndTimeL(endTime); |
|
193 |
||
194 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
195 |
TTime alarmTime(TDateTime(2007,EJune, 15, 7, 30, 0, 0)); |
|
196 |
//entryObj->SetAlarm(alarmTime); |
|
197 |
delete alarm; |
|
198 |
||
199 |
/*CRepeatInfo* rrule = CRepeatInfo::NewL(2); |
|
200 |
rrule->SetStartTimeL(stTime); |
|
201 |
TTime uTime(TDateTime(2007, EJuly, 29, 0, 0, 0, 0));*/ |
|
202 |
||
203 |
CRepeatInfo* rrule = CRepeatInfo::NewL(1); |
|
204 |
rrule->SetStartTimeL(stTime); |
|
205 |
TTime uTime(TDateTime(2007, EJune, 29, 0, 0, 0, 0)); |
|
206 |
||
207 |
rrule->SetUntilTimeL(uTime); |
|
208 |
RArray<TDay> days; |
|
209 |
days.Append(ESaturday); |
|
210 |
//days.Append(EFriday); |
|
211 |
rrule->SetDaysInWeek(days); |
|
212 |
days.Close(); |
|
213 |
||
214 |
entryObj->SetRepeatRule(rrule); |
|
215 |
delete rrule; |
|
216 |
||
217 |
TUIDSet* uids = NULL; |
|
218 |
||
219 |
TRAPD( errno, service->AddL(KNullDesC,entryObj,uids) ); |
|
220 |
||
221 |
delete uids; |
|
222 |
delete entryObj; |
|
223 |
delete service; |
|
224 |
__UHEAP_MARKEND; |
|
225 |
return errno; |
|
226 |
||
227 |
||
228 |
} |
|
229 |
||
230 |
TInt CTCalendarAddTest::AddWeeklyAppointmentEntryL(CStifItemParser &aItem ) |
|
231 |
{ |
|
232 |
/*__UHEAP_MARK; |
|
233 |
||
234 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
235 |
||
236 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
237 |
entryObj->SetLocationL(_L("Hara")); |
|
238 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
239 |
||
240 |
entryObj->SetMethodL(KMethodNone); |
|
241 |
//CleanupStack::PopAndDestroy(organizer); |
|
242 |
//CCalUser* owner = CCalUser::NewL(_L("")); |
|
243 |
||
244 |
entryObj->SetPriority(5); |
|
245 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
246 |
||
247 |
TTime stTime(TDateTime(2007, EJune, 15, 9, 0, 0, 0)); |
|
248 |
entryObj->SetStartTimeL(stTime); |
|
249 |
||
250 |
TTime endTime(TDateTime(2007, EJune, 15, 9, 30, 0, 0)); |
|
251 |
entryObj->SetEndTimeL(endTime); |
|
252 |
||
253 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
254 |
TTime alarmTime(TDateTime(2007,EJune, 15, 7, 30, 0, 0)); |
|
255 |
//entryObj->SetAlarm(alarmTime); |
|
256 |
delete alarm; |
|
257 |
||
258 |
CRepeatInfo* rrule = CRepeatInfo::NewL(2); |
|
259 |
rrule->SetStartTimeL(stTime); |
|
260 |
TTime uTime(TDateTime(2007, EJuly, 29, 0, 0, 0, 0)); |
|
261 |
rrule->SetUntilTimeL(uTime); |
|
262 |
RArray<TDay> days; |
|
263 |
days.Append(EWednesday); |
|
264 |
days.Append(EFriday); |
|
265 |
rrule->SetDaysInWeek(days); |
|
266 |
days.Close(); |
|
267 |
||
268 |
entryObj->SetRepeatRule(rrule); |
|
269 |
delete rrule; |
|
270 |
||
271 |
CCalendarService* service; |
|
272 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
273 |
||
274 |
TUIDSet* uids = NULL; |
|
275 |
||
276 |
TRAPD( errno, service->AddL(KNullDesC,entryObj,uids) ); |
|
277 |
||
278 |
delete uids; |
|
279 |
delete entryObj; |
|
280 |
delete service; |
|
281 |
__UHEAP_MARKEND; |
|
282 |
return errno;*/ |
|
283 |
||
284 |
TInt result = KErrNone; |
|
285 |
||
286 |
__UHEAP_MARK; |
|
287 |
||
288 |
CCalendarService* service = CCalendarService::NewL(); |
|
289 |
||
290 |
RemoveCalendarFile( service, KTestCal1File ); |
|
291 |
AddCalendarFile( service, KTestCal1File ); |
|
292 |
||
293 |
RPointerArray<TUIDSet> arruids(5); |
|
294 |
||
295 |
TUIDSet* uids = NULL; |
|
296 |
||
297 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
298 |
||
299 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
300 |
entryObj->SetLocationL(_L("Hara")); |
|
301 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
302 |
||
303 |
entryObj->SetMethodL(KMethodNone); |
|
304 |
//CleanupStack::PopAndDestroy(organizer); |
|
305 |
//CCalUser* owner = CCalUser::NewL(_L("")); |
|
306 |
||
307 |
entryObj->SetPriority(5); |
|
308 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
309 |
||
310 |
TTime stTime(TDateTime(2007, EJune, 15, 9, 0, 0, 0)); |
|
311 |
entryObj->SetStartTimeL(stTime); |
|
312 |
||
313 |
TTime endTime(TDateTime(2007, EJune, 15, 9, 30, 0, 0)); |
|
314 |
entryObj->SetEndTimeL(endTime); |
|
315 |
||
316 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
317 |
TTime alarmTime(TDateTime(2007,EJune, 15, 7, 30, 0, 0)); |
|
318 |
//entryObj->SetAlarm(alarmTime); |
|
319 |
delete alarm; |
|
320 |
||
321 |
CRepeatInfo* rrule = CRepeatInfo::NewL(2); |
|
322 |
rrule->SetStartTimeL(stTime); |
|
323 |
TTime uTime(TDateTime(2007, EJuly, 29, 0, 0, 0, 0)); |
|
324 |
rrule->SetUntilTimeL(uTime); |
|
325 |
RArray<TDay> days; |
|
326 |
days.Append(EWednesday); |
|
327 |
days.Append(EFriday); |
|
328 |
rrule->SetDaysInWeek(days); |
|
329 |
days.Close(); |
|
330 |
||
331 |
entryObj->SetRepeatRule(rrule); |
|
332 |
delete rrule; |
|
333 |
||
334 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
335 |
||
336 |
if(errno == KErrNone && uids) |
|
337 |
{ |
|
338 |
arruids.Append(uids); |
|
339 |
uids = NULL; |
|
340 |
} |
|
341 |
||
342 |
if ( arruids.Count() > 0 ) |
|
343 |
{ |
|
344 |
RPointerArray<CCalEntry> entryArray; |
|
345 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
346 |
if( entryArray.Count() == 1 ) |
|
347 |
{ |
|
348 |
TCalRRule rRule; |
|
349 |
entryArray[0]->GetRRuleL( rRule ); |
|
350 |
TCalTime utTime; |
|
351 |
utTime.SetTimeUtcL(TTime(TDateTime(2007, EJuly, 26, 9, 0, 0, 0))); |
|
352 |
||
353 |
if( !( entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting")) == 0 |
|
354 |
&&rRule.Type() == TCalRRule::EWeekly ) ) |
|
355 |
{ |
|
356 |
result = KErrGeneral; |
|
357 |
} |
|
358 |
} |
|
359 |
||
360 |
else |
|
361 |
{ |
|
362 |
result = KErrGeneral; |
|
363 |
} |
|
364 |
entryArray.ResetAndDestroy(); |
|
365 |
arruids.ResetAndDestroy(); |
|
366 |
delete entryObj; |
|
367 |
} |
|
368 |
else |
|
369 |
result = KErrGeneral; |
|
370 |
||
371 |
RemoveCalendarFile( service, KTestCal1File ); |
|
372 |
||
373 |
delete service; |
|
374 |
||
375 |
__UHEAP_MARKEND; |
|
376 |
||
377 |
return result; |
|
378 |
||
379 |
||
380 |
} |
|
381 |
TInt CTCalendarAddTest::AddMonthlyAppointmentEntryL(CStifItemParser &aItem ) |
|
382 |
{ |
|
383 |
/*__UHEAP_MARK; |
|
384 |
||
385 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
386 |
||
387 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
388 |
entryObj->SetLocationL(_L("Hara")); |
|
389 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
390 |
||
391 |
entryObj->SetMethodL(KMethodNone); |
|
392 |
||
393 |
entryObj->SetPriority(5); |
|
394 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
395 |
||
396 |
TTime stTime(TDateTime(2007, ESeptember, 15, 9, 0, 0, 0)); |
|
397 |
entryObj->SetStartTimeL(stTime); |
|
398 |
||
399 |
TTime endTime(TDateTime(2007, ESeptember, 15, 9, 30, 0, 0)); |
|
400 |
entryObj->SetEndTimeL(endTime); |
|
401 |
||
402 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
403 |
TTime alarmTime(TDateTime(2007,ESeptember, 15, 7, 30, 0, 0)); |
|
404 |
//entryObj->SetAlarm(alarmTime); |
|
405 |
delete alarm; |
|
406 |
||
407 |
CRepeatInfo* rrule = CRepeatInfo::NewL(3); |
|
408 |
rrule->SetStartTimeL(stTime); |
|
409 |
TTime uTime(TDateTime(2007, EDecember, 30, 0, 0, 0, 0)); |
|
410 |
rrule->SetUntilTimeL(uTime); |
|
411 |
TCalRRule::TDayOfMonth day1(EMonday,1); |
|
412 |
TCalRRule::TDayOfMonth day2(EWednesday,3); |
|
413 |
RArray<TCalRRule::TDayOfMonth> monthDays; |
|
414 |
monthDays.Append(day1); |
|
415 |
monthDays.Append(day2); |
|
416 |
rrule->SetMonthDays(monthDays); |
|
417 |
monthDays.Close(); |
|
418 |
||
419 |
entryObj->SetRepeatRule(rrule); |
|
420 |
delete rrule; |
|
421 |
||
422 |
CCalendarService* service; |
|
423 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
424 |
||
425 |
TUIDSet* uids = NULL; |
|
426 |
||
427 |
TRAPD( errno, service->AddL(KNullDesC,entryObj,uids) ); |
|
428 |
||
429 |
delete uids; |
|
430 |
delete entryObj; |
|
431 |
delete service; |
|
432 |
__UHEAP_MARKEND; |
|
433 |
return errno;*/ |
|
434 |
TInt result = KErrNone; |
|
435 |
||
436 |
__UHEAP_MARK; |
|
437 |
||
438 |
CCalendarService* service = CCalendarService::NewL(); |
|
439 |
||
440 |
RemoveCalendarFile( service, KTestCal1File ); |
|
441 |
AddCalendarFile( service, KTestCal1File ); |
|
442 |
||
443 |
RPointerArray<TUIDSet> arruids(5); |
|
444 |
||
445 |
TUIDSet* uids = NULL; |
|
446 |
||
447 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
448 |
||
449 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
450 |
entryObj->SetLocationL(_L("Hara")); |
|
451 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
452 |
||
453 |
entryObj->SetMethodL(KMethodNone); |
|
454 |
||
455 |
entryObj->SetPriority(5); |
|
456 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
457 |
||
458 |
TTime stTime(TDateTime(2007, ESeptember, 15, 9, 0, 0, 0)); |
|
459 |
entryObj->SetStartTimeL(stTime); |
|
460 |
||
461 |
TTime endTime(TDateTime(2007, ESeptember, 15, 9, 30, 0, 0)); |
|
462 |
entryObj->SetEndTimeL(endTime); |
|
463 |
||
464 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
465 |
TTime alarmTime(TDateTime(2007,ESeptember, 15, 7, 30, 0, 0)); |
|
466 |
//entryObj->SetAlarm(alarmTime); |
|
467 |
delete alarm; |
|
468 |
||
469 |
CRepeatInfo* rrule = CRepeatInfo::NewL(3); |
|
470 |
rrule->SetStartTimeL(stTime); |
|
471 |
TTime uTime(TDateTime(2007, EDecember, 30, 0, 0, 0, 0)); |
|
472 |
rrule->SetUntilTimeL(uTime); |
|
473 |
TCalRRule::TDayOfMonth day1(EMonday,1); |
|
474 |
TCalRRule::TDayOfMonth day2(EWednesday,3); |
|
475 |
RArray<TCalRRule::TDayOfMonth> monthDays; |
|
476 |
monthDays.Append(day1); |
|
477 |
monthDays.Append(day2); |
|
478 |
rrule->SetMonthDays(monthDays); |
|
479 |
monthDays.Close(); |
|
480 |
||
481 |
entryObj->SetRepeatRule(rrule); |
|
482 |
delete rrule; |
|
483 |
||
484 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
485 |
||
486 |
if(errno == KErrNone && uids) |
|
487 |
{ |
|
488 |
arruids.Append(uids); |
|
489 |
uids = NULL; |
|
490 |
} |
|
491 |
||
492 |
if ( arruids.Count() > 0 ) |
|
493 |
{ |
|
494 |
RPointerArray<CCalEntry> entryArray; |
|
495 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
496 |
if( entryArray.Count() == 1 ) |
|
497 |
{ |
|
498 |
TCalRRule rRule; |
|
499 |
entryArray[0]->GetRRuleL( rRule ); |
|
500 |
TCalTime utTime; |
|
501 |
utTime.SetTimeUtcL(TTime(TDateTime(2007, EDecember, 18, 9, 0, 0, 0))); |
|
502 |
||
503 |
if( !( entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting")) == 0 |
|
504 |
&&rRule.Type() == TCalRRule::EMonthly ) ) |
|
505 |
{ |
|
506 |
result = KErrGeneral; |
|
507 |
} |
|
508 |
} |
|
509 |
||
510 |
else |
|
511 |
{ |
|
512 |
result = KErrGeneral; |
|
513 |
} |
|
514 |
entryArray.ResetAndDestroy(); |
|
515 |
arruids.ResetAndDestroy(); |
|
516 |
delete entryObj; |
|
517 |
} |
|
518 |
else |
|
519 |
result = KErrGeneral; |
|
520 |
||
521 |
RemoveCalendarFile( service, KTestCal1File ); |
|
522 |
||
523 |
delete service; |
|
524 |
||
525 |
__UHEAP_MARKEND; |
|
526 |
||
527 |
return result; |
|
528 |
||
529 |
||
530 |
} |
|
531 |
||
532 |
TInt CTCalendarAddTest::AddTodoEntryL(CStifItemParser &aItem ) |
|
533 |
{ |
|
534 |
/*__UHEAP_MARK; |
|
535 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryTodo ); |
|
536 |
||
537 |
entryObj->SetDescriptionL(_L("New todo entry created")); |
|
538 |
entryObj->SetSummaryL(_L("TODO Entry")); |
|
539 |
||
540 |
TTime endTime(TDateTime(2007, EAugust, 21, 0, 0, 0, 0)); |
|
541 |
entryObj->SetEndTimeL(endTime); |
|
542 |
entryObj->SetReplicationL(KReplOpen); |
|
543 |
entryObj->SetPriority(0); |
|
544 |
||
545 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
546 |
TPtrC ptr(defaultfile); |
|
547 |
||
548 |
CCalendarService* service; |
|
549 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
550 |
||
551 |
TUIDSet* uids = NULL; |
|
552 |
||
553 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
554 |
||
555 |
delete uids; |
|
556 |
delete entryObj; |
|
557 |
delete service; |
|
558 |
__UHEAP_MARKEND; |
|
559 |
return errno;*/ |
|
560 |
||
561 |
TInt result = KErrNone; |
|
562 |
||
563 |
__UHEAP_MARK; |
|
564 |
||
565 |
CCalendarService* service = CCalendarService::NewL(); |
|
566 |
||
567 |
RemoveCalendarFile( service, KTestCal1File ); |
|
568 |
AddCalendarFile( service, KTestCal1File ); |
|
569 |
||
570 |
RPointerArray<TUIDSet> arruids(5); |
|
571 |
||
572 |
TUIDSet* uids = NULL; |
|
573 |
||
574 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryTodo ); |
|
575 |
||
576 |
entryObj->SetDescriptionL(_L("New todo entry created")); |
|
577 |
entryObj->SetSummaryL(_L("TODO Entry")); |
|
578 |
||
579 |
TTime endTime(TDateTime(2007, EAugust, 21, 0, 0, 0, 0)); |
|
580 |
entryObj->SetEndTimeL(endTime); |
|
581 |
entryObj->SetReplicationL(KReplOpen); |
|
582 |
entryObj->SetPriority(0); |
|
583 |
entryObj->SetReplicationL(KReplPrivate); |
|
584 |
||
585 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
586 |
||
587 |
if(errno == KErrNone && uids) |
|
588 |
{ |
|
589 |
arruids.Append(uids); |
|
590 |
uids = NULL; |
|
591 |
} |
|
592 |
||
593 |
if ( arruids.Count() > 0 ) |
|
594 |
{ |
|
595 |
RPointerArray<CCalEntry> entryArray; |
|
596 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
597 |
if( entryArray.Count() == 1 ) |
|
598 |
{ |
|
599 |
if( !( entryArray[0]->EndTimeL().TimeUtcL() == endTime && entryArray[0]->DescriptionL().CompareF(_L("New todo entry created")) == 0 |
|
600 |
&& entryArray[0]->SummaryL().CompareF(_L("TODO Entry")) == 0 ) ) |
|
601 |
{ |
|
602 |
result = KErrGeneral; |
|
603 |
} |
|
604 |
} |
|
605 |
||
606 |
else |
|
607 |
{ |
|
608 |
result = KErrGeneral; |
|
609 |
} |
|
610 |
entryArray.ResetAndDestroy(); |
|
611 |
arruids.ResetAndDestroy(); |
|
612 |
delete entryObj; |
|
613 |
} |
|
614 |
else |
|
615 |
result = KErrGeneral; |
|
616 |
||
617 |
RemoveCalendarFile( service, KTestCal1File ); |
|
618 |
||
619 |
delete service; |
|
620 |
||
621 |
__UHEAP_MARKEND; |
|
622 |
||
623 |
return result; |
|
624 |
||
625 |
||
626 |
} |
|
627 |
||
628 |
TInt CTCalendarAddTest::AddAppointmentEntryL(CStifItemParser &aItem ) |
|
629 |
{ |
|
630 |
/*__UHEAP_MARK; |
|
631 |
||
632 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
633 |
||
634 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
635 |
entryObj->SetLocationL(_L("Hara")); |
|
636 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
637 |
||
638 |
entryObj->SetMethodL(KMethodNone); |
|
639 |
||
640 |
entryObj->SetPriority(5); |
|
641 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
642 |
||
643 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
644 |
entryObj->SetStartTimeL(stTime); |
|
645 |
||
646 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
647 |
entryObj->SetEndTimeL(endTime); |
|
648 |
||
649 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
650 |
TTime alarmTime(TDateTime(2007,EAugust, 8, 7, 30, 0, 0)); |
|
651 |
//entryObj->SetAlarm(alarmTime); |
|
652 |
delete alarm; |
|
653 |
||
654 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
655 |
TPtrC ptr(defaultfile); |
|
656 |
||
657 |
CCalendarService* service; |
|
658 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
659 |
||
660 |
TUIDSet* uids = NULL; |
|
661 |
||
662 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
663 |
||
664 |
delete uids; |
|
665 |
delete entryObj; |
|
666 |
delete service; |
|
667 |
__UHEAP_MARKEND; |
|
668 |
return errno;*/ |
|
669 |
TInt result = KErrNone; |
|
670 |
||
671 |
__UHEAP_MARK; |
|
672 |
||
673 |
CCalendarService* service = CCalendarService::NewL(); |
|
674 |
||
675 |
RemoveCalendarFile( service, KTestCal1File ); |
|
676 |
AddCalendarFile( service, KTestCal1File ); |
|
677 |
||
678 |
RPointerArray<TUIDSet> arruids(5); |
|
679 |
||
680 |
TUIDSet* uids = NULL; |
|
681 |
||
682 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
683 |
||
684 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
685 |
entryObj->SetLocationL(_L("Hara")); |
|
686 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
687 |
||
688 |
entryObj->SetMethodL(KMethodNone); |
|
689 |
||
690 |
entryObj->SetPriority(5); |
|
691 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
692 |
||
693 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
694 |
entryObj->SetStartTimeL(stTime); |
|
695 |
||
696 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
697 |
entryObj->SetEndTimeL(endTime); |
|
698 |
||
699 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
700 |
TTime alarmTime(TDateTime(2007,EAugust, 8, 7, 30, 0, 0)); |
|
701 |
//entryObj->SetAlarm(alarmTime); |
|
702 |
delete alarm; |
|
703 |
||
704 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
705 |
||
706 |
if(errno == KErrNone && uids) |
|
707 |
{ |
|
708 |
arruids.Append(uids); |
|
709 |
uids = NULL; |
|
710 |
} |
|
711 |
||
712 |
if ( arruids.Count() > 0 ) |
|
713 |
{ |
|
714 |
RPointerArray<CCalEntry> entryArray; |
|
715 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
716 |
if( entryArray.Count() == 1 ) |
|
717 |
{ |
|
718 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting")) == 0 |
|
719 |
&& entryArray[0]->LocationL().CompareF(_L("Hara")) == 0 ) ) |
|
720 |
{ |
|
721 |
result = KErrGeneral; |
|
722 |
} |
|
723 |
} |
|
724 |
||
725 |
else |
|
726 |
{ |
|
727 |
result = KErrGeneral; |
|
728 |
} |
|
729 |
entryArray.ResetAndDestroy(); |
|
730 |
arruids.ResetAndDestroy(); |
|
731 |
delete entryObj; |
|
732 |
} |
|
733 |
else |
|
734 |
result = KErrGeneral; |
|
735 |
||
736 |
RemoveCalendarFile( service, KTestCal1File ); |
|
737 |
||
738 |
delete service; |
|
739 |
||
740 |
__UHEAP_MARKEND; |
|
741 |
||
742 |
return result; |
|
743 |
||
744 |
||
745 |
} |
|
746 |
||
747 |
TInt CTCalendarAddTest::AddAppointmentEntryWithAttendeesL(CStifItemParser &aItem ) |
|
748 |
{ |
|
749 |
/*__UHEAP_MARK; |
|
750 |
||
751 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
752 |
||
753 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
754 |
entryObj->SetLocationL(_L("Hara")); |
|
755 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
756 |
||
757 |
entryObj->SetMethodL(KMethodNone); |
|
758 |
||
759 |
CAttendeeInfo* organizer = CAttendeeInfo::NewL(_L("")); |
|
760 |
CleanupStack::PushL(organizer); |
|
761 |
organizer->SetCommonNameL(_L("SAPI")); |
|
762 |
entryObj->SetOrganizerDataL(organizer); |
|
763 |
CleanupStack::PopAndDestroy(organizer); |
|
764 |
||
765 |
entryObj->SetPhoneOwnerDataL(_L("")); |
|
766 |
||
767 |
entryObj->SetPriority(5); |
|
768 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
769 |
||
770 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
771 |
entryObj->SetStartTimeL(stTime); |
|
772 |
||
773 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
774 |
entryObj->SetEndTimeL(endTime); |
|
775 |
||
776 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
777 |
TTime alarmTime(TDateTime(2007,EAugust, 8, 7, 30, 0, 0)); |
|
778 |
//entryObj->SetAlarm(alarmTime); |
|
779 |
delete alarm; |
|
780 |
||
781 |
CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("")); |
|
782 |
CleanupStack::PushL(attendee); |
|
783 |
attendee->SetRoleL(KAttRoleReqParticipant); |
|
784 |
attendee->SetStatusL(KAttStatusTentative); |
|
785 |
attendee->SetRsvp(EFalse); |
|
786 |
||
787 |
entryObj->AddAttendeeL(attendee); |
|
788 |
CleanupStack::PopAndDestroy(attendee); |
|
789 |
||
790 |
attendee = CAttendeeInfo::NewL(_L("")); |
|
791 |
CleanupStack::PushL(attendee); |
|
792 |
attendee->SetCommonNameL(_L("SAPI")); |
|
793 |
attendee->SetRoleL(KAttRoleReqParticipant); |
|
794 |
attendee->SetStatusL(KAttStatusTentative); |
|
795 |
attendee->SetRsvp(EFalse); |
|
796 |
||
797 |
entryObj->AddAttendeeL(attendee); |
|
798 |
CleanupStack::PopAndDestroy(attendee); |
|
799 |
||
800 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
801 |
TPtrC ptr(defaultfile); |
|
802 |
||
803 |
CCalendarService* service; |
|
804 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
805 |
||
806 |
TUIDSet* uids = NULL; |
|
807 |
||
808 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
809 |
||
810 |
delete uids; |
|
811 |
delete entryObj; |
|
812 |
delete service; |
|
813 |
__UHEAP_MARKEND; |
|
814 |
return errno;*/ |
|
815 |
TInt result = KErrNone; |
|
816 |
||
817 |
__UHEAP_MARK; |
|
818 |
||
819 |
CCalendarService* service = CCalendarService::NewL(); |
|
820 |
||
821 |
RemoveCalendarFile( service, KTestCal1File ); |
|
822 |
AddCalendarFile( service, KTestCal1File ); |
|
823 |
||
824 |
RPointerArray<TUIDSet> arruids(5); |
|
825 |
||
826 |
TUIDSet* uids = NULL; |
|
827 |
||
828 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
829 |
||
830 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
831 |
entryObj->SetLocationL(_L("Hara")); |
|
832 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
833 |
||
834 |
entryObj->SetMethodL(KMethodNone); |
|
835 |
||
836 |
CAttendeeInfo* organizer = CAttendeeInfo::NewL(_L("mcrasta@gmail.com")); |
|
837 |
CleanupStack::PushL(organizer); |
|
838 |
organizer->SetCommonNameL(_L("SAPI")); |
|
839 |
entryObj->SetOrganizerDataL(organizer); |
|
840 |
CleanupStack::PopAndDestroy(organizer); |
|
841 |
||
842 |
entryObj->SetPhoneOwnerDataL(_L("h2s@gmail.com")); |
|
843 |
||
844 |
entryObj->SetPriority(5); |
|
845 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
846 |
||
847 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
848 |
entryObj->SetStartTimeL(stTime); |
|
849 |
||
850 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
851 |
entryObj->SetEndTimeL(endTime); |
|
852 |
||
853 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
854 |
TTime alarmTime(TDateTime(2007,EAugust, 8, 7, 30, 0, 0)); |
|
855 |
//entryObj->SetAlarm(alarmTime); |
|
856 |
delete alarm; |
|
857 |
||
858 |
CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("h2s@gmail.com")); |
|
859 |
CleanupStack::PushL(attendee); |
|
860 |
attendee->SetRoleL(KAttRoleReqParticipant); |
|
861 |
attendee->SetStatusL(KAttStatusTentative); |
|
862 |
attendee->SetRsvp(EFalse); |
|
863 |
||
864 |
entryObj->AddAttendeeL(attendee); |
|
865 |
CleanupStack::PopAndDestroy(attendee); |
|
866 |
||
867 |
attendee = CAttendeeInfo::NewL(_L("mdcosta@gmail.com")); |
|
868 |
CleanupStack::PushL(attendee); |
|
869 |
attendee->SetCommonNameL(_L("SAPI")); |
|
870 |
attendee->SetRoleL(KAttRoleReqParticipant); |
|
871 |
attendee->SetStatusL(KAttStatusTentative); |
|
872 |
attendee->SetRsvp(EFalse); |
|
873 |
||
874 |
entryObj->AddAttendeeL(attendee); |
|
875 |
CleanupStack::PopAndDestroy(attendee); |
|
876 |
||
877 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
878 |
||
879 |
if(errno == KErrNone && uids) |
|
880 |
{ |
|
881 |
arruids.Append(uids); |
|
882 |
uids = NULL; |
|
883 |
} |
|
884 |
||
885 |
if ( arruids.Count() > 0 ) |
|
886 |
{ |
|
887 |
RPointerArray<CCalEntry> entryArray; |
|
888 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
889 |
if( entryArray.Count() == 1 ) |
|
890 |
{ |
|
891 |
RPointerArray<CCalAttendee> attendeeList; |
|
892 |
attendeeList = entryArray[0]->AttendeesL(); |
|
893 |
||
894 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting")) == 0 |
|
895 |
&& attendeeList.Count() == 2 ) ) |
|
896 |
{ |
|
897 |
result = KErrGeneral; |
|
898 |
} |
|
899 |
} |
|
900 |
||
901 |
else |
|
902 |
{ |
|
903 |
result = KErrGeneral; |
|
904 |
} |
|
905 |
entryArray.ResetAndDestroy(); |
|
906 |
arruids.ResetAndDestroy(); |
|
907 |
delete entryObj; |
|
908 |
} |
|
909 |
else |
|
910 |
result = KErrGeneral; |
|
911 |
||
912 |
RemoveCalendarFile( service, KTestCal1File ); |
|
913 |
||
914 |
delete service; |
|
915 |
||
916 |
__UHEAP_MARKEND; |
|
917 |
||
918 |
return result; |
|
919 |
||
920 |
||
921 |
} |
|
922 |
||
923 |
TInt CTCalendarAddTest::AddAnniversaryL(CStifItemParser &aItem ) |
|
924 |
{ |
|
925 |
/*__UHEAP_MARK; |
|
926 |
||
927 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAnniv ); |
|
928 |
||
929 |
entryObj->SetDescriptionL(_L("New Anniversary entry created")); |
|
930 |
entryObj->SetSummaryL(_L("Anniv Entry")); |
|
931 |
||
932 |
TTime stTime(TDateTime(2007, EDecember, 30, 0, 0, 0, 0)); |
|
933 |
entryObj->SetStartTimeL(stTime); |
|
934 |
||
935 |
entryObj->SetReplicationL(KReplPrivate); |
|
936 |
||
937 |
TCalRRule rrule(TCalRRule::EYearly); |
|
938 |
TCalTime startTime; |
|
939 |
startTime.SetTimeLocalFloatingL( stTime ); |
|
940 |
rrule.SetDtStart(startTime); |
|
941 |
//rrule.SetInterval(1); |
|
942 |
||
943 |
TCalTime uTime; |
|
944 |
uTime.SetTimeLocalFloatingL(TCalTime::MaxTime()); |
|
945 |
rrule.SetUntil(uTime); |
|
946 |
entryObj->SetRepeatRule(rrule); |
|
947 |
||
948 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
949 |
TPtrC ptr(defaultfile); |
|
950 |
||
951 |
CCalendarService* service; |
|
952 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
953 |
||
954 |
TUIDSet* uids = NULL; |
|
955 |
||
956 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
957 |
||
958 |
delete uids; |
|
959 |
delete entryObj; |
|
960 |
||
961 |
delete service; |
|
962 |
__UHEAP_MARKEND; |
|
963 |
return errno;*/ |
|
964 |
||
965 |
TInt result = KErrNone; |
|
966 |
||
967 |
__UHEAP_MARK; |
|
968 |
||
969 |
CCalendarService* service = CCalendarService::NewL(); |
|
970 |
||
971 |
RemoveCalendarFile( service, KTestCal1File ); |
|
972 |
AddCalendarFile( service, KTestCal1File ); |
|
973 |
||
974 |
RPointerArray<TUIDSet> arruids(5); |
|
975 |
||
976 |
TUIDSet* uids = NULL; |
|
977 |
||
978 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAnniv ); |
|
979 |
||
980 |
entryObj->SetDescriptionL(_L("New Anniversary entry created")); |
|
981 |
entryObj->SetSummaryL(_L("Anniv Entry")); |
|
982 |
||
983 |
TTime stTime(TDateTime(2007, EDecember, 27, 0, 0, 0, 0)); |
|
984 |
entryObj->SetStartTimeL(stTime); |
|
985 |
||
986 |
entryObj->SetReplicationL(KReplPrivate); |
|
987 |
||
988 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
989 |
||
990 |
if(errno == KErrNone && uids) |
|
991 |
{ |
|
992 |
arruids.Append(uids); |
|
993 |
uids = NULL; |
|
994 |
} |
|
995 |
||
996 |
if ( arruids.Count() > 0 ) |
|
997 |
{ |
|
998 |
RPointerArray<CCalEntry> entryArray; |
|
999 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
1000 |
if( entryArray.Count() == 1 ) |
|
1001 |
{ |
|
1002 |
TDateTime tm = entryArray[0]->StartTimeL().TimeLocalL().DateTime(); |
|
1003 |
TDateTime tm1 = stTime.DateTime(); |
|
1004 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("New Anniversary entry created")) == 0 |
|
1005 |
&& entryArray[0]->SummaryL().CompareF(_L("Anniv Entry")) == 0 ) ) |
|
1006 |
{ |
|
1007 |
result = KErrGeneral; |
|
1008 |
} |
|
1009 |
} |
|
1010 |
||
1011 |
else |
|
1012 |
{ |
|
1013 |
result = KErrGeneral; |
|
1014 |
} |
|
1015 |
entryArray.ResetAndDestroy(); |
|
1016 |
arruids.ResetAndDestroy(); |
|
1017 |
delete entryObj; |
|
1018 |
} |
|
1019 |
else |
|
1020 |
result = KErrGeneral; |
|
1021 |
||
1022 |
RemoveCalendarFile( service, KTestCal1File ); |
|
1023 |
||
1024 |
delete service; |
|
1025 |
||
1026 |
__UHEAP_MARKEND; |
|
1027 |
||
1028 |
return result; |
|
1029 |
||
1030 |
} |
|
1031 |
TInt CTCalendarAddTest::AddDayEventL(CStifItemParser &aItem ) |
|
1032 |
{ |
|
1033 |
/*__UHEAP_MARK; |
|
1034 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryEvent ); |
|
1035 |
||
1036 |
entryObj->SetDescriptionL(_L("New Event entry created")); |
|
1037 |
entryObj->SetSummaryL(_L("Event Entry")); |
|
1038 |
||
1039 |
TTime stTime(TDateTime(2007, EJuly, 25, 0, 0, 0, 0)); |
|
1040 |
entryObj->SetStartTimeL(stTime); |
|
1041 |
entryObj->SetReplicationL(KReplPrivate); |
|
1042 |
||
1043 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
1044 |
TPtrC ptr(defaultfile); |
|
1045 |
||
1046 |
CCalendarService* service; |
|
1047 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
1048 |
||
1049 |
TUIDSet* uids = NULL; |
|
1050 |
||
1051 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
1052 |
||
1053 |
delete uids; |
|
1054 |
delete entryObj; |
|
1055 |
delete service; |
|
1056 |
__UHEAP_MARKEND; |
|
1057 |
return errno;*/ |
|
1058 |
||
1059 |
TInt result = KErrNone; |
|
1060 |
||
1061 |
__UHEAP_MARK; |
|
1062 |
||
1063 |
CCalendarService* service = CCalendarService::NewL(); |
|
1064 |
||
1065 |
RemoveCalendarFile( service, KTestCal1File ); |
|
1066 |
AddCalendarFile( service, KTestCal1File ); |
|
1067 |
||
1068 |
RPointerArray<TUIDSet> arruids(5); |
|
1069 |
||
1070 |
TUIDSet* uids = NULL; |
|
1071 |
||
1072 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryEvent ); |
|
1073 |
||
1074 |
entryObj->SetDescriptionL(_L("New Event entry created")); |
|
1075 |
entryObj->SetSummaryL(_L("Event Entry")); |
|
1076 |
||
1077 |
TTime stTime(TDateTime(2007, EJuly, 25, 0, 0, 0, 0)); |
|
1078 |
entryObj->SetStartTimeL(stTime); |
|
1079 |
entryObj->SetReplicationL(KReplPrivate); |
|
1080 |
||
1081 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1082 |
||
1083 |
if(errno == KErrNone && uids) |
|
1084 |
{ |
|
1085 |
arruids.Append(uids); |
|
1086 |
uids = NULL; |
|
1087 |
} |
|
1088 |
||
1089 |
if ( arruids.Count() > 0 ) |
|
1090 |
{ |
|
1091 |
RPointerArray<CCalEntry> entryArray; |
|
1092 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
1093 |
if( entryArray.Count() == 1 ) |
|
1094 |
{ |
|
1095 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("New Event entry created")) == 0 |
|
1096 |
&& entryArray[0]->SummaryL().CompareF(_L("Event Entry")) == 0 ) ) |
|
1097 |
{ |
|
1098 |
result = KErrGeneral; |
|
1099 |
} |
|
1100 |
} |
|
1101 |
||
1102 |
else |
|
1103 |
{ |
|
1104 |
result = KErrGeneral; |
|
1105 |
} |
|
1106 |
entryArray.ResetAndDestroy(); |
|
1107 |
arruids.ResetAndDestroy(); |
|
1108 |
delete entryObj; |
|
1109 |
} |
|
1110 |
else |
|
1111 |
result = KErrGeneral; |
|
1112 |
||
1113 |
RemoveCalendarFile( service, KTestCal1File ); |
|
1114 |
||
1115 |
delete service; |
|
1116 |
||
1117 |
__UHEAP_MARKEND; |
|
1118 |
||
1119 |
return result; |
|
1120 |
||
1121 |
} |
|
1122 |
||
1123 |
TInt CTCalendarAddTest::AddReminderL(CStifItemParser &aItem ) |
|
1124 |
{ |
|
1125 |
/*__UHEAP_MARK; |
|
1126 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryReminder ); |
|
1127 |
||
1128 |
entryObj->SetDescriptionL(_L("New Reminder entry created")); |
|
1129 |
entryObj->SetSummaryL(_L("Reminder Entry")); |
|
1130 |
||
1131 |
TTime stTime(TDateTime(2007, EJuly, 22, 10, 30, 0, 0)); |
|
1132 |
entryObj->SetStartTimeL(stTime); |
|
1133 |
entryObj->SetReplicationL(KReplOpen); |
|
1134 |
||
1135 |
TBuf<15> defaultfile(_L("C:Calendar")); |
|
1136 |
TPtrC ptr(defaultfile); |
|
1137 |
||
1138 |
CCalendarService* service; |
|
1139 |
TRAPD( err, service = CCalendarService::NewL() ); |
|
1140 |
||
1141 |
TUIDSet* uids = NULL; |
|
1142 |
||
1143 |
TRAPD( errno, service->AddL(ptr,entryObj,uids) ); |
|
1144 |
||
1145 |
delete uids; |
|
1146 |
delete entryObj; |
|
1147 |
delete service; |
|
1148 |
__UHEAP_MARKEND; |
|
1149 |
return errno;*/ |
|
1150 |
TInt result = KErrNone; |
|
1151 |
||
1152 |
__UHEAP_MARK; |
|
1153 |
||
1154 |
CCalendarService* service = CCalendarService::NewL(); |
|
1155 |
||
1156 |
RemoveCalendarFile( service, KTestCal1File ); |
|
1157 |
AddCalendarFile( service, KTestCal1File ); |
|
1158 |
||
1159 |
RPointerArray<TUIDSet> arruids(5); |
|
1160 |
||
1161 |
TUIDSet* uids = NULL; |
|
1162 |
||
1163 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryReminder ); |
|
1164 |
||
1165 |
entryObj->SetDescriptionL(_L("New Reminder entry created")); |
|
1166 |
entryObj->SetSummaryL(_L("Reminder Entry")); |
|
1167 |
||
1168 |
TTime stTime(TDateTime(2007, EJuly, 22, 10, 30, 0, 0)); |
|
1169 |
entryObj->SetStartTimeL(stTime); |
|
1170 |
entryObj->SetReplicationL(KReplOpen); |
|
1171 |
||
1172 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
1173 |
||
1174 |
if(errno == KErrNone && uids) |
|
1175 |
{ |
|
1176 |
arruids.Append(uids); |
|
1177 |
uids = NULL; |
|
1178 |
} |
|
1179 |
||
1180 |
if ( arruids.Count() > 0 ) |
|
1181 |
{ |
|
1182 |
CCalEntry::TReplicationStatus rep = CCalEntry::EOpen; |
|
1183 |
RPointerArray<CCalEntry> entryArray; |
|
1184 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
1185 |
if( entryArray.Count() == 1 ) |
|
1186 |
{ |
|
1187 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("New Reminder entry created")) == 0 |
|
1188 |
&& entryArray[0]->SummaryL().CompareF(_L("Reminder Entry")) == 0 |
|
1189 |
&& entryArray[0]->ReplicationStatusL() == rep ) ) |
|
1190 |
{ |
|
1191 |
result = KErrGeneral; |
|
1192 |
} |
|
1193 |
} |
|
1194 |
||
1195 |
else |
|
1196 |
{ |
|
1197 |
result = KErrGeneral; |
|
1198 |
} |
|
1199 |
entryArray.ResetAndDestroy(); |
|
1200 |
arruids.ResetAndDestroy(); |
|
1201 |
delete entryObj; |
|
1202 |
} |
|
1203 |
else |
|
1204 |
result = KErrGeneral; |
|
1205 |
||
1206 |
RemoveCalendarFile( service, KTestCal1File ); |
|
1207 |
||
1208 |
delete service; |
|
1209 |
||
1210 |
__UHEAP_MARKEND; |
|
1211 |
||
1212 |
return result; |
|
1213 |
||
1214 |
} |