340 sorting.Append(criteria); |
340 sorting.Append(criteria); |
341 |
341 |
342 NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL start"); |
342 NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL start"); |
343 |
343 |
344 // Get the message list from the backend. |
344 // Get the message list from the backend. |
345 MFSMailIterator* iterator(NULL); |
345 CFSMailIterator* iterator(NULL); |
346 iterator = folder->ListMessagesL(details, sorting); |
346 iterator = static_cast<CFSMailIterator*>(folder->ListMessagesL(details, sorting)); |
347 |
347 |
348 NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL end"); |
348 NM_TIMESTAMP("ListMessagesL in getMessagesFromFolderL end"); |
349 |
349 |
350 if (iterator) { |
350 if (iterator) { |
351 CleanupStack::PushL(iterator); |
351 CleanupStack::PushL(iterator); |
539 |
539 |
540 if (folder) { |
540 if (folder) { |
541 CleanupStack::PushL(folder); |
541 CleanupStack::PushL(folder); |
542 // First prepare all the parameters |
542 // First prepare all the parameters |
543 // select message details to be listed |
543 // select message details to be listed |
544 TFSMailDetails details(EFSMsgDataEnvelope); |
544 TFSMailDetails details(EFSMsgDataStructure); |
545 |
545 |
546 // set sorting criteria |
546 // set sorting criteria |
547 TFSMailSortCriteria criteria; |
547 TFSMailSortCriteria criteria; |
548 criteria.iField = EFSMailSortByDate; |
548 criteria.iField = EFSMailSortByDate; |
549 criteria.iOrder = EFSMailDescending; |
549 criteria.iOrder = EFSMailDescending; |
576 //Add all found emails to the result list |
576 //Add all found emails to the result list |
577 for(TInt i=0; i<messages.Count(); i++) { |
577 for(TInt i=0; i<messages.Count(); i++) { |
578 NmMessage* newMessage(NULL); |
578 NmMessage* newMessage(NULL); |
579 newMessage = messages[i]->GetNmMessage(); |
579 newMessage = messages[i]->GetNmMessage(); |
580 if (newMessage) { |
580 if (newMessage) { |
581 //Add content of message |
581 CleanupStack::PushL(newMessage); |
|
582 //Add content of message |
|
583 childrenToNmMessagePartL(messages[i], newMessage); |
582 NmMessagePart *plainTextPart = newMessage->plainTextBodyPart(); |
584 NmMessagePart *plainTextPart = newMessage->plainTextBodyPart(); |
583 if (plainTextPart) { |
585 if (plainTextPart) { |
584 contentToMessagePart(mailboxId, folderId, newMessage->envelope().messageId(), |
586 contentToMessagePart(mailboxId, folderId, newMessage->envelope().messageId(), |
585 *plainTextPart); |
587 *plainTextPart); |
586 } |
588 } |
587 messageList.append(newMessage); |
589 messageList.append(newMessage); |
|
590 CleanupStack::Pop(newMessage); |
588 } |
591 } |
589 } |
592 } |
590 |
593 |
591 CleanupStack::PopAndDestroy( &messages ); |
594 CleanupStack::PopAndDestroy( &messages ); |
592 CleanupStack::Pop(iterator); |
595 CleanupStack::Pop(iterator); |
958 Connect to mailbox if not already connected and refresh. |
961 Connect to mailbox if not already connected and refresh. |
959 |
962 |
960 \param mailboxId Id of the mailbox. |
963 \param mailboxId Id of the mailbox. |
961 \return Async request id or error code. |
964 \return Async request id or error code. |
962 */ |
965 */ |
963 int NmFrameworkAdapter::refreshMailbox(NmId mailboxId) |
966 int NmFrameworkAdapter::refreshMailbox(NmId mailboxId, bool silentConnection) |
964 { |
967 { |
965 NM_FUNCTION; |
968 NM_FUNCTION; |
966 |
969 |
967 resetCache(mailboxId); |
970 resetCache(mailboxId); |
968 |
971 |
969 TRAPD(err, RefreshMailboxL(mailboxId)); // return value not used |
972 TRAPD(err, RefreshMailboxL(mailboxId, silentConnection)); // return value not used |
970 return (err == KErrNone) ? NmNoError : NmGeneralError; |
973 return (err == KErrNone) ? NmNoError : NmGeneralError; |
971 } |
974 } |
972 |
975 |
973 /*! |
976 /*! |
974 Connect to mailbox if not already connected and refresh. |
977 Connect to mailbox if not already connected and refresh. |
1651 } |
1655 } |
1652 |
1656 |
1653 /*! |
1657 /*! |
1654 Leaving Refresh function |
1658 Leaving Refresh function |
1655 */ |
1659 */ |
1656 int NmFrameworkAdapter::RefreshMailboxL(NmId mailboxId) |
1660 int NmFrameworkAdapter::RefreshMailboxL(NmId mailboxId, bool silentConnection) |
1657 { |
1661 { |
1658 NM_FUNCTION; |
1662 NM_FUNCTION; |
1659 |
1663 |
1660 int result(KErrNotFound); |
1664 int result(KErrNotFound); |
1661 CFSMailBox *currentMailbox(NULL); |
1665 CFSMailBox *currentMailbox(NULL); |
1662 currentMailbox = mFSfw->GetMailBoxByUidL(mailboxId); |
1666 currentMailbox = mFSfw->GetMailBoxByUidL(mailboxId); |
1663 if(currentMailbox) { |
1667 if(currentMailbox) { |
1664 CleanupStack::PushL(currentMailbox); |
1668 CleanupStack::PushL(currentMailbox); |
1665 result = currentMailbox->RefreshNowL(); |
1669 result = currentMailbox->RefreshNowL(silentConnection); |
1666 CleanupStack::PopAndDestroy(currentMailbox); |
1670 CleanupStack::PopAndDestroy(currentMailbox); |
1667 } |
1671 } |
1668 return result; |
1672 return result; |
1669 } |
1673 } |
1670 |
1674 |