emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
branchRCL_3
changeset 12 f5907b1a1053
parent 8 e1b6206813b4
child 13 0396474f30f5
equal deleted inserted replaced
8:e1b6206813b4 12:f5907b1a1053
   132     BaseConstructL( R_FSEMAILUI_HTML_VIEW );
   132     BaseConstructL( R_FSEMAILUI_HTML_VIEW );
   133     iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityLow );
   133     iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityLow );
   134     iOpenMessages = new (ELeave) CStack<CFSMailMessage, ETrue>();
   134     iOpenMessages = new (ELeave) CStack<CFSMailMessage, ETrue>();
   135     iEmbeddedMessages = new (ELeave) CStack<CFSMailMessage, EFalse>();
   135     iEmbeddedMessages = new (ELeave) CStack<CFSMailMessage, EFalse>();
   136     iNextOrPrevMessageSelected = EFalse; 
   136     iNextOrPrevMessageSelected = EFalse; 
       
   137     iForwardingMessage = EFalse;
   137     }
   138     }
   138 
   139 
   139 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   140 // CFsEmailUiHtmlViewerView::Id()
   141 // CFsEmailUiHtmlViewerView::Id()
   141 // Returns View's ID.
   142 // Returns View's ID.
   296                         {
   297                         {
   297                         HideContainer();
   298                         HideContainer();
   298                         iContainer->ResetContent();
   299                         iContainer->ResetContent();
   299                         }
   300                         }
   300 
   301 
       
   302                     iForwardingMessage = ETrue;
   301                     iAppUi.LaunchEditorL( KEditorCmdForward, params );
   303                     iAppUi.LaunchEditorL( KEditorCmdForward, params );
   302                     }
   304                     }
   303                 }
   305                 }
   304             break;
   306             break;
   305             case EFsEmailUiCmdActionsDelete:
   307             case EFsEmailUiCmdActionsDelete:
   477 // -----------------------------------------------------------------------------
   479 // -----------------------------------------------------------------------------
   478 // CFsEmailUiHtmlViewerView::DoActivateL()
   480 // CFsEmailUiHtmlViewerView::DoActivateL()
   479 // Activate an Compose view
   481 // Activate an Compose view
   480 // -----------------------------------------------------------------------------
   482 // -----------------------------------------------------------------------------
   481 //
   483 //
   482 void CFsEmailUiHtmlViewerView::ChildDoActivateL( const TVwsViewId& /*aPrevViewId*/,
   484 void CFsEmailUiHtmlViewerView::ChildDoActivateL( const TVwsViewId& aPrevViewId,
   483         TUid aCustomMessageId, const TDesC8& aCustomMessage )
   485         TUid aCustomMessageId, const TDesC8& aCustomMessage )
   484     {
   486     {
   485     FUNC_LOG;
   487     FUNC_LOG;
   486 
   488 
   487     TBool msgBodyStructurePresent ( EFalse );
   489     TBool msgBodyStructurePresent ( EFalse );
   488     TBool msgBodyContentPresent ( EFalse );
   490     TBool msgBodyContentPresent ( EFalse );
   489     
   491     
       
   492     if( aCustomMessageId != KHtmlViewerReturnToPrevious)
       
   493      {
       
   494      ViewEntered( aPrevViewId );
       
   495      }
       
   496 
   490     if ( iMrObserverToInform && 
   497     if ( iMrObserverToInform && 
   491          aCustomMessageId == KStartViewerReturnToPreviousMsg )
   498          aCustomMessageId == KStartViewerReturnToPreviousMsg )
   492         {
   499         {
   493         // If returning from view launched by MRUI, complete the ongoing
   500         // If returning from view launched by MRUI, complete the ongoing
   494         // async process.
   501         // async process.
   732                     }
   739                     }
   733                 }
   740                 }
   734             }
   741             }
   735        }
   742        }
   736     iNextOrPrevMessageSelected = EFalse;
   743     iNextOrPrevMessageSelected = EFalse;
   737     
   744     iForwardingMessage = EFalse;
   738     //update rect only if it has changed from previous time.
   745     
   739     if ( iContainer->Rect() != ContainerRect()  )
       
   740         {
       
   741         iContainer->SetRect( ContainerRect() );
       
   742         }
       
   743 
       
   744     TIMESTAMP( "Html viewer opened" );    
   746     TIMESTAMP( "Html viewer opened" );    
   745     }
   747     }
   746 
   748 
   747 // -----------------------------------------------------------------------------
   749 // -----------------------------------------------------------------------------
   748 // CFsEmailUiHtmlViewerView::OfferToolbarEventL
   750 // CFsEmailUiHtmlViewerView::OfferToolbarEventL
   806         {
   808         {
   807         if ( iActivationData.iEmbeddedMessageMode )
   809         if ( iActivationData.iEmbeddedMessageMode )
   808             {
   810             {
   809             aDimmedItems.AppendL(EFsEmailUiTbCmdActions);
   811             aDimmedItems.AppendL(EFsEmailUiTbCmdActions);
   810             aDimmedItems.AppendL(EFsEmailUiTbCmdDelete);
   812             aDimmedItems.AppendL(EFsEmailUiTbCmdDelete);
       
   813             aDimmedItems.AppendL(EFsEmailUiTbCmdReply);
       
   814             aDimmedItems.AppendL(EFsEmailUiTbCmdForward);
       
   815             aDimmedItems.AppendL(EFsEmailUiTbCmdReplyAll);
   811             }
   816             }
   812         }
   817         }
   813     }
   818     }
   814 
   819 
   815 // -----------------------------------------------------------------------------
   820 // -----------------------------------------------------------------------------
   818 // -----------------------------------------------------------------------------
   823 // -----------------------------------------------------------------------------
   819 //
   824 //
   820 void CFsEmailUiHtmlViewerView::ChildDoDeactivate()
   825 void CFsEmailUiHtmlViewerView::ChildDoDeactivate()
   821     {
   826     {
   822     FUNC_LOG;
   827     FUNC_LOG;
   823     CancelFetchings();
   828     // Don't cancel fetching the message parts when forwarding the message:
   824    
   829     // it would also cancel the fetchings initiated by the forwarding,
       
   830     // causing the forwarding to abort.
       
   831     if ( !iForwardingMessage )
       
   832         {
       
   833         CancelFetchings();
       
   834         }
       
   835 
   825     if ( iContainer )
   836     if ( iContainer )
   826         {
   837         {
   827         HideContainer();
   838         HideContainer();
   828         iContainer->ResetContent();
   839         iContainer->ResetContent(ETrue);
   829         iAppUi.RemoveFromStack(iContainer);
   840         iAppUi.RemoveFromStack(iContainer);
   830         iContainer->CancelFetch();
   841         iContainer->CancelFetch();
   831         iContainer->ClearCacheAndLoadEmptyContent();
   842         iContainer->ClearCacheAndLoadEmptyContent();
   832         }
   843         }
   833     Toolbar()->SetToolbarObserver( this );
   844     Toolbar()->SetToolbarObserver( this );
  1122     }
  1133     }
  1123 
  1134 
  1124 void CFsEmailUiHtmlViewerView::HandleStatusPaneSizeChange()
  1135 void CFsEmailUiHtmlViewerView::HandleStatusPaneSizeChange()
  1125     {
  1136     {
  1126     CFsEmailUiViewBase::HandleStatusPaneSizeChange();
  1137     CFsEmailUiViewBase::HandleStatusPaneSizeChange();
  1127     
       
  1128     if ( iContainer )
       
  1129         {
       
  1130         iContainer->SetRect( ContainerRect() );
       
  1131         }
       
  1132     }
  1138     }
  1133 
  1139 
  1134 void CFsEmailUiHtmlViewerView::HandleViewRectChange()
  1140 void CFsEmailUiHtmlViewerView::HandleViewRectChange()
  1135     {
  1141     {
  1136     CFsEmailUiViewBase::HandleViewRectChange();
  1142     CFsEmailUiViewBase::HandleViewRectChange();
  1275             else
  1281             else
  1276                 {
  1282                 {
  1277                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1283                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1278                 NavigateBackL();
  1284                 NavigateBackL();
  1279                 }
  1285                 }
  1280             //inform user that mail is deleted  
  1286 
  1281             TFsEmailUiUtility::ShowGlobalInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1287 			
  1282             }        
  1288 			}
       
  1289         //inform user that mail is deleted  
       
  1290         TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1283         }
  1291         }
  1284     }
  1292     }
  1285 
  1293 
  1286 // ---------------------------------------------------------------------------
  1294 // ---------------------------------------------------------------------------
  1287 // HandleMailBoxEventL
  1295 // HandleMailBoxEventL
  1638     iAttachmentsListModel->DownloadAllAttachmentsL();
  1646     iAttachmentsListModel->DownloadAllAttachmentsL();
  1639     }
  1647     }
  1640 
  1648 
  1641 void CFsEmailUiHtmlViewerView::CancelAttachmentL( const TAttachmentData& aAttachment )
  1649 void CFsEmailUiHtmlViewerView::CancelAttachmentL( const TAttachmentData& aAttachment )
  1642     {
  1650     {
  1643     TInt reallyCancel = 
  1651     iAttachmentsListModel->CancelDownloadL(aAttachment);
  1644         TFsEmailUiUtility::ShowConfirmationQueryL( R_FSE_VIEWER_CANCEL_DOWNLOAD_QUERY );
       
  1645     if ( reallyCancel )
       
  1646         {
       
  1647         iAttachmentsListModel->CancelDownloadL(aAttachment);
       
  1648         }
       
  1649     }
  1652     }
  1650 
  1653 
  1651 void CFsEmailUiHtmlViewerView::OpenAttachmentL( const TAttachmentData& aAttachment )
  1654 void CFsEmailUiHtmlViewerView::OpenAttachmentL( const TAttachmentData& aAttachment )
  1652     {
  1655     {
  1653     if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
  1656     if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
  1948         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  1951         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  1949         TFSMailMsgId nextMsgId;
  1952         TFSMailMsgId nextMsgId;
  1950         TFSMailMsgId nextMsgFolderId;
  1953         TFSMailMsgId nextMsgFolderId;
  1951         if ( iAppUi.IsNextMsgAvailable( currentMsgId, nextMsgId, nextMsgFolderId ) )
  1954         if ( iAppUi.IsNextMsgAvailable( currentMsgId, nextMsgId, nextMsgFolderId ) )
  1952             {
  1955             {
       
  1956             if (iContainer)
       
  1957                 {
       
  1958                 iContainer->PrepareForMessageNavigation();
       
  1959                 }
       
  1960 
  1953             // Stop timer and cancel fetchings before showing next message
  1961             // Stop timer and cancel fetchings before showing next message
  1954             //iFetchingAnimationTimer->Stop();
  1962             //iFetchingAnimationTimer->Stop();
  1955             CancelFetchings();
  1963             CancelFetchings();
  1956            
  1964            
  1957             // Change empty msk when moving to next
  1965             // Change empty msk when moving to next
  1991         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  1999         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  1992         TFSMailMsgId prevMsgId;
  2000         TFSMailMsgId prevMsgId;
  1993         TFSMailMsgId prevMsgFolderId;
  2001         TFSMailMsgId prevMsgFolderId;
  1994         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
  2002         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
  1995             {
  2003             {
       
  2004             if (iContainer)
       
  2005                 {
       
  2006                 iContainer->PrepareForMessageNavigation();
       
  2007                 }
       
  2008         
  1996             // Stop timer and cancel fetchings before showing prev message
  2009             // Stop timer and cancel fetchings before showing prev message
  1997             CancelFetchings();
  2010             CancelFetchings();
  1998            
  2011            
  1999             // Change empty msk when moving to previous
  2012             // Change empty msk when moving to previous
  2000             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  2013             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  3172            StartFetchingMessagePartL( *iMessage, type );
  3185            StartFetchingMessagePartL( *iMessage, type );
  3173            }
  3186            }
  3174        }
  3187        }
  3175     }
  3188     }
  3176 
  3189 
  3177 void CFsEmailUiHtmlViewerView::CheckMessageBodyL( CFSMailMessage& aMessage, TBool& aMessageBodyStructurePresent, TBool& aMessageBodyContentPresent)
  3190 void CFsEmailUiHtmlViewerView::CheckMessageBodyL( CFSMailMessage& /*aMessage*/, TBool& aMessageBodyStructurePresent, TBool& aMessageBodyContentPresent)
  3178     {
  3191     {
  3179     CFSMailMessagePart* bodyPart = iMessage->HtmlBodyPartL();
  3192     CFSMailMessagePart* bodyPart = iMessage->HtmlBodyPartL();
  3180     if ( !bodyPart )
  3193     if ( !bodyPart )
  3181         {
  3194         {
  3182         bodyPart = iMessage->PlainTextBodyPartL();
  3195         bodyPart = iMessage->PlainTextBodyPartL();