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