emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
branchRCL_3
changeset 11 0396474f30f5
parent 10 f5907b1a1053
child 12 4ce476e64c59
equal deleted inserted replaced
10:f5907b1a1053 11:0396474f30f5
   603                     iMrUiActive = ETrue;
   603                     iMrUiActive = ETrue;
   604                     iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );  
   604                     iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );  
   605                     }                              
   605                     }                              
   606                 else
   606                 else
   607                     {
   607                     {
       
   608                     // Attachment list model is not created when opening mrViewer, so attachment options menu is
       
   609                     // not working with MR messages
   608                     iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
   610                     iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
   609                     TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
   611                     TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId );
   610                     iAttachmentsListModel->UpdateListL( msgPartData );
   612                     iAttachmentsListModel->UpdateListL( msgPartData );
   611                        
       
   612                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
   613                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
   613                     LoadContentFromMailMessageL( iMessage, ETrue );
   614                     LoadContentFromMailMessageL( iMessage, ETrue );
   614                     }
   615                     }                
   615                 
       
   616                 }
   616                 }
   617             else
   617             else
   618                 {
   618                 {
   619                 User::Leave( KErrNotFound );
   619                 User::Leave( KErrNotFound );
   620                 }
   620                 }
   933     {
   933     {
   934     TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
   934     TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
   935     if( Layout_Meta_Data::IsLandscapeOrientation() )
   935     if( Layout_Meta_Data::IsLandscapeOrientation() )
   936         {
   936         {
   937         // landscape must use different layout
   937         // landscape must use different layout
   938         res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
   938 		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
   939         }
   939         }
   940 
   940 
   941     if( StatusPane()->CurrentLayoutResId() != res )
   941     if( StatusPane()->CurrentLayoutResId() != res )
   942         {
   942         {
   943         TRAP_IGNORE(
   943         TRAP_IGNORE(
  1219         {
  1219         {
  1220         iContainer->LoadContentFromMailMessageL( aMailMessage, aResetScrollPos );
  1220         iContainer->LoadContentFromMailMessageL( aMailMessage, aResetScrollPos );
  1221         }
  1221         }
  1222     }
  1222     }
  1223 
  1223 
  1224 void CFsEmailUiHtmlViewerView::DeleteMailL()
  1224 void CFsEmailUiHtmlViewerView::DeleteMailL(TBool aSilentDelete)
  1225     {
  1225     {
  1226     FUNC_LOG;
  1226     FUNC_LOG;
  1227 
  1227 
  1228     if ( !iMessage || iActivationData.iEmbeddedMessageMode )
  1228     if ( !iMessage || iActivationData.iEmbeddedMessageMode )
  1229         {
  1229         {
  1231         }
  1231         }
  1232 
  1232 
  1233     TInt reallyDelete( ETrue );
  1233     TInt reallyDelete( ETrue );
  1234 
  1234 
  1235     if ( iAppUi.GetCRHandler()->WarnBeforeDelete() && 
  1235     if ( iAppUi.GetCRHandler()->WarnBeforeDelete() && 
  1236          !iMessage->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
  1236          !aSilentDelete )
  1237         {
  1237         {
  1238         reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
  1238         reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
  1239                            R_FREESTYLE_EMAIL_UI_DELETE_MESSAGE_CONFIRMATION );
  1239                            R_FREESTYLE_EMAIL_UI_DELETE_MESSAGE_CONFIRMATION );
  1240         }
  1240         }
  1241 
  1241 
  1267         //Delete the message
  1267         //Delete the message
  1268         iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
  1268         iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
  1269         CleanupStack::PopAndDestroy( &msgIds );
  1269         CleanupStack::PopAndDestroy( &msgIds );
  1270 
  1270 
  1271         // Notify appui of deleted mail item
  1271         // Notify appui of deleted mail item
  1272         SendEventToAppUiL( TFSEventMailDeleted ); 
  1272         SendEventToAppUiL( TFSEventMailDeletedFromViewer ); 
       
  1273         
       
  1274        
  1273         
  1275         
  1274         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
  1276         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
  1275             {   
  1277             {   
  1276             //Open the previous message or navigate back to list viewer
  1278             //Open the previous message or navigate back to list viewer
  1277             if ( available )
  1279             if ( available )
  1281             else
  1283             else
  1282                 {
  1284                 {
  1283                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1285                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1284                 NavigateBackL();
  1286                 NavigateBackL();
  1285                 }
  1287                 }
  1286 
       
  1287 			
       
  1288 			}
  1288 			}
  1289         //inform user that mail is deleted  
  1289         //inform user that mail is deleted
  1290         TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1290         if (!aSilentDelete)
       
  1291         	TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1291         }
  1292         }
  1292     }
  1293     }
  1293 
  1294 
  1294 // ---------------------------------------------------------------------------
  1295 // ---------------------------------------------------------------------------
  1295 // HandleMailBoxEventL
  1296 // HandleMailBoxEventL
  1299 void CFsEmailUiHtmlViewerView::HandleMailBoxEventL( TFSMailEvent aEvent,
  1300 void CFsEmailUiHtmlViewerView::HandleMailBoxEventL( TFSMailEvent aEvent,
  1300         TFSMailMsgId aMailbox, TAny* aParam1, TAny* /*aParam2*/, TAny* /*aParam3*/ )
  1301         TFSMailMsgId aMailbox, TAny* aParam1, TAny* /*aParam2*/, TAny* /*aParam3*/ )
  1301     {
  1302     {
  1302     FUNC_LOG;
  1303     FUNC_LOG;
  1303     if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
  1304     if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
  1304                                      aEvent == TFSEventMailDeleted && aParam1 ) // Safety, in list events that only concern active mailbox are handled
  1305                                      (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 ) // Safety, in list events that only concern active mailbox are handled
  1305         {
  1306         {
  1306         TFSMailMsgId curMsgId = iMessage->GetMessageId();       
  1307         TFSMailMsgId curMsgId = iMessage->GetMessageId();       
  1307         RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
  1308         RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
  1308         // <cmail> break-keyword should be used only in switch-clauses
       
  1309         TBool cont = ETrue;
  1309         TBool cont = ETrue;
  1310 
       
  1311         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
  1310         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
  1312             {
  1311             {
  1313             if ( ( curMsgId == ( *removedEntries )[i] ) &&
  1312             if ( ( curMsgId == ( *removedEntries )[i] ) &&
  1314                     (iDeletedMessageFromMrui != curMsgId) )
  1313                     (iDeletedMessageFromMrui != curMsgId) )
  1315                 {                
  1314                 {                
  1316                 cont = EFalse;
  1315                 cont = EFalse;
  1317                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1316                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1318                 HandleCommandL( EAknSoftkeyBack );
  1317                 if(aEvent == TFSEventMailDeleted)
       
  1318                     {   //Delete event came from server; close the viewer.
       
  1319                 	HandleCommandL( EAknSoftkeyBack );
       
  1320                 	// The message we are viewing was deleted => stop here
       
  1321                 	return;
       
  1322                     }
  1319                 }            
  1323                 }            
  1320             } 
  1324             } 
  1321         }
  1325         }
  1322      
  1326      
  1323     if (iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && aEvent == TFSEventNewMail)
  1327     if (iContainer && iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && 
  1324         {
  1328             ( aEvent == TFSEventNewMail || 
  1325         UpdateEmailHeaderIndicators();
  1329               aEvent == TFSEventMailDeleted || 
  1326         }
  1330               aEvent == TFSEventMailChanged ) )
  1327     // </cmail>
  1331         {
       
  1332         iContainer->MailListModelUpdatedL();
       
  1333         }
  1328     }
  1334     }
  1329 
  1335 
  1330 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
  1336 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
  1331     {
  1337     {
  1332     FUNC_LOG;
  1338     FUNC_LOG;
  1403     if ( newValue > KMinTInt )
  1409     if ( newValue > KMinTInt )
  1404         {
  1410         {
  1405         iContainer->BrowserControlIf()->SetBrowserSettingL(
  1411         iContainer->BrowserControlIf()->SetBrowserSettingL(
  1406             TBrCtlDefs::ESettingsCurrentZoomLevelIndex, newValue );
  1412             TBrCtlDefs::ESettingsCurrentZoomLevelIndex, newValue );
  1407         }
  1413         }
       
  1414     }
       
  1415 
       
  1416 // -----------------------------------------------------------------------------
       
  1417 // CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
       
  1418 // -----------------------------------------------------------------------------
       
  1419 //
       
  1420 void CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
       
  1421     {
       
  1422     FUNC_LOG;
       
  1423     SetZoomLevelIndexL( ZoomLevelIndexL() );
  1408     }
  1424     }
  1409 
  1425 
  1410 // -----------------------------------------------------------------------------
  1426 // -----------------------------------------------------------------------------
  1411 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL()
  1427 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL()
  1412 // -----------------------------------------------------------------------------
  1428 // -----------------------------------------------------------------------------
  1636     {
  1652     {
  1637     }
  1653     }
  1638 
  1654 
  1639 void CFsEmailUiHtmlViewerView::DownloadAttachmentL( const TAttachmentData& aAttachment )
  1655 void CFsEmailUiHtmlViewerView::DownloadAttachmentL( const TAttachmentData& aAttachment )
  1640     {
  1656     {
       
  1657     iAppUi.DownloadInfoMediator()->AddObserver( this, aAttachment.partData.iMessageId );
  1641     iAttachmentsListModel->StartDownloadL(aAttachment);
  1658     iAttachmentsListModel->StartDownloadL(aAttachment);
  1642     }
  1659     }
  1643 
  1660 
  1644 void CFsEmailUiHtmlViewerView::DownloadAllAttachmentsL()
  1661 void CFsEmailUiHtmlViewerView::DownloadAllAttachmentsL()
  1645     {
  1662     {
  1784                 break;
  1801                 break;
  1785             }
  1802             }
  1786         
  1803         
  1787         iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
  1804         iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
  1788         }
  1805         }
       
  1806     
       
  1807     if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete || 
       
  1808             aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled)
       
  1809         {
       
  1810         iAppUi.DownloadInfoMediator()->StopObserving( this, aPart.iMessageId );
       
  1811         }
  1789     }
  1812     }
  1790 
  1813 
  1791 void CFsEmailUiHtmlViewerView::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
  1814 void CFsEmailUiHtmlViewerView::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
  1792     {
  1815     {
  1793     FUNC_LOG;
  1816     FUNC_LOG;
  1965             // Change empty msk when moving to next
  1988             // Change empty msk when moving to next
  1966             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1989             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1967 
  1990 
  1968             iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId );
  1991             iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId );
  1969             // Next message is displayed in this view through doactivate, because view is re-activate by mail list
  1992             // Next message is displayed in this view through doactivate, because view is re-activate by mail list
       
  1993 
       
  1994             RestoreZoomLevelL();
  1970             }
  1995             }
  1971         }
  1996         }
  1972     }
  1997     }
  1973 // -----------------------------------------------------------------------------
  1998 // -----------------------------------------------------------------------------
  1974 // CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions
  1999 // CFsEmailUiHtmlViewerView::ShowPreviousMessageMenuInOptions
  1998         {
  2023         {
  1999         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  2024         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
  2000         TFSMailMsgId prevMsgId;
  2025         TFSMailMsgId prevMsgId;
  2001         TFSMailMsgId prevMsgFolderId;
  2026         TFSMailMsgId prevMsgFolderId;
  2002         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
  2027         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
  2003             {
  2028             {          
  2004             if (iContainer)
  2029             if (iContainer)
  2005                 {
  2030                 {
  2006                 iContainer->PrepareForMessageNavigation();
  2031                 iContainer->PrepareForMessageNavigation();
  2007                 }
  2032                 }
  2008         
  2033         
  2012             // Change empty msk when moving to previous
  2037             // Change empty msk when moving to previous
  2013             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  2038             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  2014 
  2039 
  2015             iAppUi.MoveToPreviousMsgL( currentMsgId, prevMsgId );
  2040             iAppUi.MoveToPreviousMsgL( currentMsgId, prevMsgId );
  2016             // Previous message is displayed in this view through doactivate, because view is re-activate by mail list
  2041             // Previous message is displayed in this view through doactivate, because view is re-activate by mail list
       
  2042 
       
  2043             RestoreZoomLevelL();
  2017             }
  2044             }
  2018         }
  2045         }
  2019     }
  2046     }
  2020 
  2047 
  2021 
  2048 
  2655         case EESMRCmdMailDelete:
  2682         case EESMRCmdMailDelete:
  2656             {
  2683             {
  2657             if ( iMessage )
  2684             if ( iMessage )
  2658                 {
  2685                 {
  2659                 iDeletedMessageFromMrui = iMessage->GetMessageId(); //<cmail>
  2686                 iDeletedMessageFromMrui = iMessage->GetMessageId(); //<cmail>
  2660                 DeleteMailL();
  2687                 DeleteMailL(ETrue);
  2661                 iOpResult.iResultCode = KErrNone; //???? what to pass here
  2688                 iOpResult.iResultCode = KErrNone; //???? what to pass here
  2662                 }
  2689                 }
  2663 
  2690 
  2664             // Information is returned immediately after delete has completed.
  2691             // Information is returned immediately after delete has completed.
  2665             CompletePendingMrCommand();
  2692             CompletePendingMrCommand();