开发者

How to display remote email message?

开发者 https://www.devze.com 2022-12-19 10:19 出处:网络
I have been using this code to display IMAP4 messages: void DisplayMessageL( const TMsvId &aId ) {

I have been using this code to display IMAP4 messages:

void DisplayMessageL( const TMsvId &aId )
        {
        // 1. construct the client MTM
        TMsvEntry indexEntry;
        TMsvId serviceId;
        User::LeaveIfError( iMsvSession->GetEntry(aId, serviceId, indexEntry));
        CBaseMtm* mtm = iClientReg->NewMtmL(indexEntry.iMtm);
        CleanupStack::PushL(mtm);

        // 2. construct the user interface MTM
        CBaseMtmUi* uiMtm = iUiReg->NewMtmUiL(*mtm);
        Cleanu开发者_运维技巧pStack::PushL(uiMtm);

        // 3. display the message
        uiMtm->BaseMtm().SwitchCurrentEntryL(indexEntry.Id());
        CMsvOperationWait* waiter=CMsvOperationWait::NewLC();
        waiter->Start(); //we use synchronous waiter
        CMsvOperation* op = uiMtm->OpenL(waiter->iStatus);
        CleanupStack::PushL(op);
        CActiveScheduler::Start();

        // 4. cleanup for example even members
        CleanupStack::PopAndDestroy(4); // op,waiter, mtm, uimtm
        }

However, in case when user attempts to download a remote message (i.e. one of the emails previously not retrieved from the mail server), and then cancels the request, my code remains blocked, and it never receives information that the action was canceled.

My question is:

  • what is the workaround for the above, so the application is not stuck?
  • can anyone provide a working example for asynchronous call for opening remote messages which do not panic and crash the application?

Asynchronous calls for POP3, SMTP and local IMAP4 messages work perfectly, but remote IMAP4 messages create this issue.

I am testing these examples for S60 5th edition.

Thank you all in advance.


First of all, I would retry removing CMsvOperationWait and deal with the open request asynchronously - i.e. have an active object waiting for the CMsvOperation to complete.

CMsvOperationWait is nothing more than a convenience to make an asynch operation appear synchronous and my suspicion is that this is culprit - in the case of download->show message, there are two asynch operations chained.

0

精彩评论

暂无评论...
验证码 换一张
取 消