173 } |
173 } |
174 } |
174 } |
175 |
175 |
176 else if ( aCmdName.CompareF( KCmdGetList ) == 0 ) |
176 else if ( aCmdName.CompareF( KCmdGetList ) == 0 ) |
177 { |
177 { |
178 if( !aCallback ) |
178 |
179 { |
|
180 if ( contentType.CompareF( KContentCalendar ) == 0 ) |
179 if ( contentType.CompareF( KContentCalendar ) == 0 ) |
181 { |
180 { |
182 TRAP(errcode, GetListCalendarL( aInParamList, aOutParamList, posBased )); |
181 if( !aCallback ) |
|
182 { |
|
183 TRAP(errcode, GetListCalendarL( aInParamList, aOutParamList, posBased )); |
|
184 } |
|
185 else |
|
186 { |
|
187 AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); |
|
188 } |
183 } |
189 } |
184 else if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
190 else if ( contentType.CompareF( KContentCalendarEntry ) == 0 ) |
185 { |
191 { |
186 TRAP(errcode, GetListCalendarEntryL( aInParamList, aOutParamList, posBased )); |
192 TRAP(errcode, GetListCalendarEntryL( aInParamList, aOutParamList, aCmdOptions, aCallback, posBased, transactionId )); |
187 } |
193 } |
188 } |
|
189 else |
|
190 { |
|
191 AppendErrorMessageL(aCmdName, KNullDesC8, KAsyncNotSupported); |
|
192 } |
|
193 } |
194 } |
194 |
195 |
195 else if ( aCmdName.CompareF( KCmdReqNot ) == 0 ) |
196 else if ( aCmdName.CompareF( KCmdReqNot ) == 0 ) |
196 { |
197 { |
197 if (( contentType.CompareF( KContentCalendarEntry ) == 0 ) && |
198 if (( contentType.CompareF( KContentCalendarEntry ) == 0 ) && |
510 // --------------------------------------------------------------------------- |
511 // --------------------------------------------------------------------------- |
511 // Issues GetList Calendar Entry request to Calendar Service |
512 // Issues GetList Calendar Entry request to Calendar Service |
512 // --------------------------------------------------------------------------- |
513 // --------------------------------------------------------------------------- |
513 // |
514 // |
514 void CCalendarInterface::GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, |
515 void CCalendarInterface::GetListCalendarEntryL(const CLiwGenericParamList& aInParamList, |
515 CLiwGenericParamList& aOutParamList, |
516 CLiwGenericParamList& aOutParamList, |
516 const TBool aPosBased ) |
517 TUint aCmdOptions, |
|
518 MLiwNotifyCallback* aCallback , |
|
519 const TBool aPosBased, |
|
520 TInt32& aTransactionId) |
517 { |
521 { |
518 const TLiwGenericParam* filterParam = NULL; |
522 const TLiwGenericParam* filterParam = NULL; |
519 |
523 |
520 if ( aPosBased ) |
524 if ( aPosBased ) |
521 { |
525 { |
618 } |
622 } |
619 } |
623 } |
620 if( calName ) |
624 if( calName ) |
621 CleanupStack::PushL(calName); |
625 CleanupStack::PushL(calName); |
622 TPtrC calendarName( calName ? calName->Des() : TPtrC() ); |
626 TPtrC calendarName( calName ? calName->Des() : TPtrC() ); |
|
627 |
|
628 //asynchronous version of getlist is called if callback is provided |
|
629 if ( aCallback && ( KLiwOptASyncronous & aCmdOptions ) ) |
|
630 { |
|
631 aTransactionId = aCallback->GetTransactionID(); |
|
632 |
|
633 CCalCallbackCalEntryList* callback = NULL; |
|
634 |
|
635 |
|
636 |
|
637 |
|
638 if(( filter->Filter() & EFilterGUid ) || ( filter->Filter() & EFilterLUid )) |
|
639 { |
|
640 callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, ETrue ); |
|
641 } |
|
642 else |
|
643 { |
|
644 callback = CCalCallbackCalEntryList::NewL( *this, aCallback, calendarName, aTransactionId, EFalse ); |
|
645 } |
|
646 |
|
647 CleanupStack::PushL( callback ); |
|
648 if ( filter->Filter() & EFilterGUid ) |
|
649 { |
|
650 // In case of GlobalUid only one entry is returned. |
|
651 iCalService->GetListL( calendarName, (*filter->GuidList())[0], callback); |
|
652 } |
|
653 else if( filter->Filter() & EFilterLUid ) |
|
654 { |
|
655 // In case of LocalUid there can be more than one entry(child entries) |
|
656 iCalService->GetListL( calendarName, (filter->LocalUidList())[0], callback); |
|
657 } |
|
658 else |
|
659 { |
|
660 iCalService->GetListL( calendarName , filter, callback ); |
|
661 } |
|
662 aOutParamList.AppendL(TLiwGenericParam( KTransactionID, TLiwVariant( aTransactionId ))); |
|
663 |
|
664 CleanupStack::Pop( callback ); |
|
665 } |
623 |
666 |
624 // Return list of CalendarEntries if any of LocalUid or GlobalUid is passed as Filter. |
667 // Return list of CalendarEntries if any of LocalUid or GlobalUid is passed as Filter. |
625 if ( ( filter->Filter() & EFilterGUid ) || |
668 else if ( ( filter->Filter() & EFilterGUid ) || |
626 ( filter->Filter() & EFilterLUid ) ) |
669 ( filter->Filter() & EFilterLUid ) ) |
627 { |
670 { |
628 CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, calendarName, ETrue ); |
671 CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, calendarName, ETrue ); |
629 CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); |
672 CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); |
630 |
673 |
1201 // Applicable only for Update request |
1246 // Applicable only for Update request |
1202 TBool isUpdate = EFalse; |
1247 TBool isUpdate = EFalse; |
1203 TInt entryType = -1; |
1248 TInt entryType = -1; |
1204 if ( inMap->FindL( KLocalId, inParam ) ) |
1249 if ( inMap->FindL( KLocalId, inParam ) ) |
1205 { |
1250 { |
|
1251 id = EFalse; |
1206 ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
1252 ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
1207 KCmdAdd, KLocalId, KInvalid ); |
1253 KCmdAdd, KLocalId, KInvalid ); |
1208 |
1254 |
1209 //entryAttributes->SetLocalUid( TCalLocalUid(inParam.AsTUint() )); |
1255 //entryAttributes->SetLocalUid( TCalLocalUid(inParam.AsTUint() )); |
1210 TCalLocalUid localUid; |
1256 TCalLocalUid localUid; |
1211 GetLocalUid( inParam.AsDes(), localUid ); |
1257 GetLocalUid( inParam.AsDes(), localUid ); |
1212 entryAttributes->SetLocalUid( localUid ); |
1258 entryAttributes->SetLocalUid( localUid ); |
1213 isUpdate = ETrue; |
1259 isUpdate = ETrue; |
1214 } |
1260 } |
|
1261 if ( inMap->FindL( KId, inParam ) ) |
|
1262 { |
|
1263 id = ETrue; |
|
1264 ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
|
1265 KCmdAdd, KId, KInvalid ); |
|
1266 |
|
1267 HBufC8* globalUid = HBufC8::NewL(inParam.AsDes().Length()); |
|
1268 CleanupStack::PushL( globalUid ); |
|
1269 GetGlobalUid(inParam.AsDes(), globalUid->Des()); |
|
1270 entryAttributes->SetUidL( globalUid->Des() ); |
|
1271 CleanupStack::PopAndDestroy( globalUid ); |
|
1272 isUpdate = ETrue; |
|
1273 } |
1215 |
1274 |
1216 if ( inMap->FindL( KType, inParam ) ) |
1275 if ( inMap->FindL( KType, inParam ) ) |
1217 { |
1276 { |
1218 ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
1277 ValidateParamTypeL( inParam, LIW::EVariantTypeDesC, |
1219 KCmdAdd, _L8("Entry Type"), KInvalid ); |
1278 KCmdAdd, _L8("Entry Type"), KInvalid ); |
1231 |
1290 |
1232 //Updating Existing Entry |
1291 //Updating Existing Entry |
1233 //Get the type of the original entry. User cannot change the type |
1292 //Get the type of the original entry. User cannot change the type |
1234 if( isUpdate ) |
1293 if( isUpdate ) |
1235 { |
1294 { |
1236 entryType = GetEntryType( aCalendarName, entryAttributes->LocalUid() ); |
1295 if(id) |
|
1296 { |
|
1297 entryType = GetEntryType( aCalendarName, entryAttributes->GlobalUid() ); |
|
1298 } |
|
1299 else |
|
1300 { |
|
1301 entryType = GetEntryType( aCalendarName, entryAttributes->LocalUid() ); |
|
1302 } |
1237 if ( entryType == -1 ) |
1303 if ( entryType == -1 ) |
1238 { |
1304 { |
1239 AppendErrorMessageL( KCmdAdd, KLocalId, KInvalid ); |
1305 AppendErrorMessageL( KCmdAdd, KLocalId, KInvalid ); |
1240 User::Leave( KErrArgument ); |
1306 User::Leave( KErrArgument ); |
1241 } |
1307 } |
2391 |
2457 |
2392 CleanupStack::PopAndDestroy( outputIterableList );//doubt check at debugging |
2458 CleanupStack::PopAndDestroy( outputIterableList );//doubt check at debugging |
2393 |
2459 |
2394 CleanupStack::Pop( uIDList ); |
2460 CleanupStack::Pop( uIDList ); |
2395 } |
2461 } |
2396 |
2462 // --------------------------------------------------------------------------- |
|
2463 // Set getlist output to output parameter |
|
2464 // --------------------------------------------------------------------------- |
|
2465 // |
|
2466 void CCalendarInterface::SetCalEntryOutputL( RPointerArray<CCalEntry>& aOutputCalEntry, |
|
2467 CLiwGenericParamList& aOutParamList, |
|
2468 const TDesC& aCalendarName ) |
|
2469 { |
|
2470 |
|
2471 TInt arrCount = aOutputCalEntry.Count(); |
|
2472 |
|
2473 CIterableCalEntryList* iterEntryList = CIterableCalEntryList::NewL( *this, aCalendarName, ETrue ); |
|
2474 CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterEntryList ) ); |
|
2475 |
|
2476 for( TInt index = 0; index < arrCount; ++index ) |
|
2477 { |
|
2478 iterEntryList->EntryArray().Append(aOutputCalEntry[index]); |
|
2479 } |
|
2480 |
|
2481 //Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList |
|
2482 aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterEntryList ) ) ); |
|
2483 |
|
2484 iterEntryList->DecRef(); |
|
2485 |
|
2486 iArrayCalEntryList.Append( iterEntryList ); |
|
2487 |
|
2488 CleanupStack::Pop( iterEntryList ); |
|
2489 |
|
2490 } |
|
2491 // --------------------------------------------------------------------------- |
|
2492 // Set getlist output to output parameter |
|
2493 // --------------------------------------------------------------------------- |
|
2494 // |
|
2495 void CCalendarInterface::SetCalInstanceOutputL( RPointerArray<CCalInstance>& aOutputCalInstance, |
|
2496 CLiwGenericParamList& aOutParamList, |
|
2497 const TDesC& aCalendarName) |
|
2498 { |
|
2499 TInt arrCount = aOutputCalInstance.Count(); |
|
2500 |
|
2501 CIterableCalEntryList* iterInstanceList = CIterableCalEntryList::NewL( *this, aCalendarName, EFalse ); |
|
2502 CleanupStack::PushL( TCleanupItem(CleanupIterableCalEntry, iterInstanceList ) ); |
|
2503 |
|
2504 for( TInt index = 0; index < arrCount; ++index ) |
|
2505 { |
|
2506 iterInstanceList->InstanceArray().Append(aOutputCalInstance[index]); |
|
2507 } |
|
2508 |
|
2509 // Appending the Iterator over List of Maps to the outParamList CLiwGenericParamList |
|
2510 aOutParamList.AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( iterInstanceList ) ) ); |
|
2511 |
|
2512 iterInstanceList->DecRef(); |
|
2513 |
|
2514 iArrayCalEntryList.Append( iterInstanceList ); |
|
2515 |
|
2516 CleanupStack::Pop( iterInstanceList ); |
|
2517 |
|
2518 |
|
2519 } |
2397 // --------------------------------------------------------------------------- |
2520 // --------------------------------------------------------------------------- |
2398 // Set Change Notification output to output parameter |
2521 // Set Change Notification output to output parameter |
2399 // --------------------------------------------------------------------------- |
2522 // --------------------------------------------------------------------------- |
2400 // |
2523 // |
2401 void CCalendarInterface::SetNotifyOutputL( RArray<TCalChangeEntry>& aOutputChangeSet, CLiwGenericParamList& aOutParamList ) |
2524 void CCalendarInterface::SetNotifyOutputL( RArray<TCalChangeEntry>& aOutputChangeSet, CLiwGenericParamList& aOutParamList ) |
2910 entryType = entryArray[0]->EntryTypeL(); |
3033 entryType = entryArray[0]->EntryTypeL(); |
2911 } |
3034 } |
2912 entryArray.ResetAndDestroy(); |
3035 entryArray.ResetAndDestroy(); |
2913 return entryType; |
3036 return entryType; |
2914 } |
3037 } |
2915 |
3038 // --------------------------------------------------------------------------- |
|
3039 // Return Entry Type for given GlobalUid |
|
3040 // --------------------------------------------------------------------------- |
|
3041 // |
|
3042 TInt CCalendarInterface::GetEntryType( const TDesC& aCalendarName, const TDesC8& aGuid ) |
|
3043 { |
|
3044 TInt entryType = -1; |
|
3045 RPointerArray<CCalEntry> entryArray; |
|
3046 iCalService->GetListL( aCalendarName, aGuid, entryArray); |
|
3047 if( entryArray.Count() ) |
|
3048 { |
|
3049 entryType = entryArray[0]->EntryTypeL(); |
|
3050 } |
|
3051 entryArray.ResetAndDestroy(); |
|
3052 return entryType; |
|
3053 } |
2916 // --------------------------------------------------------------------------- |
3054 // --------------------------------------------------------------------------- |
2917 // Check if given calendar is in use by other resources |
3055 // Check if given calendar is in use by other resources |
2918 // --------------------------------------------------------------------------- |
3056 // --------------------------------------------------------------------------- |
2919 // |
3057 // |
2920 TBool CCalendarInterface::CheckCalendarInUse( const TDesC& aCalendarName ) |
3058 TBool CCalendarInterface::CheckCalendarInUse( const TDesC& aCalendarName ) |