emailuis/emailui/src/FSComposerFetchLogic.cpp
changeset 0 8466d47a6819
child 1 12c456ceeff2
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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 "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: This file implements class CFsComposerFetchLogic.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 //<cmail>
       
    20 #include "emailtrace.h"
       
    21 #include "CFSMailClient.h"
       
    22 #include "CFSMailCommon.h"
       
    23 //</cmail>
       
    24 #include <FreestyleEmailUi.rsg>
       
    25 //#include <aknquerydialog.h> //<cmail>
       
    26 #include <StringLoader.h>
       
    27 
       
    28 #include "FreestyleEmailUiAppui.h"
       
    29 #include "FSComposerFetchLogic.h"
       
    30 #include "FreestyleEmailUiUtilities.h"
       
    31 #include "FSEmail.pan"
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CFsComposerFetchLogic::NewL
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 CFsComposerFetchLogic* CFsComposerFetchLogic::NewL( CFSMailClient& aClient,
       
    38 	TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId,
       
    39 	MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi )
       
    40 	{
       
    41     FUNC_LOG;
       
    42 
       
    43 	CFsComposerFetchLogic* self = new (ELeave) CFsComposerFetchLogic( aClient, aObserver, aAppUi );
       
    44 	CleanupStack::PushL( self );
       
    45 	self->ConstructL( aMailBoxId, aFolderId, aMessageId );
       
    46 	CleanupStack::Pop( self );
       
    47 
       
    48     return self;
       
    49 	}
       
    50 
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CFsComposerFetchLogic::CFsComposerFetchLogic
       
    54 // -----------------------------------------------------------------------------
       
    55 //
       
    56 CFsComposerFetchLogic::CFsComposerFetchLogic( CFSMailClient& aClient,
       
    57 	MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi ):
       
    58 	iRunMode( EModeInvalid ), iState( EStateNotStarted ), iAppUi( aAppUi ),
       
    59 	iClient( aClient ), iObserver( aObserver ),iFetchingCancelGoingOn(EFalse),//<cmail>
       
    60         iFetchingStructure(EFalse), iFetchingBody(EFalse),iRequestCompleted(EFalse)//<cmail>
       
    61 	{
       
    62     FUNC_LOG;
       
    63 	}
       
    64 
       
    65 
       
    66 // -----------------------------------------------------------------------------
       
    67 // CFsComposerFetchLogic::~CFsComposerFetchLogic
       
    68 // -----------------------------------------------------------------------------
       
    69 //
       
    70 CFsComposerFetchLogic::~CFsComposerFetchLogic()
       
    71 	{
       
    72     FUNC_LOG;
       
    73 
       
    74     //CancelFetchings(); <cmail>
       
    75     if ( iAppUi.DownloadInfoMediator() )
       
    76         {
       
    77         iAppUi.DownloadInfoMediator()->StopObserving( this );
       
    78         }
       
    79 
       
    80 	iParts.Close();
       
    81 
       
    82     //delete iAsyncWaitNote; //<cmail>
       
    83 	delete iMessage;
       
    84 	delete iFolder;
       
    85 	delete iMailBox;
       
    86 
       
    87 	}
       
    88 
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CFsComposerFetchLogic::ConstructL
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 void CFsComposerFetchLogic::ConstructL( TFSMailMsgId aMailBoxId,
       
    95 	TFSMailMsgId aFolderId, TFSMailMsgId aMessageId )
       
    96 	{
       
    97     FUNC_LOG;
       
    98 
       
    99 	iMailBox = iClient.GetMailBoxByUidL( aMailBoxId );
       
   100 	iFolder = iClient.GetFolderByUidL( aMailBoxId, aFolderId );
       
   101 	iMessage = iClient.GetMessageByUidL( aMailBoxId, aFolderId, aMessageId, EFSMsgDataStructure );
       
   102 
       
   103 	}
       
   104 
       
   105 
       
   106 // -----------------------------------------------------------------------------
       
   107 // CFsComposerFetchLogic::RunReplyLogicL
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 void CFsComposerFetchLogic::RunReplyLogicL()
       
   111 	{
       
   112     FUNC_LOG;
       
   113 
       
   114 	iRunMode = EModeReply;
       
   115 	iState = EStateSmartReply;
       
   116 	iError = KErrNone;
       
   117 	RunStateL();
       
   118 	}
       
   119 
       
   120 
       
   121 // -----------------------------------------------------------------------------
       
   122 // CFsComposerFetchLogic::RunForwardLogicL
       
   123 // -----------------------------------------------------------------------------
       
   124 //
       
   125 void CFsComposerFetchLogic::RunForwardLogicL()
       
   126 	{
       
   127     FUNC_LOG;
       
   128 
       
   129 	iRunMode = EModeForward;
       
   130 	iState = EStateSmartForward;
       
   131 	iError = KErrNone;
       
   132 	if ( iAppUi.DownloadInfoMediator() )
       
   133 		{
       
   134 		iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
       
   135 		}
       
   136 	RunStateL();
       
   137 
       
   138 	}
       
   139 
       
   140 
       
   141 // -----------------------------------------------------------------------------
       
   142 // CFsComposerFetchLogic::RequestResponseL
       
   143 // -----------------------------------------------------------------------------
       
   144 //
       
   145 void CFsComposerFetchLogic::RequestResponseL( TFSProgress aEvent, TInt aRequestId )
       
   146     {
       
   147     FUNC_LOG;
       
   148 
       
   149     iError = aEvent.iError;
       
   150 
       
   151     if ( !iError )
       
   152         {
       
   153         if ( TFsEmailUiUtility::IsCompleteOrCancelEvent( aEvent ) )
       
   154             {
       
   155             if ( aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled )
       
   156                 {
       
   157                 iError = KErrCancel;
       
   158                 }
       
   159             else
       
   160                 {
       
   161                 if ( iStructureRequestId == aRequestId )
       
   162                     {
       
   163                     iState = EStateBody;
       
   164                     }
       
   165                 else if ( iBodyRequestId == aRequestId )
       
   166                     {
       
   167                     iState = EStateAttachments;
       
   168                     }
       
   169                 else
       
   170                     {
       
   171                     __ASSERT_DEBUG( EFalse, Panic(EFSEmailUiUnexpectedValue) );
       
   172                     iError = KErrUnknown;
       
   173                     }
       
   174 
       
   175                 if ( !iError )
       
   176                     {
       
   177                     TRAP( iError, RunStateL() );
       
   178                     }
       
   179                 }
       
   180             }
       
   181         }
       
   182     
       
   183     if ( iError )
       
   184         {
       
   185         // Show error note for connection errors. Notes for other errors
       
   186         // are shown in CNcsComposeView::DoeActivateL()
       
   187         if ( iError == KErrCouldNotConnect ||
       
   188              iError == KErrConnectionTerminated )
       
   189             {
       
   190             TFsEmailUiUtility::ShowErrorNoteL(
       
   191                 R_FREESTYLE_EMAIL_ERROR_GENERAL_CONNECTION_ERROR,
       
   192                 ETrue );
       
   193             }
       
   194         Complete();
       
   195         }
       
   196 
       
   197     }
       
   198 	
       
   199 
       
   200 // -----------------------------------------------------------------------------
       
   201 // CFsComposerFetchLogic::RequestResponseL
       
   202 // -----------------------------------------------------------------------------
       
   203 //
       
   204 void CFsComposerFetchLogic::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
       
   205 	{
       
   206     FUNC_LOG;
       
   207 
       
   208     if ( !iError && aEvent.iError )
       
   209         {
       
   210         // Cancel all fetching when first error occurs
       
   211         iError = aEvent.iError;
       
   212         if(!iFetchingCancelGoingOn) //<cmail> if cancelling not going on, start now
       
   213             CancelFetchings();
       
   214         }
       
   215 
       
   216     if ( TFsEmailUiUtility::IsCompleteOrCancelEvent( aEvent ) )
       
   217     	{
       
   218     	// Remove the completed/failed download item
       
   219     	for ( TInt i=0; i<iParts.Count(); i++ )
       
   220     	    {
       
   221     	    if ( iParts[i] == aPart )
       
   222     	        {
       
   223     	        iParts.Remove( i );
       
   224     	        break;
       
   225     	        }
       
   226     	    }
       
   227 
       
   228         // If last part just got removed, then move on
       
   229         if ( !iParts.Count() )
       
   230             {
       
   231             Complete();
       
   232             }
       
   233         }
       
   234 	}
       
   235 
       
   236 
       
   237 // -----------------------------------------------------------------------------
       
   238 // CFsComposerFetchLogic::StepL
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 //<cmail>
       
   242 /*
       
   243 void CFsComposerFetchLogic::StepL()
       
   244 	{
       
   245     FUNC_LOG;
       
   246 	}*/
       
   247 //<cmail>
       
   248 
       
   249 
       
   250 // -----------------------------------------------------------------------------
       
   251 // CFsComposerFetchLogic::IsProcessDone
       
   252 // -----------------------------------------------------------------------------
       
   253 //
       
   254 //<cmail>
       
   255 /*
       
   256 TBool CFsComposerFetchLogic::IsProcessDone() const
       
   257 	{
       
   258     FUNC_LOG;
       
   259 	return iFetchComplete;
       
   260 	}*/
       
   261 //<cmail>
       
   262 
       
   263 
       
   264 // -----------------------------------------------------------------------------
       
   265 // CFsComposerFetchLogic::ProcessFinished
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 //<cmail>
       
   269 /*
       
   270 void CFsComposerFetchLogic::ProcessFinished()
       
   271 	{
       
   272     FUNC_LOG;
       
   273 	}*/
       
   274 //<cmail>
       
   275 
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CFsComposerFetchLogic::DialogDismissedL
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 /*void CFsComposerFetchLogic::DialogDismissedL( TInt aButtonId )//<cmail>
       
   282 	{
       
   283 	if(aButtonId == EAknSoftkeyCancel)
       
   284 	    {
       
   285 	    CancelFetchings();
       
   286 	    iError = KErrCancel;
       
   287 	    }
       
   288     FUNC_LOG;
       
   289 	}*///<cmail>
       
   290 
       
   291 
       
   292 // -----------------------------------------------------------------------------
       
   293 // CFsComposerFetchLogic::CycleError
       
   294 // -----------------------------------------------------------------------------
       
   295 //
       
   296 //<cmail>
       
   297 /*
       
   298 TInt CFsComposerFetchLogic::CycleError( TInt aError )
       
   299 	{
       
   300     FUNC_LOG;
       
   301 	return aError;
       
   302 	}*/
       
   303 //</cmail>
       
   304 
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CFsComposerFetchLogic::RunState
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 void CFsComposerFetchLogic::RunStateL()
       
   311 	{
       
   312     FUNC_LOG;
       
   313 
       
   314 	TBool doNextState = EFalse;
       
   315 
       
   316 	do
       
   317 		{
       
   318 		doNextState = EFalse;
       
   319 
       
   320 		switch ( iState )
       
   321 			{
       
   322 			case EStateSmartReply:
       
   323 				{
       
   324 				TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartReply );
       
   325 				if ( supported )
       
   326 					{
       
   327 					Complete();
       
   328 					}
       
   329 				else
       
   330 					{
       
   331 					iState = EStateStructure;
       
   332 					doNextState = ETrue;
       
   333 					}
       
   334 				}
       
   335 			break;
       
   336 
       
   337 			case EStateSmartForward:
       
   338 				{
       
   339 				TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartForward );
       
   340 				if ( supported )
       
   341 					{
       
   342 					Complete();
       
   343 					}
       
   344 				else
       
   345 					{
       
   346 					iState = EStateStructure;
       
   347 					doNextState = ETrue;
       
   348 					}
       
   349 				}
       
   350 			break;
       
   351 
       
   352 			case EStateStructure:
       
   353 				{
       
   354 				TBool hasStructure = TFsEmailUiUtility::IsMessageStructureKnown( *iMessage );
       
   355 				if ( hasStructure )
       
   356 					{
       
   357 					iState = EStateBody;
       
   358 					doNextState = ETrue;
       
   359 					}
       
   360 				else
       
   361 					{
       
   362 					RArray<TFSMailMsgId> ids;
       
   363 					CleanupClosePushL( ids );
       
   364 					ids.AppendL( iMessage->GetMessageId() );
       
   365 					TRAP( iError, iStructureRequestId = iFolder->FetchMessagesL( ids, EFSMsgDataStructure, *this ) );
       
   366 					CleanupStack::PopAndDestroy( &ids );
       
   367 					if ( KErrNone == iError )
       
   368 						{
       
   369 						// fetching started successfully
       
   370 						iFetchingStructure = ETrue;
       
   371 						// show wait note
       
   372 						//ShowWaitNoteL(); //<cmail>
       
   373 						}
       
   374 					else
       
   375 						{
       
   376 						// error occurred
       
   377 					    Complete();
       
   378 						}
       
   379 					}
       
   380 				}
       
   381 			break;
       
   382 
       
   383 			case EStateBody:
       
   384 				{
       
   385 				CFSMailMessagePart* body = iMessage->PlainTextBodyPartL();
       
   386                 TBool fetched = EFalse;
       
   387                 // Do we have plain text body part
       
   388                 if ( !body )
       
   389                     {
       
   390                     // No plain text body part so try to get HTML body part
       
   391                     body = iMessage->HtmlBodyPartL();
       
   392                     }
       
   393 
       
   394                 // Do we have any body part
       
   395                 if ( body )
       
   396                     {
       
   397                     fetched = TFsEmailUiUtility::IsMessagePartFullyFetched( *body );
       
   398                     }
       
   399                 else
       
   400                     {
       
   401                     // If there is no body part, then it doens't need to be fetched
       
   402                     // and we may move on.
       
   403                     fetched = ETrue;
       
   404                     }
       
   405                 
       
   406                 CleanupStack::PushL( body );
       
   407                 if ( fetched )
       
   408                     {
       
   409                     if ( EModeReply == iRunMode )
       
   410                         {
       
   411                         Complete();
       
   412                         }
       
   413                     else if ( EModeForward == iRunMode )
       
   414                         {
       
   415                         iState = EStateAttachments;
       
   416                         doNextState = ETrue;
       
   417                         }
       
   418                     else
       
   419                         {
       
   420                         // should not come here
       
   421                         __ASSERT_DEBUG( EFalse, Panic( EFSEmailUiUnexpectedValue ) );
       
   422                         }
       
   423                     }
       
   424                 else
       
   425                     {
       
   426                     TFSMailMsgId textPartId = body->GetPartId();
       
   427 
       
   428                     TRAP( iError, iBodyRequestId = body->FetchMessagePartL( textPartId, *this, 0 ) );
       
   429                     if ( KErrNone == iError )
       
   430                         {
       
   431                         // fetching started successfully
       
   432                         iFetchingBody = ETrue;
       
   433                         // show wait note if not already visible
       
   434                         //ShowWaitNoteL(); //<cmail>
       
   435                         }
       
   436                     else
       
   437                         {
       
   438                         // error occurred
       
   439                         Complete();
       
   440                         }
       
   441                     }
       
   442                 CleanupStack::PopAndDestroy( body );
       
   443 				}
       
   444 			break;
       
   445 			
       
   446 			case EStateAttachments:
       
   447 				{
       
   448 				if ( TFsEmailUiUtility::HasUnfetchedAttachmentsL( *iMessage ) )
       
   449 					{
       
   450 					RPointerArray<CFSMailMessagePart> attachments;
       
   451 					CleanupResetAndDestroyClosePushL( attachments );
       
   452                     iMessage->AttachmentListL( attachments );
       
   453                     for ( TInt i=0; i<attachments.Count(); i++ )
       
   454 						{
       
   455 						if ( !TFsEmailUiUtility::IsMessagePartFullyFetched( *attachments[i] ) )
       
   456 							{
       
   457 							if ( iAppUi.DownloadInfoMediator() ) 
       
   458 								{
       
   459 	                            TPartData data;
       
   460 	                            data.iMailBoxId = iMailBox->GetId();
       
   461 	                            data.iFolderId = iMessage->GetFolderId();
       
   462 	                            data.iMessageId = iMessage->GetMessageId();
       
   463 	                            data.iMessagePartId = attachments[i]->GetPartId();
       
   464 	                            iParts.AppendL( data );
       
   465 								iAppUi.DownloadInfoMediator()->DownloadL( data, EFalse );				
       
   466 								}
       
   467 							else
       
   468 							    {
       
   469 							    iError = KErrGeneral;
       
   470 							    Complete();
       
   471 							    }
       
   472 							}
       
   473 						}
       
   474 					CleanupStack::PopAndDestroy( &attachments );
       
   475 					// show wait note if not already visible
       
   476 					//ShowWaitNoteL(); //<cmail>
       
   477 					}
       
   478 				else
       
   479 					{
       
   480 					Complete();
       
   481 					}
       
   482 				}
       
   483 			break;
       
   484 			}
       
   485 		}
       
   486 	while ( doNextState );
       
   487 
       
   488 	}
       
   489 
       
   490 
       
   491 // -----------------------------------------------------------------------------
       
   492 // CFsComposerFetchLogic::ShowWaitNoteL
       
   493 // -----------------------------------------------------------------------------
       
   494 //
       
   495 /*void CFsComposerFetchLogic::ShowWaitNoteL() //<cmail>
       
   496 	{
       
   497     FUNC_LOG;
       
   498 
       
   499 	if ( !iAsyncWaitNote )
       
   500 		{
       
   501         iFetchComplete = EFalse;
       
   502 
       
   503         //<cmail>
       
   504         iAsyncWaitNote = new(ELeave)CAknWaitDialog(
       
   505                        (REINTERPRET_CAST(CEikDialog**,&iAsyncWaitNote)), ETrue);
       
   506         iAsyncWaitNote->SetCallback(this);
       
   507         //iError = KErrNone;
       
   508         iAsyncWaitNote->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG);
       
   509 
       
   510         iAsyncWaitNote = CAknWaitNoteWrapper::NewL(); //<cmail>
       
   511         TBool result = iAsyncWaitNote->ExecuteL( R_FSE_FETCHING_WAIT_DIALOG, *this, ETrue );
       
   512         if ( !result )
       
   513         	{
       
   514         	// dialog was canceled
       
   515         	iError = KErrCancel;
       
   516         	// stop downloads
       
   517         	CancelFetchings();
       
   518         	}//<cmail>
       
   519         //<cmail>
       
   520 
       
   521         //iObserver.FetchLogicComplete( iState, iError ); //cmail
       
   522 		}
       
   523 
       
   524 	}*/ //<cmail>
       
   525 
       
   526 // -----------------------------------------------------------------------------
       
   527 // CFsComposerFetchLogic::AskIfUserWantsToFetchAttachmentsL
       
   528 // -----------------------------------------------------------------------------
       
   529 //
       
   530 /*
       
   531 TBool CFsComposerFetchLogic::AskIfUserWantsToFetchAttachmentsL()
       
   532 	{
       
   533 
       
   534 	CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
       
   535 	dlg->PrepareLC( R_FSE_EDITOR_CONFIRM_ATTACHMENT_DOWNLOAD_DIALOG );
       
   536 	CAknQueryControl* control = STATIC_CAST( CAknQueryControl*, dlg->ControlOrNull( EGeneralQuery ) );
       
   537 	HBufC* prompt = StringLoader::LoadLC( R_FSE_EDITOR_CONFIRM_ATTACHMENT_DOWNLOAD );
       
   538 	control->SetPromptL( *prompt );
       
   539 	CleanupStack::PopAndDestroy( prompt );
       
   540 	return TBool( dlg->RunLD() );
       
   541 
       
   542 	}
       
   543 */
       
   544 
       
   545 // -----------------------------------------------------------------------------
       
   546 // CFsComposerFetchLogic::CancelFetchings
       
   547 // -----------------------------------------------------------------------------
       
   548 //
       
   549 void CFsComposerFetchLogic::CancelFetchings()
       
   550     {
       
   551     FUNC_LOG;
       
   552     iFetchingCancelGoingOn = ETrue; //<cmail> during cancel other event may come
       
   553 
       
   554     // message structure fetching
       
   555     if ( iFetchingStructure )
       
   556         {
       
   557         TRAPD( error, iClient.CancelL( iStructureRequestId ) );
       
   558         if ( error )
       
   559             {
       
   560             }
       
   561         else
       
   562             {
       
   563             iFetchingStructure = EFalse;
       
   564             }
       
   565         }
       
   566 
       
   567     // message body fetching
       
   568     if ( iFetchingBody )
       
   569         {
       
   570         TRAPD( error, iClient.CancelL( iBodyRequestId ) );
       
   571         if ( error )
       
   572             {
       
   573             }
       
   574         else
       
   575             {
       
   576             iFetchingBody = EFalse;
       
   577             }
       
   578         }
       
   579 
       
   580     // message part downloads
       
   581     //<cmail> during consecutive calls to CancelDownloadL, iParts contents don't remain same.
       
   582     // changing this so that it works even with varying contents in iParts
       
   583     TInt count = iParts.Count();
       
   584     TInt currentCount = count;
       
   585     while (count)
       
   586         {
       
   587         TInt error( KErrNone );
       
   588         if ( iAppUi.DownloadInfoMediator() )
       
   589         	{
       
   590  	        TRAP( error, iAppUi.DownloadInfoMediator()->CancelDownloadL( iParts[0].iMessagePartId ) );
       
   591  	        currentCount = iParts.Count();
       
   592  	        if(currentCount>=count)
       
   593  	            iParts.Remove(0);
       
   594  	       count = currentCount;
       
   595  	//</cmail>
       
   596         	}
       
   597         if ( error )
       
   598             {
       
   599             }
       
   600         }
       
   601     //<cmail>
       
   602     if(!iRequestCompleted)
       
   603         {
       
   604         iObserver.FetchLogicComplete( iState, KErrCancel );
       
   605         iRequestCompleted = ETrue; //so that no stray events from plugins can cause panic
       
   606         }
       
   607     iFetchingCancelGoingOn = EFalse;
       
   608     //</cmail>
       
   609     }
       
   610 
       
   611 // -----------------------------------------------------------------------------
       
   612 // CFsComposerFetchLogic::Complete
       
   613 // -----------------------------------------------------------------------------
       
   614 //
       
   615 void CFsComposerFetchLogic::Complete()
       
   616 	{
       
   617     FUNC_LOG;
       
   618 
       
   619     //<cmail>
       
   620     if(!iRequestCompleted)
       
   621         {
       
   622     //</cmail>
       
   623 	if ( iAppUi.DownloadInfoMediator() )
       
   624 		{
       
   625 		iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
       
   626 		}
       
   627 
       
   628         /*if ( iAsyncWaitNote ) //<cmail>
       
   629 		{
       
   630 		iFetchComplete = ETrue;
       
   631 		//<cmail> new note stops like this and not with IsProcessFinished method
       
   632 		iAsyncWaitNote->ProcessFinishedL();
       
   633 		//</cmail>
       
   634 		// observer is called in ShowWaitNoteL where showing
       
   635 		// wait note returns
       
   636 		}
       
   637 	else
       
   638             {*/ //<cmail>
       
   639 	    // wait note not active, call observer
       
   640         //<cmail>
       
   641         iFetchingStructure = EFalse;
       
   642         iFetchingBody = EFalse;
       
   643         iRequestCompleted = ETrue;
       
   644         //</cmail>
       
   645 		iObserver.FetchLogicComplete( iState, iError );
       
   646             //} //<cmail>
       
   647 	    }
       
   648 
       
   649 	}
       
   650