author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 17 Dec 2009 09:09:50 +0200 | |
changeset 26 | 5d0ec8b709be |
parent 10 | fc9cf246af83 |
child 34 | 5dae2c62e9b6 |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
#include <e32base.h> |
|
20 |
#include <e32def.h> |
|
21 |
||
22 |
||
23 |
#include "serviceerrno.h" |
|
24 |
#include "calendarheader.h" |
|
25 |
#include "entryattributes.h" |
|
26 |
#include "calendarservice.h" |
|
27 |
#include "calendarinterface.h" |
|
28 |
#include "calendarcallback.h" |
|
29 |
#include "calendariterableimpl.h" |
|
30 |
||
31 |
using namespace LIW; |
|
32 |
||
33 |
// --------------------------------------------------------------------------- |
|
34 |
// Two-phased constructor. |
|
35 |
// --------------------------------------------------------------------------- |
|
36 |
// |
|
37 |
CCalendarInterface* CCalendarInterface::NewL() |
|
38 |
{ |
|
39 |
CCalendarInterface* self = new (ELeave) CCalendarInterface(); |
|
40 |
CleanupStack::PushL( self ); |
|
41 |
self->ConstructL(); |
|
42 |
CleanupStack::Pop( self ); |
|
43 |
return self; |
|
44 |
} |
|
45 |
// --------------------------------------------------------------------------- |
|
46 |
// Destructor. |
|
47 |
// --------------------------------------------------------------------------- |
|
48 |
// |
|
49 |
CCalendarInterface::~CCalendarInterface() |
|
50 |
{ |
|
51 |
TInt count = iArrayCalEntryList.Count(); |
|
52 |
for(TInt index = 0; index < count; index++ ) |
|
53 |
{ |
|
54 |
iArrayCalEntryList[index]->SetResourceFree(); |
|
55 |
} |
|
56 |
||
57 |
iArrayCalEntryList.Reset(); |
|
58 |
delete iCalService; |
|
59 |
delete iErrorMessage; |
|
60 |
} |
|
61 |
||
62 |
// --------------------------------------------------------------------------- |
|
63 |
// Constructor |
|
64 |
// --------------------------------------------------------------------------- |
|
65 |
// |
|
66 |
CCalendarInterface::CCalendarInterface() |
|
67 |
{ |
|
68 |
} |
|
69 |
||
70 |
// --------------------------------------------------------------------------- |
|
71 |
// Symbian Constructor |
|
72 |
// --------------------------------------------------------------------------- |
|
73 |
// |
|
74 |
void CCalendarInterface::ConstructL() |
|
75 |
{ |
|
76 |
iCalService = CCalendarService::NewL(); |
|
77 |
} |
|
78 |
||
79 |
// --------------------------------------------------------------------------- |
|
80 |
// Executes the SAPI as per params |
|
81 |
// --------------------------------------------------------------------------- |
|
82 |
// |
|
83 |
void CCalendarInterface::ExecuteCmdL( const TDesC8& aCmdName, |
|
84 |
const CLiwGenericParamList& aInParamList, |
|
85 |
CLiwGenericParamList& aOutParamList, |
|
86 |
TUint aCmdOptions, |
|
87 |
MLiwNotifyCallback* aCallback ) |
|
88 |
{ |
|
89 |
TInt errcode = KErrNotSupported; |
|
90 |
TInt32 transactionId = -1; |
|
91 |
||
92 |
aOutParamList.AppendL(TLiwGenericParam( KErrorCode, |
|
93 |
TLiwVariant( ErrCodeConversion( KErrNone )))); |
|
94 |
||
95 |
TBool posBased; |
|
96 |
||
97 |
TPtrC contentType = GetContentType( aInParamList, posBased ); |
|
98 |
||
99 |
if ( ( contentType.CompareF( KContentCalendar ) != 0 ) && |
|
100 |
( contentType.CompareF( KContentCalendarEntry ) != 0 ) && |
|
101 |
( aCmdName.CompareF( KCmdCancel ) != 0) ) |
|
102 |
{ |
|
103 |
errcode = KErrArgument; |
|
104 |
AppendErrorMessageL( aCmdName, KContentType, KInvalid ); |
|
105 |
} |
|
106 |
||
107 |
else if (( aCallback && !( KLiwOptASyncronous & aCmdOptions )) || |
|
108 |
( !aCallback && ( KLiwOptASyncronous & aCmdOptions )) ) |
|
109 |
{ |
|
110 |
errcode = KErrArgument; |
|
111 |
AppendErrorMessageL(aCmdName, KNullDesC8, _L("Insufficent arguments for asynchronous request")); |
|
112 |
} |
|
113 |
||
114 |
else if ( aCmdName.CompareF( KCmdAdd ) == 0 ) |
|
115 |
{ |
|
116 |
if( !aCallback ) |
|
117 |
{ |
|
118 |
if ( contentType.CompareF( KContentCalendar ) == 0 ) |
|
119 |
{ |
|
120 |
TRAP(errcode, AddCalendarL( aInParamList, aOutParamList, posBased )); |
|
121 |
} |
|
122 |
else if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
|
123 |
{ |
|
124 |
TRAP(errcode, AddCalendarEntryL( aInParamList, aOutParamList, posBased )); |
|
125 |
} |
|
126 |
} |
|
127 |
else |
|
128 |
{ |
|
129 |
AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); |
|
130 |
} |
|
131 |
} |
|
132 |
||
133 |
else if ( aCmdName.CompareF( KCmdDelete ) == 0 ) |
|
134 |
{ |
|
135 |
if( contentType.CompareF( KContentCalendar ) == 0 ) |
|
136 |
{ |
|
137 |
if ( !aCallback )//deletion of calendars only synchronous |
|
138 |
{ |
|
139 |
TRAP(errcode, DeleteCalendarL( aInParamList, posBased) ); |
|
140 |
} |
|
141 |
else |
|
142 |
{ |
|
143 |
AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); |
|
144 |
} |
|
145 |
} |
|
146 |
else if ( contentType.CompareF( KContentCalendarEntry ) == 0) |
|
147 |
{ |
|
148 |
TRAP(errcode, DeleteCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); |
|
149 |
} |
|
150 |
} |
|
151 |
||
152 |
else if ( aCmdName.CompareF( KCmdImport ) == 0 ) |
|
153 |
{ |
|
154 |
if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
|
155 |
{ |
|
156 |
TRAP(errcode, ImportCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); |
|
157 |
} |
|
158 |
else |
|
159 |
{ |
|
160 |
AppendErrorMessageL( aCmdName, KContentType, KInvalid ); |
|
161 |
} |
|
162 |
} |
|
163 |
||
164 |
else if ( aCmdName.CompareF( KCmdExport ) == 0 ) |
|
165 |
{ |
|
166 |
if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
|
167 |
{ |
|
168 |
TRAP(errcode, ExportCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); |
|
169 |
} |
|
170 |
else |
|
171 |
{ |
|
172 |
AppendErrorMessageL( aCmdName, KContentType, KInvalid ); |
|
173 |
} |
|
174 |
} |
|
175 |
||
176 |
else if ( aCmdName.CompareF( KCmdGetList ) == 0 ) |
|
177 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
178 |
|
5 | 179 |
if ( contentType.CompareF( KContentCalendar ) == 0 ) |
180 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
181 |
if( !aCallback ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
182 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
183 |
TRAP(errcode, GetListCalendarL( aInParamList, aOutParamList, posBased )); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
184 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
185 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
186 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
187 |
AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
188 |
} |
5 | 189 |
} |
190 |
else if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
|
191 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
192 |
TRAP(errcode, GetListCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); |
5 | 193 |
} |
194 |
} |
|
195 |
||
196 |
else if ( aCmdName.CompareF( KCmdReqNot ) == 0 ) |
|
197 |
{ |
|
198 |
if (( contentType.CompareF( KContentCalendarEntry ) == 0 ) && |
|
199 |
aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) |
|
200 |
{ |
|
201 |
TRAP(errcode, RequestNotificationL(aInParamList, aCallback, posBased, transactionId )); |
|
202 |
} |
|
203 |
else if( !aCallback || !( KLiwOptASyncronous & aCmdOptions )) |
|
204 |
{ |
|
205 |
AppendErrorMessageL(aCmdName, KNullDesC8, KInvalidAsyncParam); |
|
206 |
} |
|
207 |
else |
|
208 |
{ |
|
209 |
AppendErrorMessageL( aCmdName, KContentType, KInvalid ); |
|
210 |
} |
|
211 |
} |
|
212 |
||
213 |
else if ( aCmdName.CompareF( KCmdCancel ) == 0 ) |
|
214 |
{ |
|
215 |
TInt32 transactionId; |
|
216 |
if( (KLiwOptCancel & aCmdOptions ) && !aCallback ) |
|
217 |
{ |
|
218 |
TRAP( errcode, GetTransactionIdL( aInParamList, transactionId ) ); |
|
219 |
if( errcode == KErrNone ) |
|
220 |
{ |
|
221 |
errcode = iCalService->Cancel( transactionId ); |
|
222 |
if ( errcode == KErrNotFound ) |
|
223 |
{ |
|
224 |
AppendErrorMessageL( aCmdName, KTransactionID, KInvalid ); |
|
225 |
} |
|
226 |
else if( errcode == KErrInUse ) |
|
227 |
{ |
|
228 |
AppendErrorMessageL( aCmdName, KNullDesC8, KServiceInUse ); |
|
229 |
} |
|
230 |
} |
|
231 |
} |
|
232 |
else |
|
233 |
{ |
|
234 |
AppendErrorMessageL( aCmdName, KNullDesC8, KInvalidCancelParam ); |
|
235 |
} |
|
236 |
} |
|
237 |
||
238 |
else |
|
239 |
{ |
|
240 |
AppendErrorMessageL(aCmdName, KNullDesC8, KCmdInvalid); |
|
241 |
} |
|
242 |
||
243 |
// Append transaction id in case of asynchronous requests |
|
244 |
if( aCallback && ( KLiwOptASyncronous & aCmdOptions ) && |
|
245 |
( errcode == KErrNone ) && ( transactionId != -1 ) ) |
|
246 |
{ |
|
247 |
aOutParamList.AppendL(TLiwGenericParam( KTransactionID, |
|
248 |
TLiwVariant( TInt32( transactionId )))); |
|
249 |
} |
|
250 |
||
251 |
if( errcode != KErrNone ) |
|
252 |
{ |
|
253 |
aOutParamList.Reset(); |
|
254 |
aOutParamList.AppendL(TLiwGenericParam( KErrorCode, |
|
255 |
TLiwVariant(ErrCodeConversion(errcode)))); |
|
256 |
||
257 |
if ( iErrorMessage ) |
|
258 |
{ |
|
259 |
aOutParamList.AppendL(TLiwGenericParam( KErrorMessage, |
|
260 |
TLiwVariant(iErrorMessage->Des()))); |
|
261 |
delete iErrorMessage; |
|
262 |
iErrorMessage = NULL; |
|
263 |
} |
|
264 |
} |
|
265 |
} |
|
266 |
||
267 |
// --------------------------------------------------------------------------- |
|
268 |
// Closes the interface |
|
269 |
// --------------------------------------------------------------------------- |
|
270 |
// |
|
271 |
void CCalendarInterface::Close() |
|
272 |
{ |
|
273 |
delete this; |
|
274 |
} |
|
275 |
||
276 |
// --------------------------------------------------------------------------- |
|
277 |
// Issues Add Calendar request to Calendar Service |
|
278 |
// --------------------------------------------------------------------------- |
|
279 |
// |
|
280 |
void CCalendarInterface::AddCalendarL(const CLiwGenericParamList& aInParamList, |
|
281 |
CLiwGenericParamList& /*aOutParamList*/, |
|
282 |
const TBool aPosBased ) |
|
283 |
{ |
|
284 |
HBufC* calName = NULL; |
|
285 |
GetCalendarNameL( aInParamList, KCmdAdd, KItem, aPosBased, calName ); |
|
286 |
if ( calName && calName->Des().Length() ) |
|
287 |
{ |
|
288 |
CleanupStack::PushL(calName); |
|
289 |
iCalService->AddL( calName->Des() ); |
|
290 |
CleanupStack::PopAndDestroy(calName); |
|
291 |
} |
|
292 |
else |
|
293 |
{ |
|
294 |
AppendErrorMessageL( KCmdAdd, KCalendarName, KMissing ); |
|
295 |
User::Leave( KErrArgument ); |
|
296 |
} |
|
297 |
} |
|
298 |
||
299 |
// --------------------------------------------------------------------------- |
|
300 |
// Issues Add Calendar Entry request to Calendar Service |
|
301 |
// --------------------------------------------------------------------------- |
|
302 |
// |
|
303 |
void CCalendarInterface::AddCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
304 |
CLiwGenericParamList& aOutParamList, |
|
305 |
const TBool aPosBased ) |
|
306 |
{ |
|
307 |
HBufC* calName = NULL; |
|
308 |
||
309 |
GetCalendarNameL( aInParamList, KCmdAdd, KItem, aPosBased, calName ); |
|
310 |
||
311 |
if ( calName ) |
|
312 |
{ |
|
313 |
CleanupStack::PushL(calName); |
|
314 |
} |
|
315 |
||
316 |
// Get New entry attributes from input param list |
|
317 |
CEntryAttributes* addAttributes = GetAddParametersL( aInParamList, |
|
318 |
calName ? calName->Des() : TPtrC(), |
|
319 |
aPosBased ); |
|
320 |
||
321 |
CleanupStack::PushL( addAttributes ); |
|
322 |
||
323 |
TUIDSet* uidset = NULL; |
|
324 |
||
325 |
iCalService->AddL( calName ? calName->Des() : TPtrC() , addAttributes, uidset ); |
|
326 |
||
327 |
// Return Uid of the newly added entry |
|
328 |
if ( uidset ) |
|
329 |
{ |
|
330 |
CleanupStack::PushL( uidset ); |
|
331 |
||
332 |
HBufC* globalUid = HBufC::NewL( uidset->iGlobalUID->Length() + 1 ); |
|
333 |
CleanupStack::PushL( globalUid ); |
|
334 |
globalUid->Des().Copy( uidset->iGlobalUID->Des() ); |
|
335 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant(*globalUid) )); |
|
336 |
CleanupStack::PopAndDestroy( globalUid ); |
|
337 |
||
338 |
CleanupStack::Pop( uidset ); |
|
339 |
||
340 |
delete uidset; |
|
341 |
||
342 |
CleanupStack::PopAndDestroy( addAttributes ); |
|
343 |
} |
|
344 |
else |
|
345 |
{ |
|
346 |
AppendErrorMessageL( KCmdAdd, KNullDesC8, KCmdFailed ); |
|
347 |
User::Leave( KErrGeneral ); |
|
348 |
} |
|
349 |
||
350 |
if ( calName ) |
|
351 |
{ |
|
352 |
CleanupStack::PopAndDestroy(calName); |
|
353 |
} |
|
354 |
} |
|
355 |
||
356 |
// --------------------------------------------------------------------------- |
|
357 |
// Issues Delete Calendar request to Calendar Service |
|
358 |
// --------------------------------------------------------------------------- |
|
359 |
// |
|
360 |
void CCalendarInterface::DeleteCalendarL( const CLiwGenericParamList& aInParamList, TBool aPosBased) |
|
361 |
{ |
|
362 |
HBufC* calName = NULL; |
|
363 |
GetCalendarNameL( aInParamList, KCmdDelete, KData, aPosBased, calName ); |
|
364 |
if ( calName && calName->Length() ) |
|
365 |
{ |
|
366 |
CleanupStack::PushL( calName ); |
|
367 |
if( CheckCalendarInUse( *calName ) ) |
|
368 |
{ |
|
369 |
AppendErrorMessageL( KCmdDelete, KCalendarName, _L(" in use.") ); |
|
370 |
User::Leave( KErrInUse ); |
|
371 |
} |
|
372 |
iCalService->DeleteL( calName->Des() ); |
|
373 |
CleanupStack::PopAndDestroy( calName ); |
|
374 |
} |
|
375 |
else |
|
376 |
{ |
|
377 |
AppendErrorMessageL( KCmdDelete, KCalendarName, KMissing ); |
|
378 |
User::Leave( KErrArgument ); |
|
379 |
} |
|
380 |
} |
|
381 |
||
382 |
// --------------------------------------------------------------------------- |
|
383 |
// Issues Delete Calendar Entry request to Calendar Service |
|
384 |
// --------------------------------------------------------------------------- |
|
385 |
// |
|
386 |
void CCalendarInterface::DeleteCalendarEntryL( const CLiwGenericParamList& aInParamList, |
|
387 |
CLiwGenericParamList& /*aOutParamList*/, |
|
388 |
TUint aCmdOptions, |
|
389 |
MLiwNotifyCallback* aCallback, |
|
390 |
const TBool aPosBased, |
|
391 |
TInt32& aTransactionId ) |
|
392 |
{ |
|
393 |
HBufC* calName = NULL; |
|
394 |
||
395 |
GetCalendarNameL( aInParamList, KCmdDelete, KData, aPosBased, calName ); |
|
396 |
||
397 |
if ( calName ) |
|
398 |
{ |
|
399 |
CleanupStack::PushL(calName); |
|
400 |
} |
|
401 |
||
402 |
CCalendarFilter* filter = CCalendarFilter::NewL(); |
|
403 |
||
404 |
CleanupStack::PushL(filter); |
|
405 |
||
406 |
// Get filter parameters from input list |
|
407 |
GetDeleteEntryFilterL( aInParamList, *filter, aPosBased ); |
|
408 |
||
409 |
// Leave if there was no filter |
|
410 |
if( ! filter->Filter() ) |
|
411 |
{ |
|
412 |
AppendErrorMessageL( KCmdDelete, KData, KMissing ); |
|
413 |
User::Leave( KErrArgument ); |
|
414 |
} |
|
415 |
||
416 |
// Issue asynchronous request if Callback present |
|
417 |
if ( aCallback && ( KLiwOptASyncronous & aCmdOptions )) |
|
418 |
{ |
|
419 |
aTransactionId = aCallback->GetTransactionID(); |
|
420 |
||
421 |
CCalCallbackInt* callback = CCalCallbackInt::NewL( aCallback, aInParamList, aTransactionId ); |
|
422 |
||
423 |
CleanupStack::PushL( callback ); |
|
424 |
||
425 |
iCalService->DeleteL( calName ? calName->Des() : TPtrC() , filter, callback ); |
|
426 |
||
427 |
CleanupStack::Pop( callback ); |
|
428 |
} |
|
429 |
// Synchronous request |
|
430 |
else |
|
431 |
{ |
|
432 |
iCalService->DeleteL( calName ? calName->Des() : TPtrC(), filter ); |
|
433 |
} |
|
434 |
||
435 |
CleanupStack::PopAndDestroy(filter); |
|
436 |
||
437 |
if ( calName ) |
|
438 |
{ |
|
439 |
CleanupStack::PopAndDestroy(calName); |
|
440 |
} |
|
441 |
||
442 |
} |
|
443 |
||
444 |
// --------------------------------------------------------------------------- |
|
445 |
// Issues GetList Calendar request to Calendar Service |
|
446 |
// --------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
void CCalendarInterface::GetListCalendarL(const CLiwGenericParamList& aInParamList, |
|
449 |
CLiwGenericParamList& aOutParamList, |
|
450 |
const TBool aPosBased ) |
|
451 |
{ |
|
452 |
const TLiwGenericParam* filter = NULL; |
|
453 |
||
454 |
if ( aPosBased ) |
|
455 |
{ |
|
456 |
if ( aInParamList.Count() > 1 ) |
|
457 |
filter = &aInParamList[1]; |
|
458 |
} |
|
459 |
else |
|
460 |
{ |
|
461 |
TInt pos = 0 ; |
|
462 |
filter = aInParamList.FindFirst( pos, KFilter ); |
|
463 |
} |
|
464 |
||
465 |
TBool defaultCalendar = EFalse; |
|
466 |
||
467 |
// Extracting "Default" input param |
|
468 |
// If True, Only default calendar is returned |
|
469 |
if ( filter ) |
|
470 |
{ |
|
471 |
const CLiwMap* inputMap = filter->Value().AsMap(); |
|
472 |
if ( inputMap ) |
|
473 |
{ |
|
474 |
TLiwVariant defaultvalue; |
|
475 |
if( inputMap->FindL( KDefault, defaultvalue)) |
|
476 |
{ |
|
477 |
ValidateParamTypeL( defaultvalue, LIW::EVariantTypeTBool, |
|
478 |
KCmdGetList, KDefault, KInvalid ); |
|
479 |
||
480 |
defaultCalendar = defaultvalue.AsTBool(); |
|
481 |
} |
|
482 |
defaultvalue.Reset(); |
|
483 |
} |
|
484 |
else |
|
485 |
{ |
|
486 |
AppendErrorMessageL( KCmdGetList, KFilter, KInvalid ); |
|
487 |
User::Leave(KErrArgument); |
|
488 |
} |
|
489 |
} |
|
490 |
||
491 |
CDesCArray* returnList = NULL; |
|
492 |
||
493 |
// Issue request to Calendar Service |
|
494 |
iCalService->GetListL( returnList, defaultCalendar ); |
|
495 |
||
496 |
CleanupStack::PushL( returnList ); |
|
497 |
||
498 |
// Encapsulate the returned list as Iterable |
|
499 |
CIterableCalendarList* iterList = CIterableCalendarList::NewL( returnList ); |
|
500 |
||
501 |
CleanupStack::Pop( returnList ); |
|
502 |
||
503 |
CleanupClosePushL( *iterList ); |
|
504 |
||
505 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterList ))); |
|
506 |
||
507 |
CleanupStack::PopAndDestroy( iterList ); |
|
508 |
||
509 |
} |
|
510 |
||
511 |
// --------------------------------------------------------------------------- |
|
512 |
// Issues GetList Calendar Entry request to Calendar Service |
|
513 |
// --------------------------------------------------------------------------- |
|
514 |
// |
|
515 |
void CCalendarInterface::GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
516 |
CLiwGenericParamList& aOutParamList, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
517 |
TUint aCmdOptions, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
518 |
MLiwNotifyCallback* aCallback , |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
519 |
const TBool aPosBased, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
520 |
TInt32& aTransactionId) |
5 | 521 |
{ |
522 |
const TLiwGenericParam* filterParam = NULL; |
|
523 |
||
524 |
if ( aPosBased ) |
|
525 |
{ |
|
526 |
if ( aInParamList.Count() > 1 ) |
|
527 |
filterParam = &aInParamList[1]; |
|
528 |
} |
|
529 |
else |
|
530 |
{ |
|
531 |
TInt pos = 0 ; |
|
532 |
filterParam = aInParamList.FindFirst( pos, KFilter ); |
|
533 |
} |
|
534 |
||
535 |
CCalendarFilter* filter = CCalendarFilter::NewL(); |
|
536 |
||
537 |
CleanupStack::PushL( filter ); |
|
538 |
||
539 |
HBufC* calName = NULL; |
|
540 |
||
541 |
// Extract filter information from input param list |
|
542 |
if ( filterParam ) |
|
543 |
{ |
|
544 |
const CLiwMap* inputMap = filterParam->Value().AsMap(); |
|
545 |
if ( inputMap ) |
|
546 |
{ |
|
547 |
TLiwVariant param; |
|
548 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , ¶m)); |
|
549 |
||
550 |
||
551 |
if( inputMap->FindL( KId, param )) |
|
552 |
{ |
|
553 |
ValidateParamTypeL( param, LIW::EVariantTypeDesC, |
|
554 |
KCmdGetList, KId, KInvalid ); |
|
555 |
||
556 |
//filter->AddGuidL( param.AsData() ); |
|
557 |
HBufC8* globalUid = HBufC8::NewL(param.AsDes().Length()); |
|
558 |
CleanupStack::PushL( globalUid ); |
|
559 |
GetGlobalUid(param.AsDes(), globalUid->Des()); |
|
560 |
filter->AddGuidL( globalUid->Des() ); |
|
561 |
CleanupStack::PopAndDestroy( globalUid ); |
|
562 |
} |
|
563 |
||
564 |
if( inputMap->FindL( KLocalId, param )) |
|
565 |
{ |
|
566 |
ValidateParamTypeL( param, LIW::EVariantTypeDesC, |
|
567 |
KCmdGetList, KLocalId, KInvalid ); |
|
568 |
||
569 |
//filter->AddLocalUid( param.AsTUint() ); |
|
570 |
TCalLocalUid localUid; |
|
571 |
GetLocalUid( param.AsDes(), localUid ); |
|
572 |
filter->AddLocalUid( localUid ); |
|
573 |
} |
|
574 |
||
575 |
if( inputMap->FindL( KStartRange, param)) |
|
576 |
{ |
|
577 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
578 |
KCmdGetList, KStartRange, KInvalid ); |
|
579 |
||
580 |
filter->SetStartTimeL( param.AsTTime() ); |
|
581 |
} |
|
582 |
||
583 |
if( inputMap->FindL( KEndRange, param)) |
|
584 |
{ |
|
585 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
586 |
KCmdGetList, KEndRange, KInvalid ); |
|
587 |
||
588 |
filter->SetEndTimeL( param.AsTTime() ); |
|
589 |
} |
|
590 |
||
591 |
if( inputMap->FindL( KSearchText, param)) |
|
592 |
{ |
|
593 |
ValidateParamTypeL( param, LIW::EVariantTypeDesC, |
|
594 |
KCmdGetList, KSearchText, KInvalid ); |
|
595 |
||
596 |
filter->SetFilterTextL( param.AsDes() ); |
|
597 |
} |
|
598 |
||
599 |
if( inputMap->FindL( KEntryType, param)) |
|
600 |
{ |
|
601 |
ValidateParamTypeL( param, LIW::EVariantTypeDesC, |
|
602 |
KCmdGetList, _L8("Entry Type") , KInvalid ); |
|
603 |
||
604 |
filter->SetFilterTypeL( param.AsDes() ); |
|
605 |
} |
|
606 |
||
607 |
if( inputMap->FindL( KCalendarName, param)) |
|
608 |
{ |
|
609 |
ValidateParamTypeL( param, LIW::EVariantTypeDesC, |
|
610 |
KCmdGetList, KCalendarName, KInvalid ); |
|
611 |
||
612 |
calName = param.AsDes().AllocL(); |
|
613 |
} |
|
614 |
||
615 |
CleanupStack::Pop( ¶m); |
|
616 |
param.Reset(); |
|
617 |
} |
|
618 |
else |
|
619 |
{ |
|
620 |
AppendErrorMessageL(KCmdGetList, KFilter, KInvalid); |
|
621 |
User::Leave(KErrArgument); |
|
622 |
} |
|
623 |
} |
|
624 |
if( calName ) |
|
625 |
CleanupStack::PushL(calName); |
|
626 |
TPtrC calendarName( calName ? calName->Des() : TPtrC() ); |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
627 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
628 |
//asynchronous version of getlist is called if callback is provided |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
629 |
if ( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
630 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
631 |
aTransactionId = aCallback->GetTransactionID(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
632 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
633 |
CCalCallbackCalEntryList* callback = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
634 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
635 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
636 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
637 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
638 |
if(( filter->Filter() & EFilterGUid ) || ( filter->Filter() & EFilterLUid )) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
639 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
640 |
callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, ETrue ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
641 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
642 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
643 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
644 |
callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, EFalse ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
645 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
646 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
647 |
CleanupStack::PushL( callback ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
648 |
if ( filter->Filter() & EFilterGUid ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
649 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
650 |
// In case of GlobalUid only one entry is returned. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
651 |
iCalService->GetListL( calendarName, (*filter->GuidList())[0], callback); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
652 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
653 |
else if( filter->Filter() & EFilterLUid ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
654 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
655 |
// In case of LocalUid there can be more than one entry(child entries) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
656 |
iCalService->GetListL( calendarName, (filter->LocalUidList())[0], callback); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
657 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
658 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
659 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
660 |
iCalService->GetListL( calendarName , filter, callback ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
661 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
662 |
aOutParamList.AppendL(TLiwGenericParam( KTransactionID, TLiwVariant( aTransactionId ))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
663 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
664 |
CleanupStack::Pop( callback ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
665 |
} |
5 | 666 |
|
667 |
// Return list of CalendarEntries if any of LocalUid or GlobalUid is passed as Filter. |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
668 |
else if ( ( filter->Filter() & EFilterGUid ) || |
5 | 669 |
( filter->Filter() & EFilterLUid ) ) |
670 |
{ |
|
671 |
CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, calendarName, ETrue ); |
|
672 |
CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); |
|
673 |
||
674 |
||
675 |
if ( filter->Filter() & EFilterLUid ) |
|
676 |
{ |
|
677 |
// In case of LocalUid only one entry is returned. |
|
678 |
iCalService->GetListL( calendarName, (filter->LocalUidList())[0], iterEntryList->EntryArray()); |
|
679 |
} |
|
680 |
else |
|
681 |
{ |
|
682 |
// In case of GlobalUid there can be more than one entry(child entries) |
|
683 |
iCalService->GetListL( calendarName, (*filter->GuidList())[0], iterEntryList->EntryArray()); |
|
684 |
} |
|
685 |
||
686 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterEntryList ))); |
|
687 |
iterEntryList->DecRef(); |
|
688 |
||
689 |
iArrayCalEntryList.Append( iterEntryList ); |
|
690 |
||
691 |
CleanupStack::Pop( iterEntryList ); |
|
692 |
} |
|
693 |
// Return list of Instances if none of LocalUid or GlobalUid is passed as Filter. |
|
694 |
else |
|
695 |
{ |
|
696 |
CIterableCalEntryList* iterInstList = CIterableCalEntryList::NewL( *this, calendarName, EFalse ); |
|
697 |
CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterInstList ) ); |
|
698 |
||
699 |
iCalService->GetListL( calendarName, filter, iterInstList->InstanceArray()); |
|
700 |
||
701 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterInstList ))); |
|
702 |
iterInstList->DecRef(); |
|
703 |
||
704 |
iArrayCalEntryList.Append( iterInstList ); |
|
705 |
||
706 |
CleanupStack::Pop( iterInstList ); |
|
707 |
} |
|
708 |
||
709 |
if ( calName ) |
|
710 |
CleanupStack::PopAndDestroy(calName); |
|
711 |
||
712 |
CleanupStack::PopAndDestroy(filter); |
|
713 |
} |
|
714 |
||
715 |
// --------------------------------------------------------------------------- |
|
716 |
// Issues Import Calendar Entry request to Calendar Service |
|
717 |
// --------------------------------------------------------------------------- |
|
718 |
// |
|
719 |
void CCalendarInterface::ImportCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
720 |
CLiwGenericParamList& aOutParamList, |
|
721 |
TUint aCmdOptions, |
|
722 |
MLiwNotifyCallback* aCallback , |
|
723 |
const TBool aPosBased, |
|
724 |
TInt32& aTransactionId ) |
|
725 |
{ |
|
726 |
HBufC8* inputBuffer = NULL; |
|
727 |
||
728 |
HBufC* calName = NULL; |
|
729 |
||
730 |
HBufC* importFile = NULL; |
|
731 |
||
732 |
HBufC8* calendarFormat = NULL; |
|
733 |
||
734 |
// Extract input information from input param list |
|
735 |
GetCalendarNameL( aInParamList, KCmdImport, KData, aPosBased, calName ); |
|
736 |
if ( calName ) |
|
737 |
{ |
|
738 |
CleanupStack::PushL( calName ); |
|
739 |
} |
|
740 |
||
741 |
GetDesCFieldFromMapL( aInParamList, KCmdImport, KData, KImExFileName, aPosBased, importFile ); |
|
742 |
if ( importFile ) |
|
743 |
{ |
|
744 |
CleanupStack::PushL( importFile ); |
|
745 |
} |
|
746 |
||
747 |
GetDesC8FieldFromMapL( aInParamList, KCmdImport, KData, KInputBuffer, aPosBased, inputBuffer ); |
|
748 |
if ( inputBuffer ) |
|
749 |
{ |
|
750 |
CleanupStack::PushL( inputBuffer ); |
|
751 |
} |
|
752 |
else if ( !importFile ) |
|
753 |
{ |
|
754 |
AppendErrorMessageL( KCmdImport, KImExFileName, KMissing ); |
|
755 |
User::Leave( KErrArgument ); |
|
756 |
} |
|
757 |
||
758 |
HBufC* tmpFormat = NULL; |
|
759 |
GetDesCFieldFromMapL( aInParamList, KCmdImport, KData, KCalendarFormat, aPosBased, tmpFormat ); |
|
760 |
if ( tmpFormat ) |
|
761 |
{ |
|
762 |
CleanupStack::PushL( tmpFormat ); |
|
763 |
calendarFormat = HBufC8::NewL(tmpFormat->Des().Length()); |
|
764 |
calendarFormat->Des().Copy(tmpFormat->Des()); |
|
765 |
CleanupStack::PopAndDestroy( tmpFormat ); |
|
766 |
CleanupStack::PushL( calendarFormat ); |
|
767 |
} |
|
768 |
else |
|
769 |
{ |
|
770 |
AppendErrorMessageL( KCmdImport, KCalendarFormat, KMissing ); |
|
771 |
User::Leave( KErrArgument ); |
|
772 |
} |
|
773 |
||
774 |
||
775 |
//asynchronous version of import is called if callback is provided |
|
776 |
if ( aCallback && ( KLiwOptASyncronous & aCmdOptions )) |
|
777 |
{ |
|
778 |
aTransactionId = aCallback->GetTransactionID(); |
|
779 |
||
780 |
CCalCallbackBaseUIDSet* callback = CCalCallbackBaseUIDSet::NewL( aCallback, aInParamList, aTransactionId); |
|
781 |
||
782 |
CleanupStack::PushL( callback ); |
|
783 |
||
784 |
if ( inputBuffer ) |
|
785 |
{ |
|
786 |
// Import from the input buffer |
|
787 |
iCalService->ImportL( calName ? calName->Des() : TPtrC(), |
|
788 |
*calendarFormat, *inputBuffer, callback ); |
|
789 |
} |
|
790 |
else |
|
791 |
{ |
|
792 |
// Import from the given file |
|
793 |
iCalService->ImportL( calName ? calName->Des() : TPtrC(), |
|
794 |
*calendarFormat , *importFile, callback ); |
|
795 |
} |
|
796 |
||
797 |
CleanupStack::Pop( callback ); |
|
798 |
} |
|
799 |
else //synchronous version of import |
|
800 |
{ |
|
801 |
RPointerArray<TUIDSet> outputUIDSet;//Push on to CalennupStack |
|
802 |
||
803 |
if ( inputBuffer ) |
|
804 |
{ |
|
805 |
// Import from the input buffer |
|
806 |
iCalService->ImportL( calName ? calName->Des() : TPtrC(), |
|
807 |
*calendarFormat , *inputBuffer, outputUIDSet ); |
|
808 |
} |
|
809 |
else |
|
810 |
{ |
|
811 |
// Import from the input file |
|
812 |
iCalService->ImportL( calName ? calName->Des() : TPtrC(), |
|
813 |
*calendarFormat , *importFile, outputUIDSet ); |
|
814 |
} |
|
815 |
||
816 |
// Set output to output param |
|
817 |
SetImportOutputL( outputUIDSet, aOutParamList ); |
|
818 |
||
819 |
outputUIDSet.ResetAndDestroy(); |
|
820 |
} |
|
821 |
||
822 |
CleanupStack::PopAndDestroy( calendarFormat ); |
|
823 |
||
824 |
if ( inputBuffer ) |
|
825 |
CleanupStack::PopAndDestroy( inputBuffer ); |
|
826 |
||
827 |
if ( importFile ) |
|
828 |
CleanupStack::PopAndDestroy( importFile ); |
|
829 |
||
830 |
if ( calName ) |
|
831 |
CleanupStack::PopAndDestroy( calName ); |
|
832 |
} |
|
833 |
||
834 |
// --------------------------------------------------------------------------- |
|
835 |
// Issues Export Calendar Entry request to Calendar Service |
|
836 |
// --------------------------------------------------------------------------- |
|
837 |
// |
|
838 |
void CCalendarInterface::ExportCalendarEntryL(const CLiwGenericParamList& aInParamList, |
|
839 |
CLiwGenericParamList& aOutParamList, |
|
840 |
TUint aCmdOptions, |
|
841 |
MLiwNotifyCallback* aCallback , |
|
842 |
const TBool aPosBased, |
|
843 |
TInt32& aTransactionId ) |
|
844 |
{ |
|
845 |
HBufC* calendarName = NULL; |
|
846 |
||
847 |
HBufC8* exportFormat = NULL; |
|
848 |
||
849 |
CCalendarExportParams* calendarExportParams = CCalendarExportParams::NewL(); |
|
850 |
||
851 |
CleanupStack::PushL( calendarExportParams ); |
|
852 |
||
853 |
// Extract input information from input param list |
|
854 |
GetCalendarNameL( aInParamList, KCmdExport, KData, aPosBased, calendarName ); |
|
855 |
if ( calendarName ) |
|
856 |
{ |
|
857 |
CleanupStack::PushL( calendarName ); |
|
858 |
} |
|
859 |
||
860 |
HBufC* tmpFormat = NULL; |
|
861 |
GetDesCFieldFromMapL( aInParamList, KCmdExport, KData, KCalendarFormat, aPosBased, tmpFormat ); |
|
862 |
if ( tmpFormat ) |
|
863 |
{ |
|
864 |
CleanupStack::PushL( tmpFormat ); |
|
865 |
exportFormat = HBufC8::NewL(tmpFormat->Des().Length()); |
|
866 |
exportFormat->Des().Copy(tmpFormat->Des()); |
|
867 |
CleanupStack::PopAndDestroy( tmpFormat ); |
|
868 |
CleanupStack::PushL( exportFormat ); |
|
869 |
} |
|
870 |
else |
|
871 |
{ |
|
872 |
AppendErrorMessageL( KCmdExport, KCalendarFormat, KMissing ); |
|
873 |
User::Leave( KErrArgument ); |
|
874 |
} |
|
875 |
||
876 |
// Extract input information from input param list |
|
877 |
GetExportInputL( aInParamList , aPosBased , *calendarExportParams ); |
|
878 |
||
879 |
//asynchronous version of Export is called if callback is provided |
|
880 |
if ( aCallback && ( KLiwOptASyncronous & aCmdOptions )) |
|
881 |
{ |
|
882 |
aTransactionId = aCallback->GetTransactionID(); |
|
883 |
||
884 |
CCalCallbackBaseBuffer* callback = CCalCallbackBaseBuffer::NewL( aCallback, aInParamList, aTransactionId ); |
|
885 |
||
886 |
CleanupStack::PushL( callback ); |
|
887 |
||
888 |
iCalService->ExportL( calendarName ? calendarName->Des() : TPtrC(), |
|
889 |
*exportFormat, calendarExportParams , callback ); |
|
890 |
||
891 |
CleanupStack::Pop( callback ); |
|
892 |
} |
|
893 |
else //synchronous version of Export |
|
894 |
{ |
|
895 |
HBufC8* outputBuffer = NULL; |
|
896 |
||
897 |
iCalService->ExportL( calendarName ? calendarName->Des() : TPtrC() , |
|
898 |
*exportFormat, calendarExportParams , outputBuffer ); |
|
899 |
||
900 |
// outputBuffer is NULL in case export is done to file |
|
901 |
if ( outputBuffer ) |
|
902 |
{ |
|
903 |
CleanupStack::PushL( outputBuffer ); |
|
904 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( *outputBuffer ) ) ); |
|
905 |
CleanupStack::PopAndDestroy( outputBuffer ); |
|
906 |
} |
|
907 |
} |
|
908 |
||
909 |
CleanupStack::PopAndDestroy( exportFormat ); |
|
910 |
||
911 |
if ( calendarName ) |
|
912 |
CleanupStack::PopAndDestroy( calendarName ); |
|
913 |
||
914 |
CleanupStack::PopAndDestroy( calendarExportParams ); |
|
915 |
} |
|
916 |
||
917 |
||
918 |
// --------------------------------------------------------------------------- |
|
919 |
// Issues Change Notification request to Calendar Service |
|
920 |
// --------------------------------------------------------------------------- |
|
921 |
// |
|
922 |
void CCalendarInterface::RequestNotificationL( const CLiwGenericParamList& aInParamList, |
|
923 |
MLiwNotifyCallback* aCallback, |
|
924 |
const TBool aPosBased, |
|
925 |
TInt32& aTransactionId ) |
|
926 |
{ |
|
927 |
HBufC* calName = NULL; |
|
928 |
||
929 |
GetCalendarNameL( aInParamList, KCmdReqNot, KFilter, aPosBased, calName ); |
|
930 |
||
931 |
if ( calName ) |
|
932 |
{ |
|
933 |
CleanupStack::PushL(calName); |
|
934 |
} |
|
935 |
||
936 |
CCalendarFilter* filter = CCalendarFilter::NewL(); |
|
937 |
||
938 |
CleanupStack::PushL(filter); |
|
939 |
||
940 |
// Get Notification filter |
|
941 |
GetNotificationFilterL( aInParamList, *filter, aPosBased ); |
|
942 |
||
943 |
aTransactionId = aCallback->GetTransactionID(); |
|
944 |
||
945 |
CCalCallbackChangeNotify* callback = CCalCallbackChangeNotify::NewL( aCallback, aInParamList, aTransactionId ); |
|
946 |
||
947 |
CleanupStack::PushL( callback ); |
|
948 |
||
949 |
// Issue request |
|
950 |
iCalService->StartChangeNotifyL( calName ? calName->Des() : TPtrC(), filter, callback ); |
|
951 |
||
952 |
CleanupStack::Pop( callback ); |
|
953 |
||
954 |
CleanupStack::PopAndDestroy(filter); |
|
955 |
||
956 |
if ( calName ) |
|
957 |
{ |
|
958 |
CleanupStack::PopAndDestroy(calName); |
|
959 |
} |
|
960 |
||
961 |
} |
|
962 |
||
963 |
// --------------------------------------------------------------------------- |
|
964 |
// Get content type from input param list |
|
965 |
// --------------------------------------------------------------------------- |
|
966 |
// |
|
967 |
TPtrC CCalendarInterface::GetContentType(const CLiwGenericParamList& aInParamList, TBool& aPosBased ) |
|
968 |
{ |
|
969 |
TInt pos = 0; |
|
970 |
||
971 |
const TLiwGenericParam* inContentType = aInParamList.FindFirst( pos, KContentType ); |
|
972 |
||
973 |
TPtrC type; |
|
974 |
||
975 |
if ( inContentType ) |
|
976 |
{ |
|
977 |
type.Set( inContentType->Value().AsDes() ); |
|
978 |
aPosBased = EFalse; |
|
979 |
} |
|
980 |
else |
|
981 |
{ |
|
982 |
if ( aInParamList.Count() > 0 ) |
|
983 |
{ |
|
984 |
inContentType = &aInParamList[0]; |
|
985 |
if( inContentType->Name().Compare(KNullDesC8) == 0 ) |
|
986 |
{ |
|
987 |
type.Set( aInParamList[0].Value().AsDes() ); |
|
988 |
aPosBased = ETrue; |
|
989 |
} |
|
990 |
} |
|
991 |
} |
|
992 |
||
993 |
return type; |
|
994 |
} |
|
995 |
||
996 |
// --------------------------------------------------------------------------- |
|
997 |
// Gets the Transaction id |
|
998 |
// --------------------------------------------------------------------------- |
|
999 |
// |
|
1000 |
void CCalendarInterface::GetTransactionIdL( const CLiwGenericParamList& aInParamList, TInt32& aTransactionId ) |
|
1001 |
{ |
|
1002 |
TInt pos = 0; |
|
1003 |
||
1004 |
const TLiwGenericParam* param = aInParamList.FindFirst( pos, |
|
1005 |
KTransactionID, |
|
1006 |
EVariantTypeTInt32 ); |
|
1007 |
if(!param && aInParamList.Count() > 0) |
|
1008 |
{ |
|
1009 |
param = &aInParamList[0]; |
|
1010 |
if( param->Name().Compare(KNullDesC8) != 0 ) |
|
1011 |
{ |
|
1012 |
AppendErrorMessageL( KCmdCancel, KTransactionID, KMissing ); |
|
1013 |
User::Leave(KErrArgument); |
|
1014 |
} |
|
1015 |
} |
|
1016 |
||
1017 |
if ( param ) |
|
1018 |
{ |
|
1019 |
TLiwVariant* tempparam = const_cast<TLiwVariant*>(& param->Value()); |
|
1020 |
ValidateParamTypeL( *tempparam, LIW::EVariantTypeTInt32, |
|
1021 |
KCmdCancel, KTransactionID, KInvalid ); |
|
1022 |
||
1023 |
aTransactionId = param->Value().AsTInt32(); |
|
1024 |
} |
|
1025 |
else |
|
1026 |
{ |
|
1027 |
AppendErrorMessageL( KCmdCancel, KTransactionID, KMissing ); |
|
1028 |
User::Leave(KErrArgument); |
|
1029 |
} |
|
1030 |
} |
|
1031 |
||
1032 |
// --------------------------------------------------------------------------- |
|
1033 |
// Gets the Calendar Name from input param list |
|
1034 |
// --------------------------------------------------------------------------- |
|
1035 |
// |
|
1036 |
void CCalendarInterface::GetCalendarNameL( const CLiwGenericParamList& aInParamList, |
|
1037 |
const TDesC8& aCmdName, |
|
1038 |
const TDesC8& aField, |
|
1039 |
TBool aPosBased, |
|
1040 |
HBufC*& aCalendarName ) |
|
1041 |
{ |
|
1042 |
const TLiwGenericParam* param = NULL; |
|
1043 |
||
1044 |
if ( aPosBased && aInParamList.Count() > 1) |
|
1045 |
{ |
|
1046 |
param = &aInParamList[1]; |
|
1047 |
} |
|
1048 |
else |
|
1049 |
{ |
|
1050 |
TInt pos = 0; |
|
1051 |
param = aInParamList.FindFirst( pos, aField ); |
|
1052 |
} |
|
1053 |
||
1054 |
if ( param ) |
|
1055 |
{ |
|
1056 |
const CLiwMap* inMap = param->Value().AsMap(); |
|
1057 |
||
1058 |
if(inMap) |
|
1059 |
{ |
|
1060 |
TLiwVariant inParam; |
|
1061 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &inParam)); |
|
1062 |
if ( inMap->FindL( KCalendarName, inParam ) ) |
|
1063 |
{ |
|
1064 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1065 |
aCmdName, KCalendarName, KInvalid ); |
|
1066 |
||
1067 |
if ( inParam.AsDes().Length() > KMaxFileName ) |
|
1068 |
{ |
|
1069 |
AppendErrorMessageL( aCmdName, KCalendarName, KInvalid ); |
|
1070 |
User::Leave(KErrArgument); |
|
1071 |
} |
|
1072 |
||
1073 |
if( inParam.AsDes().Length() ) |
|
1074 |
{ |
|
1075 |
if ( inParam.AsDes().LocateF(':') == KErrNotFound ) |
|
1076 |
{ |
|
1077 |
AppendErrorMessageL( aCmdName, KCalendarName, KInvalid ); |
|
1078 |
User::Leave(KErrArgument); |
|
1079 |
} |
|
1080 |
else |
|
1081 |
{ |
|
1082 |
aCalendarName = inParam.AsDes().AllocL(); |
|
1083 |
aCalendarName->Des().Trim(); |
|
1084 |
} |
|
1085 |
} |
|
1086 |
} |
|
1087 |
CleanupStack::Pop( &inParam ); |
|
1088 |
inParam.Reset(); |
|
1089 |
} |
|
1090 |
else |
|
1091 |
{ |
|
1092 |
AppendErrorMessageL( aCmdName, aField, KInvalid ); |
|
1093 |
User::Leave(KErrArgument); |
|
1094 |
} |
|
1095 |
} |
|
1096 |
} |
|
1097 |
||
1098 |
// --------------------------------------------------------------------------- |
|
1099 |
// Gets the Field from Map in input param list |
|
1100 |
// --------------------------------------------------------------------------- |
|
1101 |
// |
|
1102 |
void CCalendarInterface::GetDesCFieldFromMapL( const CLiwGenericParamList& aInParamList, |
|
1103 |
const TDesC8& aCmdName, |
|
1104 |
const TDesC8& aMapName, |
|
1105 |
const TDesC8& aFieldName, |
|
1106 |
TBool aPosBased, |
|
1107 |
HBufC*& aOutputField ) |
|
1108 |
{ |
|
1109 |
const TLiwGenericParam* param = NULL; |
|
1110 |
||
1111 |
if ( aPosBased && aInParamList.Count() > 1) |
|
1112 |
{ |
|
1113 |
param = &aInParamList[1]; |
|
1114 |
} |
|
1115 |
else |
|
1116 |
{ |
|
1117 |
TInt pos = 0; |
|
1118 |
param = aInParamList.FindFirst( pos, aMapName ); |
|
1119 |
} |
|
1120 |
||
1121 |
if ( param ) |
|
1122 |
{ |
|
1123 |
const CLiwMap* inMap = param->Value().AsMap(); |
|
1124 |
||
1125 |
if(inMap) |
|
1126 |
{ |
|
1127 |
TLiwVariant inParam; |
|
1128 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &inParam)); |
|
1129 |
if ( inMap->FindL( aFieldName, inParam ) ) |
|
1130 |
{ |
|
1131 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1132 |
aCmdName, aFieldName, KInvalid ); |
|
1133 |
||
1134 |
if ( inParam.AsDes().Length() > KMaxFileNameLength ) |
|
1135 |
{ |
|
1136 |
AppendErrorMessageL( aCmdName, aFieldName, KInvalid ); |
|
1137 |
User::Leave(KErrArgument); |
|
1138 |
} |
|
1139 |
||
1140 |
if( inParam.AsDes().Length() ) |
|
1141 |
{ |
|
1142 |
aOutputField = HBufC::NewL(inParam.AsDes().Length()); |
|
1143 |
aOutputField->Des().Copy( inParam.AsDes() ); |
|
1144 |
} |
|
1145 |
} |
|
1146 |
CleanupStack::Pop( &inParam ); |
|
1147 |
inParam.Reset(); |
|
1148 |
} |
|
1149 |
else |
|
1150 |
{ |
|
1151 |
AppendErrorMessageL( aCmdName, aMapName, KInvalid ); |
|
1152 |
User::Leave(KErrArgument); |
|
1153 |
} |
|
1154 |
} |
|
1155 |
} |
|
1156 |
||
1157 |
// --------------------------------------------------------------------------- |
|
1158 |
// Gets the Field from Map in input param list |
|
1159 |
// --------------------------------------------------------------------------- |
|
1160 |
// |
|
1161 |
void CCalendarInterface::GetDesC8FieldFromMapL( const CLiwGenericParamList& aInParamList, |
|
1162 |
const TDesC8& aCmdName, |
|
1163 |
const TDesC8& aMapName, |
|
1164 |
const TDesC8& aFieldName, |
|
1165 |
TBool aPosBased, |
|
1166 |
HBufC8*& aOutputField ) |
|
1167 |
{ |
|
1168 |
const TLiwGenericParam* param = NULL; |
|
1169 |
||
1170 |
if ( aPosBased && aInParamList.Count() > 1) |
|
1171 |
{ |
|
1172 |
param = &aInParamList[1]; |
|
1173 |
} |
|
1174 |
else |
|
1175 |
{ |
|
1176 |
TInt pos = 0; |
|
1177 |
param = aInParamList.FindFirst( pos, aMapName ); |
|
1178 |
} |
|
1179 |
||
1180 |
if ( param ) |
|
1181 |
{ |
|
1182 |
const CLiwMap* inMap = param->Value().AsMap(); |
|
1183 |
||
1184 |
if(inMap) |
|
1185 |
{ |
|
1186 |
TLiwVariant inParam; |
|
1187 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &inParam)); |
|
1188 |
||
1189 |
if ( inMap->FindL( aFieldName, inParam ) ) |
|
1190 |
{ |
|
1191 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC8, |
|
1192 |
aCmdName, aFieldName, KInvalid ); |
|
1193 |
||
1194 |
if( inParam.AsData().Length() ) |
|
1195 |
{ |
|
1196 |
aOutputField = inParam.AsData().AllocL(); |
|
1197 |
} |
|
1198 |
} |
|
1199 |
CleanupStack::Pop( &inParam ); |
|
1200 |
inParam.Reset(); |
|
1201 |
} |
|
1202 |
else |
|
1203 |
{ |
|
1204 |
AppendErrorMessageL( aCmdName, aMapName, KInvalid ); |
|
1205 |
User::Leave(KErrArgument); |
|
1206 |
} |
|
1207 |
} |
|
1208 |
} |
|
1209 |
||
1210 |
// --------------------------------------------------------------------------- |
|
1211 |
// Extracts Entry attributes of a Calendar entry |
|
1212 |
// --------------------------------------------------------------------------- |
|
1213 |
// |
|
1214 |
CEntryAttributes* CCalendarInterface::GetAddParametersL( const CLiwGenericParamList& aInParamList, |
|
1215 |
const TDesC& aCalendarName, |
|
1216 |
TBool aPosBasedSearch ) |
|
1217 |
{ |
|
1218 |
CEntryAttributes* entryAttributes = CEntryAttributes::NewL(); |
|
1219 |
||
1220 |
CleanupStack::PushL( entryAttributes ); |
|
1221 |
||
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1222 |
TBool id; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1223 |
|
5 | 1224 |
const TLiwGenericParam* param = NULL; |
1225 |
||
1226 |
if ( aPosBasedSearch ) |
|
1227 |
{ |
|
1228 |
if( aInParamList.Count() > 1 ) |
|
1229 |
param = &aInParamList[1]; |
|
1230 |
} |
|
1231 |
else |
|
1232 |
{ |
|
1233 |
TInt pos = 0; |
|
1234 |
param = aInParamList.FindFirst( pos, KItem ); |
|
1235 |
} |
|
1236 |
||
1237 |
if ( param ) |
|
1238 |
{ |
|
1239 |
const CLiwMap* inMap = param->Value().AsMap(); |
|
1240 |
if( inMap ) |
|
1241 |
{ |
|
1242 |
TLiwVariant inParam; |
|
1243 |
TInt error = KErrNone; |
|
1244 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &inParam)); |
|
1245 |
||
1246 |
// Applicable only for Update request |
|
1247 |
TBool isUpdate = EFalse; |
|
1248 |
TInt entryType = -1; |
|
1249 |
if ( inMap->FindL( KLocalId, inParam ) ) |
|
1250 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1251 |
id = EFalse; |
5 | 1252 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
1253 |
KCmdAdd, KLocalId, KInvalid ); |
|
1254 |
||
1255 |
//entryAttributes->SetLocalUid( TCalLocalUid(inParam.AsTUint() )); |
|
1256 |
TCalLocalUid localUid; |
|
1257 |
GetLocalUid( inParam.AsDes(), localUid ); |
|
1258 |
entryAttributes->SetLocalUid( localUid ); |
|
1259 |
isUpdate = ETrue; |
|
1260 |
} |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1261 |
if ( inMap->FindL( KId, inParam ) ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1262 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1263 |
id = ETrue; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1264 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1265 |
KCmdAdd, KId, KInvalid ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1266 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1267 |
HBufC8* globalUid = HBufC8::NewL(inParam.AsDes().Length()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1268 |
CleanupStack::PushL( globalUid ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1269 |
GetGlobalUid(inParam.AsDes(), globalUid->Des()); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1270 |
entryAttributes->SetUidL( globalUid->Des() ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1271 |
CleanupStack::PopAndDestroy( globalUid ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1272 |
isUpdate = ETrue; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1273 |
} |
5 | 1274 |
|
1275 |
if ( inMap->FindL( KType, inParam ) ) |
|
1276 |
{ |
|
1277 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1278 |
KCmdAdd, _L8("Entry Type"), KInvalid ); |
|
1279 |
||
1280 |
entryAttributes->SetTypeL( inParam.AsDes() ); |
|
1281 |
entryType = entryAttributes->EntryType(); |
|
1282 |
} |
|
1283 |
||
1284 |
//Adding New Entry |
|
1285 |
else if( !isUpdate ) |
|
1286 |
{ |
|
1287 |
AppendErrorMessageL( KCmdAdd, KType, KMissing ); |
|
1288 |
User::Leave( KErrArgument ); |
|
1289 |
} |
|
1290 |
||
1291 |
//Updating Existing Entry |
|
1292 |
//Get the type of the original entry. User cannot change the type |
|
1293 |
if( isUpdate ) |
|
1294 |
{ |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1295 |
if(id) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1296 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1297 |
entryType = GetEntryType( aCalendarName, entryAttributes->GlobalUid() ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1298 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1299 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1300 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1301 |
entryType = GetEntryType( aCalendarName, entryAttributes->LocalUid() ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
1302 |
} |
5 | 1303 |
if ( entryType == -1 ) |
1304 |
{ |
|
1305 |
AppendErrorMessageL( KCmdAdd, KLocalId, KInvalid ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1306 |
User::Leave( KErrNotFound ); |
5 | 1307 |
} |
1308 |
||
1309 |
// Leave if tring to set different entry type |
|
1310 |
if ( entryAttributes->ModifiedAttributes() & CEntryAttributes::EEntryType ) |
|
1311 |
{ |
|
1312 |
TInt tmpType = entryAttributes->EntryType(); |
|
1313 |
if ( tmpType != entryType ) |
|
1314 |
{ |
|
1315 |
AppendErrorMessageL( KCmdAdd, _L8("Entry Type "), KInvalid ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1316 |
User::Leave( KErrBadName ); |
5 | 1317 |
} |
1318 |
} |
|
1319 |
} |
|
1320 |
||
1321 |
//For Add |
|
1322 |
if ( inMap->FindL( KSummary, inParam ) ) |
|
1323 |
{ |
|
1324 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1325 |
KCmdAdd, KSummary, KInvalid ); |
|
1326 |
||
1327 |
entryAttributes->SetSummaryL( inParam.AsDes() ); |
|
1328 |
} |
|
1329 |
||
1330 |
if ( inMap->FindL( KDescription, inParam ) ) |
|
1331 |
{ |
|
1332 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1333 |
KCmdAdd, KDescription, KInvalid ); |
|
1334 |
||
1335 |
entryAttributes->SetDescriptionL( inParam.AsDes() ); |
|
1336 |
} |
|
1337 |
||
1338 |
if ( inMap->FindL( KReplication, inParam ) ) |
|
1339 |
{ |
|
1340 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1341 |
KCmdAdd, KReplication, KInvalid ); |
|
1342 |
||
1343 |
entryAttributes->SetReplicationL( inParam.AsDes() ); |
|
1344 |
} |
|
1345 |
||
1346 |
if ( inMap->FindL( KPriority, inParam ) ) |
|
1347 |
{ |
|
1348 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTInt32, |
|
1349 |
KCmdAdd, KPriority, KInvalid ); |
|
1350 |
||
1351 |
error = entryAttributes->SetPriority( inParam.AsTInt32() ); |
|
1352 |
User::LeaveIfError( error ); |
|
1353 |
} |
|
1354 |
||
1355 |
if ( ( entryType != CCalEntry::ETodo ) && |
|
1356 |
inMap->FindL( KStartTime, inParam ) ) |
|
1357 |
{ |
|
1358 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTTime, |
|
1359 |
KCmdAdd, KStartTime, KInvalid ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1360 |
iStTime = inParam.AsTTime(); |
5 | 1361 |
entryAttributes->SetStartTimeL( inParam.AsTTime() ); |
1362 |
} |
|
1363 |
||
1364 |
if ( ( ( entryType == CCalEntry::EAppt ) || |
|
1365 |
( entryType == CCalEntry::ETodo ) || |
|
1366 |
( entryType == CCalEntry::EEvent ) ) && |
|
1367 |
inMap->FindL( KEndTime, inParam ) ) |
|
1368 |
{ |
|
1369 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTTime, |
|
1370 |
KCmdAdd, KEndTime, KInvalid ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1371 |
iEnTime = inParam.AsTTime(); |
5 | 1372 |
entryAttributes->SetEndTimeL( inParam.AsTTime() ); |
1373 |
} |
|
1374 |
||
1375 |
if ( inMap->FindL( KAlarmTime, inParam ) ) |
|
1376 |
{ |
|
1377 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTTime, |
|
1378 |
KCmdAdd, KAlarmTime, KInvalid ); |
|
1379 |
||
1380 |
entryAttributes->SetAlarm( inParam.AsTTime() ); |
|
1381 |
} |
|
1382 |
||
1383 |
if( ( entryType == CCalEntry::EAppt ) || |
|
1384 |
( entryType == CCalEntry::ETodo ) ) |
|
1385 |
{ |
|
1386 |
if ( inMap->FindL( KStatus, inParam ) ) |
|
1387 |
{ |
|
1388 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1389 |
KCmdAdd, KStatus, KInvalid ); |
|
1390 |
||
1391 |
entryAttributes->SetEntryStatusL( inParam.AsDes() ); |
|
1392 |
} |
|
1393 |
} |
|
1394 |
||
1395 |
if( entryType == CCalEntry::EAppt ) |
|
1396 |
{ |
|
1397 |
// Applicable only for Update request |
|
1398 |
if ( isUpdate && inMap->FindL( KInstStartTime, inParam ) ) |
|
1399 |
{ |
|
1400 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTTime, |
|
1401 |
KCmdAdd, KInstStartTime, KInvalid ); |
|
1402 |
||
1403 |
entryAttributes->SetInstanceStartTimeL( inParam.AsTTime() ); |
|
1404 |
} |
|
1405 |
||
1406 |
if ( inMap->FindL( KLocation, inParam ) ) |
|
1407 |
{ |
|
1408 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1409 |
KCmdAdd, KLocation, KInvalid ); |
|
1410 |
||
1411 |
entryAttributes->SetLocationL( inParam.AsDes() ); |
|
1412 |
} |
|
1413 |
||
1414 |
if ( inMap->FindL( KMethod, inParam ) ) |
|
1415 |
{ |
|
1416 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1417 |
KCmdAdd, KMethod, KInvalid ); |
|
1418 |
||
1419 |
entryAttributes->SetMethodL( inParam.AsDes() ); |
|
1420 |
} |
|
1421 |
||
1422 |
if ( inMap->FindL( KSeqNum, inParam ) ) |
|
1423 |
{ |
|
1424 |
ValidateParamTypeL( inParam, LIW::EVariantTypeTInt32, |
|
1425 |
KCmdAdd, KSeqNum, KInvalid ); |
|
1426 |
||
1427 |
entryAttributes->SetSequenceNumber( inParam.AsTInt32() ); |
|
1428 |
} |
|
1429 |
||
1430 |
if ( inMap->FindL( KPhoneOwner, inParam ) ) |
|
1431 |
{ |
|
1432 |
ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1433 |
KCmdAdd, KPhoneOwner, KInvalid ); |
|
1434 |
||
1435 |
entryAttributes->SetPhoneOwnerDataL( inParam.AsDes() ); |
|
1436 |
} |
|
1437 |
||
1438 |
if ( inMap->FindL( KOrganizer, inParam ) ) |
|
1439 |
{ |
|
1440 |
const CLiwMap* map = inParam.AsMap(); |
|
1441 |
if ( map ) |
|
1442 |
{ |
|
1443 |
TLiwVariant orgParam; |
|
1444 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &orgParam)); |
|
1445 |
if ( map->FindL( KAddress, orgParam ) ) |
|
1446 |
{ |
|
1447 |
CAttendeeInfo* organizer = CAttendeeInfo::NewL( orgParam.AsDes() ); |
|
1448 |
CleanupStack::PushL( organizer ); |
|
1449 |
if ( map->FindL( KCommonName, orgParam ) ) |
|
1450 |
{ |
|
1451 |
ValidateParamTypeL( orgParam, LIW::EVariantTypeDesC, |
|
1452 |
KCmdAdd, KCommonName, KInvalid ); |
|
1453 |
||
1454 |
organizer->SetCommonNameL( orgParam.AsDes() ); |
|
1455 |
} |
|
1456 |
entryAttributes->SetOrganizerDataL( organizer ); |
|
1457 |
CleanupStack::PopAndDestroy( organizer ); |
|
1458 |
} |
|
1459 |
else |
|
1460 |
{ |
|
1461 |
AppendErrorMessageL(KCmdAdd, KOrganizer, KInvalid ); |
|
1462 |
User::Leave( KErrArgument ); |
|
1463 |
} |
|
1464 |
CleanupStack::Pop( &orgParam ); |
|
1465 |
orgParam.Reset(); |
|
1466 |
} |
|
1467 |
else |
|
1468 |
{ |
|
1469 |
AppendErrorMessageL(KCmdAdd, KOrganizer, KInvalid ); |
|
1470 |
User::Leave( KErrArgument ); |
|
1471 |
} |
|
1472 |
} |
|
1473 |
||
1474 |
if ( inMap->FindL( KAttendeeList, inParam ) ) |
|
1475 |
{ |
|
1476 |
const CLiwList* obj = inParam.AsList(); |
|
1477 |
if ( obj ) |
|
1478 |
{ |
|
1479 |
TInt count = obj->Count(); |
|
1480 |
for ( int index = 0; index < count; index++ ) |
|
1481 |
{ |
|
1482 |
TLiwVariant element; |
|
1483 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1484 |
obj->AtL(index, element); |
|
1485 |
const CLiwMap* map = element.AsMap(); |
|
1486 |
TLiwVariant attParam; |
|
1487 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &attParam)); |
|
1488 |
if ( map && map->FindL(KAddress, attParam) ) |
|
1489 |
{ |
|
1490 |
ValidateParamTypeL( attParam, LIW::EVariantTypeDesC, |
|
1491 |
KCmdAdd, KAddress, KInvalid ); |
|
1492 |
||
1493 |
CAttendeeInfo* attendee = CAttendeeInfo::NewL( attParam.AsDes() ); |
|
1494 |
CleanupStack::PushL( attendee ); |
|
1495 |
if ( map->FindL( KCommonName, attParam ) ) |
|
1496 |
{ |
|
1497 |
ValidateParamTypeL( attParam, LIW::EVariantTypeDesC, |
|
1498 |
KCmdAdd, KCommonName, KInvalid ); |
|
1499 |
||
1500 |
attendee->SetCommonNameL( attParam.AsDes() ); |
|
1501 |
} |
|
1502 |
if ( map->FindL( KRole, attParam ) ) |
|
1503 |
{ |
|
1504 |
ValidateParamTypeL( attParam, LIW::EVariantTypeDesC, |
|
1505 |
KCmdAdd, KRole, KInvalid ); |
|
1506 |
||
1507 |
attendee->SetRoleL( attParam.AsDes() ); |
|
1508 |
} |
|
1509 |
||
1510 |
if ( map->FindL( KStatus, attParam ) ) |
|
1511 |
{ |
|
1512 |
ValidateParamTypeL( attParam, LIW::EVariantTypeDesC, |
|
1513 |
KCmdAdd, KStatus, KInvalid ); |
|
1514 |
||
1515 |
attendee->SetStatusL( attParam.AsDes() ); |
|
1516 |
} |
|
1517 |
||
1518 |
if ( map->FindL( KRsvp, attParam ) ) |
|
1519 |
{ |
|
1520 |
ValidateParamTypeL( attParam, LIW::EVariantTypeTBool, |
|
1521 |
KCmdAdd, KRsvp, KInvalid ); |
|
1522 |
||
1523 |
attendee->SetRsvp( attParam.AsTBool() ); |
|
1524 |
} |
|
1525 |
entryAttributes->AddAttendeeL( attendee ); |
|
1526 |
CleanupStack::PopAndDestroy( attendee ); |
|
1527 |
} |
|
1528 |
else |
|
1529 |
{ |
|
1530 |
AppendErrorMessageL(KCmdAdd, KAttendeeList, KInvalid); |
|
1531 |
User::Leave( KErrArgument ); |
|
1532 |
} |
|
1533 |
CleanupStack::Pop( &attParam ); |
|
1534 |
attParam.Reset(); |
|
1535 |
CleanupStack::Pop( &element ); |
|
1536 |
element.Reset(); |
|
1537 |
} |
|
1538 |
} |
|
1539 |
else |
|
1540 |
{ |
|
1541 |
AppendErrorMessageL(KCmdAdd, KAttendeeList, KInvalid); |
|
1542 |
User::Leave( KErrArgument ); |
|
1543 |
} |
|
1544 |
} |
|
1545 |
||
1546 |
if( inMap->FindL( KRepeatDates, inParam ) ) |
|
1547 |
{ |
|
1548 |
const CLiwList* obj = inParam.AsList(); |
|
1549 |
if ( obj ) |
|
1550 |
{ |
|
1551 |
for ( int index = 0; index < obj->Count(); index++ ) |
|
1552 |
{ |
|
1553 |
TLiwVariant element; |
|
1554 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1555 |
obj->AtL(index, element); |
|
1556 |
||
1557 |
ValidateParamTypeL( element, LIW::EVariantTypeTTime, |
|
1558 |
KCmdAdd, KRepeatDates, KInvalid); |
|
1559 |
||
1560 |
TTime reptDate = element.AsTTime(); |
|
1561 |
entryAttributes->AddRepeatDateL( reptDate ); |
|
1562 |
CleanupStack::Pop( &element ); |
|
1563 |
element.Reset(); |
|
1564 |
} |
|
1565 |
} |
|
1566 |
else |
|
1567 |
{ |
|
1568 |
AppendErrorMessageL(KCmdAdd, KRepeatDates, KInvalid); |
|
1569 |
User::Leave( KErrArgument ); |
|
1570 |
} |
|
1571 |
} |
|
1572 |
||
1573 |
if( inMap->FindL( KExceptionDates, inParam ) ) |
|
1574 |
{ |
|
1575 |
const CLiwList* obj = inParam.AsList(); |
|
1576 |
if ( obj ) |
|
1577 |
{ |
|
1578 |
for ( int index = 0; index < obj->Count(); index++ ) |
|
1579 |
{ |
|
1580 |
TLiwVariant element; |
|
1581 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1582 |
obj->AtL(index, element); |
|
1583 |
||
1584 |
ValidateParamTypeL( element, LIW::EVariantTypeTTime, |
|
1585 |
KCmdAdd, KExceptionDates, KInvalid ); |
|
1586 |
||
1587 |
TTime exDate = element.AsTTime(); |
|
1588 |
entryAttributes->AddExceptionDateL( exDate ); |
|
1589 |
CleanupStack::Pop( &element ); |
|
1590 |
element.Reset(); |
|
1591 |
} |
|
1592 |
} |
|
1593 |
else |
|
1594 |
{ |
|
1595 |
inParam.Reset(); |
|
1596 |
AppendErrorMessageL( KCmdAdd, KExceptionDates, KInvalid ); |
|
1597 |
User::Leave( KErrArgument ); |
|
1598 |
} |
|
1599 |
} |
|
1600 |
||
1601 |
if ( inMap->FindL( KRepeatRule, inParam ) ) |
|
1602 |
{ |
|
1603 |
const CLiwMap* map = inParam.AsMap(); |
|
1604 |
if ( map ) |
|
1605 |
{ |
|
1606 |
CRepeatInfo* rrule = NULL; |
|
1607 |
TLiwVariant rptParam; |
|
1608 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &rptParam)); |
|
1609 |
if ( map->FindL( KRepeatType, rptParam ) ) |
|
1610 |
{ |
|
1611 |
ValidateParamTypeL( rptParam, LIW::EVariantTypeTInt32, |
|
1612 |
KCmdAdd, KRepeatType, KInvalid ); |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1613 |
if(!isValidEntryDuration(rptParam.AsTInt32())) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1614 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1615 |
AppendErrorMessageL( KCmdAdd, KRepeatType, KInvalid ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1616 |
User::Leave( KErrBadName ); |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
1617 |
} |
5 | 1618 |
|
1619 |
rrule = CRepeatInfo::NewL( rptParam.AsTInt32() ); |
|
1620 |
CleanupStack::PushL( rrule ); |
|
1621 |
} |
|
1622 |
else |
|
1623 |
{ |
|
1624 |
AppendErrorMessageL( KCmdAdd, KRepeatType, KMissing ); |
|
1625 |
User::Leave( KErrArgument ); |
|
1626 |
} |
|
1627 |
||
1628 |
if ( map->FindL( KDaysInWeek, rptParam ) ) |
|
1629 |
{ |
|
1630 |
const CLiwList* obj = rptParam.AsList(); |
|
1631 |
if ( obj ) |
|
1632 |
{ |
|
1633 |
RArray < TDay > days; |
|
1634 |
for ( int index = 0; index < obj->Count(); index++ ) |
|
1635 |
{ |
|
1636 |
TLiwVariant element; |
|
1637 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1638 |
obj->AtL(index, element); |
|
1639 |
||
1640 |
ValidateParamTypeL( element, LIW::EVariantTypeTInt32, |
|
1641 |
KCmdAdd, KDaysInWeek, KInvalid ); |
|
1642 |
||
1643 |
days.Append( TDay( element.AsTInt32() ) ); |
|
1644 |
if( element.AsTInt32() < 0 || element.AsTInt32() > 6 ) |
|
1645 |
{ |
|
1646 |
days.Close(); |
|
1647 |
AppendErrorMessageL( KCmdAdd, KDaysInWeek, KInvalid ); |
|
1648 |
User::Leave( KErrArgument ); |
|
1649 |
} |
|
1650 |
CleanupStack::Pop( &element ); |
|
1651 |
element.Reset(); |
|
1652 |
} |
|
1653 |
rrule->SetDaysInWeek(days); |
|
1654 |
days.Close(); |
|
1655 |
} |
|
1656 |
else |
|
1657 |
{ |
|
1658 |
AppendErrorMessageL( KCmdAdd, KDaysInWeek, KInvalid ); |
|
1659 |
User::Leave( KErrArgument ); |
|
1660 |
} |
|
1661 |
} |
|
1662 |
||
1663 |
if ( map->FindL( KUntilDate, rptParam ) ) |
|
1664 |
{ |
|
1665 |
ValidateParamTypeL( rptParam, LIW::EVariantTypeTTime, |
|
1666 |
KCmdAdd, KUntilDate, KInvalid ); |
|
1667 |
||
1668 |
rrule->SetUntilTimeL( rptParam.AsTTime() ); |
|
1669 |
} |
|
1670 |
||
1671 |
if ( map->FindL( KRStartDate, rptParam ) ) |
|
1672 |
{ |
|
1673 |
ValidateParamTypeL( rptParam, LIW::EVariantTypeTTime, |
|
1674 |
KCmdAdd, _L8("RepeatRule:StartDate"), KInvalid ); |
|
1675 |
||
1676 |
rrule->SetStartTimeL( rptParam.AsTTime() ); |
|
1677 |
} |
|
1678 |
if ( map->FindL( KInterval, rptParam ) ) |
|
1679 |
{ |
|
1680 |
ValidateParamTypeL( rptParam, LIW::EVariantTypeTInt32, |
|
1681 |
KCmdAdd, KInterval, KInvalid ); |
|
1682 |
||
1683 |
rrule->SetInterval( rptParam.AsTInt32() ); |
|
1684 |
} |
|
1685 |
||
1686 |
if ( map->FindL( KMonthDays, rptParam ) ) |
|
1687 |
{ |
|
1688 |
const CLiwList* obj = rptParam.AsList(); |
|
1689 |
if ( obj ) |
|
1690 |
{ |
|
1691 |
RArray < TInt > days; |
|
1692 |
for ( int index = 0; index < obj->Count(); index++ ) |
|
1693 |
{ |
|
1694 |
TLiwVariant element; |
|
1695 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1696 |
||
1697 |
obj->AtL(index, element); |
|
1698 |
||
1699 |
ValidateParamTypeL( element, LIW::EVariantTypeTInt32, |
|
1700 |
KCmdAdd, KMonthDays, KInvalid ); |
|
1701 |
||
1702 |
TInt mthdays = element.AsTInt32(); |
|
1703 |
if( mthdays < 0 || mthdays > 30 ) |
|
1704 |
{ |
|
1705 |
days.Close(); |
|
1706 |
AppendErrorMessageL( KCmdAdd, KMonthDays, KInvalid ); |
|
1707 |
User::Leave( KErrArgument ); |
|
1708 |
} |
|
1709 |
days.Append( TDay( mthdays ) ); |
|
1710 |
CleanupStack::Pop( &element ); |
|
1711 |
element.Reset(); |
|
1712 |
} |
|
1713 |
rrule->SetMonthDates(days); |
|
1714 |
days.Close(); |
|
1715 |
} |
|
1716 |
else |
|
1717 |
{ |
|
1718 |
AppendErrorMessageL( KCmdAdd, KMonthDays, KInvalid ); |
|
1719 |
User::Leave( KErrArgument ); |
|
1720 |
} |
|
1721 |
} |
|
1722 |
||
1723 |
if ( map->FindL( KDaysOfMonth, rptParam ) ) |
|
1724 |
{ |
|
1725 |
const CLiwList* obj = rptParam.AsList(); |
|
1726 |
if ( obj ) |
|
1727 |
{ |
|
1728 |
RArray <TCalRRule::TDayOfMonth> monthdays; |
|
1729 |
TInt count = obj->Count(); |
|
1730 |
for ( int index = 0; index < count ; index++ ) |
|
1731 |
{ |
|
1732 |
TLiwVariant element; |
|
1733 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &element)); |
|
1734 |
obj->AtL(index, element); |
|
1735 |
const CLiwMap* map = element.AsMap(); |
|
1736 |
if( map ) |
|
1737 |
{ |
|
1738 |
TLiwVariant dayno; |
|
1739 |
TLiwVariant week; |
|
1740 |
||
1741 |
if ( map->FindL( KDay, dayno ) && map->FindL( KWeekNum, week ) ) |
|
1742 |
{ |
|
1743 |
ValidateParamTypeL( dayno, LIW::EVariantTypeTInt32, |
|
1744 |
KCmdAdd, _L8("RepeatRule:DaysOfMonth:Day"), KInvalid ); |
|
1745 |
||
1746 |
ValidateParamTypeL( week, LIW::EVariantTypeTInt32, |
|
1747 |
KCmdAdd, KRepeatWeekNum, KInvalid ); |
|
1748 |
||
1749 |
TInt weekno = week.AsTInt32(); |
|
1750 |
TInt daynum = dayno.AsTInt32(); |
|
1751 |
||
1752 |
if ( ( ( weekno == -1 ) || ( weekno >=1 && weekno <=4 ) ) && |
|
1753 |
( daynum >=0 && daynum <=6 )) |
|
1754 |
{ |
|
1755 |
monthdays.Append(TCalRRule::TDayOfMonth( TDay( daynum ), weekno ) ); |
|
1756 |
} |
|
1757 |
else |
|
1758 |
{ |
|
1759 |
AppendErrorMessageL(KCmdAdd, KRepeatWeekNum, KInvalid); |
|
1760 |
User::Leave( KErrArgument ); |
|
1761 |
} |
|
1762 |
} |
|
1763 |
dayno.Reset(); |
|
1764 |
week.Reset(); |
|
1765 |
CleanupStack::Pop( &element ); |
|
1766 |
element.Reset(); |
|
1767 |
} |
|
1768 |
else |
|
1769 |
{ |
|
1770 |
AppendErrorMessageL(KCmdAdd, KDaysOfMonth, KInvalid); |
|
1771 |
User::Leave( KErrArgument ); |
|
1772 |
} |
|
1773 |
} |
|
1774 |
rrule->SetMonthDays( monthdays ); |
|
1775 |
monthdays.Close(); |
|
1776 |
} |
|
1777 |
else |
|
1778 |
{ |
|
1779 |
AppendErrorMessageL(KCmdAdd, KDaysOfMonth, KInvalid); |
|
1780 |
User::Leave( KErrArgument ); |
|
1781 |
} |
|
1782 |
} |
|
1783 |
||
1784 |
if ( map->FindL( KMonth, rptParam ) ) |
|
1785 |
{ |
|
1786 |
ValidateParamTypeL( rptParam, LIW::EVariantTypeTInt32, |
|
1787 |
KCmdAdd, KMonth, KInvalid ); |
|
1788 |
||
1789 |
TInt rptmonth = rptParam.AsTInt32(); |
|
1790 |
if( rptmonth <0 || rptmonth > 11 ) |
|
1791 |
{ |
|
1792 |
AppendErrorMessageL( KCmdAdd, KMonth, KInvalid ); |
|
1793 |
User::Leave( KErrArgument ); |
|
1794 |
} |
|
1795 |
rrule->SetMonth( rptmonth ); |
|
1796 |
} |
|
1797 |
entryAttributes->SetRepeatRule( rrule ); |
|
1798 |
CleanupStack::PopAndDestroy( rrule ); |
|
1799 |
CleanupStack::Pop( &rptParam ); |
|
1800 |
rptParam.Reset(); |
|
1801 |
} |
|
1802 |
else |
|
1803 |
{ |
|
1804 |
AppendErrorMessageL( KCmdAdd, KRepeatRule, KInvalid ); |
|
1805 |
User::Leave( KErrArgument ); |
|
1806 |
} |
|
1807 |
||
1808 |
} |
|
1809 |
} |
|
1810 |
||
1811 |
||
1812 |
CleanupStack::Pop( &inParam ); |
|
1813 |
inParam.Reset(); |
|
1814 |
} |
|
1815 |
else |
|
1816 |
{ |
|
1817 |
AppendErrorMessageL( KCmdAdd, KItem, KInvalid ); |
|
1818 |
User::Leave( KErrArgument ); |
|
1819 |
} |
|
1820 |
||
1821 |
} |
|
1822 |
else |
|
1823 |
{ |
|
1824 |
AppendErrorMessageL( KCmdAdd, KItem, KMissing ); |
|
1825 |
User::Leave( KErrArgument ); |
|
1826 |
} |
|
1827 |
CleanupStack::Pop( entryAttributes ); |
|
1828 |
return entryAttributes; |
|
1829 |
} |
|
1830 |
||
1831 |
// --------------------------------------------------------------------------- |
|
1832 |
// Extracts Delete Filter from input param list |
|
1833 |
// --------------------------------------------------------------------------- |
|
1834 |
// |
|
1835 |
void CCalendarInterface::GetDeleteEntryFilterL(const CLiwGenericParamList& aInParamList, |
|
1836 |
CCalendarFilter& aFilter, |
|
1837 |
const TBool aPosBased ) |
|
1838 |
{ |
|
1839 |
const TLiwGenericParam* filter = NULL; |
|
1840 |
||
1841 |
if ( aPosBased ) |
|
1842 |
{ |
|
1843 |
if ( aInParamList.Count() > 1 ) |
|
1844 |
filter = &aInParamList[1]; |
|
1845 |
} |
|
1846 |
else |
|
1847 |
{ |
|
1848 |
TInt pos = 0 ; |
|
1849 |
filter = aInParamList.FindFirst( pos, KData ); |
|
1850 |
} |
|
1851 |
||
1852 |
if ( filter ) |
|
1853 |
{ |
|
1854 |
const CLiwMap* filterMap = filter->Value().AsMap(); |
|
1855 |
if ( filterMap ) |
|
1856 |
{ |
|
1857 |
TLiwVariant param; |
|
1858 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , ¶m)); |
|
1859 |
if( filterMap->FindL( KStartRange, param )) |
|
1860 |
{ |
|
1861 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
1862 |
KCmdDelete, KStartRange, KInvalid ); |
|
1863 |
||
1864 |
aFilter.SetStartTimeL(param.AsTTime()); |
|
1865 |
} |
|
1866 |
||
1867 |
if( filterMap->FindL( KEndRange, param )) |
|
1868 |
{ |
|
1869 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
1870 |
KCmdDelete, KEndRange, KInvalid ); |
|
1871 |
||
1872 |
aFilter.SetEndTimeL(param.AsTTime()); |
|
1873 |
} |
|
1874 |
||
1875 |
if( filterMap->FindL( KDeleteAll, param )) |
|
1876 |
{ |
|
1877 |
ValidateParamTypeL( param, LIW::EVariantTypeTBool, |
|
1878 |
KCmdDelete, KDeleteAll, KInvalid ); |
|
1879 |
||
1880 |
aFilter.SetDeleteAll( param.AsTBool() ); |
|
1881 |
} |
|
1882 |
||
1883 |
if( filterMap->FindL( KIdList, param )) |
|
1884 |
{ |
|
1885 |
const CLiwList* guidList = param.AsList(); |
|
1886 |
if ( guidList ) |
|
1887 |
{ |
|
1888 |
TLiwVariant listElement; |
|
1889 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &listElement)); |
|
1890 |
TInt count = guidList->Count(); |
|
1891 |
for(TInt index = 0; index < count; index++) |
|
1892 |
{ |
|
1893 |
if ( guidList->AtL(index, listElement) ) |
|
1894 |
{ |
|
1895 |
//aFilter.AddGuidL( listElement.AsData() ); |
|
1896 |
ValidateParamTypeL( listElement, LIW::EVariantTypeDesC, |
|
1897 |
KCmdDelete, KIdList, KInvalid ); |
|
1898 |
||
1899 |
HBufC8* globalUid = HBufC8::NewL(listElement.AsDes().Length()); |
|
1900 |
CleanupStack::PushL( globalUid ); |
|
1901 |
GetGlobalUid(listElement.AsDes(), globalUid->Des()); |
|
1902 |
aFilter.AddGuidL( globalUid->Des() ); |
|
1903 |
CleanupStack::PopAndDestroy( globalUid ); |
|
1904 |
} |
|
1905 |
} |
|
1906 |
CleanupStack::Pop( &listElement ); |
|
1907 |
listElement.Reset(); |
|
1908 |
} |
|
1909 |
else |
|
1910 |
{ |
|
1911 |
AppendErrorMessageL( KCmdDelete, KIdList, KInvalid ); |
|
1912 |
User::Leave(KErrArgument); |
|
1913 |
} |
|
1914 |
} |
|
1915 |
||
1916 |
if( filterMap->FindL( KLocalIdList, param )) |
|
1917 |
{ |
|
1918 |
const CLiwList* luidList = param.AsList(); |
|
1919 |
if ( luidList ) |
|
1920 |
{ |
|
1921 |
TLiwVariant listElement; |
|
1922 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &listElement)); |
|
1923 |
TInt count = luidList->Count(); |
|
1924 |
for(TInt index = 0; index < count; index++) |
|
1925 |
{ |
|
1926 |
if ( luidList->AtL(index, listElement) ) |
|
1927 |
{ |
|
1928 |
//aFilter.AddLocalUid( TCalLocalUid( listElement.AsTUint() )); |
|
1929 |
ValidateParamTypeL( listElement, LIW::EVariantTypeDesC, |
|
1930 |
KCmdDelete, KLocalIdList, KInvalid ); |
|
1931 |
||
1932 |
||
1933 |
TCalLocalUid localUid; |
|
1934 |
GetLocalUid( listElement.AsDes(), localUid ); |
|
1935 |
aFilter.AddLocalUid( localUid ); |
|
1936 |
} |
|
1937 |
} |
|
1938 |
CleanupStack::Pop( &listElement ); |
|
1939 |
listElement.Reset(); |
|
1940 |
} |
|
1941 |
else |
|
1942 |
{ |
|
1943 |
AppendErrorMessageL( KCmdDelete, KLocalIdList, KInvalid ); |
|
1944 |
User::Leave(KErrArgument); |
|
1945 |
} |
|
1946 |
} |
|
1947 |
CleanupStack::Pop( ¶m ); |
|
1948 |
param.Reset(); |
|
1949 |
} |
|
1950 |
else |
|
1951 |
{ |
|
1952 |
AppendErrorMessageL( KCmdDelete, KData, KInvalid ); |
|
1953 |
User::Leave(KErrArgument); |
|
1954 |
} |
|
1955 |
} |
|
1956 |
else |
|
1957 |
{ |
|
1958 |
AppendErrorMessageL( KCmdDelete, KData, KMissing ); |
|
1959 |
User::Leave(KErrArgument); |
|
1960 |
} |
|
1961 |
} |
|
1962 |
||
1963 |
// --------------------------------------------------------------------------- |
|
1964 |
// Extracts Import input from input param list |
|
1965 |
// --------------------------------------------------------------------------- |
|
1966 |
// |
|
1967 |
void CCalendarInterface::GetImportInputL( const CLiwGenericParamList& aInParamList, |
|
1968 |
TBool aPosBased, |
|
1969 |
HBufC8*& aInputBuffer, |
|
1970 |
TDes& importFile, |
|
1971 |
TDes8& aCalendarFormat, |
|
1972 |
TDes& aCalendarName ) |
|
1973 |
{ |
|
1974 |
||
1975 |
//get the Input Filter Map |
|
1976 |
const TLiwGenericParam* inMap = NULL; |
|
1977 |
||
1978 |
if( aPosBased ) |
|
1979 |
{ |
|
1980 |
if( aInParamList.Count() > 1 ) |
|
1981 |
inMap = &(aInParamList[1]);//start searching from pos and reset the pos to found at index |
|
1982 |
} |
|
1983 |
else |
|
1984 |
{ |
|
1985 |
TInt pos = 0; |
|
1986 |
inMap = aInParamList.FindFirst( pos, KData ); |
|
1987 |
} |
|
1988 |
||
1989 |
if ( inMap ) |
|
1990 |
{ |
|
1991 |
const CLiwMap * filterMap = inMap->Value().AsMap(); |
|
1992 |
||
1993 |
if ( filterMap ) |
|
1994 |
{ |
|
1995 |
TLiwVariant value; |
|
1996 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &value)); |
|
1997 |
||
1998 |
if ( filterMap->FindL( KCalendarName, value )) |
|
1999 |
{ |
|
2000 |
ValidateParamTypeL( value, LIW::EVariantTypeDesC, |
|
2001 |
KCmdImport, KCalendarName, KInvalid ); |
|
2002 |
||
2003 |
aCalendarName.Copy( value.AsDes() ); |
|
2004 |
} |
|
2005 |
||
2006 |
if ( filterMap->FindL( KCalendarFormat, value )) |
|
2007 |
{ |
|
2008 |
ValidateParamTypeL( value, LIW::EVariantTypeDesC, |
|
2009 |
KCmdImport, KCalendarFormat, KInvalid ); |
|
2010 |
||
2011 |
aCalendarFormat.Copy( value.AsDes() ); |
|
2012 |
} |
|
2013 |
else |
|
2014 |
{ |
|
2015 |
AppendErrorMessageL( KCmdImport, KCalendarFormat, KMissing ); |
|
2016 |
User::Leave( KErrArgument ); |
|
2017 |
} |
|
2018 |
||
2019 |
if ( filterMap->FindL( KInputBuffer, value )) |
|
2020 |
{ |
|
2021 |
ValidateParamTypeL( value, LIW::EVariantTypeDesC8, |
|
2022 |
KCmdImport, KInputBuffer, KInvalid ); |
|
2023 |
||
2024 |
aInputBuffer = value.AsData().AllocL(); |
|
2025 |
} |
|
2026 |
else if ( filterMap->FindL( KImExFileName, value )) |
|
2027 |
{ |
|
2028 |
ValidateParamTypeL( value, LIW::EVariantTypeDesC, |
|
2029 |
KCmdImport, KImExFileName, KInvalid ); |
|
2030 |
||
2031 |
importFile.Copy( value.AsDes() ); |
|
2032 |
} |
|
2033 |
else |
|
2034 |
{ |
|
2035 |
AppendErrorMessageL( KCmdImport, KImExFileName, KMissing ); |
|
2036 |
User::Leave( KErrArgument ); |
|
2037 |
} |
|
2038 |
CleanupStack::Pop( &value ); |
|
2039 |
value.Reset(); |
|
2040 |
||
2041 |
} |
|
2042 |
else |
|
2043 |
{ |
|
2044 |
AppendErrorMessageL( KCmdImport, KData, KInvalid ); |
|
2045 |
User::Leave( KErrArgument ); |
|
2046 |
} |
|
2047 |
} |
|
2048 |
else |
|
2049 |
{ |
|
2050 |
AppendErrorMessageL( KCmdImport, KData, KMissing ); |
|
2051 |
User::Leave( KErrArgument ); |
|
2052 |
} |
|
2053 |
} |
|
2054 |
||
2055 |
// --------------------------------------------------------------------------- |
|
2056 |
// Extracts Export input from input param list |
|
2057 |
// --------------------------------------------------------------------------- |
|
2058 |
// |
|
2059 |
void CCalendarInterface::GetExportInputL( const CLiwGenericParamList& aInParamList, |
|
2060 |
TBool aPosBased, |
|
2061 |
CCalendarExportParams& aCalExportParams ) |
|
2062 |
{ |
|
2063 |
const TLiwGenericParam* inMap = NULL; //get the Input Filter Map |
|
2064 |
||
2065 |
TInt pos = 0; |
|
2066 |
||
2067 |
if( aPosBased ) |
|
2068 |
{ |
|
2069 |
if( aInParamList.Count() > 1 ) |
|
2070 |
inMap = &(aInParamList[1]); |
|
2071 |
} |
|
2072 |
else |
|
2073 |
inMap = aInParamList.FindFirst( pos, KData ); |
|
2074 |
||
2075 |
if( inMap ) |
|
2076 |
{ |
|
2077 |
const CLiwMap *filterMap = inMap->Value().AsMap(); |
|
2078 |
||
2079 |
if( filterMap ) |
|
2080 |
{ |
|
2081 |
TLiwVariant tLiwVariantValue; |
|
2082 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &tLiwVariantValue)); |
|
2083 |
||
2084 |
if ( filterMap->FindL( KImExFileName, tLiwVariantValue )) |
|
2085 |
{ |
|
2086 |
ValidateParamTypeL( tLiwVariantValue, LIW::EVariantTypeDesC, |
|
2087 |
KCmdExport, KImExFileName, KInvalid ); |
|
2088 |
||
2089 |
aCalExportParams.SetExportFileNameL( tLiwVariantValue.AsDes() ); |
|
2090 |
} |
|
2091 |
||
2092 |
||
2093 |
TLiwVariant tLiwVariantValueTemp; |
|
2094 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &tLiwVariantValueTemp)); |
|
2095 |
if( filterMap->FindL( KCalendarGuidList, tLiwVariantValue ) ) |
|
2096 |
{ |
|
2097 |
const CLiwList *cLiwList = tLiwVariantValue.AsList(); |
|
2098 |
||
2099 |
if ( cLiwList ) |
|
2100 |
{ |
|
2101 |
for( TInt x = 0; x < cLiwList->Count(); ++x ) |
|
2102 |
{ |
|
2103 |
cLiwList->AtL( x , tLiwVariantValueTemp ); |
|
2104 |
||
2105 |
ValidateParamTypeL( tLiwVariantValueTemp, LIW::EVariantTypeDesC, |
|
2106 |
KCmdExport, KCalendarGuidList, KInvalid ); |
|
2107 |
||
2108 |
HBufC8* globalUid = HBufC8::NewL(tLiwVariantValueTemp.AsDes().Length()); |
|
2109 |
CleanupStack::PushL( globalUid ); |
|
2110 |
GetGlobalUid(tLiwVariantValueTemp.AsDes(), globalUid->Des()); |
|
2111 |
aCalExportParams.AddGuidL( globalUid->Des() ); |
|
2112 |
CleanupStack::PopAndDestroy( globalUid ); |
|
2113 |
} |
|
2114 |
} |
|
2115 |
else |
|
2116 |
{ |
|
2117 |
AppendErrorMessageL( KCmdExport, KCalendarGuidList, KInvalid ); |
|
2118 |
User::Leave( KErrArgument ); |
|
2119 |
} |
|
2120 |
||
2121 |
} |
|
2122 |
||
2123 |
if( filterMap->FindL( KCalendarLuidList, tLiwVariantValue ) ) |
|
2124 |
{ |
|
2125 |
const CLiwList *cLiwListTemp = tLiwVariantValue.AsList(); |
|
2126 |
||
2127 |
if ( cLiwListTemp ) |
|
2128 |
{ |
|
2129 |
if( cLiwListTemp->Count() && ( aCalExportParams.Params() & CCalendarExportParams::EParamsGUid ) ) |
|
2130 |
{//means the GUIDS are set so break, as both GUIDS and LUids cant be set |
|
2131 |
AppendErrorMessageL(KCmdExport, KNullDesC8,_L("Only one of IdList and LocalIdList can be given")); |
|
2132 |
User::Leave( KErrArgument ); |
|
2133 |
} |
|
2134 |
||
2135 |
for( TInt x = 0; x < cLiwListTemp->Count(); ++x ) |
|
2136 |
{ |
|
2137 |
cLiwListTemp->AtL( x , tLiwVariantValueTemp ); |
|
2138 |
||
2139 |
ValidateParamTypeL( tLiwVariantValueTemp, LIW::EVariantTypeDesC, |
|
2140 |
KCmdExport, KCalendarLuidList, KInvalid ); |
|
2141 |
||
2142 |
TCalLocalUid localUid; |
|
2143 |
GetLocalUid( tLiwVariantValueTemp.AsDes(), localUid ); |
|
2144 |
aCalExportParams.AddLocalUid( localUid ); |
|
2145 |
} |
|
2146 |
} |
|
2147 |
else |
|
2148 |
{ |
|
2149 |
AppendErrorMessageL( KCmdExport, KCalendarLuidList, KInvalid ); |
|
2150 |
User::Leave( KErrArgument ); |
|
2151 |
} |
|
2152 |
} |
|
2153 |
||
2154 |
CleanupStack::Pop( &tLiwVariantValueTemp ); |
|
2155 |
tLiwVariantValueTemp.Reset(); |
|
2156 |
CleanupStack::Pop( &tLiwVariantValue ); |
|
2157 |
tLiwVariantValue.Reset(); |
|
2158 |
} |
|
2159 |
else |
|
2160 |
{ |
|
2161 |
AppendErrorMessageL( KCmdExport, KData, KInvalid ); |
|
2162 |
User::Leave( KErrArgument ); |
|
2163 |
} |
|
2164 |
} |
|
2165 |
else |
|
2166 |
{ |
|
2167 |
AppendErrorMessageL( KCmdExport, KData, KMissing ); |
|
2168 |
User::Leave( KErrArgument ); |
|
2169 |
} |
|
2170 |
} |
|
2171 |
||
2172 |
// --------------------------------------------------------------------------- |
|
2173 |
// Extracts Change Notification filter from input param list |
|
2174 |
// --------------------------------------------------------------------------- |
|
2175 |
// |
|
2176 |
void CCalendarInterface::GetNotificationFilterL(const CLiwGenericParamList& aInParamList, |
|
2177 |
CCalendarFilter& aFilter, |
|
2178 |
const TBool aPosBased ) |
|
2179 |
{ |
|
2180 |
const TLiwGenericParam* filter = NULL; |
|
2181 |
||
2182 |
if ( aPosBased ) |
|
2183 |
{ |
|
2184 |
if ( aInParamList.Count() > 1 ) |
|
2185 |
filter = &aInParamList[1]; |
|
2186 |
} |
|
2187 |
else |
|
2188 |
{ |
|
2189 |
TInt pos = 0 ; |
|
2190 |
filter = aInParamList.FindFirst( pos, KFilter ); |
|
2191 |
} |
|
2192 |
||
2193 |
if ( filter ) |
|
2194 |
{ |
|
2195 |
const CLiwMap* filterMap = filter->Value().AsMap(); |
|
2196 |
if ( filterMap ) |
|
2197 |
{ |
|
2198 |
TLiwVariant param; |
|
2199 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , ¶m)); |
|
2200 |
if( filterMap->FindL( KStartRange, param )) |
|
2201 |
{ |
|
2202 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
2203 |
KCmdReqNot, KStartRange, KInvalid ); |
|
2204 |
||
2205 |
aFilter.SetStartTimeL(param.AsTTime()); |
|
2206 |
} |
|
2207 |
||
2208 |
if( filterMap->FindL( KEndRange, param )) |
|
2209 |
{ |
|
2210 |
ValidateParamTypeL( param, LIW::EVariantTypeTTime, |
|
2211 |
KCmdReqNot, KEndRange, KInvalid ); |
|
2212 |
||
2213 |
aFilter.SetEndTimeL(param.AsTTime()); |
|
2214 |
} |
|
2215 |
||
2216 |
if( filterMap->FindL( KIncludeUndatedTodos, param )) |
|
2217 |
{ |
|
2218 |
ValidateParamTypeL( param, LIW::EVariantTypeTBool, |
|
2219 |
KCmdReqNot, KIncludeUndatedTodos, KInvalid ); |
|
2220 |
||
2221 |
aFilter.SetIncludeUnDateToDo( param.AsTBool() ); |
|
2222 |
} |
|
2223 |
||
2224 |
if( filterMap->FindL( KLocalIdList, param )) |
|
2225 |
{ |
|
2226 |
const CLiwList* luidList = param.AsList(); |
|
2227 |
if ( luidList ) |
|
2228 |
{ |
|
2229 |
TLiwVariant listElement; |
|
2230 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &listElement)); |
|
2231 |
TInt count = luidList->Count(); |
|
2232 |
for(TInt index = 0; index < count; index++) |
|
2233 |
{ |
|
2234 |
if ( luidList->AtL(index, listElement) ) |
|
2235 |
{ |
|
2236 |
TCalLocalUid localUid; |
|
2237 |
||
2238 |
ValidateParamTypeL( listElement, LIW::EVariantTypeDesC, |
|
2239 |
KCmdReqNot, KLocalIdList, KInvalid ); |
|
2240 |
||
2241 |
GetLocalUid( listElement.AsDes(), localUid ); |
|
2242 |
aFilter.AddLocalUid( localUid ); |
|
2243 |
} |
|
2244 |
} |
|
2245 |
CleanupStack::Pop( &listElement ); |
|
2246 |
listElement.Reset(); |
|
2247 |
} |
|
2248 |
else |
|
2249 |
{ |
|
2250 |
AppendErrorMessageL( KCmdReqNot, KLocalIdList, KInvalid ); |
|
2251 |
User::Leave(KErrArgument); |
|
2252 |
} |
|
2253 |
} |
|
2254 |
CleanupStack::Pop( ¶m ); |
|
2255 |
param.Reset(); |
|
2256 |
} |
|
2257 |
else |
|
2258 |
{ |
|
2259 |
AppendErrorMessageL( KCmdReqNot, KFilter, KInvalid ); |
|
2260 |
User::Leave(KErrArgument); |
|
2261 |
} |
|
2262 |
} |
|
2263 |
} |
|
2264 |
||
2265 |
||
2266 |
// --------------------------------------------------------------------------- |
|
2267 |
// Extracts LocalUid as TCalLocalUid from input Uid String |
|
2268 |
// --------------------------------------------------------------------------- |
|
2269 |
// |
|
2270 |
void CCalendarInterface::GetLocalUid( const TDesC& aLocalUid, TCalLocalUid& aOutLocalUid ) |
|
2271 |
{ |
|
2272 |
aOutLocalUid = 0; |
|
2273 |
/*if( aLocalUid.Length() ) |
|
2274 |
{ |
|
2275 |
TInt sepPos = aLocalUid.Locate( KUidSeparator ); |
|
2276 |
TPtrC temp; |
|
2277 |
if( sepPos == KErrNotFound ) |
|
2278 |
{ |
|
2279 |
temp.Set(aLocalUid.Mid(0)); |
|
2280 |
} |
|
2281 |
else |
|
2282 |
{ |
|
2283 |
temp.Set(aLocalUid.Mid(0, sepPos)); |
|
2284 |
} |
|
2285 |
}*/ |
|
2286 |
TLex lex(aLocalUid); |
|
2287 |
TInt32 num; |
|
2288 |
||
2289 |
if(lex.Val(num) == KErrNone) |
|
2290 |
aOutLocalUid = TCalLocalUid(num); |
|
2291 |
||
2292 |
} |
|
2293 |
||
2294 |
// --------------------------------------------------------------------------- |
|
2295 |
// Extracts GlobalUid as 8-bit string from input Uid String |
|
2296 |
// --------------------------------------------------------------------------- |
|
2297 |
// |
|
2298 |
void CCalendarInterface::GetGlobalUid( const TDesC& aGlobalUid, TPtr8 aOutGlobalUid ) |
|
2299 |
{ |
|
2300 |
if( aGlobalUid.Length() ) |
|
2301 |
{ |
|
2302 |
/*TInt sepPos = aGlobalUid.Locate( KUidSeparator ); |
|
2303 |
||
2304 |
if( sepPos == KErrNotFound ) |
|
2305 |
{ |
|
2306 |
aOutGlobalUid.Copy( aGlobalUid.Mid(0) ); |
|
2307 |
} |
|
2308 |
else |
|
2309 |
{ |
|
2310 |
aOutGlobalUid.Copy( aGlobalUid.Mid( sepPos + 1 ) ); |
|
2311 |
}*/ |
|
2312 |
aOutGlobalUid.Copy( aGlobalUid ); |
|
2313 |
} |
|
2314 |
||
2315 |
} |
|
2316 |
||
2317 |
// --------------------------------------------------------------------------- |
|
2318 |
// ErrCode Conversion |
|
2319 |
// --------------------------------------------------------------------------- |
|
2320 |
// |
|
2321 |
TInt32 CCalendarInterface::ErrCodeConversion(TInt code) |
|
2322 |
{ |
|
2323 |
TInt32 err; |
|
2324 |
switch (code) |
|
2325 |
{ |
|
2326 |
case KErrCancel: |
|
2327 |
// Returning KErrNone incase of KErrCancel |
|
2328 |
case KErrNone: |
|
2329 |
err= SErrNone; |
|
2330 |
break; |
|
2331 |
||
2332 |
case KErrNotFound: |
|
2333 |
err= SErrNotFound; |
|
2334 |
break; |
|
2335 |
||
2336 |
case KErrNoMemory: |
|
2337 |
err = SErrNoMemory; |
|
2338 |
break; |
|
2339 |
||
2340 |
case KErrInUse: |
|
2341 |
err = SErrServiceInUse; |
|
2342 |
break; |
|
2343 |
||
2344 |
case KErrNotSupported: |
|
2345 |
err = SErrServiceNotSupported; |
|
2346 |
break; |
|
2347 |
||
2348 |
case KErrBadName: |
|
2349 |
err = SErrBadArgumentType; |
|
2350 |
break; |
|
2351 |
||
2352 |
case KErrArgument: |
|
2353 |
err = SErrInvalidServiceArgument; |
|
2354 |
break; |
|
2355 |
||
2356 |
case KErrAccessDenied: |
|
2357 |
err = SErrAccessDenied; |
|
2358 |
break; |
|
2359 |
||
2360 |
case KErrPathNotFound: |
|
2361 |
err = SErrPathNotFound; |
|
2362 |
break; |
|
2363 |
||
2364 |
case KErrAlreadyExists: |
|
2365 |
err = SErrEntryExists; |
|
2366 |
break; |
|
2367 |
||
2368 |
default : |
|
2369 |
err = SErrGeneralError; |
|
2370 |
break; |
|
2371 |
} |
|
2372 |
||
2373 |
return err; |
|
2374 |
||
2375 |
} |
|
2376 |
||
2377 |
// --------------------------------------------------------------------------- |
|
2378 |
// Validate the type of the input param with the expected type |
|
2379 |
// --------------------------------------------------------------------------- |
|
2380 |
// |
|
2381 |
void CCalendarInterface::ValidateParamTypeL( TLiwVariant& aParam, |
|
2382 |
LIW::TVariantTypeId aExpectedtype, |
|
2383 |
const TDesC8& aCmdName, |
|
2384 |
const TDesC8& aParameter, |
|
2385 |
const TDesC& aMessage ) |
|
2386 |
{ |
|
2387 |
if( aParam.TypeId() != aExpectedtype ) |
|
2388 |
{ |
|
2389 |
AppendErrorMessageL(aCmdName, aParameter, aMessage); |
|
2390 |
aParam.Reset(); |
|
2391 |
User::Leave(KErrArgument); |
|
2392 |
} |
|
2393 |
} |
|
2394 |
||
2395 |
// --------------------------------------------------------------------------- |
|
2396 |
// Append Error Message |
|
2397 |
// --------------------------------------------------------------------------- |
|
2398 |
// |
|
2399 |
void CCalendarInterface::AppendErrorMessageL( const TDesC8& aCmdName, const TDesC8& aParameter, const TDesC& aMessage ) |
|
2400 |
{ |
|
2401 |
iErrorMessage = HBufC::NewL( KMaxErrorMessageLength ); |
|
2402 |
TPtr tmpMsgPtr = iErrorMessage->Des(); |
|
2403 |
tmpMsgPtr.Copy(KDomainName); |
|
2404 |
||
2405 |
HBufC* temp = HBufC::NewL( KMaxErrorMessageLength ); |
|
2406 |
||
2407 |
if ( aCmdName.Length() ) |
|
2408 |
{ |
|
2409 |
tmpMsgPtr.Append( KErrorMsgSeparator ); |
|
2410 |
temp->Des().Copy( aCmdName ); |
|
2411 |
tmpMsgPtr.Append( temp->Des() ); |
|
2412 |
} |
|
2413 |
||
2414 |
tmpMsgPtr.Append(KErrorMsgSeparator); |
|
2415 |
||
2416 |
if ( aParameter.Length() ) |
|
2417 |
{ |
|
2418 |
temp->Des().Copy(aParameter); |
|
2419 |
tmpMsgPtr.Append(temp->Des()); |
|
2420 |
} |
|
2421 |
||
2422 |
if ( aMessage.Length() ) |
|
2423 |
{ |
|
2424 |
tmpMsgPtr.Append( aMessage ); |
|
2425 |
} |
|
2426 |
||
2427 |
delete temp; |
|
2428 |
} |
|
2429 |
||
2430 |
// --------------------------------------------------------------------------- |
|
2431 |
// Set Import output to output parameter |
|
2432 |
// --------------------------------------------------------------------------- |
|
2433 |
// |
|
2434 |
void CCalendarInterface::SetImportOutputL( RPointerArray<TUIDSet>& aOutputUIDSet, CLiwGenericParamList& aOutParamList ) |
|
2435 |
{ |
|
2436 |
TInt arrCount = aOutputUIDSet.Count(); |
|
2437 |
||
2438 |
//List of Maps |
|
2439 |
CLiwDefaultList *uIDList = CLiwDefaultList::NewL(); |
|
2440 |
||
2441 |
CleanupClosePushL( *uIDList ); |
|
2442 |
||
2443 |
for( TInt index = 0; index < arrCount; ++index ) |
|
2444 |
{ |
|
2445 |
TLiwVariant liwVariant; |
|
2446 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &liwVariant)); |
|
2447 |
||
2448 |
GetTLiwVariantForUIDSetL( liwVariant, aOutputUIDSet[ index ] ); |
|
2449 |
||
2450 |
uIDList->AppendL( liwVariant ); |
|
2451 |
||
2452 |
CleanupStack::Pop( &liwVariant ); |
|
2453 |
liwVariant.Reset(); |
|
2454 |
} |
|
2455 |
||
2456 |
//Iterator over List of Maps |
|
2457 |
CIterableUIDMapList *outputIterableList = CIterableUIDMapList::NewL( uIDList ); |
|
2458 |
||
2459 |
CleanupClosePushL( *outputIterableList ); |
|
2460 |
// Appending the Iteratot over List of Maps to the outParamList CLiwGenericParamList |
|
2461 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( outputIterableList ) ) ); |
|
2462 |
||
2463 |
CleanupStack::PopAndDestroy( outputIterableList );//doubt check at debugging |
|
2464 |
||
2465 |
CleanupStack::Pop( uIDList ); |
|
2466 |
} |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2467 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2468 |
// Set getlist output to output parameter |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2469 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2470 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2471 |
void CCalendarInterface::SetCalEntryOutputL( RPointerArray<CCalEntry>& aOutputCalEntry, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2472 |
CLiwGenericParamList& aOutParamList, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2473 |
const TDesC& aCalendarName ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2474 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2475 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2476 |
TInt arrCount = aOutputCalEntry.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2477 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2478 |
CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, aCalendarName, ETrue ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2479 |
CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2480 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2481 |
for( TInt index = 0; index < arrCount; ++index ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2482 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2483 |
iterEntryList->EntryArray().Append(aOutputCalEntry[index]); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2484 |
} |
5 | 2485 |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2486 |
//Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2487 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterEntryList ) ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2488 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2489 |
iterEntryList->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2490 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2491 |
iArrayCalEntryList.Append( iterEntryList ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2492 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2493 |
CleanupStack::Pop( iterEntryList ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2494 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2495 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2496 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2497 |
// Set getlist output to output parameter |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2498 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2499 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2500 |
void CCalendarInterface::SetCalInstanceOutputL( RPointerArray<CCalInstance>& aOutputCalInstance, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2501 |
CLiwGenericParamList& aOutParamList, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2502 |
const TDesC& aCalendarName) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2503 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2504 |
TInt arrCount = aOutputCalInstance.Count(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2505 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2506 |
CIterableCalEntryList* iterInstanceList = CIterableCalEntryList::NewL( *this, aCalendarName, EFalse ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2507 |
CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterInstanceList ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2508 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2509 |
for( TInt index = 0; index < arrCount; ++index ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2510 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2511 |
iterInstanceList->InstanceArray().Append(aOutputCalInstance[index]); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2512 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2513 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2514 |
// Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2515 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterInstanceList ) ) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2516 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2517 |
iterInstanceList->DecRef(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2518 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2519 |
iArrayCalEntryList.Append( iterInstanceList ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2520 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2521 |
CleanupStack::Pop( iterInstanceList ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2522 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2523 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
2524 |
} |
5 | 2525 |
// --------------------------------------------------------------------------- |
2526 |
// Set Change Notification output to output parameter |
|
2527 |
// --------------------------------------------------------------------------- |
|
2528 |
// |
|
2529 |
void CCalendarInterface::SetNotifyOutputL( RArray<TCalChangeEntry>& aOutputChangeSet, CLiwGenericParamList& aOutParamList ) |
|
2530 |
{ |
|
2531 |
TInt arrCount = aOutputChangeSet.Count(); |
|
2532 |
||
2533 |
//List of Maps |
|
2534 |
CLiwDefaultList *changeList = CLiwDefaultList::NewL(); |
|
2535 |
||
2536 |
CleanupClosePushL( *changeList ); |
|
2537 |
||
2538 |
for( TInt index = 0; index < arrCount; ++index ) |
|
2539 |
{ |
|
2540 |
TLiwVariant liwVariant; |
|
2541 |
CleanupStack::PushL( TCleanupItem(TLiwVariant::VariantCleanup , &liwVariant)); |
|
2542 |
||
2543 |
GetTLiwVariantForCalChangeEntryL( liwVariant, aOutputChangeSet[index] ); |
|
2544 |
||
2545 |
changeList->AppendL( liwVariant ); |
|
2546 |
||
2547 |
CleanupStack::Pop( &liwVariant ); |
|
2548 |
liwVariant.Reset(); |
|
2549 |
} |
|
2550 |
||
2551 |
//Iterator over List of Maps |
|
2552 |
CIterableUIDMapList *outputIterableList = CIterableUIDMapList::NewL( changeList ); |
|
2553 |
CleanupStack::Pop( changeList ); |
|
2554 |
CleanupClosePushL( *outputIterableList ); |
|
2555 |
||
2556 |
// Appending the Iteratot over List of Maps to the outParamList CLiwGenericParamList |
|
2557 |
aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( outputIterableList ) ) ); |
|
2558 |
||
2559 |
CleanupStack::PopAndDestroy( outputIterableList ); |
|
2560 |
||
2561 |
} |
|
2562 |
||
2563 |
// --------------------------------------------------------------------------- |
|
2564 |
// Set GlobalUid/LocalUid to the LiwVariant |
|
2565 |
// --------------------------------------------------------------------------- |
|
2566 |
// |
|
2567 |
void CCalendarInterface::GetTLiwVariantForUIDSetL( TLiwVariant& aValue, TUIDSet* aUIDSet ) |
|
2568 |
{ |
|
2569 |
HBufC* globalUid = HBufC::NewL( aUIDSet->iGlobalUID->Length() + 1 ); |
|
2570 |
CleanupStack::PushL( globalUid ); |
|
2571 |
globalUid->Des().Copy( aUIDSet->iGlobalUID->Des() ); |
|
2572 |
aValue.SetL( TLiwVariant(*globalUid)); |
|
2573 |
CleanupStack::PopAndDestroy( globalUid ); |
|
2574 |
} |
|
2575 |
||
2576 |
// --------------------------------------------------------------------------- |
|
2577 |
// Set Change type to the LiwVariant |
|
2578 |
// --------------------------------------------------------------------------- |
|
2579 |
// |
|
2580 |
void CCalendarInterface::GetTLiwVariantForCalChangeEntryL( TLiwVariant& aValue, TCalChangeEntry& aChangeEntry ) |
|
2581 |
{ |
|
2582 |
CLiwDefaultMap* uIDMap = CLiwDefaultMap::NewL(); |
|
2583 |
||
2584 |
CleanupClosePushL( *uIDMap ); |
|
2585 |
||
2586 |
TBuf<20> localUid; |
|
2587 |
||
2588 |
localUid.Num( TInt64(aChangeEntry.iEntryId )); |
|
2589 |
||
2590 |
uIDMap->InsertL( KLocalId, TLiwVariant( localUid ) ); |
|
2591 |
||
2592 |
uIDMap->InsertL( KChangeType, TLiwVariant( CCalendarInterface::GetChangeType( aChangeEntry.iChangeType ) ) ); |
|
2593 |
||
2594 |
aValue.SetL( uIDMap ); |
|
2595 |
||
2596 |
CleanupStack::PopAndDestroy( uIDMap ); |
|
2597 |
||
2598 |
} |
|
2599 |
||
2600 |
// --------------------------------------------------------------------------- |
|
2601 |
// Cleanup function for an CIterableCalEntryList |
|
2602 |
// --------------------------------------------------------------------------- |
|
2603 |
// |
|
2604 |
void CCalendarInterface::CleanupIterableCalEntry(void* aIterEntryList) |
|
2605 |
{ |
|
2606 |
CIterableCalEntryList* iterEntryList = static_cast<CIterableCalEntryList*>(aIterEntryList); |
|
2607 |
if ( iterEntryList ) |
|
2608 |
{ |
|
2609 |
iterEntryList->DecRef(); |
|
2610 |
} |
|
2611 |
} |
|
2612 |
||
2613 |
// --------------------------------------------------------------------------- |
|
2614 |
// Returns Day of Month of repeat rule as LiwVariant Map. Caller takes the ownership of map |
|
2615 |
// --------------------------------------------------------------------------- |
|
2616 |
// |
|
2617 |
CLiwDefaultMap* CCalendarInterface::GetDayOfMonthL( const TCalRRule::TDayOfMonth& aDayOfMonth ) |
|
2618 |
{ |
|
2619 |
CLiwDefaultMap* dayMap = CLiwDefaultMap::NewL(); |
|
2620 |
CleanupClosePushL( *dayMap ); |
|
2621 |
||
2622 |
dayMap->InsertL( KDay, TLiwVariant( TInt32( aDayOfMonth.Day() ) )); |
|
2623 |
dayMap->InsertL( KWeekNum, TLiwVariant( TInt32( aDayOfMonth.WeekInMonth() ) )); |
|
2624 |
||
2625 |
CleanupStack::Pop( dayMap ); |
|
2626 |
return dayMap; |
|
2627 |
} |
|
2628 |
||
2629 |
// --------------------------------------------------------------------------- |
|
2630 |
// Returns CalUser as LiwVariant Map. Caller takes the ownership of map |
|
2631 |
// --------------------------------------------------------------------------- |
|
2632 |
// |
|
2633 |
CLiwDefaultMap* CCalendarInterface::GetCalUserL( CCalUser* aCalUser, TBool aAttendee ) |
|
2634 |
{ |
|
2635 |
CLiwDefaultMap* userMap = CLiwDefaultMap::NewL(); |
|
2636 |
CleanupClosePushL( *userMap ); |
|
2637 |
||
2638 |
userMap->InsertL( KCommonName, TLiwVariant( aCalUser->CommonName() ) ); |
|
2639 |
userMap->InsertL( KAddress, TLiwVariant( aCalUser->Address() ) ); |
|
2640 |
||
2641 |
if ( aAttendee ) |
|
2642 |
{ |
|
2643 |
userMap->InsertL( KRole, TLiwVariant( CCalendarInterface::GetAttendeeRoleL(((CCalAttendee*)aCalUser)->RoleL() ) )); |
|
2644 |
userMap->InsertL( KStatus, TLiwVariant( CCalendarInterface::GetAttendeeStatusL(((CCalAttendee*)aCalUser)->StatusL() ) )); |
|
2645 |
userMap->InsertL( KRsvp, TLiwVariant( ((CCalAttendee*)aCalUser)->ResponseRequested() ) ); |
|
2646 |
} |
|
2647 |
||
2648 |
CleanupStack::Pop( userMap ); |
|
2649 |
return userMap; |
|
2650 |
} |
|
2651 |
||
2652 |
// --------------------------------------------------------------------------- |
|
2653 |
// Returns array of CalTime as LiwVariant List. Caller takes the ownership of list |
|
2654 |
// --------------------------------------------------------------------------- |
|
2655 |
// |
|
2656 |
CLiwDefaultList* CCalendarInterface::GetDatesListL( RArray<TCalTime>& aDates ) |
|
2657 |
{ |
|
2658 |
TInt count = aDates.Count(); |
|
2659 |
||
2660 |
CLiwDefaultList* dateList = CLiwDefaultList::NewL(); |
|
2661 |
CleanupClosePushL( *dateList ); |
|
2662 |
||
2663 |
for ( TInt index = 0 ; index < count; index++ ) |
|
2664 |
{ |
|
2665 |
dateList->AppendL( aDates[index].TimeUtcL() ); |
|
2666 |
} |
|
2667 |
||
2668 |
CleanupStack::Pop( dateList ); |
|
2669 |
return dateList; |
|
2670 |
} |
|
2671 |
||
2672 |
// --------------------------------------------------------------------------- |
|
2673 |
// Returns RepeatRule as LiwVariant Map. Caller takes the ownership of map |
|
2674 |
// --------------------------------------------------------------------------- |
|
2675 |
// |
|
2676 |
CLiwDefaultMap* CCalendarInterface::GetRRMapL( const TCalRRule& repeatRule ) |
|
2677 |
{ |
|
2678 |
TCalRRule::TType rrType = repeatRule.Type(); |
|
2679 |
||
2680 |
if ( rrType == TCalRRule::EInvalid ) |
|
2681 |
return NULL; |
|
2682 |
||
2683 |
CLiwDefaultMap* rrMap = CLiwDefaultMap::NewL(); |
|
2684 |
||
2685 |
CleanupClosePushL( *rrMap ); |
|
2686 |
||
2687 |
rrMap->InsertL( KRepeatType, TLiwVariant( TInt32( rrType ) )); |
|
2688 |
||
2689 |
rrMap->InsertL( KUntilDate, TLiwVariant( repeatRule.Until().TimeUtcL() )); |
|
2690 |
||
2691 |
rrMap->InsertL( KInterval, TLiwVariant( TInt32( repeatRule.Interval() ))); |
|
2692 |
||
2693 |
rrMap->InsertL( KRStartDate, TLiwVariant( repeatRule.DtStart().TimeUtcL() )); |
|
2694 |
||
2695 |
if ( rrType == TCalRRule::EWeekly ) |
|
2696 |
{ |
|
2697 |
RArray<TDay> dayArray; |
|
2698 |
repeatRule.GetByDayL( dayArray ); |
|
2699 |
||
2700 |
CLiwDefaultList* dayList = CLiwDefaultList::NewL(); |
|
2701 |
CleanupClosePushL( *dayList ); |
|
2702 |
||
2703 |
TInt count = dayArray.Count(); |
|
2704 |
for ( TInt index = 0 ; index < count; index++ ) |
|
2705 |
{ |
|
2706 |
dayList->AppendL( TInt32( dayArray[index] )); |
|
2707 |
} |
|
2708 |
||
2709 |
rrMap->InsertL( KDaysInWeek, TLiwVariant( dayList )); |
|
2710 |
||
2711 |
CleanupStack::PopAndDestroy( dayList ); |
|
2712 |
||
2713 |
dayArray.Reset(); |
|
2714 |
} |
|
2715 |
else if ( rrType == TCalRRule::EMonthly ) |
|
2716 |
{ |
|
2717 |
RArray<TInt> monthDays; |
|
2718 |
repeatRule.GetByMonthDayL( monthDays ); |
|
2719 |
TInt count = monthDays.Count(); |
|
2720 |
if ( count > 0 ) |
|
2721 |
{ |
|
2722 |
// |
|
2723 |
CLiwDefaultList* dayList = CLiwDefaultList::NewL(); |
|
2724 |
CleanupClosePushL( *dayList ); |
|
2725 |
||
2726 |
for ( TInt index = 0 ; index < count; index++ ) |
|
2727 |
{ |
|
2728 |
dayList->AppendL( TInt32(monthDays[index] )); |
|
2729 |
} |
|
2730 |
||
2731 |
rrMap->InsertL( KMonthDays, TLiwVariant( dayList )); |
|
2732 |
||
2733 |
CleanupStack::PopAndDestroy( dayList ); |
|
2734 |
||
2735 |
||
2736 |
} |
|
2737 |
else |
|
2738 |
{ |
|
2739 |
RArray< TCalRRule::TDayOfMonth > daysOfMonth; |
|
2740 |
repeatRule.GetByDayL( daysOfMonth ); |
|
2741 |
count = daysOfMonth.Count(); |
|
2742 |
if ( count > 0 ) |
|
2743 |
{ |
|
2744 |
CLiwDefaultList* dayList = CLiwDefaultList::NewL(); |
|
2745 |
CleanupClosePushL( *dayList ); |
|
2746 |
||
2747 |
for ( TInt index = 0; index < count; index++ ) |
|
2748 |
{ |
|
2749 |
CLiwDefaultMap* dayOfMonthMap = CCalendarInterface::GetDayOfMonthL( daysOfMonth[index] ); |
|
2750 |
dayList->AppendL( TLiwVariant ( dayOfMonthMap ) ); |
|
2751 |
dayOfMonthMap->DecRef(); |
|
2752 |
} |
|
2753 |
||
2754 |
rrMap->InsertL( KDaysOfMonth, TLiwVariant( dayList )); |
|
2755 |
||
2756 |
CleanupStack::PopAndDestroy( dayList ); |
|
2757 |
||
2758 |
} |
|
2759 |
daysOfMonth.Reset(); |
|
2760 |
} |
|
2761 |
monthDays.Reset(); |
|
2762 |
} |
|
2763 |
else if ( rrType == TCalRRule::EYearly ) |
|
2764 |
{ |
|
2765 |
RArray<TMonth> monthArray; |
|
2766 |
repeatRule.GetByMonthL( monthArray ); |
|
2767 |
||
2768 |
if ( monthArray.Count() > 0 ) |
|
2769 |
{ |
|
2770 |
rrMap->InsertL( KMonth, TLiwVariant( TInt32( monthArray[0] ) )); |
|
2771 |
} |
|
2772 |
monthArray.Reset(); |
|
2773 |
||
2774 |
||
2775 |
RArray< TCalRRule::TDayOfMonth > daysOfMonth; |
|
2776 |
repeatRule.GetByDayL( daysOfMonth ); |
|
2777 |
TInt count = daysOfMonth.Count(); |
|
2778 |
if ( count > 0 ) |
|
2779 |
{ |
|
2780 |
CLiwDefaultList* dayList = CLiwDefaultList::NewL(); |
|
2781 |
CleanupClosePushL( *dayList ); |
|
2782 |
||
2783 |
for ( TInt index = 0; index < count; index++ ) |
|
2784 |
{ |
|
2785 |
CLiwDefaultMap* dayOfMonthMap = CCalendarInterface::GetDayOfMonthL( daysOfMonth[index] ); |
|
2786 |
dayList->AppendL( TLiwVariant ( dayOfMonthMap ) ); |
|
2787 |
dayOfMonthMap->DecRef(); |
|
2788 |
} |
|
2789 |
||
2790 |
rrMap->InsertL( KDaysOfMonth, TLiwVariant( dayList )); |
|
2791 |
||
2792 |
CleanupStack::PopAndDestroy( dayList ); |
|
2793 |
||
2794 |
} |
|
2795 |
daysOfMonth.Reset(); |
|
2796 |
||
2797 |
} |
|
2798 |
||
2799 |
CleanupStack::Pop( rrMap ); |
|
2800 |
||
2801 |
return rrMap; |
|
2802 |
} |
|
2803 |
||
2804 |
||
2805 |
// --------------------------------------------------------------------------- |
|
2806 |
// Returns string literal for the given Entry Type |
|
2807 |
// --------------------------------------------------------------------------- |
|
2808 |
// |
|
2809 |
TPtrC CCalendarInterface::GetEntryTypeL( const CCalEntry::TType aType ) |
|
2810 |
{ |
|
2811 |
TPtrC retValue; |
|
2812 |
||
2813 |
if ( aType == CCalEntry::EAppt ) |
|
2814 |
retValue.Set( KEntryAppt ); |
|
2815 |
||
2816 |
else if ( aType == CCalEntry::ETodo ) |
|
2817 |
retValue.Set( KEntryTodo ); |
|
2818 |
||
2819 |
else if ( aType == CCalEntry::EEvent ) |
|
2820 |
retValue.Set( KEntryEvent ); |
|
2821 |
||
2822 |
else if ( aType == CCalEntry::EReminder ) |
|
2823 |
retValue.Set( KEntryReminder ); |
|
2824 |
||
2825 |
else if ( aType == CCalEntry::EAnniv ) |
|
2826 |
retValue.Set( KEntryAnniv ); |
|
2827 |
||
2828 |
else |
|
2829 |
User::Leave(KErrArgument); |
|
2830 |
||
2831 |
return retValue; |
|
2832 |
||
2833 |
} |
|
2834 |
||
2835 |
// --------------------------------------------------------------------------- |
|
2836 |
// Returns string literal for the given Entry Replication status |
|
2837 |
// --------------------------------------------------------------------------- |
|
2838 |
// |
|
2839 |
TPtrC CCalendarInterface::GetReplicationL( const CCalEntry::TReplicationStatus aType ) |
|
2840 |
{ |
|
2841 |
TPtrC retValue; |
|
2842 |
||
2843 |
if ( aType == CCalEntry::EPrivate ) |
|
2844 |
retValue.Set( KReplPrivate ); |
|
2845 |
||
2846 |
else if ( aType == CCalEntry::ERestricted ) |
|
2847 |
retValue.Set( KReplRest ); |
|
2848 |
||
2849 |
else |
|
2850 |
retValue.Set( KReplOpen ); |
|
2851 |
||
2852 |
return retValue; |
|
2853 |
||
2854 |
} |
|
2855 |
||
2856 |
// --------------------------------------------------------------------------- |
|
2857 |
// Returns string literal for Change Types |
|
2858 |
// --------------------------------------------------------------------------- |
|
2859 |
// |
|
2860 |
TPtrC CCalendarInterface::GetChangeType( const MCalChangeCallBack2::TChangeType aType ) |
|
2861 |
{ |
|
2862 |
TPtrC retValue; |
|
2863 |
||
2864 |
if ( aType == MCalChangeCallBack2::EChangeAdd ) |
|
2865 |
retValue.Set( KChangeAdd ); |
|
2866 |
||
2867 |
else if ( aType == MCalChangeCallBack2::EChangeDelete ) |
|
2868 |
retValue.Set( KChangeDelete ); |
|
2869 |
||
2870 |
else if ( aType == MCalChangeCallBack2::EChangeModify ) |
|
2871 |
retValue.Set( KChangeModify ); |
|
2872 |
||
2873 |
else |
|
2874 |
retValue.Set( KChangeUndefined ); |
|
2875 |
||
2876 |
return retValue; |
|
2877 |
||
2878 |
} |
|
2879 |
||
2880 |
// --------------------------------------------------------------------------- |
|
2881 |
// Returns string literal for Entry Status |
|
2882 |
// --------------------------------------------------------------------------- |
|
2883 |
// |
|
2884 |
TPtrC CCalendarInterface::GetStatusL( const CCalEntry::TStatus aStatus ) |
|
2885 |
{ |
|
2886 |
TPtrC retValue; |
|
2887 |
||
2888 |
if ( aStatus == CCalEntry::ETentative ) |
|
2889 |
retValue.Set( KStatusTentative ); |
|
2890 |
||
2891 |
else if ( aStatus == CCalEntry::EConfirmed ) |
|
2892 |
retValue.Set( KStatusConfirmed ); |
|
2893 |
||
2894 |
else if ( aStatus == CCalEntry::ECancelled ) |
|
2895 |
retValue.Set( KStatusCancelled ); |
|
2896 |
||
2897 |
else if ( aStatus == CCalEntry::ETodoNeedsAction ) |
|
2898 |
retValue.Set( KStatusTodoNeedsAction ); |
|
2899 |
||
2900 |
else if ( aStatus == CCalEntry::ETodoCompleted ) |
|
2901 |
retValue.Set( KStatusTodoCompleted ); |
|
2902 |
||
2903 |
else if ( aStatus == CCalEntry::ETodoInProcess ) |
|
2904 |
retValue.Set( KStatusTodoInProcess ); |
|
2905 |
||
2906 |
else |
|
2907 |
retValue.Set( KNullStatus ); |
|
2908 |
||
2909 |
return retValue; |
|
2910 |
} |
|
2911 |
||
2912 |
// --------------------------------------------------------------------------- |
|
2913 |
// Returns string literal for Attendee Status |
|
2914 |
// --------------------------------------------------------------------------- |
|
2915 |
// |
|
2916 |
TPtrC CCalendarInterface::GetAttendeeStatusL( const CCalAttendee::TCalStatus aStatus ) |
|
2917 |
{ |
|
2918 |
TPtrC retValue; |
|
2919 |
||
2920 |
if ( aStatus == CCalAttendee::EAccepted ) |
|
2921 |
retValue.Set( KAttStatusAccepted ); |
|
2922 |
||
2923 |
else if ( aStatus == CCalAttendee::ETentative ) |
|
2924 |
retValue.Set( KAttStatusTentative ); |
|
2925 |
||
2926 |
else if ( aStatus == CCalAttendee::EConfirmed ) |
|
2927 |
retValue.Set( KAttStatusConfirmed ); |
|
2928 |
||
2929 |
else if ( aStatus == CCalAttendee::EDeclined ) |
|
2930 |
retValue.Set( KAttStatusDeclined ); |
|
2931 |
||
2932 |
else if ( aStatus == CCalAttendee::ECompleted ) |
|
2933 |
retValue.Set( KAttStatusCompleted ); |
|
2934 |
||
2935 |
else if ( aStatus == CCalAttendee::EDelegated ) |
|
2936 |
retValue.Set( KAttStatusDelegated ); |
|
2937 |
||
2938 |
else if ( aStatus == CCalAttendee::EInProcess ) |
|
2939 |
retValue.Set( KAttStatusInProcess ); |
|
2940 |
||
2941 |
else |
|
2942 |
retValue.Set( KAttStatusNeedsAction ); |
|
2943 |
||
2944 |
return retValue; |
|
2945 |
} |
|
2946 |
||
2947 |
// --------------------------------------------------------------------------- |
|
2948 |
// Get string literal for Attendee Role |
|
2949 |
// --------------------------------------------------------------------------- |
|
2950 |
// |
|
2951 |
TPtrC CCalendarInterface::GetAttendeeRoleL( const CCalAttendee::TCalRole aRole ) |
|
2952 |
{ |
|
2953 |
TPtrC retValue; |
|
2954 |
||
2955 |
if ( aRole == CCalAttendee::EOptParticipant ) |
|
2956 |
retValue.Set( KAttRoleOptParticipant ); |
|
2957 |
||
2958 |
else if ( aRole == CCalAttendee::ENonParticipant ) |
|
2959 |
retValue.Set( KAttRoleNonParticipant ); |
|
2960 |
||
2961 |
else if ( aRole == CCalAttendee::EChair ) |
|
2962 |
retValue.Set( KAttRoleChair ); |
|
2963 |
||
2964 |
else |
|
2965 |
retValue.Set( KAttRoleReqParticipant ); |
|
2966 |
||
2967 |
return retValue; |
|
2968 |
} |
|
2969 |
||
2970 |
// --------------------------------------------------------------------------- |
|
2971 |
// Return string literal for Entry Method |
|
2972 |
// --------------------------------------------------------------------------- |
|
2973 |
// |
|
2974 |
TPtrC CCalendarInterface::GetMethodL( const CCalEntry::TMethod aMethod ) |
|
2975 |
{ |
|
2976 |
TPtrC retValue; |
|
2977 |
||
2978 |
if ( aMethod == CCalEntry::EMethodPublish ) |
|
2979 |
retValue.Set( KMethodPublish ); |
|
2980 |
||
2981 |
else if ( aMethod == CCalEntry::EMethodRequest) |
|
2982 |
retValue.Set( KMethodRequest ); |
|
2983 |
||
2984 |
else if ( aMethod == CCalEntry::EMethodReply) |
|
2985 |
retValue.Set( KMethodReply ); |
|
2986 |
||
2987 |
else if ( aMethod == CCalEntry::EMethodAdd ) |
|
2988 |
retValue.Set( KMethodAdd ); |
|
2989 |
||
2990 |
else if ( aMethod == CCalEntry::EMethodCancel ) |
|
2991 |
retValue.Set( KMethodCancel ); |
|
2992 |
||
2993 |
else if ( aMethod == CCalEntry::EMethodRefresh ) |
|
2994 |
retValue.Set( KMethodRefresh ); |
|
2995 |
||
2996 |
else if ( aMethod == CCalEntry::EMethodCounter ) |
|
2997 |
retValue.Set( KMethodCounter ); |
|
2998 |
||
2999 |
else if ( aMethod == CCalEntry::EMethodDeclineCounter ) |
|
3000 |
retValue.Set( KMethodDecCounter ); |
|
3001 |
||
3002 |
else |
|
3003 |
retValue.Set( KMethodNone ); |
|
3004 |
||
3005 |
return retValue; |
|
3006 |
} |
|
3007 |
||
3008 |
// --------------------------------------------------------------------------- |
|
3009 |
// Return string literal for Entry Method |
|
3010 |
// --------------------------------------------------------------------------- |
|
3011 |
// |
|
3012 |
void CCalendarInterface::RemoveCalEntryListFromArray( CIterableCalEntryList* aCalEntryList ) |
|
3013 |
{ |
|
3014 |
TInt count = iArrayCalEntryList.Count(); |
|
3015 |
for(TInt index = 0; index < count; index++ ) |
|
3016 |
{ |
|
3017 |
if ( iArrayCalEntryList[index] == aCalEntryList ) |
|
3018 |
{ |
|
3019 |
iArrayCalEntryList.Remove( index ); |
|
3020 |
break; |
|
3021 |
} |
|
3022 |
} |
|
3023 |
||
3024 |
iArrayCalEntryList.Compress(); |
|
3025 |
} |
|
3026 |
||
3027 |
// --------------------------------------------------------------------------- |
|
3028 |
// Return Entry Type for given LocalUid |
|
3029 |
// --------------------------------------------------------------------------- |
|
3030 |
// |
|
3031 |
TInt CCalendarInterface::GetEntryType( const TDesC& aCalendarName, TCalLocalUid aLocalUid ) |
|
3032 |
{ |
|
3033 |
TInt entryType = -1; |
|
3034 |
RPointerArray<CCalEntry> entryArray; |
|
3035 |
iCalService->GetListL( aCalendarName, aLocalUid, entryArray); |
|
3036 |
if( entryArray.Count() ) |
|
3037 |
{ |
|
3038 |
entryType = entryArray[0]->EntryTypeL(); |
|
3039 |
} |
|
3040 |
entryArray.ResetAndDestroy(); |
|
3041 |
return entryType; |
|
3042 |
} |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3043 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3044 |
// Return Entry Type for given GlobalUid |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3045 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3046 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3047 |
TInt CCalendarInterface::GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3048 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3049 |
TInt entryType = -1; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3050 |
RPointerArray<CCalEntry> entryArray; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3051 |
iCalService->GetListL( aCalendarName, aGuid, entryArray); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3052 |
if( entryArray.Count() ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3053 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3054 |
entryType = entryArray[0]->EntryTypeL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3055 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3056 |
entryArray.ResetAndDestroy(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3057 |
return entryType; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
3058 |
} |
5 | 3059 |
// --------------------------------------------------------------------------- |
3060 |
// Check if given calendar is in use by other resources |
|
3061 |
// --------------------------------------------------------------------------- |
|
3062 |
// |
|
3063 |
TBool CCalendarInterface::CheckCalendarInUse( const TDesC& aCalendarName ) |
|
3064 |
{ |
|
3065 |
TBool retValue = EFalse; |
|
3066 |
TInt count = iArrayCalEntryList.Count(); |
|
3067 |
for(TInt index = 0; index < count; index++ ) |
|
3068 |
{ |
|
3069 |
if ( aCalendarName.CompareF( iArrayCalEntryList[index]->CalendarName() ) == 0 ) |
|
3070 |
{ |
|
3071 |
retValue = ETrue; |
|
3072 |
break; |
|
3073 |
} |
|
3074 |
} |
|
3075 |
return retValue; |
|
3076 |
} |
|
26
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3077 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3078 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3079 |
bool CCalendarInterface::isValidEntryDuration(int type) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3080 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3081 |
TTime temp; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3082 |
TDateTime temp1; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3083 |
switch(type) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3084 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3085 |
case TCalRRule::EDaily : |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3086 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3087 |
TTimeIntervalDays days = 1; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3088 |
temp = iStTime + days; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3089 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3090 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3091 |
break; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3092 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3093 |
case TCalRRule::EWeekly : |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3094 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3095 |
TTimeIntervalDays days = 7; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3096 |
temp = iStTime + days; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3097 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3098 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3099 |
break; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3100 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3101 |
case TCalRRule::EMonthly : |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3102 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3103 |
TTimeIntervalMonths month = 1; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3104 |
temp = iStTime + month; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3105 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3106 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3107 |
break; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3108 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3109 |
case TCalRRule::EYearly : |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3110 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3111 |
TTimeIntervalYears yr = 1; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3112 |
temp = iStTime + yr; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3113 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3114 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3115 |
break; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3116 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3117 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3118 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3119 |
if(temp < iEnTime) |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3120 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3121 |
return false; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3122 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3123 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3124 |
else |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3125 |
{ |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3126 |
return true; |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3127 |
} |
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3128 |
|
5d0ec8b709be
Revision: 200949
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
10
diff
changeset
|
3129 |
} |