emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
branchRCL_3
changeset 8 e1b6206813b4
parent 4 e7aa27f58ae1
child 10 f5907b1a1053
equal deleted inserted replaced
4:e7aa27f58ae1 8:e1b6206813b4
    24 #include <AknWaitDialog.h>
    24 #include <AknWaitDialog.h>
    25 #include <AknGlobalListQuery.h>
    25 #include <AknGlobalListQuery.h>
    26 #include <AknGlobalNote.h>
    26 #include <AknGlobalNote.h>
    27 #include <aknnavi.h>
    27 #include <aknnavi.h>
    28 #include <aknnavide.h>
    28 #include <aknnavide.h>
    29 #include <APGCLI.H>
    29 #include <apgcli.h>
    30 #include <APMSTD.H>
    30 #include <apmstd.h>
    31 #include <FavouritesDb.h>
    31 #include <favouritesdb.h>
    32 //<cmail>
    32 //<cmail>
    33 #include <featmgr.h>
    33 #include <featmgr.h>
    34 #include "CFSMailMessage.h"
    34 #include "cfsmailmessage.h"
    35 #include "CFSMailClient.h"
    35 #include "cfsmailclient.h"
    36 #include <FreestyleEmailUi.rsg>
    36 #include <FreestyleEmailUi.rsg>
    37 #include <SchemeHandler.h> // CSchemeHandler
    37 #include <schemehandler.h> // CSchemeHandler
    38 #include <brctlinterface.h>
    38 #include <brctlinterface.h>
    39 #include <csxhelp/cmail.hlp.hrh>
    39 #include <csxhelp/cmail.hlp.hrh>
    40 #include <baclipb.h> // for clipboard copy
    40 #include <baclipb.h> // for clipboard copy
    41 
    41 
    42 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    42 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    51 #include "FreestyleEmailUi.hrh"
    51 #include "FreestyleEmailUi.hrh"
    52 #include "FreestyleEmailUiAppui.h"
    52 #include "FreestyleEmailUiAppui.h"
    53 #include "FreestyleEmailUiHtmlViewerContainer.h"
    53 #include "FreestyleEmailUiHtmlViewerContainer.h"
    54 #include "FreestyleEmailUiUtilities.h"
    54 #include "FreestyleEmailUiUtilities.h"
    55 #include "FreestyleEmailUiShortcutBinding.h"
    55 #include "FreestyleEmailUiShortcutBinding.h"
    56 #include "FreestyleEmailCenRepHandler.h"
    56 #include "freestyleemailcenrephandler.h"
    57 #include "FreestyleEmailUiAttachmentsListModel.h"
    57 #include "FreestyleEmailUiAttachmentsListModel.h"
    58 #include "FreestyleEmailUiConstants.h"
    58 #include "FreestyleEmailUiConstants.h"
    59 #include "FSEmail.pan"
    59 #include "FSEmail.pan"
    60 #include "CFSMailCommon.h"
    60 #include "cfsmailcommon.h"
    61 
    61 
    62 #include "FreestyleEmailUiMailViewerConstants.h"
    62 #include "FreestyleEmailUiMailViewerConstants.h"
    63 #include "FSDelayedLoader.h"
    63 #include "FSDelayedLoader.h"
    64 #include "FreestyleMessageHeaderURL.h"
    64 #include "FreestyleMessageHeaderURL.h"
    65 #include "FreestyleEmailUiAknStatusIndicator.h"
    65 #include "FreestyleEmailUiAknStatusIndicator.h"
   207                         }
   207                         }
   208                     break;
   208                     break;
   209                     case TBrCtlDefs::EElementAnchor:
   209                     case TBrCtlDefs::EElementAnchor:
   210                         {
   210                         {
   211                         // OPEN url in standalone browser UI
   211                         // OPEN url in standalone browser UI
   212                         /*                         HBufC* url = iContainer->BrowserControlIf()->PageInfoLC(TBrCtlDefs::EPageInfoFocusedNodeUrl);
   212                         HBufC* url = iContainer->BrowserControlIf()->PageInfoLC(TBrCtlDefs::EPageInfoFocusedNodeUrl);
   213                                                // Use scheme handler to launch the browser as a stand alone application
   213                         // Use scheme handler to launch the browser as a stand alone application
   214                                                TInt urlPos = url->Find( KUrlPrefixIdentifier );
   214                         TInt urlPos = url->Find( KUrlPrefixIdentifier );
   215                                                if( urlPos == KErrNotFound )
   215                         if( urlPos == KErrNotFound )
   216                                                    {
   216                             {
   217                                                    HBufC* newBuf = url->ReAllocL( url->Length() + KHttpUrlPrefix().Length() );
   217                             HBufC* newBuf = url->ReAllocL( url->Length() + KHttpUrlPrefix().Length() );
   218                                                    CleanupStack::Pop( url );
   218                             CleanupStack::Pop( url );
   219                                                    url = newBuf;
   219                             url = newBuf;
   220                                                    CleanupStack::PushL( url );
   220                             CleanupStack::PushL( url );
   221                                                    TPtr urlPtr = url->Des();
   221                             TPtr urlPtr = url->Des();
   222                                                    urlPtr.Insert( 0, KHttpUrlPrefix );
   222                             urlPtr.Insert( 0, KHttpUrlPrefix );
   223                                                    }
   223                             }
   224                                                CSchemeHandler* handler = CSchemeHandler::NewL( *url );
   224                         CSchemeHandler* handler = CSchemeHandler::NewL( *url );
   225                                                CleanupStack::PushL( handler );
   225                         CleanupStack::PushL( handler );
   226                                                handler->HandleUrlStandaloneL();
   226                         handler->HandleUrlStandaloneL();
   227                                                CleanupStack::PopAndDestroy( handler );
   227                         CleanupStack::PopAndDestroy( handler );
   228                                                CleanupStack::PopAndDestroy( url );                                     */
   228                         CleanupStack::PopAndDestroy( url );                                     
   229                         }
   229                         }
   230                     break;
   230                     break;
   231                     case TBrCtlDefs::EElementNone:
   231                     case TBrCtlDefs::EElementNone:
   232                     default:
   232                     default:
   233                         break;
   233                         break;
   241                 }
   241                 }
   242             break;
   242             break;
   243             case EFsEmailUiCmdActionsOpen:
   243             case EFsEmailUiCmdActionsOpen:
   244             case EFsEmailUiCmdActionsReply:
   244             case EFsEmailUiCmdActionsReply:
   245                 {
   245                 {
       
   246                 TIMESTAMP( "Reply selected from html viewer" );
   246                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   247                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   247                     {
   248                     {
   248                     TEditorLaunchParams params;
   249                     TEditorLaunchParams params;
   249 
   250 
   250                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   251                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   261                     }
   262                     }
   262                 }
   263                 }
   263             break;
   264             break;
   264             case EFsEmailUiCmdActionsReplyAll:
   265             case EFsEmailUiCmdActionsReplyAll:
   265                 {
   266                 {
       
   267                 TIMESTAMP( "Reply to all selected from html viewer" );
   266                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   268                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   267                     {
   269                     {
   268                     TEditorLaunchParams params;
   270                     TEditorLaunchParams params;
   269                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   271                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   270                     params.iMsgId = iMessage->GetMessageId();
   272                     params.iMsgId = iMessage->GetMessageId();
   280                     }
   282                     }
   281                 }
   283                 }
   282             break;
   284             break;
   283             case EFsEmailUiCmdActionsForward:
   285             case EFsEmailUiCmdActionsForward:
   284                 {
   286                 {
       
   287                 TIMESTAMP( "Forward selected from html viewer" );
   285                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   288                 if ( iMessage && !iActivationData.iEmbeddedMessageMode )
   286                     {
   289                     {
   287                     TEditorLaunchParams params;
   290                     TEditorLaunchParams params;
   288                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   291                     params.iMailboxId = iAppUi.GetActiveMailboxId();
   289                     params.iMsgId = iMessage->GetMessageId();
   292                     params.iMsgId = iMessage->GetMessageId();
   299                     }
   302                     }
   300                 }
   303                 }
   301             break;
   304             break;
   302             case EFsEmailUiCmdActionsDelete:
   305             case EFsEmailUiCmdActionsDelete:
   303                 {
   306                 {
       
   307                 TIMESTAMP( "Delete selected from html viewer" );
   304                 DeleteMailL();
   308                 DeleteMailL();
   305                 }
   309                 }
   306             break;
   310             break;
   307             case EFsEmailUiCmdZoomIn:
   311             case EFsEmailUiCmdZoomIn:
   308                 {
   312                 {
   321                 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
   325                 TFsEmailUiUtility::LaunchHelpL( KFSE_HLP_LAUNCHER_GRID );
   322                 }
   326                 }
   323             break;
   327             break;
   324             case EFsEmailUiCmdExit:
   328             case EFsEmailUiCmdExit:
   325                 {
   329                 {
       
   330                 TIMESTAMP( "Exit selected from html viewer" );
   326                 // <cmail>
   331                 // <cmail>
   327                 iContainer->PrepareForExit();
   332                 iContainer->PrepareForExit();
   328                 // </cmail>
   333                 // </cmail>
   329                 iAppUi.Exit();
   334                 iAppUi.Exit();
   330                 }
   335                 }
   404                     }
   409                     }
   405                 }
   410                 }
   406             break;
   411             break;
   407             }
   412             }
   408         }
   413         }
       
   414     TIMESTAMP( "Html viewer selected operation done" );    
   409     }
   415     }
   410 
   416 
   411 // ---------------------------------------------------------------------------
   417 // ---------------------------------------------------------------------------
   412 // Changes the MSK command depending on the focused element.
   418 // Changes the MSK command depending on the focused element.
   413 // ---------------------------------------------------------------------------
   419 // ---------------------------------------------------------------------------
   475 //
   481 //
   476 void CFsEmailUiHtmlViewerView::ChildDoActivateL( const TVwsViewId& /*aPrevViewId*/,
   482 void CFsEmailUiHtmlViewerView::ChildDoActivateL( const TVwsViewId& /*aPrevViewId*/,
   477         TUid aCustomMessageId, const TDesC8& aCustomMessage )
   483         TUid aCustomMessageId, const TDesC8& aCustomMessage )
   478     {
   484     {
   479     FUNC_LOG;
   485     FUNC_LOG;
       
   486 
       
   487     TBool msgBodyStructurePresent ( EFalse );
       
   488     TBool msgBodyContentPresent ( EFalse );
   480     
   489     
   481     if ( iMrObserverToInform && 
   490     if ( iMrObserverToInform && 
   482          aCustomMessageId == KStartViewerReturnToPreviousMsg )
   491          aCustomMessageId == KStartViewerReturnToPreviousMsg )
   483         {
   492         {
   484         // If returning from view launched by MRUI, complete the ongoing
   493         // If returning from view launched by MRUI, complete the ongoing
   586                     ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
   595                     ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
   587                     iMrUiActive = ETrue;
   596                     iMrUiActive = ETrue;
   588                     iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );  
   597                     iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );  
   589                     }                              
   598                     }                              
   590                 else
   599                 else
   591             		{
   600                     {
   592 		            iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
   601                     iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
   593 		            TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
   602                     TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
   594 		            iAttachmentsListModel->UpdateListL( msgPartData );
   603                     iAttachmentsListModel->UpdateListL( msgPartData );
   595                        
   604                        
   596             		LoadContentFromMailMessageL( iMessage, ETrue );
   605                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
   597             		}
   606                     LoadContentFromMailMessageL( iMessage, ETrue );
       
   607                     }
   598                 
   608                 
   599                 }
   609                 }
   600             else
   610             else
   601                 {
   611                 {
   602                 User::Leave( KErrNotFound );
   612                 User::Leave( KErrNotFound );
   638                 }
   648                 }
   639             else{
   649             else{
   640                 iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );         
   650                 iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );         
   641                 }                
   651                 }                
   642             
   652             
   643     
   653             CheckMessageBodyL( *iOpenMessages->Head(), msgBodyStructurePresent, msgBodyContentPresent );
   644             LoadContentFromMailMessageL( iOpenMessages->Head(), ETrue );
   654             LoadContentFromMailMessageL( iOpenMessages->Head(), ETrue );
   645             
   655             
   646             // update tool bar as some action menu boton should not appear in embbeded messages.
   656             // update tool bar as some action menu boton should not appear in embbeded messages.
   647             UpdateToolbarL();
   657             UpdateToolbarL();
   648             
   658             
   709             StartWaitedFetchingL(EMessageStructure);
   719             StartWaitedFetchingL(EMessageStructure);
   710             iFetchingAlready = ETrue;
   720             iFetchingAlready = ETrue;
   711             }
   721             }
   712         else 
   722         else 
   713             {
   723             {
   714             TBool bodypartNotFound ( EFalse );
   724             if ( msgBodyStructurePresent && !msgBodyContentPresent )
   715             if ( type == EMessagePlainTextBodyPart )
       
   716                 {
       
   717                 CFSMailMessagePart* textBodyPart = iMessage->PlainTextBodyPartL();
       
   718                 if ( textBodyPart )
       
   719                     {
       
   720                     delete textBodyPart;
       
   721                     }
       
   722                 else
       
   723                     {
       
   724                     bodypartNotFound = ETrue;
       
   725                     }                
       
   726                 }
       
   727             
       
   728             if ( bodypartNotFound )
       
   729                 {
   725                 {
   730                 iAsyncProcessComplete = EFalse;
   726                 iAsyncProcessComplete = EFalse;
   731                 iFetchingAlready = EFalse;
   727                 iFetchingAlready = EFalse;
   732                 iStartAsyncFetchType = type;
   728                 iStartAsyncFetchType = type;
   733                 if(iMessage)
   729                 if(iMessage)
   743     if ( iContainer->Rect() != ContainerRect()  )
   739     if ( iContainer->Rect() != ContainerRect()  )
   744         {
   740         {
   745         iContainer->SetRect( ContainerRect() );
   741         iContainer->SetRect( ContainerRect() );
   746         }
   742         }
   747 
   743 
   748     
   744     TIMESTAMP( "Html viewer opened" );    
   749     }
   745     }
   750 
   746 
   751 // -----------------------------------------------------------------------------
   747 // -----------------------------------------------------------------------------
   752 // CFsEmailUiHtmlViewerView::OfferToolbarEventL
   748 // CFsEmailUiHtmlViewerView::OfferToolbarEventL
   753 // -----------------------------------------------------------------------------
   749 // -----------------------------------------------------------------------------
   921 // ---------------------------------------------------------------------------
   917 // ---------------------------------------------------------------------------
   922 // Sets status bar layout
   918 // Sets status bar layout
   923 // ---------------------------------------------------------------------------
   919 // ---------------------------------------------------------------------------
   924 //
   920 //
   925 void CFsEmailUiHtmlViewerView::SetStatusBarLayout()
   921 void CFsEmailUiHtmlViewerView::SetStatusBarLayout()
   926 	{
   922     {
   927     TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
   923     TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
   928     if( Layout_Meta_Data::IsLandscapeOrientation() )
   924     if( Layout_Meta_Data::IsLandscapeOrientation() )
   929         {
   925         {
   930         // landscape must use different layout
   926         // landscape must use different layout
   931         res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
   927         res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
   934     if( StatusPane()->CurrentLayoutResId() != res )
   930     if( StatusPane()->CurrentLayoutResId() != res )
   935         {
   931         {
   936         TRAP_IGNORE(
   932         TRAP_IGNORE(
   937             StatusPane()->SwitchLayoutL( res ));
   933             StatusPane()->SwitchLayoutL( res ));
   938         }
   934         }
   939 	}
   935     }
   940 
   936 
   941 void CFsEmailUiHtmlViewerView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
   937 void CFsEmailUiHtmlViewerView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
   942     {
   938     {
   943     FUNC_LOG;
   939     FUNC_LOG;
   944 
   940 
  1251         TFSMailMsgId currentMsgId = iMessage->GetMessageId();    
  1247         TFSMailMsgId currentMsgId = iMessage->GetMessageId();    
  1252         msgIds.Append( currentMsgId );
  1248         msgIds.Append( currentMsgId );
  1253         TFSMailMsgId mailBox = iMessage->GetMailBoxId();
  1249         TFSMailMsgId mailBox = iMessage->GetMailBoxId();
  1254         TFSMailMsgId folderId = iMessage->GetFolderId();        
  1250         TFSMailMsgId folderId = iMessage->GetFolderId();        
  1255  
  1251  
  1256 		//Get the id and check if there is a previous message available 
  1252         //Get the id and check if there is a previous message available 
  1257 		TFSMailMsgId prevMsgId;
  1253         TFSMailMsgId prevMsgId;
  1258 		TFSMailMsgId prevMsgFolderId;  
  1254         TFSMailMsgId prevMsgFolderId;  
  1259 		
  1255         
  1260 		//Get the previous message if it exists
  1256         //Get the previous message if it exists
  1261 		TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId, 
  1257         TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId, 
  1262 												   prevMsgId, 
  1258                                                    prevMsgId, 
  1263                         		                   prevMsgFolderId );
  1259                                                    prevMsgFolderId );
  1264         
  1260         
  1265         //Delete the message
  1261         //Delete the message
  1266         iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
  1262         iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
  1267         CleanupStack::PopAndDestroy( &msgIds );
  1263         CleanupStack::PopAndDestroy( &msgIds );
  1268 
  1264 
  1269         // Notify appui of deleted mail item
  1265         // Notify appui of deleted mail item
  1270         SendEventToAppUiL( TFSEventMailDeleted ); 
  1266         SendEventToAppUiL( TFSEventMailDeleted ); 
  1271         
  1267         
  1272         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
  1268         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
  1273 			{	
  1269             {   
  1274 			//Open the previous message or navigate back to list viewer
  1270             //Open the previous message or navigate back to list viewer
  1275 			if ( available )
  1271             if ( available )
  1276 				{
  1272                 {
  1277 				iAppUi.MoveToPreviousMsgAfterDeleteL( prevMsgId );				
  1273                 iAppUi.MoveToPreviousMsgAfterDeleteL( prevMsgId );              
  1278 				}	
  1274                 }   
  1279 			else
  1275             else
  1280 				{
  1276                 {
  1281 				ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1277                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
  1282 				NavigateBackL();
  1278                 NavigateBackL();
  1283 				}
  1279                 }
  1284 			//inform user that mail is deleted	
  1280             //inform user that mail is deleted  
  1285 			TFsEmailUiUtility::ShowGlobalInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1281             TFsEmailUiUtility::ShowGlobalInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
  1286 			}        
  1282             }        
  1287         }
  1283         }
  1288     }
  1284     }
  1289 
  1285 
  1290 // ---------------------------------------------------------------------------
  1286 // ---------------------------------------------------------------------------
  1291 // HandleMailBoxEventL
  1287 // HandleMailBoxEventL
  1304         // <cmail> break-keyword should be used only in switch-clauses
  1300         // <cmail> break-keyword should be used only in switch-clauses
  1305         TBool cont = ETrue;
  1301         TBool cont = ETrue;
  1306 
  1302 
  1307         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
  1303         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
  1308             {
  1304             {
  1309             if ( curMsgId == ( *removedEntries )[i] )
  1305             if ( ( curMsgId == ( *removedEntries )[i] ) &&
       
  1306                     (iDeletedMessageFromMrui != curMsgId) )
  1310                 {                
  1307                 {                
  1311                 cont = EFalse;
  1308                 cont = EFalse;
       
  1309                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
       
  1310                 HandleCommandL( EAknSoftkeyBack );
  1312                 }            
  1311                 }            
  1313             } 
  1312             } 
  1314         }
  1313         }
  1315      
  1314      
  1316     if (iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && aEvent == TFSEventNewMail)
  1315     if (iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && aEvent == TFSEventNewMail)
  1428                 {
  1427                 {
  1429                 SaveEmailAsContactL( aEmailAddress );
  1428                 SaveEmailAsContactL( aEmailAddress );
  1430                 }
  1429                 }
  1431             break;
  1430             break;
  1432             case EFsEmailUiCmdActionsAddContact:
  1431             case EFsEmailUiCmdActionsAddContact:
  1433 			   {
  1432                {
  1434 			   SaveEmailAsContactL( aEmailAddress );
  1433                SaveEmailAsContactL( aEmailAddress );
  1435 			   }
  1434                }
  1436 			   break;
  1435                break;
  1437             case EFsEmailUiCmdActionsCall:
  1436             case EFsEmailUiCmdActionsCall:
  1438                 {
  1437                 {
  1439                 CallAdressL( aEmailAddress, EFalse );
  1438                 CallAdressL( aEmailAddress, EFalse );
  1440                 }
  1439                 }
  1441             break;
  1440             break;
  1453                 {
  1452                 {
  1454                 LaunchRemoteLookupL( aEmailAddress );
  1453                 LaunchRemoteLookupL( aEmailAddress );
  1455                 }
  1454                 }
  1456             break;
  1455             break;
  1457             case EFsEmailUiCmdActionsCopyToClipboard:
  1456             case EFsEmailUiCmdActionsCopyToClipboard:
  1458             	{
  1457                 {
  1459             	CopyCurrentToClipBoardL( aEmailAddress );
  1458                 CopyCurrentToClipBoardL( aEmailAddress );
  1460             	}
  1459                 }
  1461             break;
  1460             break;
  1462             default:
  1461             default:
  1463                 //nothing right now?
  1462                 //nothing right now?
  1464                 break;
  1463                 break;
  1465             }
  1464             }
  1472 //
  1471 //
  1473 void CFsEmailUiHtmlViewerView::HandleWebAddressCommandL( TInt aCommand, const TDesC& aUrl )
  1472 void CFsEmailUiHtmlViewerView::HandleWebAddressCommandL( TInt aCommand, const TDesC& aUrl )
  1474     {
  1473     {
  1475     FUNC_LOG;
  1474     FUNC_LOG;
  1476     switch ( aCommand )
  1475     switch ( aCommand )
  1477     	{
  1476         {
  1478     	case EFsEmailUiCmdActionsOpenWeb:
  1477         case EFsEmailUiCmdActionsOpenWeb:
  1479     		{
  1478             {
  1480     		OpenLinkInBrowserL( aUrl );
  1479             OpenLinkInBrowserL( aUrl );
  1481     		break;
  1480             break;
  1482     		}
  1481             }
  1483 		case EFsEmailUiCmdActionsAddBookmark:
  1482         case EFsEmailUiCmdActionsAddBookmark:
  1484 			{
  1483             {
  1485 			SaveWebAddressToFavouritesL( aUrl );
  1484             SaveWebAddressToFavouritesL( aUrl );
  1486 			break;
  1485             break;
  1487 			}
  1486             }
  1488 		case EFsEmailUiCmdActionsCopyWWWAddressToClipboard:
  1487         case EFsEmailUiCmdActionsCopyWWWAddressToClipboard:
  1489 			{
  1488             {
  1490 			CopyCurrentToClipBoardL( aUrl );
  1489             CopyCurrentToClipBoardL( aUrl );
  1491 			break;
  1490             break;
  1492 			}    				
  1491             }                   
  1493     	}
  1492         }
  1494     }
  1493     }
  1495 
  1494 
  1496 void CFsEmailUiHtmlViewerView::SaveEmailAsContactL(
  1495 void CFsEmailUiHtmlViewerView::SaveEmailAsContactL(
  1497     const TDesC& aEmailAddress )
  1496     const TDesC& aEmailAddress )
  1498     {
  1497     {
  1730     }
  1729     }
  1731 
  1730 
  1732 TBool CFsEmailUiHtmlViewerView::IsEmbeddedMsgSavingAllowed()
  1731 TBool CFsEmailUiHtmlViewerView::IsEmbeddedMsgSavingAllowed()
  1733     {
  1732     {
  1734     return iMailBox->HasCapability( 
  1733     return iMailBox->HasCapability( 
  1735 				EFSMboxCapaSupportsSavingOfEmbeddedMessages );
  1734                 EFSMboxCapaSupportsSavingOfEmbeddedMessages );
  1736     }
  1735     }
  1737 
  1736 
  1738 void CFsEmailUiHtmlViewerView::UpdateDownloadIndicatorL( 
  1737 void CFsEmailUiHtmlViewerView::UpdateDownloadIndicatorL( 
  1739         const TPartData& aPart, 
  1738         const TPartData& aPart, 
  1740         const TFSProgress& aEvent )
  1739         const TFSProgress& aEvent )
  1882         }
  1881         }
  1883     }
  1882     }
  1884 void CFsEmailUiHtmlViewerView::SendEventToAppUiL( TFSMailEvent aEventType )
  1883 void CFsEmailUiHtmlViewerView::SendEventToAppUiL( TFSMailEvent aEventType )
  1885     {
  1884     {
  1886     if ( iMessage )
  1885     if ( iMessage )
  1887     	{
  1886         {
  1888 		RArray<TFSMailMsgId> msgIdArray;
  1887         RArray<TFSMailMsgId> msgIdArray;
  1889 		CleanupClosePushL( msgIdArray );
  1888         CleanupClosePushL( msgIdArray );
  1890 		msgIdArray.AppendL( iMessage->GetMessageId() );
  1889         msgIdArray.AppendL( iMessage->GetMessageId() );
  1891 		TFSMailMsgId folderId = iMessage->GetFolderId();
  1890         TFSMailMsgId folderId = iMessage->GetFolderId();
  1892 		iAppUi.EventL( aEventType,
  1891         iAppUi.EventL( aEventType,
  1893 					   iAppUi.GetActiveMailboxId(),
  1892                        iAppUi.GetActiveMailboxId(),
  1894 					   &msgIdArray, &folderId, NULL );
  1893                        &msgIdArray, &folderId, NULL );
  1895 		CleanupStack::PopAndDestroy( &msgIdArray );
  1894         CleanupStack::PopAndDestroy( &msgIdArray );
  1896     	}
  1895         }
  1897     }
  1896     }
  1898 // -----------------------------------------------------------------------------
  1897 // -----------------------------------------------------------------------------
  1899 // CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL
  1898 // CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL
  1900 // -----------------------------------------------------------------------------
  1899 // -----------------------------------------------------------------------------
  1901 void CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL(
  1900 void CFsEmailUiHtmlViewerView::ChangeMsgReadStatusL(
  2311         {
  2310         {
  2312     
  2311     
  2313         if (  iContainer )
  2312         if (  iContainer )
  2314             {
  2313             {
  2315             iContainer->ResetContent();                
  2314             iContainer->ResetContent();                
  2316 			if( iMessage )
  2315             if( iMessage )
  2317 				{
  2316                 {
  2318 				LoadContentFromMailMessageL( iMessage , EFalse);  
  2317                 LoadContentFromMailMessageL( iMessage , EFalse);  
  2319 				SetMskL();
  2318                 SetMskL();
  2320 				}
  2319                 }
  2321             }
  2320             }
  2322         }
  2321         }
  2323             
  2322             
  2324     
  2323     
  2325     if(iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed)
  2324     if(iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed)
  3008 void CFsEmailUiHtmlViewerView::UpdateEmailHeaderIndicators()
  3007 void CFsEmailUiHtmlViewerView::UpdateEmailHeaderIndicators()
  3009     {
  3008     {
  3010     FUNC_LOG;
  3009     FUNC_LOG;
  3011     // Reload mail header.
  3010     // Reload mail header.
  3012     if ( iContainer )
  3011     if ( iContainer )
  3013     	{
  3012         {
  3014     	iContainer->RefreshCurrentMailHeader();
  3013         iContainer->RefreshCurrentMailHeader();
  3015     	}
  3014         }
  3016     }
  3015     }
  3017 
  3016 
  3018 // -----------------------------------------------------------------------------
  3017 // -----------------------------------------------------------------------------
  3019 // CFsEmailUiHtmlViewerView::IsOpenedInMRViewerL
  3018 // CFsEmailUiHtmlViewerView::IsOpenedInMRViewerL
  3020 // ---------------------------------------------------------------------------
  3019 // ---------------------------------------------------------------------------
  3048 
  3047 
  3049 // -----------------------------------------------------------------------------
  3048 // -----------------------------------------------------------------------------
  3050 // CFsEmailUiHtmlViewerView::CopyToClipBoardL
  3049 // CFsEmailUiHtmlViewerView::CopyToClipBoardL
  3051 // -----------------------------------------------------------------------------
  3050 // -----------------------------------------------------------------------------
  3052 void CFsEmailUiHtmlViewerView::CopyCurrentToClipBoardL( const TDesC& aArgument ) const
  3051 void CFsEmailUiHtmlViewerView::CopyCurrentToClipBoardL( const TDesC& aArgument ) const
  3053 	{
  3052     {
  3054     FUNC_LOG;
  3053     FUNC_LOG;
  3055     
  3054     
  3056     // Making sure that we are copying something to the clipboard 
  3055     // Making sure that we are copying something to the clipboard 
  3057     if ( aArgument.Length() > 0 )
  3056     if ( aArgument.Length() > 0 )
  3058         {
  3057         {
  3059         HBufC* clipBoardText = aArgument.AllocLC();
  3058         HBufC* clipBoardText = aArgument.AllocLC();
  3060         CClipboard* cb = CClipboard::NewForWritingLC( CCoeEnv::Static()->FsSession() );
  3059         CClipboard* cb = CClipboard::NewForWritingLC( CCoeEnv::Static()->FsSession() );
  3061 		cb->StreamDictionary().At( KClipboardUidTypePlainText );
  3060         cb->StreamDictionary().At( KClipboardUidTypePlainText );
  3062 		CPlainText* plainText = CPlainText::NewL();
  3061         CPlainText* plainText = CPlainText::NewL();
  3063 		CleanupStack::PushL( plainText );
  3062         CleanupStack::PushL( plainText );
  3064 		plainText->InsertL( 0 , *clipBoardText );
  3063         plainText->InsertL( 0 , *clipBoardText );
  3065 		plainText->CopyToStoreL( cb->Store(), cb->StreamDictionary(), 0, plainText->DocumentLength() );
  3064         plainText->CopyToStoreL( cb->Store(), cb->StreamDictionary(), 0, plainText->DocumentLength() );
  3066 		CleanupStack::PopAndDestroy( plainText );
  3065         CleanupStack::PopAndDestroy( plainText );
  3067 		cb->CommitL();
  3066         cb->CommitL();
  3068 		CleanupStack::PopAndDestroy( cb );
  3067         CleanupStack::PopAndDestroy( cb );
  3069 		CleanupStack::PopAndDestroy( clipBoardText );     
  3068         CleanupStack::PopAndDestroy( clipBoardText );     
  3070         }
  3069         }
  3071 	}
  3070     }
  3072 
  3071 
  3073 // --------------------------------------------------------------------------------
  3072 // --------------------------------------------------------------------------------
  3074 // CFsEmailUiHtmlViewerView::OpenLinkInBrowserL
  3073 // CFsEmailUiHtmlViewerView::OpenLinkInBrowserL
  3075 // --------------------------------------------------------------------------------
  3074 // --------------------------------------------------------------------------------
  3076 void CFsEmailUiHtmlViewerView::OpenLinkInBrowserL( const TDesC& aUrl ) const
  3075 void CFsEmailUiHtmlViewerView::OpenLinkInBrowserL( const TDesC& aUrl ) const
  3077 	{
  3076     {
  3078 	FUNC_LOG;
  3077     FUNC_LOG;
  3079 	
  3078     
  3080 	// Create session
  3079     // Create session
  3081 	RApaLsSession session;
  3080     RApaLsSession session;
  3082 	User::LeaveIfError( session.Connect() );
  3081     User::LeaveIfError( session.Connect() );
  3083 	CleanupClosePushL( session );
  3082     CleanupClosePushL( session );
  3084 	 
  3083      
  3085 	// Gets the default application UID for for the given MIME type
  3084     // Gets the default application UID for for the given MIME type
  3086 	TUid uid;
  3085     TUid uid;
  3087 	TDataType dataType( _L8( "text/html" ) );
  3086     TDataType dataType( _L8( "text/html" ) );
  3088 	session.AppForDataType( dataType, uid );
  3087     session.AppForDataType( dataType, uid );
  3089 	 
  3088      
  3090 	// Runs the default application using the dataType
  3089     // Runs the default application using the dataType
  3091 	TThreadId threadId;
  3090     TThreadId threadId;
  3092 	User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
  3091     User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
  3093 	 
  3092      
  3094 	CleanupStack::PopAndDestroy(); // session
  3093     CleanupStack::PopAndDestroy(); // session
  3095 }
  3094 }
  3096 
  3095 
  3097 // --------------------------------------------------------------------------------
  3096 // --------------------------------------------------------------------------------
  3098 // CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL
  3097 // CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL
  3099 // --------------------------------------------------------------------------------
  3098 // --------------------------------------------------------------------------------
  3100 void CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL( const TDesC& aUrl ) const
  3099 void CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL( const TDesC& aUrl ) const
  3101 	{
  3100     {
  3102 	FUNC_LOG;
  3101     FUNC_LOG;
  3103 	HBufC* url = aUrl.AllocLC();
  3102     HBufC* url = aUrl.AllocLC();
  3104 	
  3103     
  3105 	RFavouritesSession fSession;
  3104     RFavouritesSession fSession;
  3106 	User::LeaveIfError( fSession.Connect() );
  3105     User::LeaveIfError( fSession.Connect() );
  3107 	CleanupClosePushL( fSession );
  3106     CleanupClosePushL( fSession );
  3108 
  3107 
  3109 	RFavouritesDb favourites;
  3108     RFavouritesDb favourites;
  3110 	User::LeaveIfError( favourites.Open( fSession, KBrowserBookmarks ) );
  3109     User::LeaveIfError( favourites.Open( fSession, KBrowserBookmarks ) );
  3111 	CleanupClosePushL( favourites );
  3110     CleanupClosePushL( favourites );
  3112 
  3111 
  3113 	CFavouritesItem *favouritesItem = CFavouritesItem::NewLC();
  3112     CFavouritesItem *favouritesItem = CFavouritesItem::NewLC();
  3114 	favouritesItem->SetType( CFavouritesItem::EItem );
  3113     favouritesItem->SetType( CFavouritesItem::EItem );
  3115 	favouritesItem->SetUrlL( aUrl );
  3114     favouritesItem->SetUrlL( aUrl );
  3116 	// Should be less than KFavouritesMaxName ( 50 )
  3115     // Should be less than KFavouritesMaxName ( 50 )
  3117 	if ( url->Length() > KFavouritesMaxName )
  3116     if ( url->Length() > KFavouritesMaxName )
  3118 		{
  3117         {
  3119 		favouritesItem->SetNameL( url->Left( KFavouritesMaxName ) );
  3118         favouritesItem->SetNameL( url->Left( KFavouritesMaxName ) );
  3120 		}
  3119         }
  3121 	else
  3120     else
  3122 		{
  3121         {
  3123 		favouritesItem->SetNameL( *url );
  3122         favouritesItem->SetNameL( *url );
  3124 		}
  3123         }
  3125 
  3124 
  3126 	favouritesItem->SetParentFolder( KFavouritesRootUid );
  3125     favouritesItem->SetParentFolder( KFavouritesRootUid );
  3127 
  3126 
  3128 	TInt error = favourites.Add( *favouritesItem, ETrue );
  3127     TInt error = favourites.Add( *favouritesItem, ETrue );
  3129 
  3128 
  3130 	CleanupStack::PopAndDestroy( favouritesItem );
  3129     CleanupStack::PopAndDestroy( favouritesItem );
  3131 	CleanupStack::PopAndDestroy( &favourites );
  3130     CleanupStack::PopAndDestroy( &favourites );
  3132 	CleanupStack::PopAndDestroy( &fSession );
  3131     CleanupStack::PopAndDestroy( &fSession );
  3133 
  3132 
  3134 	CleanupStack::PopAndDestroy( url );
  3133     CleanupStack::PopAndDestroy( url );
  3135 	
  3134     
  3136 	if ( error == KErrNone )
  3135     if ( error == KErrNone )
  3137 		{
  3136         {
  3138 		TFsEmailUiUtility::ShowInfoNoteL(
  3137         TFsEmailUiUtility::ShowInfoNoteL(
  3139 			R_FREESTYLE_EMAIL_UI_VIEWER_BOOKMARK_ADDED, ETrue );
  3138             R_FREESTYLE_EMAIL_UI_VIEWER_BOOKMARK_ADDED, ETrue );
  3140 		}
  3139         }
  3141 	else // Error in bookmark creation, show could not complete message
  3140     else // Error in bookmark creation, show could not complete message
  3142 		{
  3141         {
  3143 		TFsEmailUiUtility::ShowErrorNoteL(
  3142         TFsEmailUiUtility::ShowErrorNoteL(
  3144 			R_FREESTYLE_EMAIL_ERROR_GENERAL_UNABLE_TO_COMPLETE, ETrue );
  3143             R_FREESTYLE_EMAIL_ERROR_GENERAL_UNABLE_TO_COMPLETE, ETrue );
  3145 		}
  3144         }
  3146 	}
  3145     }
  3147 
  3146 
  3148 /*
  3147 /*
  3149  * Delaying the fetch for MfE till the user scrolls to the bottom of 
  3148  * Delaying the fetch for MfE till the user scrolls to the bottom of 
  3150  * the message. 
  3149  * the message. 
  3151  */
  3150  */
  3172            {
  3171            {
  3173            StartFetchingMessagePartL( *iMessage, type );
  3172            StartFetchingMessagePartL( *iMessage, type );
  3174            }
  3173            }
  3175        }
  3174        }
  3176     }
  3175     }
       
  3176 
       
  3177 void CFsEmailUiHtmlViewerView::CheckMessageBodyL( CFSMailMessage& aMessage, TBool& aMessageBodyStructurePresent, TBool& aMessageBodyContentPresent)
       
  3178     {
       
  3179     CFSMailMessagePart* bodyPart = iMessage->HtmlBodyPartL();
       
  3180     if ( !bodyPart )
       
  3181         {
       
  3182         bodyPart = iMessage->PlainTextBodyPartL();
       
  3183         }
       
  3184     
       
  3185     if ( bodyPart )
       
  3186         {
       
  3187         aMessageBodyStructurePresent = ETrue;
       
  3188         CleanupStack::PushL( bodyPart );
       
  3189 
       
  3190         if ( bodyPart->FetchedContentSize() == 0 && bodyPart->ContentSize() != 0 )
       
  3191             {
       
  3192             aMessageBodyContentPresent = EFalse;
       
  3193             }
       
  3194         else
       
  3195             {
       
  3196             aMessageBodyContentPresent = ETrue;
       
  3197             }
       
  3198         
       
  3199         CleanupStack::PopAndDestroy( bodyPart );
       
  3200         }
       
  3201     else
       
  3202         {
       
  3203         aMessageBodyStructurePresent = EFalse;
       
  3204         aMessageBodyContentPresent = EFalse;
       
  3205         }
       
  3206     }
       
  3207 
  3177 //////////////////////////////////////////////////////////////////////////////////////
  3208 //////////////////////////////////////////////////////////////////////////////////////
  3178 // CLASS IMPLEMENTATION CHANGE TO FLAG DIALOG GLOBAL NOTE
  3209 // CLASS IMPLEMENTATION CHANGE TO FLAG DIALOG GLOBAL NOTE
  3179 ///////////////////////////////////////////////////////////////////////////////////
  3210 ///////////////////////////////////////////////////////////////////////////////////
  3180 CFlagSelectionNoteHandler* CFlagSelectionNoteHandler::NewL( CFsEmailUiHtmlViewerView& aViewerVisualiser )
  3211 CFlagSelectionNoteHandler* CFlagSelectionNoteHandler::NewL( CFsEmailUiHtmlViewerView& aViewerVisualiser )
  3181     {
  3212     {