emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
branchRCL_3
changeset 11 0396474f30f5
parent 10 f5907b1a1053
child 12 4ce476e64c59
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -605,14 +605,14 @@
                     }                              
                 else
                     {
+                    // Attachment list model is not created when opening mrViewer, so attachment options menu is
+                    // not working with MR messages
                     iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
-                    TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
+                    TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId );
                     iAttachmentsListModel->UpdateListL( msgPartData );
-                       
                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
                     LoadContentFromMailMessageL( iMessage, ETrue );
-                    }
-                
+                    }                
                 }
             else
                 {
@@ -935,7 +935,7 @@
     if( Layout_Meta_Data::IsLandscapeOrientation() )
         {
         // landscape must use different layout
-        res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
+		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
         }
 
     if( StatusPane()->CurrentLayoutResId() != res )
@@ -1221,7 +1221,7 @@
         }
     }
 
-void CFsEmailUiHtmlViewerView::DeleteMailL()
+void CFsEmailUiHtmlViewerView::DeleteMailL(TBool aSilentDelete)
     {
     FUNC_LOG;
 
@@ -1233,7 +1233,7 @@
     TInt reallyDelete( ETrue );
 
     if ( iAppUi.GetCRHandler()->WarnBeforeDelete() && 
-         !iMessage->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
+         !aSilentDelete )
         {
         reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
                            R_FREESTYLE_EMAIL_UI_DELETE_MESSAGE_CONFIRMATION );
@@ -1269,7 +1269,9 @@
         CleanupStack::PopAndDestroy( &msgIds );
 
         // Notify appui of deleted mail item
-        SendEventToAppUiL( TFSEventMailDeleted ); 
+        SendEventToAppUiL( TFSEventMailDeletedFromViewer ); 
+        
+       
         
         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
             {   
@@ -1283,11 +1285,10 @@
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
                 NavigateBackL();
                 }
-
-			
 			}
-        //inform user that mail is deleted  
-        TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
+        //inform user that mail is deleted
+        if (!aSilentDelete)
+        	TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
         }
     }
 
@@ -1301,13 +1302,11 @@
     {
     FUNC_LOG;
     if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
-                                     aEvent == TFSEventMailDeleted && aParam1 ) // Safety, in list events that only concern active mailbox are handled
+                                     (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 ) // Safety, in list events that only concern active mailbox are handled
         {
         TFSMailMsgId curMsgId = iMessage->GetMessageId();       
         RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
-        // <cmail> break-keyword should be used only in switch-clauses
         TBool cont = ETrue;
-
         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
             {
             if ( ( curMsgId == ( *removedEntries )[i] ) &&
@@ -1315,16 +1314,23 @@
                 {                
                 cont = EFalse;
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
-                HandleCommandL( EAknSoftkeyBack );
+                if(aEvent == TFSEventMailDeleted)
+                    {   //Delete event came from server; close the viewer.
+                	HandleCommandL( EAknSoftkeyBack );
+                	// The message we are viewing was deleted => stop here
+                	return;
+                    }
                 }            
             } 
         }
      
-    if (iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && aEvent == TFSEventNewMail)
+    if (iContainer && iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && 
+            ( aEvent == TFSEventNewMail || 
+              aEvent == TFSEventMailDeleted || 
+              aEvent == TFSEventMailChanged ) )
         {
-        UpdateEmailHeaderIndicators();
+        iContainer->MailListModelUpdatedL();
         }
-    // </cmail>
     }
 
 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
@@ -1408,6 +1414,16 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
+// -----------------------------------------------------------------------------
+//
+void CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
+    {
+    FUNC_LOG;
+    SetZoomLevelIndexL( ZoomLevelIndexL() );
+    }
+
+// -----------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL()
 // -----------------------------------------------------------------------------
 //
@@ -1638,6 +1654,7 @@
 
 void CFsEmailUiHtmlViewerView::DownloadAttachmentL( const TAttachmentData& aAttachment )
     {
+    iAppUi.DownloadInfoMediator()->AddObserver( this, aAttachment.partData.iMessageId );
     iAttachmentsListModel->StartDownloadL(aAttachment);
     }
 
@@ -1786,6 +1803,12 @@
         
         iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
         }
+    
+    if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete || 
+            aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled)
+        {
+        iAppUi.DownloadInfoMediator()->StopObserving( this, aPart.iMessageId );
+        }
     }
 
 void CFsEmailUiHtmlViewerView::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
@@ -1967,6 +1990,8 @@
 
             iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId );
             // Next message is displayed in this view through doactivate, because view is re-activate by mail list
+
+            RestoreZoomLevelL();
             }
         }
     }
@@ -2000,7 +2025,7 @@
         TFSMailMsgId prevMsgId;
         TFSMailMsgId prevMsgFolderId;
         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
-            {
+            {          
             if (iContainer)
                 {
                 iContainer->PrepareForMessageNavigation();
@@ -2014,6 +2039,8 @@
 
             iAppUi.MoveToPreviousMsgL( currentMsgId, prevMsgId );
             // Previous message is displayed in this view through doactivate, because view is re-activate by mail list
+
+            RestoreZoomLevelL();
             }
         }
     }
@@ -2657,7 +2684,7 @@
             if ( iMessage )
                 {
                 iDeletedMessageFromMrui = iMessage->GetMessageId(); //<cmail>
-                DeleteMailL();
+                DeleteMailL(ETrue);
                 iOpResult.iResultCode = KErrNone; //???? what to pass here
                 }