emailuis/emailui/src/FSComposerFetchLogic.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 8 e1b6206813b4
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
    14 * Description: This file implements class CFsComposerFetchLogic.
    14 * Description: This file implements class CFsComposerFetchLogic.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 //<cmail>
       
    20 #include "emailtrace.h"
    19 #include "emailtrace.h"
    21 #include "cfsmailclient.h"
    20 #include "cfsmailclient.h"
    22 #include "cfsmailcommon.h"
    21 #include "cfsmailcommon.h"
    23 //</cmail>
       
    24 #include <FreestyleEmailUi.rsg>
    22 #include <FreestyleEmailUi.rsg>
    25 //#include <aknquerydialog.h> //<cmail>
       
    26 #include <StringLoader.h>
    23 #include <StringLoader.h>
    27 
    24 
    28 #include "FreestyleEmailUiAppui.h"
    25 #include "FreestyleEmailUiAppui.h"
    29 #include "FSComposerFetchLogic.h"
    26 #include "FSComposerFetchLogic.h"
    30 #include "FreestyleEmailUiUtilities.h"
    27 #include "FreestyleEmailUiUtilities.h"
    33 // -----------------------------------------------------------------------------
    30 // -----------------------------------------------------------------------------
    34 // CFsComposerFetchLogic::NewL
    31 // CFsComposerFetchLogic::NewL
    35 // -----------------------------------------------------------------------------
    32 // -----------------------------------------------------------------------------
    36 //
    33 //
    37 CFsComposerFetchLogic* CFsComposerFetchLogic::NewL( CFSMailClient& aClient,
    34 CFsComposerFetchLogic* CFsComposerFetchLogic::NewL( CFSMailClient& aClient,
    38 	TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId,
    35     TFSMailMsgId aMailBoxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId,
    39 	MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi )
    36     MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi )
    40 	{
    37     {
    41     FUNC_LOG;
    38     FUNC_LOG;
    42 
    39 
    43 	CFsComposerFetchLogic* self = new (ELeave) CFsComposerFetchLogic( aClient, aObserver, aAppUi );
    40     CFsComposerFetchLogic* self = new (ELeave) CFsComposerFetchLogic( aClient, aObserver, aAppUi );
    44 	CleanupStack::PushL( self );
    41     CleanupStack::PushL( self );
    45 	self->ConstructL( aMailBoxId, aFolderId, aMessageId );
    42     self->ConstructL( aMailBoxId, aFolderId, aMessageId );
    46 	CleanupStack::Pop( self );
    43     CleanupStack::Pop( self );
    47 
    44 
    48     return self;
    45     return self;
    49 	}
    46     }
    50 
    47 
    51 
    48 
    52 // -----------------------------------------------------------------------------
    49 // -----------------------------------------------------------------------------
    53 // CFsComposerFetchLogic::CFsComposerFetchLogic
    50 // CFsComposerFetchLogic::CFsComposerFetchLogic
    54 // -----------------------------------------------------------------------------
    51 // -----------------------------------------------------------------------------
    55 //
    52 //
    56 CFsComposerFetchLogic::CFsComposerFetchLogic( CFSMailClient& aClient,
    53 CFsComposerFetchLogic::CFsComposerFetchLogic( CFSMailClient& aClient,
    57 	MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi ):
    54     MComposerFetchLogicCallback& aObserver, CFreestyleEmailUiAppUi& aAppUi ):
    58 	iRunMode( EModeInvalid ), iState( EStateNotStarted ), iAppUi( aAppUi ),
    55     iRunMode( EModeInvalid ), iState( EStateNotStarted ), iAppUi( aAppUi ),
    59 	iClient( aClient ), iObserver( aObserver ),iFetchingCancelGoingOn(EFalse),//<cmail>
    56     iClient( aClient ), iObserver( aObserver ),iFetchingCancelGoingOn(EFalse),
    60         iFetchingStructure(EFalse), iFetchingBody(EFalse),iRequestCompleted(EFalse)//<cmail>
    57         iFetchingStructure(EFalse), iFetchingBody(EFalse),iRequestCompleted(EFalse)
    61 	{
    58     {
    62     FUNC_LOG;
    59     FUNC_LOG;
    63 	}
    60     }
    64 
    61 
    65 
    62 
    66 // -----------------------------------------------------------------------------
    63 // -----------------------------------------------------------------------------
    67 // CFsComposerFetchLogic::~CFsComposerFetchLogic
    64 // CFsComposerFetchLogic::~CFsComposerFetchLogic
    68 // -----------------------------------------------------------------------------
    65 // -----------------------------------------------------------------------------
    69 //
    66 //
    70 CFsComposerFetchLogic::~CFsComposerFetchLogic()
    67 CFsComposerFetchLogic::~CFsComposerFetchLogic()
    71 	{
    68     {
    72     FUNC_LOG;
    69     FUNC_LOG;
    73 
    70 
    74     //CancelFetchings(); <cmail>
       
    75     if ( iAppUi.DownloadInfoMediator() )
    71     if ( iAppUi.DownloadInfoMediator() )
    76         {
    72         {
    77         iAppUi.DownloadInfoMediator()->StopObserving( this );
    73         iAppUi.DownloadInfoMediator()->StopObserving( this );
    78         }
    74         }
    79 
    75 
    80 	iParts.Close();
    76     iParts.Close();
    81 
    77 
    82     //delete iAsyncWaitNote; //<cmail>
    78     delete iMessage;
    83 	delete iMessage;
    79     delete iFolder;
    84 	delete iFolder;
    80     delete iMailBox;
    85 	delete iMailBox;
    81 
    86 
    82     }
    87 	}
       
    88 
    83 
    89 
    84 
    90 // -----------------------------------------------------------------------------
    85 // -----------------------------------------------------------------------------
    91 // CFsComposerFetchLogic::ConstructL
    86 // CFsComposerFetchLogic::ConstructL
    92 // -----------------------------------------------------------------------------
    87 // -----------------------------------------------------------------------------
    93 //
    88 //
    94 void CFsComposerFetchLogic::ConstructL( TFSMailMsgId aMailBoxId,
    89 void CFsComposerFetchLogic::ConstructL( TFSMailMsgId aMailBoxId,
    95 	TFSMailMsgId aFolderId, TFSMailMsgId aMessageId )
    90     TFSMailMsgId aFolderId, TFSMailMsgId aMessageId )
    96 	{
    91     {
    97     FUNC_LOG;
    92     FUNC_LOG;
    98 
    93 
    99 	iMailBox = iClient.GetMailBoxByUidL( aMailBoxId );
    94     iMailBox = iClient.GetMailBoxByUidL( aMailBoxId );
   100 	iFolder = iClient.GetFolderByUidL( aMailBoxId, aFolderId );
    95     iFolder = iClient.GetFolderByUidL( aMailBoxId, aFolderId );
   101 	iMessage = iClient.GetMessageByUidL( aMailBoxId, aFolderId, aMessageId, EFSMsgDataStructure );
    96     iMessage = iClient.GetMessageByUidL( aMailBoxId, aFolderId, aMessageId, EFSMsgDataStructure );
   102 
    97 
   103 	}
    98     }
   104 
    99 
   105 
   100 
   106 // -----------------------------------------------------------------------------
   101 // -----------------------------------------------------------------------------
   107 // CFsComposerFetchLogic::RunReplyLogicL
   102 // CFsComposerFetchLogic::RunReplyLogicL
   108 // -----------------------------------------------------------------------------
   103 // -----------------------------------------------------------------------------
   109 //
   104 //
   110 void CFsComposerFetchLogic::RunReplyLogicL()
   105 void CFsComposerFetchLogic::RunReplyLogicL()
   111 	{
   106     {
   112     FUNC_LOG;
   107     FUNC_LOG;
   113 
   108 
   114 	iRunMode = EModeReply;
   109     iRunMode = EModeReply;
   115 	iState = EStateSmartReply;
   110     iState = EStateSmartReply;
   116 	iError = KErrNone;
   111     iError = KErrNone;
   117 	RunStateL();
   112     RunStateL();
   118 	}
   113     }
   119 
   114 
   120 
   115 
   121 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   122 // CFsComposerFetchLogic::RunForwardLogicL
   117 // CFsComposerFetchLogic::RunForwardLogicL
   123 // -----------------------------------------------------------------------------
   118 // -----------------------------------------------------------------------------
   124 //
   119 //
   125 void CFsComposerFetchLogic::RunForwardLogicL()
   120 void CFsComposerFetchLogic::RunForwardLogicL()
   126 	{
   121     {
   127     FUNC_LOG;
   122     FUNC_LOG;
   128 
   123 
   129 	iRunMode = EModeForward;
   124     iRunMode = EModeForward;
   130 	iState = EStateSmartForward;
   125     iState = EStateSmartForward;
   131 	iError = KErrNone;
   126     iError = KErrNone;
   132 	if ( iAppUi.DownloadInfoMediator() )
   127     if ( iAppUi.DownloadInfoMediator() )
   133 		{
   128         {
   134 		iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
   129         iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
   135 		}
   130         }
   136 	RunStateL();
   131     RunStateL();
   137 
   132 
   138 	}
   133     }
   139 
   134 
   140 
   135 
   141 // -----------------------------------------------------------------------------
   136 // -----------------------------------------------------------------------------
   142 // CFsComposerFetchLogic::RequestResponseL
   137 // CFsComposerFetchLogic::RequestResponseL
   143 // -----------------------------------------------------------------------------
   138 // -----------------------------------------------------------------------------
   199             }
   194             }
   200         Complete();
   195         Complete();
   201         }
   196         }
   202 
   197 
   203     }
   198     }
   204 	
   199     
   205 
   200 
   206 // -----------------------------------------------------------------------------
   201 // -----------------------------------------------------------------------------
   207 // CFsComposerFetchLogic::RequestResponseL
   202 // CFsComposerFetchLogic::RequestResponseL
   208 // -----------------------------------------------------------------------------
   203 // -----------------------------------------------------------------------------
   209 //
   204 //
   210 void CFsComposerFetchLogic::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
   205 void CFsComposerFetchLogic::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
   211 	{
   206     {
   212     FUNC_LOG;
   207     FUNC_LOG;
   213 
   208 
   214     // Ignore all responses when cancelling is in progress.
   209     // Ignore all responses when cancelling is in progress.
   215     if ( !iFetchingCancelGoingOn )
   210     if ( !iFetchingCancelGoingOn )
   216         {
   211         {
   239                 }
   234                 }
   240             }
   235             }
   241         }
   236         }
   242     }
   237     }
   243 
   238 
   244 
       
   245 // -----------------------------------------------------------------------------
       
   246 // CFsComposerFetchLogic::StepL
       
   247 // -----------------------------------------------------------------------------
       
   248 //
       
   249 //<cmail>
       
   250 /*
       
   251 void CFsComposerFetchLogic::StepL()
       
   252 	{
       
   253     FUNC_LOG;
       
   254 	}*/
       
   255 //<cmail>
       
   256 
       
   257 
       
   258 // -----------------------------------------------------------------------------
       
   259 // CFsComposerFetchLogic::IsProcessDone
       
   260 // -----------------------------------------------------------------------------
       
   261 //
       
   262 //<cmail>
       
   263 /*
       
   264 TBool CFsComposerFetchLogic::IsProcessDone() const
       
   265 	{
       
   266     FUNC_LOG;
       
   267 	return iFetchComplete;
       
   268 	}*/
       
   269 //<cmail>
       
   270 
       
   271 
       
   272 // -----------------------------------------------------------------------------
       
   273 // CFsComposerFetchLogic::ProcessFinished
       
   274 // -----------------------------------------------------------------------------
       
   275 //
       
   276 //<cmail>
       
   277 /*
       
   278 void CFsComposerFetchLogic::ProcessFinished()
       
   279 	{
       
   280     FUNC_LOG;
       
   281 	}*/
       
   282 //<cmail>
       
   283 
       
   284 
       
   285 // -----------------------------------------------------------------------------
       
   286 // CFsComposerFetchLogic::DialogDismissedL
       
   287 // -----------------------------------------------------------------------------
       
   288 //
       
   289 /*void CFsComposerFetchLogic::DialogDismissedL( TInt aButtonId )//<cmail>
       
   290 	{
       
   291 	if(aButtonId == EAknSoftkeyCancel)
       
   292 	    {
       
   293 	    CancelFetchings();
       
   294 	    iError = KErrCancel;
       
   295 	    }
       
   296     FUNC_LOG;
       
   297 	}*///<cmail>
       
   298 
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CFsComposerFetchLogic::CycleError
       
   302 // -----------------------------------------------------------------------------
       
   303 //
       
   304 //<cmail>
       
   305 /*
       
   306 TInt CFsComposerFetchLogic::CycleError( TInt aError )
       
   307 	{
       
   308     FUNC_LOG;
       
   309 	return aError;
       
   310 	}*/
       
   311 //</cmail>
       
   312 
       
   313 
       
   314 // -----------------------------------------------------------------------------
   239 // -----------------------------------------------------------------------------
   315 // CFsComposerFetchLogic::RunState
   240 // CFsComposerFetchLogic::RunState
   316 // -----------------------------------------------------------------------------
   241 // -----------------------------------------------------------------------------
   317 //
   242 //
   318 void CFsComposerFetchLogic::RunStateL()
   243 void CFsComposerFetchLogic::RunStateL()
   319 	{
   244     {
   320     FUNC_LOG;
   245     FUNC_LOG;
   321 
   246 
   322 	TBool doNextState = EFalse;
   247     TBool doNextState = EFalse;
   323 
   248 
   324 	do
   249     do
   325 		{
   250         {
   326 		doNextState = EFalse;
   251         doNextState = EFalse;
   327 
   252 
   328 		switch ( iState )
   253         switch ( iState )
   329 			{
   254             {
   330 			case EStateSmartReply:
   255             case EStateSmartReply:
   331 				{
   256                 {
   332 				TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartReply );
   257                 TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartReply );
   333 				if ( supported )
   258                 TBool smartEdit = iMailBox->HasCapability( EFSMBoxCapaSmartEdit );
   334 					{
   259                 if ( supported && !smartEdit )
   335 					Complete();
   260                     {
   336 					}
   261                     Complete();
   337 				else
   262                     }
   338 					{
   263                 else
   339 					iState = EStateStructure;
   264                     {
   340 					doNextState = ETrue;
   265                     iState = EStateStructure;
   341 					}
   266                     doNextState = ETrue;
   342 				}
   267                     }
   343 			break;
   268                 }
   344 
   269             break;
   345 			case EStateSmartForward:
   270 
   346 				{
   271             case EStateSmartForward:
   347 				TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartForward );
   272                 {
   348 				if ( supported )
   273                 TBool supported = iMailBox->HasCapability( EFSMBoxCapaSmartForward );
   349 					{
   274                 TBool smartEdit = iMailBox->HasCapability( EFSMBoxCapaSmartEdit );
   350 					Complete();
   275                 if ( supported && !smartEdit )
   351 					}
   276                     {
   352 				else
   277                     Complete();
   353 					{
   278                     }
   354 					iState = EStateStructure;
   279                 else
   355 					doNextState = ETrue;
   280                     {
   356 					}
   281                     iState = EStateStructure;
   357 				}
   282                     doNextState = ETrue;
   358 			break;
   283                     }
   359 
   284                 }
   360 			case EStateStructure:
   285             break;
   361 				{
   286 
   362 				TBool hasStructure = TFsEmailUiUtility::IsMessageStructureKnown( *iMessage );
   287             case EStateStructure:
   363 				if ( hasStructure )
   288                 {
   364 					{
   289                 TBool hasStructure = TFsEmailUiUtility::IsMessageStructureKnown( *iMessage );
   365 					iState = EStateBody;
   290                 if ( hasStructure )
   366 					doNextState = ETrue;
   291                     {
   367 					}
   292                     iState = EStateBody;
   368 				else
   293                     doNextState = ETrue;
   369 					{
   294                     }
   370 					RArray<TFSMailMsgId> ids;
   295                 else
   371 					CleanupClosePushL( ids );
   296                     {
   372 					ids.AppendL( iMessage->GetMessageId() );
   297                     RArray<TFSMailMsgId> ids;
   373 					TRAP( iError, iStructureRequestId = iFolder->FetchMessagesL( ids, EFSMsgDataStructure, *this ) );
   298                     CleanupClosePushL( ids );
   374 					CleanupStack::PopAndDestroy( &ids );
   299                     ids.AppendL( iMessage->GetMessageId() );
   375 					if ( KErrNone == iError )
   300                     TRAP( iError, iStructureRequestId = iFolder->FetchMessagesL( ids, EFSMsgDataStructure, *this ) );
   376 						{
   301                     CleanupStack::PopAndDestroy( &ids );
   377 						// fetching started successfully
   302                     if ( KErrNone == iError )
   378 						iFetchingStructure = ETrue;
   303                         {
   379 						// show wait note
   304                         // fetching started successfully
   380 						//ShowWaitNoteL(); //<cmail>
   305                         iFetchingStructure = ETrue;
   381 						}
   306                         }
   382 					else
   307                     else
   383 						{
   308                         {
   384 						// error occurred
   309                         // error occurred
   385 					    Complete();
   310                         Complete();
   386 						}
   311                         }
   387 					}
   312                     }
   388 				}
   313                 }
   389 			break;
   314             break;
   390 
   315 
   391 			case EStateBody:
   316             case EStateBody:
   392 				{
   317                 {
   393 				CFSMailMessagePart* body = iMessage->PlainTextBodyPartL();
   318                 CFSMailMessagePart* body = iMessage->PlainTextBodyPartL();
   394                 TBool fetched = EFalse;
   319                 TBool fetched = EFalse;
   395                 // Do we have plain text body part
   320                 // Do we have plain text body part
   396                 if ( !body )
   321                 if ( !body )
   397                     {
   322                     {
   398                     // No plain text body part so try to get HTML body part
   323                     // No plain text body part so try to get HTML body part
   412                     }
   337                     }
   413                 
   338                 
   414                 CleanupStack::PushL( body );
   339                 CleanupStack::PushL( body );
   415                 if ( fetched )
   340                 if ( fetched )
   416                     {
   341                     {
       
   342                     // with Smart
   417                     if ( EModeReply == iRunMode )
   343                     if ( EModeReply == iRunMode )
   418                         {
   344                         {
   419                         Complete();
   345                         Complete();
   420                         }
   346                         }
   421                     else if ( EModeForward == iRunMode )
   347                     else if ( EModeForward == iRunMode )
   422                         {
   348                         {
   423                         iState = EStateAttachments;
   349                         TBool smartForward = iMailBox->HasCapability( EFSMBoxCapaSmartForward );
   424                         doNextState = ETrue;
   350                         if ( smartForward )
       
   351                             {
       
   352                             // do not download attachments if smartforward
       
   353                             Complete();
       
   354                             }
       
   355                         else
       
   356                             {
       
   357                             // if smartforward is not suppported fetch attachments
       
   358                             iState = EStateAttachments;
       
   359                             doNextState = ETrue;
       
   360                             }
       
   361 // Smart Edit changes end
   425                         }
   362                         }
   426                     else
   363                     else
   427                         {
   364                         {
   428                         // should not come here
   365                         // should not come here
   429                         __ASSERT_DEBUG( EFalse, Panic( EFSEmailUiUnexpectedValue ) );
   366                         __ASSERT_DEBUG( EFalse, Panic( EFSEmailUiUnexpectedValue ) );
   436                     TRAP( iError, iBodyRequestId = body->FetchMessagePartL( textPartId, *this, 0 ) );
   373                     TRAP( iError, iBodyRequestId = body->FetchMessagePartL( textPartId, *this, 0 ) );
   437                     if ( KErrNone == iError )
   374                     if ( KErrNone == iError )
   438                         {
   375                         {
   439                         // fetching started successfully
   376                         // fetching started successfully
   440                         iFetchingBody = ETrue;
   377                         iFetchingBody = ETrue;
   441                         // show wait note if not already visible
       
   442                         //ShowWaitNoteL(); //<cmail>
       
   443                         }
   378                         }
   444                     else
   379                     else
   445                         {
   380                         {
   446                         // error occurred
   381                         // error occurred
   447                         Complete();
   382                         Complete();
   448                         }
   383                         }
   449                     }
   384                     }
   450                 CleanupStack::PopAndDestroy( body );
   385                 CleanupStack::PopAndDestroy( body );
   451 				}
   386                 }
   452 			break;
   387             break;
   453 			
   388             
   454 			case EStateAttachments:
   389             case EStateAttachments:
   455 				{
   390                 {
   456 				if ( TFsEmailUiUtility::HasUnfetchedAttachmentsL( *iMessage ) )
   391                 if ( TFsEmailUiUtility::HasUnfetchedAttachmentsL( *iMessage ) )
   457 					{
   392                     {
   458 					RPointerArray<CFSMailMessagePart> attachments;
   393                     RPointerArray<CFSMailMessagePart> attachments;
   459 					CleanupResetAndDestroyClosePushL( attachments );
   394                     CleanupResetAndDestroyClosePushL( attachments );
   460                     iMessage->AttachmentListL( attachments );
   395                     iMessage->AttachmentListL( attachments );
   461                     for ( TInt i=0; i<attachments.Count(); i++ )
   396                     for ( TInt i=0; i<attachments.Count(); i++ )
   462 						{
   397                         {
   463 						if ( !TFsEmailUiUtility::IsMessagePartFullyFetched( *attachments[i] ) )
   398                         if ( !TFsEmailUiUtility::IsMessagePartFullyFetched( *attachments[i] ) )
   464 							{
   399                             {
   465 							if ( iAppUi.DownloadInfoMediator() ) 
   400                             if ( iAppUi.DownloadInfoMediator() ) 
   466 								{
   401                                 {
   467 	                            TPartData data;
   402                                 TPartData data;
   468 	                            data.iMailBoxId = iMailBox->GetId();
   403                                 data.iMailBoxId = iMailBox->GetId();
   469 	                            data.iFolderId = iMessage->GetFolderId();
   404                                 data.iFolderId = iMessage->GetFolderId();
   470 	                            data.iMessageId = iMessage->GetMessageId();
   405                                 data.iMessageId = iMessage->GetMessageId();
   471 	                            data.iMessagePartId = attachments[i]->GetPartId();
   406                                 data.iMessagePartId = attachments[i]->GetPartId();
   472 	                            iParts.AppendL( data );
   407                                 iParts.AppendL( data );
   473 								iAppUi.DownloadInfoMediator()->DownloadL( data, EFalse );				
   408                                 iAppUi.DownloadInfoMediator()->DownloadL( data, EFalse );               
   474 								}
   409                                 }
   475 							else
   410                             else
   476 							    {
   411                                 {
   477 							    iError = KErrGeneral;
   412                                 iError = KErrGeneral;
   478 							    Complete();
   413                                 Complete();
   479 							    }
   414                                 }
   480 							}
   415                             }
   481 						}
   416                         }
   482 					CleanupStack::PopAndDestroy( &attachments );
   417                     CleanupStack::PopAndDestroy( &attachments );
   483 					// show wait note if not already visible
   418                     }
   484 					//ShowWaitNoteL(); //<cmail>
   419                 else
   485 					}
   420                     {
   486 				else
   421                     Complete();
   487 					{
   422                     }
   488 					Complete();
   423                 }
   489 					}
   424             break;
   490 				}
   425             }
   491 			break;
   426         }
   492 			}
   427     while ( doNextState );
   493 		}
   428     }
   494 	while ( doNextState );
   429 
   495 
       
   496 	}
       
   497 
       
   498 
       
   499 // -----------------------------------------------------------------------------
       
   500 // CFsComposerFetchLogic::ShowWaitNoteL
       
   501 // -----------------------------------------------------------------------------
       
   502 //
       
   503 /*void CFsComposerFetchLogic::ShowWaitNoteL() //<cmail>
       
   504 	{
       
   505     FUNC_LOG;
       
   506 
       
   507 	if ( !iAsyncWaitNote )
       
   508 		{
       
   509         iFetchComplete = EFalse;
       
   510 
       
   511         //<cmail>
       
   512         iAsyncWaitNote = new(ELeave)CAknWaitDialog(
       
   513                        (REINTERPRET_CAST(CEikDialog**,&iAsyncWaitNote)), ETrue);
       
   514         iAsyncWaitNote->SetCallback(this);
       
   515         //iError = KErrNone;
       
   516         iAsyncWaitNote->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG);
       
   517 
       
   518         iAsyncWaitNote = CAknWaitNoteWrapper::NewL(); //<cmail>
       
   519         TBool result = iAsyncWaitNote->ExecuteL( R_FSE_FETCHING_WAIT_DIALOG, *this, ETrue );
       
   520         if ( !result )
       
   521         	{
       
   522         	// dialog was canceled
       
   523         	iError = KErrCancel;
       
   524         	// stop downloads
       
   525         	CancelFetchings();
       
   526         	}//<cmail>
       
   527         //<cmail>
       
   528 
       
   529         //iObserver.FetchLogicComplete( iState, iError ); //cmail
       
   530 		}
       
   531 
       
   532 	}*/ //<cmail>
       
   533 
       
   534 // -----------------------------------------------------------------------------
       
   535 // CFsComposerFetchLogic::AskIfUserWantsToFetchAttachmentsL
       
   536 // -----------------------------------------------------------------------------
       
   537 //
       
   538 /*
       
   539 TBool CFsComposerFetchLogic::AskIfUserWantsToFetchAttachmentsL()
       
   540 	{
       
   541 
       
   542 	CAknQueryDialog* dlg = CAknQueryDialog::NewL( CAknQueryDialog::ENoTone );
       
   543 	dlg->PrepareLC( R_FSE_EDITOR_CONFIRM_ATTACHMENT_DOWNLOAD_DIALOG );
       
   544 	CAknQueryControl* control = STATIC_CAST( CAknQueryControl*, dlg->ControlOrNull( EGeneralQuery ) );
       
   545 	HBufC* prompt = StringLoader::LoadLC( R_FSE_EDITOR_CONFIRM_ATTACHMENT_DOWNLOAD );
       
   546 	control->SetPromptL( *prompt );
       
   547 	CleanupStack::PopAndDestroy( prompt );
       
   548 	return TBool( dlg->RunLD() );
       
   549 
       
   550 	}
       
   551 */
       
   552 
   430 
   553 // -----------------------------------------------------------------------------
   431 // -----------------------------------------------------------------------------
   554 // CFsComposerFetchLogic::CancelFetchings
   432 // CFsComposerFetchLogic::CancelFetchings
   555 // -----------------------------------------------------------------------------
   433 // -----------------------------------------------------------------------------
   556 //
   434 //
   594             {
   472             {
   595             TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelDownloadL( iParts[i].iMessagePartId ) );
   473             TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelDownloadL( iParts[i].iMessagePartId ) );
   596             }
   474             }
   597         }
   475         }
   598 
   476 
   599     //<cmail>
       
   600     if( !iRequestCompleted )
   477     if( !iRequestCompleted )
   601         {
   478         {
   602         if ( iObserver.FetchLogicComplete( iState, KErrCancel ))
   479         if ( iObserver.FetchLogicComplete( iState, KErrCancel ))
   603             {
   480             {
   604             // If the observer deleted this object, don't try to do anything
   481             // If the observer deleted this object, don't try to do anything
   607             }
   484             }
   608         iRequestCompleted = ETrue; //so that no stray events from plugins can cause panic
   485         iRequestCompleted = ETrue; //so that no stray events from plugins can cause panic
   609         }
   486         }
   610 
   487 
   611     iFetchingCancelGoingOn = EFalse;
   488     iFetchingCancelGoingOn = EFalse;
   612     //</cmail>
       
   613     }
   489     }
   614 
   490 
   615 // -----------------------------------------------------------------------------
   491 // -----------------------------------------------------------------------------
   616 // CFsComposerFetchLogic::Complete
   492 // CFsComposerFetchLogic::Complete
   617 // -----------------------------------------------------------------------------
   493 // -----------------------------------------------------------------------------
   618 //
   494 //
   619 void CFsComposerFetchLogic::Complete()
   495 void CFsComposerFetchLogic::Complete()
   620 	{
   496     {
   621     FUNC_LOG;
   497     FUNC_LOG;
   622 
   498 
   623     //<cmail>
       
   624     if(!iRequestCompleted)
   499     if(!iRequestCompleted)
   625         {
   500         {
   626     //</cmail>
   501         if ( iAppUi.DownloadInfoMediator() )
   627 	if ( iAppUi.DownloadInfoMediator() )
   502             {
   628 		{
   503             iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
   629 		iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
   504             }
   630 		}
   505         // wait note not active, call observer
   631 
       
   632         /*if ( iAsyncWaitNote ) //<cmail>
       
   633 		{
       
   634 		iFetchComplete = ETrue;
       
   635 		//<cmail> new note stops like this and not with IsProcessFinished method
       
   636 		iAsyncWaitNote->ProcessFinishedL();
       
   637 		//</cmail>
       
   638 		// observer is called in ShowWaitNoteL where showing
       
   639 		// wait note returns
       
   640 		}
       
   641 	else
       
   642             {*/ //<cmail>
       
   643 	    // wait note not active, call observer
       
   644         //<cmail>
       
   645         iFetchingStructure = EFalse;
   506         iFetchingStructure = EFalse;
   646         iFetchingBody = EFalse;
   507         iFetchingBody = EFalse;
   647         iRequestCompleted = ETrue;
   508         iRequestCompleted = ETrue;
   648         //</cmail>
   509         iObserver.FetchLogicComplete( iState, iError );
   649 		iObserver.FetchLogicComplete( iState, iError );
   510         }
   650             //} //<cmail>
   511     }
   651 	    }
   512 
   652 
       
   653 	}
       
   654