433 void CMessagingInterface::GetHeaderListL( const CLiwGenericParamList& aInParamList, |
433 void CMessagingInterface::GetHeaderListL( const CLiwGenericParamList& aInParamList, |
434 CLiwGenericParamList& aOutParamList, |
434 CLiwGenericParamList& aOutParamList, |
435 TUint aCmdOptions, |
435 TUint aCmdOptions, |
436 MLiwNotifyCallback* aCallback ) |
436 MLiwNotifyCallback* aCallback ) |
437 { |
437 { |
438 LeaveIfAsynchronousL( aCmdOptions, aCallback, KCmdGetHeaderList, KAsyncNotSupported ); |
438 |
439 |
439 |
440 const TLiwGenericParam* param = NULL; |
440 const TLiwGenericParam* param = NULL; |
441 |
441 |
442 TBool indexBaseInp = EFalse; |
442 TBool indexBaseInp = EFalse; |
443 |
443 |
481 |
481 |
482 CleanupStack::PushL( filterParam ); |
482 CleanupStack::PushL( filterParam ); |
483 |
483 |
484 CMsvEntrySelection* entrySelection = NULL; |
484 CMsvEntrySelection* entrySelection = NULL; |
485 |
485 |
486 |
486 CMsgCallbackBase* callback = NULL; |
|
487 |
|
488 if ( aCallback && ( KLiwOptASyncronous & aCmdOptions )) |
|
489 { |
|
490 callback = CMsgCallbackHeader::NewL(iMsgService); |
|
491 CleanupStack::PushL( callback ); |
|
492 callback->iPtrInParamList = &aInParamList; |
|
493 callback->iPtrNotifyCallback = aCallback; |
|
494 callback->iTransactionId = aCallback->GetTransactionID(); |
|
495 |
|
496 aOutParamList.AppendL(TLiwGenericParam( KTransactionID, |
|
497 TLiwVariant( callback->iTransactionId ))); |
|
498 } |
487 |
499 |
488 iMsgService->GetIdListL( filterParam, |
500 iMsgService->GetIdListL( filterParam, |
489 folderId, |
501 folderId, |
490 NULL/*Callback*/, |
502 callback/*Callback*/, |
491 entrySelection ); |
503 entrySelection ); |
492 |
504 |
|
505 if ( callback ) |
|
506 { |
|
507 CleanupStack::Pop( callback ); |
|
508 CleanupStack::PopAndDestroy(filterParam); |
|
509 } |
|
510 if(!callback) |
493 CleanupStack::Pop( filterParam ); |
511 CleanupStack::Pop( filterParam ); |
494 |
512 |
495 // Successfull completion |
513 // Successfull completion |
496 // filterParam and entrySelection ownership passed to called function |
514 // filterParam and entrySelection ownership passed to called function |
|
515 if(!callback) |
497 UpdateOutputAsIdListL( &aOutParamList, entrySelection, iMsgService, filterParam ); |
516 UpdateOutputAsIdListL( &aOutParamList, entrySelection, iMsgService, filterParam ); |
498 } |
517 } |
499 |
518 |
500 |
519 |
501 |
520 |
516 TNotificationType notificationType; |
535 TNotificationType notificationType; |
517 |
536 |
518 GetNotificationTypeL( aInParamList, notificationType, KCmdRegNotification ); |
537 GetNotificationTypeL( aInParamList, notificationType, KCmdRegNotification ); |
519 |
538 |
520 CMsgCallbackBase* callback = NULL; |
539 CMsgCallbackBase* callback = NULL; |
521 callback = CMsgCallbackHeader::NewL(); |
540 callback = CMsgCallbackHeader::NewL(iMsgService); |
522 callback->iPtrInParamList = &aInParamList; |
541 callback->iPtrInParamList = &aInParamList; |
523 callback->iPtrNotifyCallback = aCallback; |
542 callback->iPtrNotifyCallback = aCallback; |
524 callback->iTransactionId = aCallback->GetTransactionID(); |
543 callback->iTransactionId = aCallback->GetTransactionID(); |
525 TInt errcode = iMsgService->RequestNotification( notificationType, callback ); |
544 TInt errcode = iMsgService->RequestNotification( notificationType, callback ); |
526 |
545 |
1368 |
1387 |
1369 // --------------------------------------------------------------------------- |
1388 // --------------------------------------------------------------------------- |
1370 // Two-phase Constructor |
1389 // Two-phase Constructor |
1371 // --------------------------------------------------------------------------- |
1390 // --------------------------------------------------------------------------- |
1372 // |
1391 // |
1373 CMsgCallbackHeader* CMsgCallbackHeader::NewL() |
1392 CMsgCallbackHeader* CMsgCallbackHeader::NewL(CMessagingService* aMsgService) |
1374 { |
1393 { |
1375 CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(); |
1394 CMsgCallbackHeader* self = new (ELeave) CMsgCallbackHeader(aMsgService); |
|
1395 |
1376 return self; |
1396 return self; |
1377 } |
1397 } |
1378 |
1398 |
1379 // --------------------------------------------------------------------------- |
1399 // --------------------------------------------------------------------------- |
1380 // Destructor |
1400 // Destructor |
1381 // --------------------------------------------------------------------------- |
1401 // --------------------------------------------------------------------------- |
1382 // |
1402 // |
1383 CMsgCallbackHeader::~CMsgCallbackHeader() |
1403 CMsgCallbackHeader::~CMsgCallbackHeader() |
1386 |
1406 |
1387 // --------------------------------------------------------------------------- |
1407 // --------------------------------------------------------------------------- |
1388 // Constructor |
1408 // Constructor |
1389 // --------------------------------------------------------------------------- |
1409 // --------------------------------------------------------------------------- |
1390 // |
1410 // |
1391 CMsgCallbackHeader::CMsgCallbackHeader() |
1411 CMsgCallbackHeader::CMsgCallbackHeader(CMessagingService* aMsgService):iMsg(aMsgService) |
1392 { |
1412 { |
1393 } |
1413 } |
1394 |
1414 |
1395 // --------------------------------------------------------------------------- |
1415 // --------------------------------------------------------------------------- |
1396 // Gives the result of asynchronous SAPI |
1416 // Gives the result of asynchronous SAPI |
1426 *(outParams), |
1446 *(outParams), |
1427 *((CLiwGenericParamList*)iPtrInParamList) ); |
1447 *((CLiwGenericParamList*)iPtrInParamList) ); |
1428 |
1448 |
1429 CleanupStack::PopAndDestroy( outParams ); |
1449 CleanupStack::PopAndDestroy( outParams ); |
1430 } |
1450 } |
1431 |
1451 |
|
1452 // --------------------------------------------------------------------------- |
|
1453 // Gives the result of getlist asynchronous SAPI |
|
1454 // --------------------------------------------------------------------------- |
|
1455 // |
|
1456 void CMsgCallbackHeader::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) |
|
1457 { |
|
1458 CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
1459 |
|
1460 CleanupStack::PushL( outParams ); |
|
1461 |
|
1462 outParams->AppendL(TLiwGenericParam(KErrorCode, |
|
1463 TLiwVariant(ErrCodeConversion(aErrCode)))); |
|
1464 |
|
1465 if ( aErrCode==KErrNone ) |
|
1466 { |
|
1467 CIterableIdList* iter = CIterableIdList::NewL( aEntrySelection, iMsg, aFilter ); |
|
1468 |
|
1469 CleanupStack::PushL( iter ); |
|
1470 |
|
1471 TLiwVariant listVal; |
|
1472 |
|
1473 listVal.Set( iter ); |
|
1474 |
|
1475 outParams->AppendL( TLiwGenericParam( KReturnValue/*KMessageList*/, listVal )); |
|
1476 |
|
1477 CleanupStack::Pop( iter ); |
|
1478 |
|
1479 listVal.Reset(); |
|
1480 |
|
1481 iter->DecRef(); |
|
1482 } |
|
1483 |
|
1484 TInt event = KLiwEventCompleted; |
|
1485 |
|
1486 if ( aErrCode == KErrCancel ) |
|
1487 { |
|
1488 event = KLiwEventCanceled; |
|
1489 } |
|
1490 else if ( aErrCode != KErrNone ) |
|
1491 { |
|
1492 event = KLiwEventStopped; |
|
1493 } |
|
1494 |
|
1495 ((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
1496 event, |
|
1497 *(outParams), |
|
1498 *((CLiwGenericParamList*)iPtrInParamList) ); |
|
1499 |
|
1500 CleanupStack::PopAndDestroy( outParams ); |
|
1501 } |
1432 |
1502 |
1433 // --------------------------------------------------------------------------- |
1503 // --------------------------------------------------------------------------- |
1434 // Two-phase Constructor |
1504 // Two-phase Constructor |
1435 // --------------------------------------------------------------------------- |
1505 // --------------------------------------------------------------------------- |
1436 // |
1506 // |
1475 *(outParams), |
1545 *(outParams), |
1476 *((CLiwGenericParamList*)iPtrInParamList) ); |
1546 *((CLiwGenericParamList*)iPtrInParamList) ); |
1477 |
1547 |
1478 CleanupStack::PopAndDestroy( outParams ); |
1548 CleanupStack::PopAndDestroy( outParams ); |
1479 } |
1549 } |
|
1550 |
|
1551 void CMsgCallbackInt::HandleGetlistL( TInt aErrCode, CMsvEntrySelection* aEntrySelection, CFilterParamInfo* aFilter ) |
|
1552 { |
|
1553 //Dummy Function |
|
1554 } |
1480 |
1555 |
1481 // --------------------------------------------------------------------------- |
1556 // --------------------------------------------------------------------------- |
1482 // Updates the output for message header |
1557 // Updates the output for message header |
1483 // --------------------------------------------------------------------------- |
1558 // --------------------------------------------------------------------------- |
1484 // |
1559 // |