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 - 2007 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 "tcal_add.h" |
26 |
#include "calendarheader.h" |
|
27 |
#include "calendarservice.h" |
|
28 |
#include <calentry.h>//for CCalEntry |
|
29 |
#include <calinstanceview.h>//for CCalInstance |
|
30 |
#include <calcommon.h>//for Filter Type Enum Constants |
|
31 |
#include <calinstance.h> |
|
32 |
#include "teststartconsolealarmserver.h" |
|
33 |
||
34 |
||
35 |
// EXTERNAL DATA STRUCTURES |
|
36 |
//extern ?external_data; |
|
37 |
||
38 |
// EXTERNAL FUNCTION PROTOTYPES |
|
39 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
40 |
||
41 |
// CONSTANTS |
|
42 |
//const ?type ?constant_var = ?constant; |
|
43 |
||
44 |
// MACROS |
|
45 |
//#define ?macro ?macro_def |
|
46 |
||
47 |
// LOCAL CONSTANTS AND MACROS |
|
48 |
//const ?type ?constant_var = ?constant; |
|
49 |
//#define ?macro_name ?macro_def |
|
50 |
||
51 |
// MODULE DATA STRUCTURES |
|
52 |
//enum ?declaration |
|
53 |
//typedef ?declaration |
|
54 |
||
55 |
// LOCAL FUNCTION PROTOTYPES |
|
56 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
57 |
||
58 |
// FORWARD DECLARATIONS |
|
59 |
//class ?FORWARD_CLASSNAME; |
|
60 |
||
61 |
// ============================= LOCAL FUNCTIONS =============================== |
|
62 |
||
63 |
// ----------------------------------------------------------------------------- |
|
64 |
// ?function_name ?description. |
|
65 |
// ?description |
|
66 |
// Returns: ?value_1: ?description |
|
67 |
// ?value_n: ?description_line1 |
|
68 |
// ?description_line2 |
|
69 |
// ----------------------------------------------------------------------------- |
|
70 |
// |
|
71 |
/* |
|
72 |
?type ?function_name( |
|
73 |
?arg_type arg, // ?description |
|
74 |
?arg_type arg) // ?description |
|
75 |
{ |
|
76 |
||
77 |
?code // ?comment |
|
78 |
||
79 |
// ?comment |
|
80 |
?code |
|
81 |
} |
|
82 |
*/ |
|
83 |
||
84 |
// ============================ MEMBER FUNCTIONS =============================== |
|
85 |
||
86 |
// ----------------------------------------------------------------------------- |
|
87 |
// Ctcal_add::Delete |
|
88 |
// Delete here all resources allocated and opened from test methods. |
|
89 |
// Called from destructor. |
|
90 |
// ----------------------------------------------------------------------------- |
|
91 |
// |
|
92 |
void Ctcal_add::Delete() |
|
93 |
{ |
|
94 |
||
95 |
} |
|
96 |
||
97 |
// ----------------------------------------------------------------------------- |
|
98 |
// Ctcal_add::RunMethodL |
|
99 |
// Run specified method. Contains also table of test mothods and their names. |
|
100 |
// ----------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
TInt Ctcal_add::RunMethodL( |
|
103 |
CStifItemParser& aItem ) |
|
104 |
{ |
|
105 |
||
106 |
static TStifFunctionInfo const KFunctions[] = |
|
107 |
{ |
|
108 |
// Copy this line for every implemented function. |
|
109 |
// First string is the function name used in TestScripter script file. |
|
110 |
// Second is the actual implementation member function. |
|
111 |
ENTRY( "AddCalendar", Ctcal_add::AddCalendar ), |
|
112 |
ENTRY( "AddMeetingEntry", Ctcal_add::AddMeetingEntry ), |
|
113 |
ENTRY( "AddRepeatingEntry", Ctcal_add::AddRepeatingEntry ), |
|
114 |
ENTRY( "AddMonthlyRepeatingEntry", Ctcal_add::AddMonthlyRepeatingEntry ), |
|
115 |
ENTRY( "AddAptWithAttendee", Ctcal_add::AddAptWithAttendee ), |
|
116 |
//ADD NEW ENTRY HERE |
|
117 |
||
118 |
}; |
|
119 |
||
120 |
const TInt count = sizeof( KFunctions ) / |
|
121 |
sizeof( TStifFunctionInfo ); |
|
122 |
||
123 |
return RunInternalL( KFunctions, count, aItem ); |
|
124 |
||
125 |
} |
|
126 |
||
127 |
||
128 |
_LIT(KTestCal1File ,"C:getlistcal1"); |
|
129 |
_LIT(KTestCal2File ,"C:getlistcal2"); |
|
130 |
_LIT(KTestCalFile ,"C:Calendar"); |
|
131 |
||
132 |
// ----------------------------------------------------------------------------- |
|
133 |
// Ctcal_add::AddCalendar |
|
134 |
// Add calendar file |
|
135 |
// (other items were commented in a header). |
|
136 |
// ----------------------------------------------------------------------------- |
|
137 |
// |
|
138 |
TInt Ctcal_add::AddCalendar( CStifItemParser& /*aItem*/ ) |
|
139 |
{ |
|
140 |
TInt result = KErrNone; |
|
141 |
__UHEAP_MARK; |
|
142 |
_LIT(KTestCalTestFile ,"X:001"); |
|
143 |
_LIT(KTestCalTest1File ,"X:001"); |
|
144 |
TInt count =0; |
|
145 |
||
146 |
||
147 |
CCalendarService* service = CCalendarService::NewL(); |
|
148 |
||
149 |
||
150 |
TInt err = AddCalendarFile( service, KTestCal1File ); |
|
151 |
||
152 |
if(err != KErrNone) |
|
153 |
result = err; |
|
154 |
||
155 |
||
156 |
TInt err_one = AddCalendarFile( service, KTestCal1File ); |
|
157 |
||
158 |
if(err_one != KErrAlreadyExists && result == KErrNone) |
|
159 |
result = err_one; |
|
160 |
||
161 |
||
162 |
TInt err_three = AddCalendarFile( service, KTestCalTestFile ); |
|
163 |
||
164 |
if(err_three != KErrNotReady && result == KErrNone) |
|
165 |
result = KErrGeneral; |
|
166 |
||
167 |
TInt err_four = AddCalendarFile( service, KTestCalTest1File ); |
|
168 |
||
169 |
if(err_four != KErrNotReady && result == KErrNone) |
|
170 |
result = KErrGeneral; |
|
171 |
||
172 |
TInt err_five = AddCalendarFile( service, KNullDesC); |
|
173 |
||
174 |
if(err_five != KErrAlreadyExists && result == KErrNone) |
|
175 |
result = KErrGeneral; |
|
176 |
||
177 |
TInt err_six = AddCalendarFile( service, KTestCalFile); |
|
178 |
||
179 |
if(err_six != KErrAlreadyExists && result == KErrNone) |
|
180 |
result = KErrGeneral; |
|
181 |
||
182 |
RemoveCalendarFile( service, KTestCal1File ); |
|
183 |
delete service; |
|
184 |
__UHEAP_MARKEND; |
|
185 |
return result; |
|
186 |
||
187 |
||
188 |
} |
|
189 |
||
190 |
// ----------------------------------------------------------------------------- |
|
191 |
// Ctcal_add::AddMeetingEntry |
|
192 |
// Add a new meeting entry |
|
193 |
// (other items were commented in a header). |
|
194 |
// ----------------------------------------------------------------------------- |
|
195 |
// |
|
196 |
TInt Ctcal_add::AddMeetingEntry( CStifItemParser& /*aItem*/ ) |
|
197 |
{ |
|
198 |
TInt result = KErrNone; |
|
199 |
__UHEAP_MARK; |
|
200 |
_LIT(KTestMethod, "XYZ123"); |
|
201 |
||
202 |
CCalendarService* service = CCalendarService::NewL(); |
|
203 |
||
204 |
RemoveCalendarFile( service, KTestCal1File ); |
|
205 |
TInt err = AddCalendarFile( service, KTestCal1File ); |
|
206 |
||
207 |
if(err != KErrNone) |
|
208 |
result = err; |
|
209 |
||
210 |
RPointerArray<TUIDSet> arruids; |
|
211 |
||
212 |
TUIDSet* uids = NULL; |
|
213 |
||
214 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
215 |
||
216 |
TRAPD(err_one,entryObj->SetDescriptionL(_L("SAPI weekly meeting sdsdnsbdsdsb sdkjsjk sjkdbks bsdb8808s sdnskjdbsjkdnsjkdjk nnjksndsjn kjsnd jns"))); |
|
217 |
if(err_one != KErrNone) |
|
218 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
219 |
||
220 |
||
221 |
TRAPD(err_two,entryObj->SetLocationL(_L("fsdfsjdnf jnnjns jknsdkjn jkndsjfnsd9030934 ndfns nlsdnf ldnflksn lksdnflkns dlfn lksdfnsdnfl kndflkn"))); |
|
222 |
if(err_two != KErrNone) |
|
223 |
entryObj->SetLocationL(_L("Hara")); |
|
224 |
||
225 |
||
226 |
TRAPD(err_entrystatus,entryObj->SetEntryStatusL(KNullDesC)); |
|
227 |
if(err_entrystatus != KErrNone) |
|
228 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
229 |
||
230 |
TRAPD(err_three,entryObj->SetMethodL(KTestMethod)); |
|
231 |
if(err_three != KErrNone) |
|
232 |
entryObj->SetMethodL(KMethodNone); |
|
233 |
||
234 |
TRAPD(err_four,entryObj->SetPriority(55555e12)); |
|
235 |
if(err_four != KErrNone) |
|
236 |
entryObj->SetPriority(5); |
|
237 |
||
238 |
||
239 |
TRAPD(err_five,entryObj->SetSummaryL(_L("Happens from 9 to 9:30 sdfndfjs n89834 dsfksdfjsdfjdsjflsdjflsdj ljdf"))); |
|
240 |
if(err_five != KErrNone) |
|
241 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
242 |
||
243 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
244 |
entryObj->SetStartTimeL(stTime); |
|
245 |
||
246 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
247 |
entryObj->SetEndTimeL(endTime); |
|
248 |
||
249 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
250 |
TTime alarmTime(TDateTime(2007,EAugust, 7, 23, 30, 0, 0)); |
|
251 |
delete alarm; |
|
252 |
||
253 |
||
254 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
255 |
||
256 |
if(errno == KErrNone && uids) |
|
257 |
{ |
|
258 |
arruids.Append(uids); |
|
259 |
uids = NULL; |
|
260 |
} |
|
261 |
||
262 |
if ( arruids.Count() > 0 ) |
|
263 |
{ |
|
264 |
RPointerArray<CCalEntry> entryArray; |
|
265 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
266 |
TInt count = entryArray.Count(); |
|
267 |
if( entryArray.Count() == 1 ) |
|
268 |
{ |
|
269 |
if( !( entryArray[0]->StartTimeL().TimeUtcL() == stTime && entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting sdsdnsbdsdsb sdkjsjk sjkdbks bsdb8808s sdnskjdbsjkdnsjkdjk nnjksndsjn kjsnd jns")) == 0 |
|
270 |
&& entryArray[0]->LocationL().CompareF(_L("fsdfsjdnf jnnjns jknsdkjn jkndsjfnsd9030934 ndfns nlsdnf ldnflksn lksdnflkns dlfn lksdfnsdnfl kndflkn")) == 0 ) ) |
|
271 |
{ |
|
272 |
result = KErrGeneral; |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
else |
|
277 |
{ |
|
278 |
result = KErrGeneral; |
|
279 |
} |
|
280 |
entryArray.ResetAndDestroy(); |
|
281 |
arruids.ResetAndDestroy(); |
|
282 |
delete entryObj; |
|
283 |
} |
|
284 |
else |
|
285 |
result = KErrGeneral; |
|
286 |
||
287 |
RemoveCalendarFile( service, KTestCal1File ); |
|
288 |
||
289 |
delete service; |
|
290 |
// delete entryObj; |
|
291 |
// delete uids; |
|
292 |
__UHEAP_MARKEND; |
|
293 |
return result; |
|
294 |
||
295 |
||
296 |
||
297 |
} |
|
298 |
||
299 |
||
300 |
// ----------------------------------------------------------------------------- |
|
301 |
// Ctcal_add::AddRepeatingEntry |
|
302 |
// Add a new daily repeating meeting entry |
|
303 |
// (other items were commented in a header). |
|
304 |
// ----------------------------------------------------------------------------- |
|
305 |
// |
|
306 |
TInt Ctcal_add::AddRepeatingEntry( CStifItemParser& /*aItem*/ ) |
|
307 |
{ |
|
308 |
TInt result = KErrNone; |
|
309 |
__UHEAP_MARK; |
|
310 |
RPointerArray<TUIDSet> arruids; |
|
311 |
TInt err_six; |
|
312 |
TUIDSet* uids = NULL; |
|
313 |
||
314 |
CCalendarService* service = CCalendarService::NewL(); |
|
315 |
||
316 |
RemoveCalendarFile( service, KTestCal1File ); |
|
317 |
AddCalendarFile( service, KTestCal1File ); |
|
318 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
319 |
||
320 |
TRAPD(err_desc,entryObj->SetDescriptionL(KNullDesC)); |
|
321 |
if(err_desc != KErrNone) |
|
322 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
323 |
||
324 |
TRAPD(err_loc,entryObj->SetLocationL(KNullDesC)); |
|
325 |
if(err_loc != KErrNone) |
|
326 |
entryObj->SetLocationL(_L("Hara")); |
|
327 |
||
328 |
||
329 |
TRAPD(err_one,entryObj->SetEntryStatusL(KStatusTodoNeedsAction)); |
|
330 |
if(err_one != KErrNone) |
|
331 |
entryObj->SetEntryStatusL(KStatusCancelled); |
|
332 |
||
333 |
entryObj->SetMethodL(KMethodNone); |
|
334 |
||
335 |
TRAPD(err_two,entryObj->SetPriority(-5.2)); |
|
336 |
if(err_two != KErrNone) |
|
337 |
entryObj->SetPriority(1); |
|
338 |
||
339 |
entryObj->SetSummaryL(_L("Repeating entry")); |
|
340 |
||
341 |
TTime stTime(TDateTime(2007, EJune, 15, 9, 0, 0, 0)); |
|
342 |
entryObj->SetStartTimeL(stTime); |
|
343 |
||
344 |
TTime endTime(TDateTime(2007, EJune, 15, 9, 30, 0, 0)); |
|
345 |
entryObj->SetEndTimeL(endTime); |
|
346 |
||
347 |
CRepeatInfo* rrule = CRepeatInfo::NewL(2); |
|
348 |
||
349 |
rrule->SetStartTimeL(stTime); |
|
350 |
TTime uTime(TDateTime(2007, EJuly, 29, 0, 0, 0, 0)); |
|
351 |
rrule->SetUntilTimeL(uTime); |
|
352 |
||
353 |
RArray<TDay> days; |
|
354 |
days.Append(EWednesday); |
|
355 |
days.Append(EFriday); |
|
356 |
TRAPD(err_rrule,rrule->SetDaysInWeek(days)); |
|
357 |
if(err_rrule != KErrNone) |
|
358 |
rrule->SetDaysInWeek(days); |
|
359 |
||
360 |
days.Close(); |
|
361 |
||
362 |
TRAPD(err_three,entryObj->SetRepeatRule(NULL)); |
|
363 |
if(err_three != KErrNone) |
|
364 |
result = KErrGeneral; |
|
365 |
||
366 |
||
367 |
entryObj->SetRepeatRule(rrule); |
|
368 |
||
369 |
||
370 |
TRAPD(err_five,service->AddL(KTestCal1File,entryObj,uids)); |
|
371 |
if(err_five == KErrNotSupported) |
|
372 |
{ |
|
373 |
entryObj->SetEntryStatusL(KStatusCancelled); |
|
374 |
TRAP(err_six,service->AddL(KTestCal1File,entryObj,uids)); |
|
375 |
} |
|
376 |
||
377 |
||
378 |
//TRAPD(err_add,service->AddL(KTestCal1File,entryObj,uids)); |
|
379 |
||
380 |
||
381 |
if ( err_six == KErrNone && uids ) |
|
382 |
{ |
|
383 |
arruids.Append(uids); |
|
384 |
RPointerArray<CCalEntry> entryArray; |
|
385 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
386 |
TInt count = entryArray.Count(); |
|
387 |
if( entryArray.Count() == 1 ) |
|
388 |
{ |
|
389 |
TCalRRule rRule; |
|
390 |
entryArray[0]->GetRRuleL( rRule ); |
|
391 |
TCalTime utTime; |
|
392 |
utTime.SetTimeLocalL(TTime(TDateTime(2007, EJuly, 26, 9, 0, 0, 0))); |
|
393 |
||
394 |
TInt val = entryArray[0]->DescriptionL().CompareF(KNullDesC); |
|
395 |
// if( entryArray[0]->DescriptionL().CompareF(KNullDesC) != 0 || rRule.Type() != TCalRRule::EWeekly || rRule.Until().TimeLocalL() != utTime.TimeLocalL() ) |
|
396 |
if( entryArray[0]->DescriptionL().CompareF(KNullDesC) != 0 || rRule.Type() != TCalRRule::EWeekly ) |
|
397 |
result = KErrGeneral; |
|
398 |
||
399 |
} |
|
400 |
||
401 |
else |
|
402 |
{ |
|
403 |
result = KErrGeneral; |
|
404 |
} |
|
405 |
count = 0; |
|
406 |
entryArray.ResetAndDestroy(); |
|
407 |
||
408 |
} |
|
409 |
else |
|
410 |
result = KErrGeneral; |
|
411 |
||
412 |
RemoveCalendarFile( service, KTestCal1File ); |
|
413 |
arruids.ResetAndDestroy(); |
|
414 |
if(uids) |
|
415 |
// delete uids; |
|
416 |
delete entryObj; |
|
417 |
delete rrule; |
|
418 |
delete service; |
|
419 |
__UHEAP_MARKEND; |
|
420 |
return result; |
|
421 |
||
422 |
} |
|
423 |
||
424 |
||
425 |
// ----------------------------------------------------------------------------- |
|
426 |
// Ctcal_add::AddMonthlyRepeatingEntry |
|
427 |
// Add a new monthly repeating meeting entry |
|
428 |
// (other items were commented in a header). |
|
429 |
// ----------------------------------------------------------------------------- |
|
430 |
// |
|
431 |
TInt Ctcal_add::AddMonthlyRepeatingEntry( CStifItemParser& /*aItem*/ ) |
|
432 |
{ |
|
433 |
TInt result = KErrNone; |
|
434 |
__UHEAP_MARK; |
|
435 |
||
436 |
CCalendarService* service = CCalendarService::NewL(); |
|
437 |
||
438 |
RemoveCalendarFile( service, KTestCal1File ); |
|
439 |
AddCalendarFile( service, KTestCal1File ); |
|
440 |
||
441 |
RPointerArray<TUIDSet> arruids(5); |
|
442 |
||
443 |
TUIDSet* uids = NULL; |
|
444 |
||
445 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
446 |
||
447 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
448 |
entryObj->SetLocationL(_L("Safed")); |
|
449 |
entryObj->SetEntryStatusL(KStatusConfirmed ); |
|
450 |
||
451 |
entryObj->SetMethodL(KMethodNone); |
|
452 |
||
453 |
entryObj->SetPriority(15); |
|
454 |
entryObj->SetSummaryL(_L(" Monthly Rep entry")); |
|
455 |
||
456 |
TTime stTime(TDateTime(2007, EJuly, 15, 9, 0, 0, 0)); |
|
457 |
entryObj->SetStartTimeL(stTime); |
|
458 |
||
459 |
TTime endTime(TDateTime(2007, EJuly, 15, 9, 30, 0, 0)); |
|
460 |
entryObj->SetEndTimeL(endTime); |
|
461 |
||
462 |
CCalAlarm* alarm = CCalAlarm::NewL(); |
|
463 |
TTime alarmTime(TDateTime(2007,ESeptember, 15, 7, 30, 0, 0)); |
|
464 |
//entryObj->SetAlarm(alarmTime); |
|
465 |
delete alarm; |
|
466 |
||
467 |
CRepeatInfo* rrule = CRepeatInfo::NewL(3); |
|
468 |
rrule->SetStartTimeL(stTime); |
|
469 |
TTime uTime(TDateTime(2008, ESeptember, 29, 0, 0, 0, 0)); |
|
470 |
rrule->SetUntilTimeL(uTime); |
|
471 |
TCalRRule::TDayOfMonth day1(EMonday,1); |
|
472 |
TCalRRule::TDayOfMonth day2(EThursday,4); |
|
473 |
TCalRRule::TDayOfMonth day3(EFriday,5); |
|
474 |
RArray<TCalRRule::TDayOfMonth> monthDays; |
|
475 |
monthDays.Append(day1); |
|
476 |
monthDays.Append(day2); |
|
477 |
monthDays.Append(day3); |
|
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 |
if( !( entryArray[0]->DescriptionL().CompareF(_L("SAPI weekly meeting")) == 0 |
|
501 |
&&rRule.Type() == TCalRRule::EMonthly ) ) |
|
502 |
{ |
|
503 |
result = KErrGeneral; |
|
504 |
} |
|
505 |
} |
|
506 |
||
507 |
else |
|
508 |
{ |
|
509 |
result = KErrGeneral; |
|
510 |
} |
|
511 |
entryArray.ResetAndDestroy(); |
|
512 |
arruids.ResetAndDestroy(); |
|
513 |
delete entryObj; |
|
514 |
} |
|
515 |
else |
|
516 |
result = KErrGeneral; |
|
517 |
||
518 |
RemoveCalendarFile( service, KTestCal1File ); |
|
519 |
||
520 |
delete service; |
|
521 |
||
522 |
__UHEAP_MARKEND; |
|
523 |
||
524 |
return result; |
|
525 |
||
526 |
||
527 |
} |
|
528 |
||
529 |
||
530 |
// ----------------------------------------------------------------------------- |
|
531 |
// Ctcal_add::AddAptWithAttendee |
|
532 |
// Add a new meeting entry |
|
533 |
// (other items were commented in a header). |
|
534 |
// ----------------------------------------------------------------------------- |
|
535 |
// |
|
536 |
TInt Ctcal_add::AddAptWithAttendee( CStifItemParser& /*aItem*/ ) |
|
537 |
{ |
|
538 |
TInt result = KErrNone; |
|
539 |
||
540 |
__UHEAP_MARK; |
|
541 |
||
542 |
CCalendarService* service = CCalendarService::NewL(); |
|
543 |
||
544 |
RemoveCalendarFile( service, KTestCal1File ); |
|
545 |
AddCalendarFile( service, KTestCal1File ); |
|
546 |
||
547 |
RPointerArray<TUIDSet> arruids(5); |
|
548 |
||
549 |
TUIDSet* uids = NULL; |
|
550 |
||
551 |
CEntryAttributes* entryObj = CEntryAttributes::NewL( KEntryAppt ); |
|
552 |
||
553 |
entryObj->SetDescriptionL(_L("SAPI weekly meeting")); |
|
554 |
entryObj->SetLocationL(_L("Safed")); |
|
555 |
entryObj->SetEntryStatusL(KStatusConfirmed); |
|
556 |
||
557 |
entryObj->SetMethodL(KMethodNone); |
|
558 |
||
559 |
CAttendeeInfo* organizer = CAttendeeInfo::NewL(_L("roshan@gmail.com")); |
|
560 |
CleanupStack::PushL(organizer); |
|
561 |
organizer->SetCommonNameL(_L("Service")); |
|
562 |
entryObj->SetOrganizerDataL(organizer); |
|
563 |
CleanupStack::PopAndDestroy(organizer); |
|
564 |
||
565 |
entryObj->SetPhoneOwnerDataL(_L("roshan@gmail.com")); |
|
566 |
||
567 |
entryObj->SetPriority(5); |
|
568 |
entryObj->SetSummaryL(_L("Happens from 9 to 9:30")); |
|
569 |
||
570 |
TTime stTime(TDateTime(2007, EAugust, 8, 9, 0, 0, 0)); |
|
571 |
entryObj->SetStartTimeL(stTime); |
|
572 |
||
573 |
TTime endTime(TDateTime(2007, EAugust, 8, 9, 30, 0, 0)); |
|
574 |
entryObj->SetEndTimeL(endTime); |
|
575 |
||
576 |
||
577 |
CAttendeeInfo* attendee = CAttendeeInfo::NewL(_L("roshan@gmail.com")); |
|
578 |
CleanupStack::PushL(attendee); |
|
579 |
attendee->SetRoleL(KAttRoleReqParticipant); |
|
580 |
attendee->SetStatusL(KAttStatusTentative); |
|
581 |
attendee->SetRsvp(EFalse); |
|
582 |
||
583 |
entryObj->AddAttendeeL(attendee); |
|
584 |
CleanupStack::PopAndDestroy(attendee); |
|
585 |
||
586 |
TRAPD( errno, service->AddL(KTestCal1File,entryObj,uids) ); |
|
587 |
||
588 |
if(errno == KErrNone && uids) |
|
589 |
{ |
|
590 |
arruids.Append(uids); |
|
591 |
uids = NULL; |
|
592 |
} |
|
593 |
||
594 |
if ( arruids.Count() > 0 ) |
|
595 |
{ |
|
596 |
RPointerArray<CCalEntry> entryArray; |
|
597 |
service->GetListL( KTestCal1File, arruids[0]->iLocalUID , entryArray ); |
|
598 |
if( entryArray.Count() == 1 ) |
|
599 |
{ |
|
600 |
RPointerArray<CCalAttendee> attendeeList; |
|
601 |
attendeeList = entryArray[0]->AttendeesL(); |
|
602 |
TInt count = attendeeList.Count(); |
|
603 |
||
604 |
if( count != 1 ) |
|
605 |
result = KErrGeneral; |
|
606 |
else |
|
607 |
{ |
|
608 |
if(attendeeList[0]->RoleL() != 0 || attendeeList[0]->StatusL() != 2) |
|
609 |
result = KErrGeneral; |
|
610 |
||
611 |
if(attendeeList[0]->Address().CompareF(_L("roshan@gmail.com")) != 0) |
|
612 |
result = KErrGeneral; |
|
613 |
} |
|
614 |
} |
|
615 |
||
616 |
else |
|
617 |
{ |
|
618 |
result = KErrGeneral; |
|
619 |
} |
|
620 |
entryArray.ResetAndDestroy(); |
|
621 |
||
622 |
} |
|
623 |
else |
|
624 |
result = KErrGeneral; |
|
625 |
||
626 |
arruids.ResetAndDestroy(); |
|
627 |
delete entryObj; |
|
628 |
||
629 |
RemoveCalendarFile( service, KTestCal1File ); |
|
630 |
||
631 |
delete service; |
|
632 |
||
633 |
__UHEAP_MARKEND; |
|
634 |
||
635 |
return result; |
|
636 |
||
637 |
} |
|
638 |
||
639 |
// ----------------------------------------------------------------------------- |
|
640 |
// Ctcal_add::?member_function |
|
641 |
// ?implementation_description |
|
642 |
// (other items were commented in a header). |
|
643 |
// ----------------------------------------------------------------------------- |
|
644 |
// |
|
645 |
/* |
|
646 |
TInt Ctcal_add::?member_function( |
|
647 |
CItemParser& aItem ) |
|
648 |
{ |
|
649 |
||
650 |
?code |
|
651 |
||
652 |
} |
|
653 |
*/ |
|
654 |
||
655 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
656 |
// None |
|
657 |
||
658 |
// End of File |