Revision: 201025 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 18:19:25 +0300
branchRCL_3
changeset 22 d620048b4810
parent 20 efd4f1afd43e
child 23 dcf0eedfc1a3
Revision: 201025 Kit: 2010127
emailservices/emailframework/bwins/FSMailFrameworkU.DEF
emailservices/emailframework/commonlib/inc/CFSMailCommon.h
emailservices/emailframework/eabi/FSMailFrameworkU.DEF
emailservices/emailframework/inc/CFSMailClient.h
emailservices/emailframework/inc/CFSMailPlugin.h
emailservices/emailframework/src/CFSMailClient.cpp
emailservices/emailserver/cmailhandlerplugin/inc/cmailmailboxdetails.h
emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailmailboxdetails.cpp
emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp
emailservices/emailserver/inc/cmailmailboxdetails.h
emailservices/emailserver/inc/fsnotificationhandlerbase.h
emailservices/emailserver/inc/fsnotificationhandlermgr.h
emailservices/emailserver/inc/fsnotificationhandlermgrimpl.h
emailservices/emailserver/src/fsnotificationhandlermgrimpl.cpp
emailservices/psmruadapter/inc/CPsMruAdapter.h
emailservices/psmruadapter/src/CPsMruAdapter.cpp
emailuis/emailui/data/FreestyleEmailUi.rss
emailuis/emailui/data/html/Thumbs.db
emailuis/emailui/data/html/attachment.gif
emailuis/emailui/data/html/attachment.png
emailuis/emailui/data/html/btn_left.png
emailuis/emailui/data/html/btn_middle.png
emailuis/emailui/data/html/btn_right.png
emailuis/emailui/data/html/collapse.png
emailuis/emailui/data/html/email.html
emailuis/emailui/data/html/expand.png
emailuis/emailui/data/html/follow_up.png
emailuis/emailui/data/html/follow_up_complete.png
emailuis/emailui/data/html/header.css
emailuis/emailui/data/html/header.js
emailuis/emailui/data/html/hidden.png
emailuis/emailui/data/html/html.flag
emailuis/emailui/data/html/minus.gif
emailuis/emailui/data/html/plus.gif
emailuis/emailui/data/html/priority_high.png
emailuis/emailui/data/html/priority_low.png
emailuis/emailui/data/html/todo_high_add.png
emailuis/emailui/data/html/todo_low_add.png
emailuis/emailui/group/FreestyleEmailUi.mmp
emailuis/emailui/group/bld.inf
emailuis/emailui/inc/FreestyleEmailUiAknStatusIndicator.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h
emailuis/emailui/inc/FreestyleEmailUiViewBase.h
emailuis/emailui/inc/FreestyleMessageHeaderHTML.h
emailuis/emailui/loc/freestyleemailui.loc
emailuis/emailui/rom/freestyleemailui.iby
emailuis/emailui/sis/commonemail.pkg
emailuis/emailui/sis/commonemail_loc.pkg
emailuis/emailui/sis/commonemail_udeb.pkg
emailuis/emailui/sis/commonemail_udeb_loc.pkg
emailuis/emailui/src/FreestyleEmailUi.cpp
emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp
emailuis/emailui/src/FreestyleEmailUiAppui.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiViewBase.cpp
emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
emailuis/emailui/src/ncscomposeview.cpp
emailuis/uicomponents/inc/fstreevisualizerbase.h
emailuis/uicomponents/src/fstreevisualizerbase.cpp
ipsservices/ipssosplugin/inc/ipsplgpop3fetchoperation.h
ipsservices/ipssosplugin/inc/ipsplgsearch.h
ipsservices/ipssosplugin/inc/ipsplgsearch.inl
ipsservices/ipssosplugin/inc/ipsplgsosbaseplugin.hrh
ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp
ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp
ipsservices/ipssosplugin/src/ipsplgsearch.cpp
ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp
ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp
ipsservices/ipssossettings/src/ipssetdataapi.cpp
meetingrequest/mrgui/inc/cmrfieldcontainer.h
meetingrequest/mrgui/inc/cmrlistpane.h
meetingrequest/mrgui/mrfieldbuildercommon/bwins/esmrfieldbuildercommonu.def
meetingrequest/mrgui/mrfieldbuildercommon/eabi/esmrfieldbuildercommonu.def
meetingrequest/mrgui/mrfieldbuildercommon/group/esmrfieldbuildercommon.mmp
meetingrequest/mrgui/mrfieldbuildercommon/inc/cesmrfield.h
meetingrequest/mrgui/mrfieldbuildercommon/inc/cmrrecordinggc.h
meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrfield.cpp
meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp
meetingrequest/mrgui/mrfieldbuildercommon/src/cmrrecordinggc.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdescriptionfield.h
meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdetailedsubjectfield.h
meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerlocationfield.h
meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrmulticalenfield.h
meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrviewerattachmentfield.h
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsubjectfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmdatefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmtimefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralldayeventfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdescriptionfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdetailedsubjectfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerpriorityfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencedatefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstartdatefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstopdatefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewersyncfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewertimefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponsefield.h
meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponseitem.h
meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerattendeesfield.h
meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerfromfield.h
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerattendeesfield.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerfromfield.cpp
meetingrequest/mrgui/src/cesmrview.cpp
meetingrequest/mrgui/src/cmrfieldcontainer.cpp
meetingrequest/mrgui/src/cmrlistpane.cpp
meetingrequest/mrgui/src/cmrlistpanephysics.cpp
meetingrequest/mrguicommon/bwins/mrguicommonu.def
meetingrequest/mrguicommon/eabi/mrguicommonu.def
meetingrequest/mrguicommon/inc/cmrbutton.h
meetingrequest/mrguicommon/inc/cmrimage.h
meetingrequest/mrguicommon/inc/cmrlabel.h
meetingrequest/mrguicommon/src/cmrbutton.cpp
meetingrequest/mrguicommon/src/cmrimage.cpp
meetingrequest/mrguicommon/src/cmrlabel.cpp
--- a/emailservices/emailframework/bwins/FSMailFrameworkU.DEF	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/bwins/FSMailFrameworkU.DEF	Thu Jul 15 18:19:25 2010 +0300
@@ -28,4 +28,5 @@
 	?NewL@CFSMailClient@@SAPAV1@XZ @ 27 NONAME ; class CFSMailClient * CFSMailClient::NewL(void)
 	?AddObserverL@CFSMailClient@@QAEXAAVMFSMailEventObserver@@@Z @ 28 NONAME ; void CFSMailClient::AddObserverL(class MFSMailEventObserver &)
 	?GetMailBoxByUidLC@CFSMailClient@@QAEPAVCFSMailBox@@VTFSMailMsgId@@@Z @ 29 NONAME ; class CFSMailBox * CFSMailClient::GetMailBoxByUidLC(class TFSMailMsgId)
+	?PrepareMrDescriptionL@CFSMailClient@@UAEXABVTFSMailMsgId@@0@Z @ 30 NONAME ; void CFSMailClient::PrepareMrDescriptionL(class TFSMailMsgId const &, class TFSMailMsgId const &)
 
--- a/emailservices/emailframework/commonlib/inc/CFSMailCommon.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/commonlib/inc/CFSMailCommon.h	Thu Jul 15 18:19:25 2010 +0300
@@ -47,6 +47,7 @@
     EFSMsgFlag_OnlyToMe = 2048,          // The message was sent only to this user
     EFSMsgFlag_RemoteDeleted = 4096,     // The message has been deleted on the server
     EFSMsgFlag_HasMsgSender = 8192,      // The message has one or more senders 
+    EFSMsgFlag_BodyTruncated = 16384,    // The message body has exceeded the maximum size and was truncated 
     };
 
 /** email list sorting options */  
--- a/emailservices/emailframework/eabi/FSMailFrameworkU.DEF	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/eabi/FSMailFrameworkU.DEF	Thu Jul 15 18:19:25 2010 +0300
@@ -42,4 +42,5 @@
 	_ZTV23CFSMailBrandManagerImpl @ 41 NONAME
 	_ZTV26CFSClientAPIRequestHandler @ 42 NONAME
 	_ZN13CFSMailClient17GetMailBoxByUidLCE12TFSMailMsgId @ 43 NONAME
+	_ZN13CFSMailClient21PrepareMrDescriptionLERK12TFSMailMsgIdS2_ @ 44 NONAME
 
--- a/emailservices/emailframework/inc/CFSMailClient.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/inc/CFSMailClient.h	Thu Jul 15 18:19:25 2010 +0300
@@ -389,7 +389,15 @@
       * @param aMailboxName new name for the mailbox
       */
      IMPORT_C void SetMailboxName( const TFSMailMsgId aMailboxId, const TDesC& aMailboxName );
-
+     
+     /**
+      * Prepares and sets the MR description by converting HTML body to Plain text
+      *
+      * @param aMailboxId mailbox id
+      * @param aMessageId message id
+      */     
+     IMPORT_C virtual void PrepareMrDescriptionL( const TFSMailMsgId& aMailBoxId,
+                                                  const TFSMailMsgId& aMessageId );
 public: // from  CExtendableEmail
 
     /**
--- a/emailservices/emailframework/inc/CFSMailPlugin.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/inc/CFSMailPlugin.h	Thu Jul 15 18:19:25 2010 +0300
@@ -1019,6 +1019,16 @@
       * @param aMailboxName new name for the mailbox
       */
     virtual void SetMailboxName(const TFSMailMsgId& aMailboxId, const TDesC& aMailboxName ) = 0;
+    
+    /**
+     * Prepares and sets the MR description by converting HTML body to Plain text
+     *
+     * @param aMailboxId mailbox id
+     * @param aMessageId message id
+     */     
+    virtual void PrepareMrDescriptionL( const TFSMailMsgId& /*aMailBoxId*/,
+                                        const TFSMailMsgId& /*aMessageId*/ )
+                                        { return; };
 
 protected:
 
--- a/emailservices/emailframework/src/CFSMailClient.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailframework/src/CFSMailClient.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -553,7 +553,24 @@
 		plugin->SetMailboxName( aMailboxId, aMailboxName );
 		}
 	}
-	
+
+// -----------------------------------------------------------------------------
+// CFSMailClient::PrepareMrDescriptionL
+// -----------------------------------------------------------------------------
+EXPORT_C void CFSMailClient::PrepareMrDescriptionL(  const TFSMailMsgId& aMailBoxId,
+                                                     const TFSMailMsgId& aMessageId )
+    {
+    FUNC_LOG;
+    CFSMailMessage* message = NULL;
+    // select plugin
+    CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid( aMessageId );
+    if ( plugin )
+        {
+        // set MR description from the plugin
+        plugin->PrepareMrDescriptionL( aMailBoxId, aMessageId );
+        }  
+    }
+
 // -----------------------------------------------------------------------------
 // CFSMailClient::Close
 // -----------------------------------------------------------------------------
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailmailboxdetails.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailmailboxdetails.h	Thu Jul 15 18:19:25 2010 +0300
@@ -71,8 +71,6 @@
     // For bookkeeping
     // id of the mailbox in the message store
     TFSMailMsgId                        iMailboxId;
-    // array of message details objects
-    RPointerArray<CMailMessageDetails>  iMessageDetailsArray;
     // Data
     // mailbox name
     HBufC*                              iMailboxName;
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -483,7 +483,7 @@
                                                                *ints );
 
                 iLiwIf->PublishActiveMailboxNameL(
-				        aWidgetInstance,
+                        aWidgetInstance,
                         aRowNumber, *mailboxAndCount);
 
                 CleanupStack::PopAndDestroy(mailboxAndCount);
@@ -495,7 +495,7 @@
                 // show only mailbox name
 
                 iLiwIf->PublishActiveMailboxNameL(
-				        aWidgetInstance,
+                        aWidgetInstance,
                         aRowNumber, accountName);
                 }
             }
@@ -505,8 +505,8 @@
         // Publishing empty descriptor for rows that should not contain
         // anything on widget UI.
         iLiwIf->PublishActiveMailboxNameL( aWidgetInstance,
-		                                   aRowNumber,
-										   KNullDesC);
+                                           aRowNumber,
+                                           KNullDesC);
         }
     }
 
@@ -537,7 +537,7 @@
             CFSMailFolder* folder = MailClient().GetFolderByUidL( mailBoxId, parentFolder );
             if ( !folder )
                 {
-				UpdateEmptyMessagesL( aWidgetInstance, aRow );
+                UpdateEmptyMessagesL( aWidgetInstance, aRow );
                 return;
                 }
             CleanupStack::PushL( folder );
@@ -757,9 +757,9 @@
         {
         mailBoxId = iAccountsArray[aMailBoxNumber]->iMailboxId;
         iLiwIf->PublishMailboxIconL( aWidgetInstance,
-		                             aRowNumber,
-									 EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
-									 mailBoxId);
+                                     aRowNumber,
+                                     EMbmCmailhandlerpluginQgn_indi_cmail_drop_email_account,
+                                     mailBoxId);
         }
     else
         {
@@ -886,14 +886,12 @@
             }
         case TFSEventNewMail:
             {
-            HandleNewMailEventL( aMailbox, aParam1, aParam2 );
             SetUpdateNeeded( aMailbox );
             UpdateFullL();
             break;
             }
         case TFSEventMailDeleted:
             {
-            HandleMailDeletedEventL( aMailbox, aParam1, aParam2 );
             SetUpdateNeeded( aMailbox );
             UpdateFullL();
             break;
@@ -983,162 +981,6 @@
         }
     }
 
-// ---------------------------------------------------------
-// CMailCpsHandler::HandleNewMailEventL
-// ---------------------------------------------------------
-//
-void CMailCpsHandler::HandleNewMailEventL(
-    TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2 )
-    {
-    FUNC_LOG;
-
-    iSettings->ToggleWidgetNewMailIconL( ETrue, aMailbox );
-
-    // Basic assertions
-    if ( !aParam1 || !aParam2 )
-        {
-        User::Leave( KErrArgument );
-        }
-
-    // typecast param2
-    TFSMailMsgId* parentFolder = static_cast<TFSMailMsgId*>( aParam2 );
-
-    // Check that folder is correct
-    CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, *parentFolder );
-    if ( !folder )
-        {
-        User::Leave( KErrNotFound );
-        }
-    CleanupStack::PushL( folder );
-    if ( folder->GetFolderType() != EFSInbox )
-        {
-        CleanupStack::PopAndDestroy( folder );
-        return;
-        }
-    CleanupStack::PopAndDestroy( folder );
-
-    // typecast param1
-    RArray<TFSMailMsgId>* newEntries(
-            static_cast< RArray<TFSMailMsgId>* >( aParam1 ) );
-    CleanupClosePushL( *newEntries );
-    const TInt iiMax( newEntries->Count() );
-    if ( iiMax == 0 )
-        {
-        User::Leave( KErrArgument );
-        }
-
-    // Loop through message array
-    TFSMailMsgId msgId;
-    CFSMailMessage* msg( NULL );
-    CMailMailboxDetails* mailbox;
-    for ( TInt ii = 0; ii < iiMax; ii++ )
-        {
-        msgId = (*newEntries)[ii];
-
-        msg = MailClient().GetMessageByUidL(
-            aMailbox, *parentFolder, (*newEntries)[ii], EFSMsgDataEnvelope );
-        if ( !msg )
-            {
-            User::Leave( KErrNotFound );
-            }
-        CleanupStack::PushL( msg );
-
-        // Check if message read
-        if ( !MsgIsUnread( *msg ) )
-            {
-            // Ignore already read messages
-            CleanupStack::PopAndDestroy( msg );
-            continue;
-            }
-
-        // Find mailbox instance from array
-        mailbox = FindMailboxDetails( aMailbox );
-        if ( !mailbox )
-            {
-            CleanupStack::PopAndDestroy( msg );
-            CleanupStack::PopAndDestroy( newEntries );
-            return;
-            }
-
-        // Check if message is duplicate
-        if ( IsDuplicate( *mailbox, msgId ) )
-            {
-            // Ignore already known messages
-            CleanupStack::PopAndDestroy( msg );
-            continue;
-            }
-
-        CMailMessageDetails* messageDetails = CMailMessageDetails::NewL(
-            msg->GetMessageId(),
-            mailbox,
-            msg->GetSender()->GetEmailAddress(),
-            msg->GetSubject(),
-            msg->GetDate() );
-        CleanupStack::PopAndDestroy( msg );
-        CleanupStack::PushL( messageDetails );
-
-        // Place message to array
-        mailbox->iMessageDetailsArray.AppendL( messageDetails );
-        CleanupStack::Pop( messageDetails );
-        }
-    CleanupStack::PopAndDestroy( newEntries );
-    }
-
-// ---------------------------------------------------------
-// CMailCpsHandler::HandleMailDeletedEventL
-// ---------------------------------------------------------
-//
-void CMailCpsHandler::HandleMailDeletedEventL(
-    TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2 )
-    {
-    FUNC_LOG;
-    // Basic assertions
-    if ( !aParam1 || !aParam2 )
-        {
-        User::Leave( KErrArgument );
-        }
-    // Typecast parameters
-    RArray<TFSMailMsgId>* entries(
-            static_cast< RArray<TFSMailMsgId>* >( aParam1 ) );
-    CleanupClosePushL( *entries );
-    if ( entries->Count() == 0 )
-        {
-        User::Leave( KErrArgument );
-        }
-
-    // Find correct mailbox
-    CMailMailboxDetails* mailbox = FindMailboxDetails( aMailbox );
-    if ( !mailbox )
-        {
-        CleanupStack::PopAndDestroy( entries );
-        return;
-        }
-
-    const TInt iiMax( entries->Count() );
-    const TInt jjMax( mailbox->iMessageDetailsArray.Count() );
-    // Loop through entries in the array
-    for ( TInt ii = 0; ii < iiMax; ii++ )
-        {
-        // Loop through messages in the local cache
-        for ( TInt jj = 0; jj < jjMax; jj++ )
-            {
-            if ( mailbox->iMessageDetailsArray[jj]->iMsgId.Id() ==
-                (*entries)[ii].Id() )
-                {
-                CMailMessageDetails* details = mailbox->iMessageDetailsArray[jj];
-                delete details;
-                details = NULL;
-                mailbox->iMessageDetailsArray.Remove(jj);
-                break; // breaks out from the inner loop and starts new outer loop if necessary
-                }
-            else
-                {
-                }
-            }
-        }
-
-    CleanupStack::PopAndDestroy( entries );
-    }
 
 // ---------------------------------------------------------
 // CMailCpsHandler::GetUnreadCountL
@@ -1666,24 +1508,6 @@
     }
 
 // -----------------------------------------------------------------------------
-// CMailCpsHandler::IsDuplicate
-// -----------------------------------------------------------------------------
-TBool CMailCpsHandler::IsDuplicate( const CMailMailboxDetails& aMailbox, const TFSMailMsgId& aMsgId )
-    {
-    FUNC_LOG;
-    TBool isDuplicate( EFalse );
-    const TInt size( aMailbox.iMessageDetailsArray.Count() );
-    for ( TInt jj = 0; jj < size; jj++ )
-        {
-        if ( aMailbox.iMessageDetailsArray[jj]->iMsgId.Id() == aMsgId.Id() )
-            {
-            isDuplicate = ETrue;
-            }
-        }
-    return isDuplicate;
-    }
-
-// -----------------------------------------------------------------------------
 //  CMailCpsHandler::LaunchWidgetSettingsL()
 // -----------------------------------------------------------------------------
 //
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailmailboxdetails.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailmailboxdetails.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -55,7 +55,6 @@
     FUNC_LOG;
     delete iMailboxName;
     delete iWidgetInstance;    
-    iMessageDetailsArray.ResetAndDestroy();
     }
 
 // ---------------------------------------------------------
--- a/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -68,6 +68,7 @@
 void CFSMailSoundHandler::ConstructL()
     {
     FUNC_LOG;
+    CFSNotificationHandlerBase::ConstructL();
 
     SetObserving(ETrue);
 
--- a/emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -16,10 +16,8 @@
 */
 
 #include <centralrepository.h>
-//<cmail>
 #include "emailtrace.h"
 #include "cfsmailclient.h"
-//</cmail>
 
 #include "fsnotificationhandlermgr.h"
 #include "fsnotificationhandlerbase.h"
@@ -29,6 +27,8 @@
 #include "FreestyleEmailUiConstants.h"
 
 
+const TInt KTimerDelay = 20;
+
 // ======== MEMBER FUNCTIONS ========
 
 CFSNotificationHandlerBase::CFSNotificationHandlerBase(
@@ -42,12 +42,17 @@
 void CFSNotificationHandlerBase::ConstructL()
     {
     FUNC_LOG;
+    
+    iTimer = CNewMailNotificationTimer::NewL( *this );
     }
 
 CFSNotificationHandlerBase::~CFSNotificationHandlerBase()
     {
     FUNC_LOG;
     REComSession::DestroyedImplementation( iDestructorKey );
+    
+    delete iTimer;
+    iNewInboxEntries.Reset(); 
     }
 
 CFSMailClient& CFSNotificationHandlerBase::MailClient() const
@@ -64,16 +69,6 @@
         return;
         }   
     
-   /* TBool capabilitiesToContinue( CapabilitiesToContinueL( aEvent,
-                                                          aMailbox,
-                                                          aParam1,
-                                                          aParam2,
-                                                          aParam3) );
-    if ( !capabilitiesToContinue )
-        {
-        return;
-        }*/
-    
     HandleEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 );
     }
 
@@ -102,14 +97,20 @@
     }
 
 TBool CFSNotificationHandlerBase::MessagesCauseNotificationL( TFSMailMsgId aMailboxId,
-                                                              CFSMailFolder& aParentFolder,
+                                                              TFSMailMsgId aParentFolderId,
                                                               const RArray<TFSMailMsgId>& aMsgIdList )
     {
     FUNC_LOG;
+
+    CFSMailFolder* parentFolder(
+        MailClient().GetFolderByUidL( aMailboxId, aParentFolderId ) );
+    User::LeaveIfNull( parentFolder );
+    CleanupStack::PushL( parentFolder );
+    
     CFSMailMessage* newestMsg( NULL );
     TRAPD( notFoundError,
            newestMsg =
-               NewestMsgInFolderL( aParentFolder ) );
+               NewestMsgInFolderL( *parentFolder ) );
     if ( notFoundError == KErrNotFound )
         {
         // For some odd reason we are not able to get the newest
@@ -125,11 +126,12 @@
     delete newestMsg;
     newestMsg = NULL;
 
-    TFSMailMsgId parentFolderId( aParentFolder.GetFolderId() );
-
-    TInt index( 0 );
+    CleanupStack::PopAndDestroy( parentFolder );
+    
     const TInt entriesCount( aMsgIdList.Count() );
-    while ( index < entriesCount )
+    TInt index( entriesCount-1 );
+    // go from back of list, as messages are coming from earliest to latest..
+    while ( index >= 0 ) 
         {
         // Let's get the message. We need to check from it that
         // it is really unread. This info is stored in the
@@ -139,7 +141,7 @@
         CFSMailMessage*
             currentMessage( MailClient().GetMessageByUidL(
                 aMailboxId, 
-                parentFolderId,
+                aParentFolderId,
                 aMsgIdList[index], 
                 EFSMsgDataEnvelope ) );
         User::LeaveIfNull( currentMessage );
@@ -157,7 +159,7 @@
             return ETrue;
             }
             
-        ++index;
+        --index;
         }
     
     return EFalse;
@@ -221,33 +223,33 @@
             {
             User::Leave( KErrArgument );
             }
-        CFSMailFolder* parentFolder(
-            MailClient().GetFolderByUidL( aMailbox, *parentFolderId ) );
-        User::LeaveIfNull( parentFolder );
-        CleanupStack::PushL( parentFolder );
-        
+
         // Set the notification on only in cases that the new mail is
         // in folder of type EFSInbox
-        if ( parentFolder->GetFolderType() == EFSInbox )
+        if ( iOwner.GetFolderTypeL( aMailbox, parentFolderId ) == EFSInbox )
             {
-            
             RArray<TFSMailMsgId>* newEntries(
                 static_cast< RArray<TFSMailMsgId>* >( aParam1 ) );
 
-            if ( MessagesCauseNotificationL(
-                     aMailbox,
-                     *parentFolder,
-                     *newEntries ) )
+            TInt count = newEntries->Count();
+            for ( TInt i = 0; i<count;i++ )
                 {
-                TurnNotificationOn();
+                TFSMailMsgId msgId = newEntries->operator []( i );
+                TNewMailInfo info( msgId, aMailbox, *parentFolderId ); 
+                iNewInboxEntries.AppendL( info );
                 }
+
+            if (iTimer->IsActive() )
+                {
+                iTimer->Cancel();
+                }
+            iTimer->After( KTimerDelay );
             }
          else
             {
             // If messages are in some other folder than in inbox
             // they have no effect on the notification
             }
-        CleanupStack::PopAndDestroy( parentFolder );
         }
     else
         {
@@ -257,9 +259,51 @@
         }
     }
 
+void CFSNotificationHandlerBase::TimerExpiredL()
+    {
+    // process collected insert requests
+    RArray<TFSMailMsgId> msgIds;
+    TFSMailMsgId mailBoxId;
+    TFSMailMsgId parentFolderId;
+    for ( TInt i = 0; i< iNewInboxEntries.Count(); i++ )
+        {
+        TNewMailInfo& info = iNewInboxEntries[ i ];
+        if ( mailBoxId.IsNullId() && parentFolderId.IsNullId() )
+            {
+            // starting new group is starting to collect
+            mailBoxId = info.iMailBox;
+            parentFolderId = info.iParentFolderId;
+            }
+        if ( mailBoxId == info.iMailBox && parentFolderId == info.iParentFolderId )
+            {
+            // collect message ids for the same mailbox and parent folder
+            msgIds.Append( info.iMsgId );
+            }
+        else
+            {
+            // process collected message ids for the same mailbox and parent folder
+            if ( msgIds.Count()&& MessagesCauseNotificationL( mailBoxId, parentFolderId, msgIds ) )
+                {
+                TurnNotificationOn();
+                }
+            // clear data and start collecting again
+            msgIds.Reset();
+            mailBoxId = TFSMailMsgId();
+            parentFolderId = TFSMailMsgId();
+            }
+        }
+    // process collected message ids for the same mailbox and parent folder
+    if ( msgIds.Count() && MessagesCauseNotificationL( mailBoxId, parentFolderId, msgIds ) )
+        {
+        TurnNotificationOn();
+        }
+    // clear processed entries
+    msgIds.Reset();
+    iNewInboxEntries.Reset();    
+    }
 
 CFSMailMessage* CFSNotificationHandlerBase::NewestMsgInFolderL(
-    /*const*/ CFSMailFolder& aFolder ) const
+    CFSMailFolder& aFolder ) const
     {
     FUNC_LOG;
     // Load info only necessary for sorting by date into the messages.
@@ -273,11 +317,11 @@
     RArray<TFSMailSortCriteria> sorting;
     CleanupClosePushL( sorting );
     // First criteria appended would be the primary criteria
-    // but here we don't have any other criterias
+    // but here we don't have any other criteria
     sorting.Append( criteriaDate );
     MFSMailIterator* iterator = aFolder.ListMessagesL( details, sorting );
     
-    // Resetting array of sort criterias already here because
+    // Resetting array of sort criteria already here because
     // the iterator does not need it anymore.
     CleanupStack::PopAndDestroy(); // sorting
                                     
@@ -303,6 +347,52 @@
     return outcome;
     }
 
+CNewMailNotificationTimer::CNewMailNotificationTimer( MFSTimerObserver& aObserver ) :
+    CTimer( EPriorityIdle ), iObserver( aObserver )
+    {
+    FUNC_LOG;
+    }
+
+void CNewMailNotificationTimer::ConstructL()
+    {
+    FUNC_LOG;
+    CTimer::ConstructL();
+    CActiveScheduler::Add( this );
+    }
+
+CNewMailNotificationTimer* CNewMailNotificationTimer::NewL(
+        MFSTimerObserver& aObserver )
+    {
+    FUNC_LOG;
+    CNewMailNotificationTimer* self =
+        new( ELeave ) CNewMailNotificationTimer( aObserver );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+
+CNewMailNotificationTimer::~CNewMailNotificationTimer()
+    {
+    FUNC_LOG;
+    Cancel();
+    }
+
+void CNewMailNotificationTimer::DoCancel()
+    {
+    FUNC_LOG;
+    // Cancel Base class
+    CTimer::DoCancel(); 
+    }
+
+void CNewMailNotificationTimer::RunL()
+    {
+    FUNC_LOG;
+    iObserver.TimerExpiredL();
+    }
+
+
 void Panic( TCmailhandlerPanic aPanic )
     {
     _LIT( KPanicText, "emailhandlerplugin" );
--- a/emailservices/emailserver/inc/cmailmailboxdetails.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/inc/cmailmailboxdetails.h	Thu Jul 15 18:19:25 2010 +0300
@@ -61,8 +61,6 @@
     // For bookkeeping
     // id of the mailbox in the message store
     TFSMailMsgId iMailboxId;
-    // array of message details objects
-    RPointerArray<CMailMessageDetails> iMessageDetailsArray;
     // Data
     // mailbox name
     HBufC*       iMailboxName;
--- a/emailservices/emailserver/inc/fsnotificationhandlerbase.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/inc/fsnotificationhandlerbase.h	Thu Jul 15 18:19:25 2010 +0300
@@ -29,8 +29,78 @@
 class CFSMailMessage;
 class MFSNotificationHandlerMgr;
 class CFSNotificationHandlerHSConnection;
+class TFSMailMsgId;
 
 
+class TNewMailInfo
+    {
+public:
+    inline TNewMailInfo( TFSMailMsgId aMsgId, 
+                         TFSMailMsgId aMailBoxId,
+                         TFSMailMsgId aParentFolderId) 
+    : iMsgId( aMsgId ), iMailBox( aMailBoxId ), iParentFolderId( aParentFolderId)
+    { }
+    
+    TFSMailMsgId iMsgId;
+    TFSMailMsgId iMailBox;
+    TFSMailMsgId iParentFolderId;
+    };
+
+class MFSTimerObserver
+    {
+    public:
+
+    /**
+     * TODO document me
+     */
+     virtual void TimerExpiredL() = 0;
+
+     };
+
+class CNewMailNotificationTimer : public CTimer
+    {
+public:
+
+    static CNewMailNotificationTimer* NewL(
+            MFSTimerObserver& aObserver );
+    static CNewMailNotificationTimer* NewLC(
+            MFSTimerObserver& aObserver );
+
+    /**
+     * Destructor.
+     */
+    virtual ~CNewMailNotificationTimer();
+
+
+protected:
+  
+    /**
+     * Constructor.
+     *
+     * @since S60 ?S60_version
+     * @param aObserver Observer of this timer.
+     */ 
+    CNewMailNotificationTimer(
+            MFSTimerObserver& aObserver );
+    void ConstructL();
+
+// from base class CActive
+    virtual void DoCancel();
+    virtual void RunL();
+
+private:
+
+
+            
+private: // data
+
+    /**
+     * Observer and user of this timer.
+     */    
+    MFSTimerObserver& iObserver;
+
+    };
+
 /**
  *  A base class for notification handlers that need timer services.
  *
@@ -41,7 +111,7 @@
  *  @lib ?library
  *  @since S60 ?S60_version *** for example, S60 v3.0
  */
-class CFSNotificationHandlerBase : public CBase, public MFSMailEventObserver
+class CFSNotificationHandlerBase : public CBase, public MFSMailEventObserver, public MFSTimerObserver
     {
 public:
     
@@ -133,7 +203,7 @@
     *         messages was found among the identified messages.
     */
     virtual TBool MessagesCauseNotificationL( TFSMailMsgId aMailboxId,
-                                              CFSMailFolder& aParentFolder,
+                                              TFSMailMsgId aParentFolderId,
                                               const RArray<TFSMailMsgId>& aMsgIdList );
     
 
@@ -234,6 +304,9 @@
      */  
     virtual void TurnNotificationOff() = 0;
     
+// from TODO
+    virtual void TimerExpiredL();
+    
 protected: // data
 
     /**
@@ -253,6 +326,10 @@
     
     // Destructor key for the ECOM plugin
     TUid                               iDestructorKey;
+    
+    RArray<TNewMailInfo> iNewInboxEntries;
+    
+    CNewMailNotificationTimer* iTimer;
     };
 
 #include "fsnotificationhandlerbase.inl"
--- a/emailservices/emailserver/inc/fsnotificationhandlermgr.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/inc/fsnotificationhandlermgr.h	Thu Jul 15 18:19:25 2010 +0300
@@ -73,7 +73,6 @@
      */     
     virtual CFSNotificationHandlerHSConnection* HSConnection() const = 0;
 
-    //<cmail>
     virtual void MessageQueryL( TDesC& aMailboxName,
                                 TRequestStatus& aStatus,
                                 const TDesC& aCustomMessageText,
@@ -82,7 +81,12 @@
     virtual TInt AuthenticateL( TDes& aPassword,
                                 TDesC& aMailboxName, 
                                 TRequestStatus& aStatus ) = 0;
-    //</cmail>
+
+    /**
+     * Gets cached folder type
+     * @param TODO SK 
+     */
+    virtual TFSFolderType GetFolderTypeL( TFSMailMsgId& aMailbox, TFSMailMsgId* parentFolderId ) = 0;
 
     /**
      * Increases the active dialog count.
@@ -118,7 +122,6 @@
     //</cmail>
 
 protected:
-
     };
 
 
--- a/emailservices/emailserver/inc/fsnotificationhandlermgrimpl.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/inc/fsnotificationhandlermgrimpl.h	Thu Jul 15 18:19:25 2010 +0300
@@ -99,7 +99,11 @@
     virtual TInt AuthenticateL( TDes& aPassword,
                                 TDesC& aMailboxName,
                                 TRequestStatus& aStatus  );
-    //</cmail>
+
+    /**
+     * @see MFSNotificationHandlerMgr::GetFolderType
+     */
+    virtual TFSFolderType GetFolderTypeL( TFSMailMsgId& aMailbox, TFSMailMsgId* parentFolderId );
 
     /**
      * @see MFSNotificationHandlerMgr::IncreaseDialogCount
@@ -171,7 +175,7 @@
     */
     void CreateAndStoreHandlerL( TInt aImplementationUid );
 
-	void CleanTempFilesIfNeededL();
+    void CleanTempFilesIfNeededL();
 
 private: // data
 
@@ -209,6 +213,10 @@
      */
     TInt iDialogCount;
 
+    // for caching of parent folder type
+    TFSMailMsgId  iPreviousMailbox;
+    TFSMailMsgId  iPreviousParentFolderId;
+    TFSFolderType iPreviousParentFolderType;
     };
 
 #endif // C_FSNOTIFICATIONHANDLERMGRIMPL_H
--- a/emailservices/emailserver/src/fsnotificationhandlermgrimpl.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/emailserver/src/fsnotificationhandlermgrimpl.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -70,7 +70,7 @@
     }
 
 // ---------------------------------------------------------------------------
-// Finishes the initialisation
+// Finishes the initialization
 // ---------------------------------------------------------------------------
 //
 void CFSNotificationHandlerMgr::RunL()
@@ -189,15 +189,13 @@
 
     iHSConnection = NULL;
 
-	if( iMailClient )
-		{
+    if( iMailClient )
+        {
         iMailClient->Close();
         iMailClient = NULL;
-		}
+        }
 
-	//<cmail>
-	iAppUi = NULL;
-	//</cmail>
+    iAppUi = NULL;
 
     // Finished using ECom
     // ECom used at least in CFSMailHSUpdateHandler
@@ -231,8 +229,11 @@
             }
         case TFSEventMailboxDeleted:
             {
-            // Don't have to do anything here. Observing has ended when the
-            // mailbox is deleted.
+            // Observing has ended when the mailbox is deleted.
+
+            // reset mailbox cached values
+            iPreviousParentFolderId = TFSMailMsgId();
+            iPreviousMailbox = TFSMailMsgId();
             break;
             }
         case TFSMailboxAvailable: // Flow through
@@ -243,13 +244,13 @@
             }
         case TFSEventNewMail:
             {
-            // If this is a preinstalled version and we receive a new mail we
+            // If this is a pre-installed version and we receive a new mail we
             // update the current status of the HS here before passing
             // the events to handlers so they don't have to do it. If they
             // do it, it is done several times which is not desired.
             // The drawback is that by doing it here we might also do it
             // in situations where the handlers would actually not need it.
-            // Possibly the best solution would be to initialise the
+            // Possibly the best solution would be to initialize the
             // iHSConnection once and then let it observe for changes in
             // central repository. Currently that solution is not implemented
             // as it would require more time to implement.
@@ -269,7 +270,7 @@
         {
         // Event is passed to each handler. If one fails the
         // event is still passed to others as they are not
-        // necessarily dependant on the same services. This way
+        // necessarily dependent on the same services. This way
         // If one fails the others can still succeed.
         TRAP_IGNORE(
             iHandlers[handlerIndex]->EventL( aEvent,
@@ -339,6 +340,37 @@
     return err;
     }
 
+
+TFSFolderType CFSNotificationHandlerMgr::GetFolderTypeL( TFSMailMsgId& aMailbox, TFSMailMsgId* parentFolderId )
+    {
+    TFSFolderType folderType( EFSInbox );
+    if ( parentFolderId )
+        {
+        if ( (*parentFolderId) == iPreviousParentFolderId && 
+             aMailbox == iPreviousMailbox )
+            {
+            // we assume that folder with some id does not change 
+            // its type during mail synchronization
+            folderType = iPreviousParentFolderType;
+            }
+        else
+            {
+            iPreviousParentFolderId = (*parentFolderId);
+            // Get the parent folder object
+            CFSMailFolder* parentFolder = iMailClient->GetFolderByUidL(
+                    aMailbox, *parentFolderId );
+            if ( parentFolder )
+                {
+                folderType = parentFolder->GetFolderType();
+                iPreviousParentFolderType = folderType;
+                delete parentFolder;
+                parentFolder = NULL;
+                }
+            }
+        }
+    
+    return folderType;
+    }
 // ---------------------------------------------------------------------------
 //
 // ---------------------------------------------------------------------------
@@ -419,7 +451,7 @@
 // ---------------------------------------------------------------------------
 //
 void CFSNotificationHandlerMgr::CleanTempFilesIfNeededL()
-	{
+    {
     FUNC_LOG;
     RFs fsSession;
     User::LeaveIfError(fsSession.Connect());
@@ -427,19 +459,19 @@
     // Check whether disk space is below 3MB, in that case start cleaning up
     // downloaded attachments from mailboxes.
     if ( SysUtil::DiskSpaceBelowCriticalLevelL( &fsSession, 3*KMegaByte, EDriveC ) )
-    	{
-	    RPointerArray<CFSMailBox> mailBoxList;
-	    // Null id given as a plugin id. mailboxes of all plugins retrieved.
-	    // Notice that ownership of the mailboxes is not passed to here.
-	    iMailClient->ListMailBoxes( TFSMailMsgId(), mailBoxList );
-		for ( TInt i = 0 ; i < mailBoxList.Count() ; ++i )
-		    {
-			TRAP_IGNORE( mailBoxList[i]->RemoveDownLoadedAttachmentsL() );
-		    }
-	    mailBoxList.ResetAndDestroy();
- 	    }
+        {
+        RPointerArray<CFSMailBox> mailBoxList;
+        // Null id given as a plugin id. mailboxes of all plugins retrieved.
+        // Notice that ownership of the mailboxes is not passed to here.
+        iMailClient->ListMailBoxes( TFSMailMsgId(), mailBoxList );
+        for ( TInt i = 0 ; i < mailBoxList.Count() ; ++i )
+            {
+            TRAP_IGNORE( mailBoxList[i]->RemoveDownLoadedAttachmentsL() );
+            }
+        mailBoxList.ResetAndDestroy();
+        }
     CleanupStack::PopAndDestroy( &fsSession );
-	}
+    }
 
 
 //<cmail>
--- a/emailservices/psmruadapter/inc/CPsMruAdapter.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/psmruadapter/inc/CPsMruAdapter.h	Thu Jul 15 18:19:25 2010 +0300
@@ -111,7 +111,7 @@
          */
         void DeleayMailboxCreationEventL( TFSMailMsgId &aMailbox );
         
-	private:
+    private:
 
         /**
          * Constructor
@@ -126,18 +126,18 @@
         
         /**
          * Updates given data store
-         */  	    
+         */         
         TBool FillDataStoreL( TDesC& aDataStoreURI );
         
         /**
          * Updates given data store
-         */  	    	    
+         */                 
         TBool FillDataStoreL( TFSMailMsgId& aId );
         
         /**
          * Updates a list of supported data stores
-         */  	    
-        void UpdateSupportedDataStoresList();	    
+         */         
+        void UpdateSupportedDataStoresList();       
         
         /**
          * Starts observing mailbox
@@ -166,12 +166,12 @@
         
         /**
         * Updates given data store
-        */  	    	    
-        TBool FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI );	    
+        */                  
+        TBool FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI );        
         
         /**
         * Calls MDataStoreObserver::AddData for every mru email - used for trapping 
-        */  	    	    
+        */                  
         void AddMruEmailsL( MDesCArray* aMruList, TDesC& aDataStoreURI );
 
     private: // data
@@ -185,12 +185,12 @@
         /**
         * An observer instance used to send the datastore to the adapter
         */
-        MStoreListObserver* iStoreListObserver;		
-        	
+        MStoreListObserver* iStoreListObserver;     
+            
         /**
         * Supported Uris(data stores)
         */
-        RPointerArray<HBufC> iSupportedUris;	
+        RPointerArray<HBufC> iSupportedUris;    
         
         /**
          * List of mailboxes currently being observed
@@ -212,6 +212,10 @@
         */
         RArray<TFSMailMsgId> iDelayedCreatedMailboxes;
 
+        TFSMailMsgId  iPreviousMailboxId; 
+        TFSMailMsgId  iPreviousParentFolderId; // not owned
+        /* folder type for a mailbox referenced by iPreviousMailbox and iPreviousParentFolderId */
+        TFSFolderType iPreviousParentFolderType; 
     }; // class CPsMruAdapter
 
 //-----------------------------------------------------------------------------
@@ -236,7 +240,7 @@
         // d-tor
         virtual ~CDelayMailboxCreationHelper();
         // Start timer to call CPsMruAdapter::DeleayedMailboxCreationEventL by RunL 
-        void StartDelayedCall();	
+        void StartDelayedCall();    
     protected:
         // on timer event - calls CPsMruAdapter::DeleayedMailboxCreationEventL
         virtual void RunL();
--- a/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -17,6 +17,7 @@
 
 
 
+
 #include <CPsData.h>
 #include <CPcsDefs.h>
 #include <coemain.h>
@@ -53,7 +54,7 @@
     
     // Get the PsData plugin parametrs
     TPsDataPluginParams* params =
-    		reinterpret_cast<TPsDataPluginParams*>(aPsDataPluginParameters );
+            reinterpret_cast<TPsDataPluginParams*>(aPsDataPluginParameters );
     CPsMruAdapter* self = new ( ELeave ) CPsMruAdapter();
     CleanupStack::PushL(self);
     self->ConstructL( params->iDataStoreObserver, params->iStoreListObserver );
@@ -83,7 +84,7 @@
 void CPsMruAdapter::ConstructL( MDataStoreObserver* aObserverForDataStore,
         MStoreListObserver* aStoreListObserver )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     PRINT ( _L( "Enter CPsMruAdapter::ConstructL" ) );
 
     // Mail client for FS Email framework
@@ -109,7 +110,7 @@
 // ----------------------------------------------------------------------------
 CPsMruAdapter::~CPsMruAdapter()
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     PRINT ( _L( "Enter CPsMruAdapter::~CPsMruAdapter" ) );
 
     iSupportedUris.ResetAndDestroy();
@@ -140,8 +141,8 @@
 // 
 // ----------------------------------------------------------------------------
 void CPsMruAdapter::RequestForDataL( TDesC& aDataStoreURI )
-	{
-    FUNC_LOG;	
+    {
+    FUNC_LOG;   
     PRINT ( _L( "Enter CPsMruAdapter::RequestForDataL" ) );
 
     // Add data to datastore, fill only requested one
@@ -158,7 +159,7 @@
 void CPsMruAdapter::GetSupportedDataStoresL(
         RPointerArray<TDesC> &aDataStoresURIs )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
         {
         aDataStoresURIs.Append( iSupportedUris[i] );
@@ -171,7 +172,7 @@
 // ----------------------------------------------------------------------------
 TAny* CPsMruAdapter::RequestForDataExtensionL(TInt /*aItemId*/)
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     // No extention required for this since we have and interger as itemId
     // Simply return NULL
     return NULL;
@@ -183,7 +184,7 @@
 // ----------------------------------------------------------------------------
 void CPsMruAdapter::UpdateSupportedDataStoresList()
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     // Mailboxes will be fetched to this array
     RPointerArray<CFSMailBox> mailBoxes;
 
@@ -222,7 +223,7 @@
 // ----------------------------------------------------------------------------
 TBool CPsMruAdapter::FillDataStoreL( TDesC& aDataStoreURI )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     TBool result = EFalse;
 
     TFSMailMsgId dataStoreId;
@@ -237,7 +238,7 @@
 
 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     TBool result = EFalse;
 
     // Create Uri for this mailbox
@@ -252,7 +253,7 @@
 
 void CPsMruAdapter::AddMruEmailsL( MDesCArray* aMruList, TDesC& aDataStoreURI )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     TInt entryIndex = 0;
     // Add all data to data store, the format is:
     // index0: displayname
@@ -281,18 +282,20 @@
 
 TBool CPsMruAdapter::FillDataStoreL( TFSMailMsgId& aId, TDesC& aDataStoreURI )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     TBool result = EFalse;
 // code was simplified not to trace all mailboxes
 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
 // should not leave when new mailbox only when new mail address
+// TODO SK how to avoid extra calls?    
     CFSMailBox *mailBox = iMailClient->GetMailBoxByUidLC(aId);
     if( mailBox )
         {
         AddMailboxObserverL( aId );
         
         // Get MRU list for this mailbox
-        MDesCArray* mruList = mailBox->ListMrusL();
+        MDesCArray* mruList = mailBox->ListMrusL(); // TODO SK this value can be cached?
+        //TODO add to cleanup stack?
         
         // update the caching status as InProgress
         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
@@ -327,7 +330,7 @@
 // ----------------------------------------------------------------------------
 TBool CPsMruAdapter::IsDataStoresSupportedL( TDesC& aDataStoreURI )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     for ( TInt i = 0; i < iSupportedUris.Count(); i++ )
         {
         if ( iSupportedUris[i]->Compare( aDataStoreURI ) == 0 )
@@ -342,7 +345,7 @@
 // ----------------------------------------------------------------------------
 void CPsMruAdapter::GetSupportedDataFieldsL( RArray<TInt>& aDataFields )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     aDataFields.Append( R_VPBK_FIELD_TYPE_FIRSTNAME );
     aDataFields.Append( R_VPBK_FIELD_TYPE_LASTNAME );
     aDataFields.Append( R_VPBK_FIELD_TYPE_EMAILGEN );
@@ -350,7 +353,7 @@
 
 TBool CPsMruAdapter::GetMailboxIdentifierFromUri( TDesC& aUri, TFSMailMsgId& aId )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     // Find first separator in reverse order
     TInt lastSeparator = aUri.LocateReverseF( KDefaultMailBoxURISeparator );
     if ( lastSeparator == KErrNotFound )
@@ -392,7 +395,7 @@
 
 TBool CPsMruAdapter::GetUriFromMailboxIdentifier( TFSMailMsgId& aId, HBufC& aUri )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     // Add the uri identifier
     aUri.Des().Copy( KDefaultMailBoxURI );
     // Add plugin ID
@@ -408,35 +411,48 @@
 void CPsMruAdapter::EventL( TFSMailEvent aEvent, TFSMailMsgId aMailbox,
         TAny* /*aParam1*/, TAny* aParam2, TAny* /*aParam3*/ )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     switch ( aEvent )
         {
         case TFSEventMailMoved:
-        case TFSEventMailCopied:		
+        case TFSEventMailCopied:        
         case TFSEventNewMail:
             {
             // Check the new parent folder id for this message
             // For all these events, param2 indicates the new parent folder
             TFSMailMsgId* parentFolderId =
-            		static_cast< TFSMailMsgId* >( aParam2 );
+                    static_cast< TFSMailMsgId* >( aParam2 );
             if ( parentFolderId )
                 {
-                // Get the parent folder object
-                CFSMailFolder* parentFolder = iMailClient->GetFolderByUidL(
-                        aMailbox, *parentFolderId );
-                if ( parentFolder )
+                TFSFolderType folderType( EFSInbox ); 
+                if ( (*parentFolderId) == iPreviousParentFolderId && aMailbox == iPreviousMailboxId )
+                    {
+                    // we assume that folder with some id does not change 
+                    // its type during mail synchronization
+                    folderType = iPreviousParentFolderType;
+                    }
+                else
                     {
-                    CleanupStack::PushL( parentFolder );
-                
-                    // If it's sent/outbox folder,
-                    // we'll consider that as a new message being sent
-                    // and therefore we'll update the MRU list here
-                    if ( ( parentFolder->GetFolderType() == EFSSentFolder ) || 
-                         ( parentFolder->GetFolderType() == EFSOutbox ) )
+                    // Get the parent folder object
+                    CFSMailFolder* parentFolder = iMailClient->GetFolderByUidL(
+                            aMailbox, *parentFolderId );
+                    if ( parentFolder )
                         {
-                        FillDataStoreL( aMailbox );
+                        iPreviousParentFolderId = (*parentFolderId);
+                        iPreviousMailboxId = aMailbox;
+                        folderType = parentFolder->GetFolderType();
+                        iPreviousParentFolderType = folderType;
+                        delete parentFolder;
+                        parentFolder = NULL;
                         }
-                    CleanupStack::PopAndDestroy( parentFolder );
+                    }
+                // If it's sent/outbox folder,
+                // we'll consider that as a new message being sent
+                // and therefore we'll update the MRU list here
+                if ( ( folderType == EFSSentFolder ) || 
+                     ( folderType == EFSOutbox ) )
+                    {
+                    FillDataStoreL( aMailbox );
                     }
                 }
             }
@@ -459,7 +475,7 @@
             else
                 {
                 // mailbox still does not exist
-                DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation	
+                DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation    
                 break;
                 }
             
@@ -510,14 +526,22 @@
                     }
                 }
             delete identifier;
+            
+            iPreviousParentFolderId = TFSMailMsgId();
+            iPreviousMailboxId = TFSMailMsgId();  
+            break;
             }
+        case TFSEventMailboxSettingsChanged: // TODO SK check
+            {
+            iPreviousParentFolderId = TFSMailMsgId();
+            iPreviousMailboxId = TFSMailMsgId();  
             break;
+            }
         }
     }
-
 TBool CPsMruAdapter::AddMailboxObserverL( TFSMailMsgId& aId )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
         {
         if( iObservedMailboxes[index] == aId )
@@ -534,7 +558,7 @@
 
 TBool CPsMruAdapter::RemoveMailboxObserver( TFSMailMsgId& aId )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
         {
         if( iObservedMailboxes[index] == aId )
@@ -550,13 +574,13 @@
 
 void CPsMruAdapter::RemoveAllMailboxObservers()
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     for( TInt index = 0; index < iObservedMailboxes.Count(); index++ )
         {
         iMailClient->UnsubscribeMailboxEvents( iObservedMailboxes[index], *this );
         }
 
-    iObservedMailboxes.Reset();	
+    iObservedMailboxes.Reset(); 
     }
 
 /**
@@ -564,7 +588,7 @@
  * by CDelayMailboxCreationHelper timer to try it after some delay
  */
 TBool CPsMruAdapter::DeleayedMailboxCreationEventL()
-	{
+    {
     FUNC_LOG;
     for ( int i = iDelayedCreatedMailboxes.Count()-1; i>=0; i-- )
         {
@@ -598,7 +622,7 @@
                 AddMailboxObserverL( iDelayedCreatedMailboxes[i] ); // will be added by FillDataStoreL
 
                 CleanupStack::Pop( identifier );
-                iDelayedCreatedMailboxes.Remove( i );    	
+                iDelayedCreatedMailboxes.Remove( i );       
                 }
             else
                 {
@@ -615,7 +639,7 @@
  */
 void CPsMruAdapter::DeleayMailboxCreationEventL( TFSMailMsgId &aMailbox )
     {
-    FUNC_LOG;	
+    FUNC_LOG;   
     if ( NULL == iDelayMailboxCreationPtr )
         {
         iDelayMailboxCreationPtr = CDelayMailboxCreationHelper::NewL( this );
@@ -648,7 +672,7 @@
     }
 
 // used by MruAdapter when delayed datasource adding is needed
-void CDelayMailboxCreationHelper::StartDelayedCall()	
+void CDelayMailboxCreationHelper::StartDelayedCall()    
     {
     FUNC_LOG;
     if( IsActive() )  // don't call again in case the timer rq is pending
--- a/emailuis/emailui/data/FreestyleEmailUi.rss	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss	Thu Jul 15 18:19:25 2010 +0300
@@ -988,6 +988,12 @@
     cba = r_freestyle_emauil_ui_sk_options_back;
     }
 
+RESOURCE AVKON_VIEW r_fsemailui_html_view_fullscreen
+    {
+    menubar = r_fsemailui_htmlviewer_menubar;
+    cba = r_freestyle_emauil_ui_sk_options_back_fullscreen;
+    }
+    
 RESOURCE MENU_BAR r_freestyle_emailui_menubar
     {
     titles =
@@ -1050,6 +1056,31 @@
             }
         };
     }
+RESOURCE CBA r_freestyle_emauil_ui_sk_options_back_fullscreen
+    {
+    flags = EEikButtonGroupAddToStack | EEikCbaFlagAppMskIcon;
+    buttons =
+        {
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyOptions;
+            txt = text_softkey_option;
+            },
+        CBA_BUTTON
+            {
+            id = EAknSoftkeyBack;
+            txt = text_softkey_back;
+            },
+        CBA_BUTTON
+            {
+            id = EFsEmailUiCmdActionsDelete;
+            // txt = text_softkey_empty;
+            bmpfile = EMAILUI_ICON_FILE;
+            bmpid = EMbmFreestyleemailuiQgn_prop_cmail_action_delete;
+            bmpmask = EMbmFreestyleemailuiQgn_prop_cmail_action_delete_mask;
+            }
+        };
+    }
 
 RESOURCE CBA r_freestyle_emauil_ui_sk_options_cancel
     {
@@ -1204,6 +1235,7 @@
 RESOURCE TBUF r_freestyle_email_ui_viewer_low_prio    { buf=qtn_cmail_header_low_prio; }
 RESOURCE TBUF r_freestyle_email_ui_images_are_not_displayed    { buf=qtn_cmail_viewer_images_not_displayed; }
 RESOURCE TBUF r_freestyle_email_ui_display_images    { buf=qtn_cmail_viewer_display_images; }
+RESOURCE TBUF r_freestyle_email_ui_view_additional_info	{ buf=qtn_mail_viewer_additional_info; }
 
 // NOTES
 RESOURCE TBUF r_freestyle_email_delete_mail_note				{ buf=qtn_fse_delete_mail_note; }
Binary file emailuis/emailui/data/html/Thumbs.db has changed
Binary file emailuis/emailui/data/html/attachment.gif has changed
Binary file emailuis/emailui/data/html/attachment.png has changed
Binary file emailuis/emailui/data/html/btn_left.png has changed
Binary file emailuis/emailui/data/html/btn_middle.png has changed
Binary file emailuis/emailui/data/html/btn_right.png has changed
Binary file emailuis/emailui/data/html/collapse.png has changed
--- a/emailuis/emailui/data/html/email.html	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/data/html/email.html	Thu Jul 15 18:19:25 2010 +0300
@@ -1,6 +1,6 @@
 <html>
 <script language="javascript" src="email.js"></script>
-<frameset rows="10%,*" border=0 id="email_frameSet" onLoad="hideImages('body_frame')">
+<frameset rows="14%,*" border=0 id="email_frameSet" onLoad="hideImages('body_frame')">
 <frame id="header_frame" src="header.html" >
 <frame id="body_frame" src="temp/body.html" >
 </frameset>
Binary file emailuis/emailui/data/html/expand.png has changed
Binary file emailuis/emailui/data/html/follow_up.png has changed
Binary file emailuis/emailui/data/html/follow_up_complete.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailuis/emailui/data/html/header.css	Thu Jul 15 18:19:25 2010 +0300
@@ -0,0 +1,73 @@
+table { border-style: none; }
+table.fixed { border-style: none; table-layout:fixed; }
+td  { font-family:arial,sans-serif; font-size:75%; border-style: solid; border-width: 0px; }
+.button_cell { width: 60px; }
+.icon_cell { width: 60px; }
+.sender_name { font-weight: bold; font-family: arial,sans-serif; }
+.subject { font-weight: bold; font-family: arial,sans-serif; }
+.subject_intended { font-weight: bold; font-family: arial,sans-serif; padding-left: 10px; }
+.attachment { font-family: arial,sans-serif; padding: 2px 0 5px 7px; }
+.recipient { padding-left: 10px; }
+.sender_address { padding-left: 14px; }
+.message_icon { width: 20px; height 20px; }
+.label { font-weight: bold; font-family: arial,sans-serif; }
+.datetime  { font-family: arial,sans-serif; }
+.truncate { text-overflow: ellipsis; overflow: hidden;  }
+img.icon { height: 21px; }
+
+button {
+    color: black;
+	position: relative;
+	border: 0;
+	padding: 0;
+	cursor: pointer;
+	overflow: visible;
+}
+
+button::-moz-focus-inner {
+	border: none;
+}
+
+button span {
+	position: relative;
+	display:block;
+	white-space: nowrap;
+}
+
+@media screen and (-webkit-min-device-pixel-ratio:0 ) {
+	button span {
+		margin-top: -1px;
+	}
+}
+
+button.submitBtn {
+	padding: 0 9px 0 0;
+	margin-right: 0px;
+	font-size: 21px;
+	text-align: center;
+	background: transparent url('btn_right.png') no-repeat right 6px;
+}
+
+button.submitBtn span {
+	padding: 8px 0 0 5px;
+	height: 40px;
+	background: transparent url('btn_left.png') no-repeat left 6px;
+}
+
+button.submitBtn span.buttonText {
+	background: none;
+    display: inline;
+    top: 8px;
+}
+
+button.expand {
+    width: 57px;
+    height: 40px;
+	background: transparent url('expand.png') no-repeat top left;
+}
+
+button.collapse {
+    width: 57px;
+    height: 40px;
+	background: transparent url('collapse.png') no-repeat top left;
+}
--- a/emailuis/emailui/data/html/header.js	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/data/html/header.js	Thu Jul 15 18:19:25 2010 +0300
@@ -1,51 +1,166 @@
-var collapsed = true;
+var collapsed = is_header_expanded_visible;
 var displayImagesHidden = false;
 var previousPageYOffset = -1;
 var setScrollPositionInterval;
 
 function collapseHeader(sendEvent) {
-    if (sendEvent) {
-        location.href = "cmail://collapseHeader/";
-        }
+	if (sendEvent) {
+    	location.href = "cmail://collapseHeader/";
+    	}
     collapsed = true;
-    handleHeaderDisplay('expanded_header', 'collapsed_header');
-    updateHeader();
+	handleHeaderDisplay( "header_expanded", "header_collapsed" );
+	showTable( "header_collapsed_2" );
+	hideTable( "to_table" );
+	hideTable( "cc_table" );
+	hideTable( "bcc_table" );
+	hideTable( "header_expanded_2" );
+	handleHeaderDisplay( "to_expanded", "to_collapsed" );
+	handleHeaderDisplay( "cc_expanded", "cc_collapsed" );
+	handleHeaderDisplay( "bcc_expanded", "bcc_collapsed" );
+	if (sendEvent) {
+	    handleHeaderDisplay( "attachments_expanded", "attachments_collapsed" );
+        }
+	updateHeader();
     }
 
+function initHeader() {
+
+    if (typeof(is_header_expanded_visible) !== "undefined" && !is_header_expanded_visible) {
+    	handleHeaderDisplay( "header_expanded", "header_collapsed" );
+	}
+
+    if (typeof(is_header_collapsed_visible) !== "undefined" && !is_header_collapsed_visible) {
+	    hideTable( "header_collapsed" );
+	}
+
+	if (typeof(is_header_collapsed_2_visible) !== "undefined" && !is_header_collapsed_2_visible) {
+	    hideTable( "header_collapsed_2" );
+	}
+
+	if (typeof(is_header_expanded_2_visible) !== "undefined" && !is_header_expanded_2_visible) {
+	    hideTable( "header_expanded_2" );
+	}
+
+    if (typeof(is_to_table_visible) !== "undefined") {
+        if (!is_to_table_visible) {
+    	    hideTable( "to_table" );
+        	handleHeaderDisplay( "to_expanded", "to_collapsed" );
+    	} else {
+    	    if (typeof(is_to_expanded_visible) !== "undefined" ) {
+    	        if (is_to_expanded_visible) {
+                	handleHeaderDisplay( "to_collapsed", "to_expanded" );
+    	        } else {
+                	handleHeaderDisplay( "to_expanded", "to_collapsed" );
+    	        }
+    	    } else {
+                handleHeaderDisplay( "to_expanded", "to_collapsed" );
+    	    }
+    	}
+    }
+
+    if (typeof(is_cc_table_visible) !== "undefined") {
+    	if (!is_cc_table_visible) {
+    	    hideTable( "cc_table" );
+    	    handleHeaderDisplay( "cc_expanded", "cc_collapsed" );
+    	} else {
+    	    if (typeof(is_cc_expanded_visible) !== "undefined" ) {
+    	        if (is_cc_expanded_visible) {
+                	handleHeaderDisplay( "cc_collapsed", "cc_expanded" );
+    	        } else {
+                	handleHeaderDisplay( "cc_expanded", "cc_collapsed" );
+    	        }
+    	    } else {
+                handleHeaderDisplay( "cc_expanded", "cc_collapsed" );
+    	    }
+    	}
+    }
+
+
+    if (typeof(is_bcc_table_visible) !== "undefined") {
+    	if (!is_bcc_table_visible) {
+	        hideTable( "bcc_table" );
+    	    handleHeaderDisplay( "bcc_expanded", "bcc_collapsed" );
+	    } else {
+    	    if (typeof(is_bcc_expanded_visible) !== "undefined" ) {
+    	        if (is_bcc_expanded_visible) {
+                	handleHeaderDisplay( "bcc_collapsed", "bcc_expanded" );
+    	        } else {
+                	handleHeaderDisplay( "bcc_expanded", "bcc_collapsed" );
+    	        }
+    	    } else {
+                handleHeaderDisplay( "bcc_expanded", "bcc_collapsed" );
+    	    }
+    	}
+	}
+
+    if (typeof(is_header_expanded_2_visible) !== "undefined" && !is_header_expanded_2_visible) {
+        hideTable( "attachments_expanded" );
+    }
+
+    if (typeof(is_attachments_expanded_visible) !== "undefined" && is_attachments_expanded_visible) {
+        handleHeaderDisplay( "attachments_collapsed" , "attachments_expanded" );
+    } else {
+        handleHeaderDisplay( "attachments_expanded", "attachments_collapsed" );
+    }
+}
+
 function expandHeader(sendEvent) {
-    if (sendEvent) {
-        location.href = "cmail://expandHeader/";
-        }
-    collapsed = false;
-    handleHeaderDisplay('collapsed_header', 'expanded_header');
-    updateHeader();
-    }
+	if (sendEvent) {
+	    location.href = "cmail://expandHeader/";
+    	}
+	collapsed = false;
+	handleHeaderDisplay( "header_collapsed", "header_expanded" )
+	hideTable( "header_collapsed_2" );
+	showTable( "to_table" );
+	showTable( "cc_table" );
+	showTable( "bcc_table" );
+	showTable( "header_expanded_2" );
+	parent.document.getElementById('email_frameSet').rows = "30%, *";
+	}
 
 function updateHeader() {
-    var rows = "40%, *";
-    if (collapsed) {
-        if (displayImagesHidden || (parent.header_frame.g_autoLoadImages != 0) || (parent.hiddenCount == 0)) {
+    var rows = "30%, *";
+	if (collapsed) {
+    	if (displayImagesHidden || (parent.header_frame.g_autoLoadImages != 0) || (parent.hiddenCount == 0)) {
             rows = "10%, *";
         } else {
-            rows = "17%, *";
-            }
-        }
+            rows = "19%, *";
+	    }
+	}
     parent.document.getElementById('email_frameSet').rows = rows;
     }
 
+function showTable( tableToShow ) {
+    if (document.getElementById(tableToShow) != null) {
+	    document.getElementById(tableToShow).style.display = "";
+	}
+}
+
+function hideTable( tableToHide ) {
+    if (document.getElementById(tableToHide) != null) {
+	    document.getElementById(tableToHide).style.display = "none";
+    }
+}
+
 function handleHeaderDisplay( tableToHide, tableToShow ) {
-    document.getElementById(tableToHide).style.display = 'none';
-    document.getElementById(tableToShow).style.display = '';
+    showTable(tableToShow);
+    if (document.getElementById(tableToShow) != null) {
+        hideTable(tableToHide);
+    } else {
+        showTable(tableToHide);
     }
+}
 
 function init(scrollPos) {
-    if (document.getElementById('collapsed_header').style.display != 'none') {
+	/*if (document.getElementById("header_collapsed").style.display != "none") {
         collapseHeader(false);
-    } else {
-        expandHeader(false);
-    }
+	} else {
+	    expandHeader(false);
+	}*/
+
+	initHeader();
     window.scrollTo(0, scrollPos);
-    setScrollPositionInterval = setInterval("updateScrollPosition()", 500);
+	setScrollPositionInterval = setInterval("updateScrollPosition()", 500);
     }
 
 function displayImagesButtonPressed() {
Binary file emailuis/emailui/data/html/hidden.png has changed
Binary file emailuis/emailui/data/html/minus.gif has changed
Binary file emailuis/emailui/data/html/plus.gif has changed
Binary file emailuis/emailui/data/html/priority_high.png has changed
Binary file emailuis/emailui/data/html/priority_low.png has changed
Binary file emailuis/emailui/data/html/todo_high_add.png has changed
Binary file emailuis/emailui/data/html/todo_low_add.png has changed
--- a/emailuis/emailui/group/FreestyleEmailUi.mmp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/group/FreestyleEmailUi.mmp	Thu Jul 15 18:19:25 2010 +0300
@@ -30,7 +30,7 @@
 CAPABILITY      CAP_APPLICATION NetworkControl SwEvent
 
 UID             0x0 0x2001E277
-EPOCHEAPSIZE    0x5000 0x800000
+EPOCHEAPSIZE    0x5000 0x2000000
 EPOCSTACKSIZE   0x13880
 
 VERSION         KEmailBinaryVersionNumber
@@ -220,3 +220,4 @@
 LIBRARY touchfeedback.lib
 LIBRARY ccaclient.lib
 LIBRARY pbk2rclengine.lib
+LIBRARY memman.lib
--- a/emailuis/emailui/group/bld.inf	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/group/bld.inf	Thu Jul 15 18:19:25 2010 +0300
@@ -51,49 +51,55 @@
 ../group/backup_registration.xml /epoc32/data/z/private/2001E277/backup_registration.xml
 
 // Files for html display
-// make the files ready for creating ROM image 
-../data/html/attachment.gif /epoc32/data/z/private/2001E277/HtmlFile/attachment.gif
+// make the files ready for creating ROM image
 ../data/html/email.html /epoc32/data/z/private/2001E277/HtmlFile/email.html
 ../data/html/email_rtl.html /epoc32/data/z/private/2001E277/HtmlFile/email_rtl.html
 ../data/html/header.js /epoc32/data/z/private/2001E277/HtmlFile/header.js
-../data/html/plus.gif /epoc32/data/z/private/2001E277/HtmlFile/plus.gif
-../data/html/minus.gif /epoc32/data/z/private/2001E277/HtmlFile/minus.gif
+../data/html/header.css /epoc32/data/z/private/2001E277/HtmlFile/header.css
 ../data/html/email.js /epoc32/data/z/private/2001E277/HtmlFile/email.js
 ../data/html/follow_up.png /epoc32/data/z/private/2001E277/HtmlFile/follow_up.png
 ../data/html/follow_up_complete.png /epoc32/data/z/private/2001E277/HtmlFile/follow_up_complete.png
-../data/html/btn_middle.png /epoc32/data/z/private/2001E277/HtmlFile/btn_middle.png
-../data/html/todo_high_add.png /epoc32/data/z/private/2001E277/HtmlFile/todo_high_add.png
-../data/html/todo_low_add.png /epoc32/data/z/private/2001E277/HtmlFile/todo_low_add.png
-
+../data/html/btn_right.png /epoc32/data/z/private/2001E277/HtmlFile/btn_right.png
+../data/html/btn_left.png /epoc32/data/z/private/2001E277/HtmlFile/btn_left.png
+../data/html/priority_high.png /epoc32/data/z/private/2001E277/HtmlFile/priority_high.png
+../data/html/priority_low.png /epoc32/data/z/private/2001E277/HtmlFile/priority_low.png
+../data/html/attachment.png /epoc32/data/z/private/2001E277/HtmlFile/attachment.png
+../data/html/hidden.png /epoc32/data/z/private/2001E277/HtmlFile/hidden.png
+../data/html/expand.png /epoc32/data/z/private/2001E277/HtmlFile/expand.png
+../data/html/collapse.png /epoc32/data/z/private/2001E277/HtmlFile/collapse.png
 
 // make the files ready for udeb emulator
-../data/html/attachment.gif /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/attachment.gif
 ../data/html/email.html /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/email.html
 ../data/html/email_rtl.html /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/email_rtl.html
 ../data/html/header.js /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/header.js
-../data/html/plus.gif /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/plus.gif
-../data/html/minus.gif /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/minus.gif
+../data/html/header.css /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/header.css
 ../data/html/email.js /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/email.js
 ../data/html/follow_up.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/follow_up.png
 ../data/html/follow_up_complete.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/follow_up_complete.png
-../data/html/todo_high_add.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/todo_high_add.png
-../data/html/btn_middle.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/btn_middle.png
-../data/html/todo_low_add.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/todo_low_add.png
+../data/html/btn_right.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/btn_right.png
+../data/html/btn_left.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/btn_left.png
+../data/html/priority_high.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/priority_high.png
+../data/html/priority_low.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/priority_low.png
+../data/html/attachment.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/attachment.png
+../data/html/hidden.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/hidden.png
+../data/html/expand.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/expand.png
+../data/html/collapse.png /epoc32/release/winscw/udeb/z/private/2001E277/HtmlFile/collapse.png
 
 // make the files ready for urel emulator
-../data/html/attachment.gif /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/attachment.gif
 ../data/html/email.html /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/email.html
 ../data/html/email_rtl.html /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/email_rtl.html
 ../data/html/header.js /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/header.js
-../data/html/plus.gif /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/plus.gif
-../data/html/minus.gif /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/minus.gif
+../data/html/header.css /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/header.css
 ../data/html/email.js /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/email.js
 ../data/html/follow_up.png /epoc32/release/winscw/urel/z/private/2001E277/follow_up.png
-../data/html/follow_up_complete.png /epoc32/release/winscw/urel/z/private/2001E277/follow_up_complete.png
-../data/html/todo_high_add.png /epoc32/release/winscw/urel/z/private/2001E277/todo_high_add.png
-../data/html/btn_middle.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/btn_middle.png
-../data/html/todo_low_add.png /epoc32/release/winscw/urel/z/private/2001E277/todo_low_add.png
-
+../data/html/btn_right.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/btn_right.png
+../data/html/btn_left.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/btn_left.png
+../data/html/priority_high.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/priority_high.png
+../data/html/priority_low.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/priority_low.png
+../data/html/attachment.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/attachment.png
+../data/html/hidden.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/hidden.png
+../data/html/expand.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/expand.png
+../data/html/collapse.png /epoc32/release/winscw/urel/z/private/2001E277/HtmlFile/collapse.png
 ../data/cmail_marking_mode_bg.svg /epoc32/s60/icons/cmail_marking_mode_bg.svg
 
 ../sis/commonemailstub.sis          /epoc32/data/z/system/install/commonemailstub.sis
--- a/emailuis/emailui/inc/FreestyleEmailUiAknStatusIndicator.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiAknStatusIndicator.h	Thu Jul 15 18:19:25 2010 +0300
@@ -42,9 +42,11 @@
     void ShowIndicatorL( CFbsBitmap* aBitmap, 
                          CFbsBitmap* aMaskBitmap,
                          TDesC* aText,
-                         TInt aDuration );
+                         TInt aDuration,
+                         const TBool aAnimate = EFalse );
 
     void HideIndicator( TInt aDelayBeforeHidingInMs = 0 );
+    void StartTimer( const TInt aTimeOut );
     
     // The ownship of aText is transferred in.
     void SetTextL( TDesC* aText );
@@ -77,11 +79,17 @@
     void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer );
 
 private:
+    TRect ImageRect( const TRect& aRect ) const;
+    TRect TextRect( const TRect& aRect ) const;
     void CalculateLayout( const TRect& aRect ) const;
     
     void SetTextFont() const;
     void CalculateVisualText() const;
 
+    TRgb BackgroundColor() const;
+    TRgb BorderColor() const;
+    TRgb FontColor() const;
+
     void DrawBoundary( const TRect& aRect ) const;
     void DrawImage( const TRect& aRect ) const;
     void DrawText( const TRect& aRect ) const;
@@ -104,6 +112,11 @@
     
     mutable HBufC*              iVisualText;
     mutable CFont*              iTextFont;
+    mutable TInt                iVisualTextWidth;            
+    
+    TInt iHideTimeout;
+    TInt iAngle;
+    TBool iAnimate;
     };
 
 #endif // __FREESTYLEEMAILUI_AKN_STATUS_INDICATOR_H__
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Thu Jul 15 18:19:25 2010 +0300
@@ -153,6 +153,7 @@
      */
     void KeyValueChangedL( TUint32 aKey );
 
+public:    
     /**
      * @see CEUiHtmlViewerSettingsKeyListener::MObserver::Repository
      */
@@ -302,7 +303,7 @@
     void ConvertToHtmlFileL( CFSMailMessagePart& aTextBodyPart, const TDesC& aHtmlFileName );
 
     // Reads given file content to buffer and return pointer to it
-    HBufC8* ReadContentFromFileLC( RFile& aFile );
+    HBufC8* ReadContentFromFileLC( RFile& aFile, CFSMailMessagePart& aHtmlBodyPart );
     // Writes buffer to given file
     void WriteContentToFileL( const TDesC8& aContent, const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
 
@@ -394,7 +395,7 @@
     TBool iHeaderExpanded;
     // tactile feed back -- not owned
     MTouchFeedback* iTouchFeedBack;
-    
+    TBitFlags iFlags;
     TInt iZoomLevel;
     };
 
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Thu Jul 15 18:19:25 2010 +0300
@@ -56,7 +56,7 @@
 public:
 
     /** Two-phased constructor. */
-    static CFsEmailUiHtmlViewerView* NewL( CAlfEnv& aEnv, 
+    static CFsEmailUiHtmlViewerView* NewL( CAlfEnv& aEnv,
                                            CFreestyleEmailUiAppUi& aAppUi,
                                            CAlfControlGroup& aControlGroup );
 
@@ -72,22 +72,22 @@
     TUid Id() const;
 
     void HandleStatusPaneSizeChange();
-    
+
     void HandleViewRectChange();
-    
+
     /**
     * HandleCommandL
     * From CAknView, takes care of command handling.
     * @param aCommand Command to be handled
     */
     void HandleCommandL( TInt aCommand );
-    
+
     // Handle accept/decline/tentative/remove commands given for meeting request message directly from list UI.
 	void HandleMrCommandL( TInt aCommandId, TFSMailMsgId aMailboxId, TFSMailMsgId aFolderId, TFSMailMsgId aMessageId );
-    
+
 	void CompletePendingMrCommand();
 	void CancelPendingMrCommandL();
-	
+
     /**
     * ChildDoDeactivate
     * From CFsEmailUiViewBase, deactivate the AknView
@@ -106,32 +106,32 @@
 
     void SetMskL();
     void PrepareForExit();
-    
+
 public : // for MFSMailRequestObserver
     void RequestResponseL( TFSProgress aEvent, TInt aRequestId );
-    
-public: 
+
+public:
     // from MProgressDialogCallback
     void DialogDismissedL( TInt aButtonId);
-    
+
     CFSMailMessage* CurrentMessage();
     CFSEmailUiAttachmentsListModel* CurrentAttachmentsListModel();
-    
+
     // Return view area that can be used for container
     TRect ContainerRect() const;
 
-public: 
+public:
     void HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType );
     void HandleMailBoxEventL( TFSMailEvent aEvent,
                               TFSMailMsgId aMailbox, TAny* aParam1, TAny* /*aParam2*/, TAny* /*aParam3*/ );
-    
-    void HandleEmailAddressCommandL( TInt aCommand, const TDesC& aEmailAddress ); 
+
+    void HandleEmailAddressCommandL( TInt aCommand, const TDesC& aEmailAddress );
     void HandleWebAddressCommandL( TInt aCommand, const TDesC& aUrl );
-    
+
     void DownloadAttachmentL( const TAttachmentData& aAttachment );
     void DownloadAllAttachmentsL();
-    void CancelAttachmentL( const TAttachmentData& aAttachment );    
-    void CancelAllAttachmentsL();    
+    void CancelAttachmentL( const TAttachmentData& aAttachment );
+    void CancelAllAttachmentsL();
     void OpenAttachmentL( const TAttachmentData& aAttachment );
     void SaveAttachmentL( const TAttachmentData& aAttachment );
     void SaveAllAttachmentsL();
@@ -141,8 +141,8 @@
     TBool IsEmbeddedMsgSavingAllowed();
     // Helper funcitons to get viewed message ID and Folder id
     TFSMailMsgId ViewedMessageFolderId();
-    TFSMailMsgId ViewedMessageId(); 
-    
+    TFSMailMsgId ViewedMessageId();
+
     TBool GetAsyncFetchStatus();
     void StartFetchingMessageL();
     void ReloadPageL();
@@ -154,21 +154,21 @@
 
 public : // from MFSEmailDownloadInformationObserver
     void RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart );
-    
+
 public: // from MFSEmailUiAttachmentsStatusObserver
     void DownloadStatusChangedL( TInt aIndex );
-    
+
 public: // from MESMRIcalViewerCallback
-    void ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId,	const CFSMailMessage& aMessage, MESMRIcalViewerObserver* aObserver = NULL );   
-	  void ProcessSyncCommandL( TESMRIcalViewerOperationType aCommandId, const CFSMailMessage& aMessage );   
-    TBool CanProcessCommand( TESMRIcalViewerOperationType aCommandId  ) const;  
-     
+    void ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId,	const CFSMailMessage& aMessage, MESMRIcalViewerObserver* aObserver = NULL );
+	  void ProcessSyncCommandL( TESMRIcalViewerOperationType aCommandId, const CFSMailMessage& aMessage );
+    TBool CanProcessCommand( TESMRIcalViewerOperationType aCommandId  ) const;
+
 public: // from MESMRIcalViewerObserver
-    void OperationCompleted( TIcalViewerOperationResult aResult );        
+    void OperationCompleted( TIcalViewerOperationResult aResult );
     void OperationError( TIcalViewerOperationResult aResult );
-	
+
     void FadeOut(TBool aDirectionOut);
-    
+
 private: // from
     /**
      * @see CFsEmailUiViewBase::ChildDoActivateL
@@ -178,31 +178,27 @@
                            const TDesC8& aCustomMessage );
 
     /**
-     * @see CFsEmailUiViewBase::ToolbarResourceId
+     * @see CFsEmailUiViewBase::NavigateBackL
      */
-    TInt ToolbarResourceId() const;
-    
+    void NavigateBackL();
+
     /**
-     * @see CFsEmailUiViewBase::GetInitiallyDimmedItemsL
+     * @see CFsEmailUiViewBase::ChangeMskCommandL
      */
-    virtual void GetInitiallyDimmedItemsL( const TInt aResourceId,
-                RArray<TInt>& aDimmedItems ) const;
+    void ChangeMskCommandL( TInt aLabelResourceId );
 
     /**
-     * @see CFsEmailUiViewBase::OfferToolbarEventL
+     * @see CFsEmailUiViewBase::IsStatusPaneVisible
      */
-    void OfferToolbarEventL( TInt aCommand );
-  
-    /**
-     * @see CFsEmailUiViewBase::NavigateBackL
-     */ 
-    void NavigateBackL();
-    
+    TBool IsStatusPaneVisible() const;
+
     /**
 	 * @see CFsEmailUiViewBase::SetStatusBarLayout
-	 */ 
+	 */
     void SetStatusBarLayout();
+
 private: // New functions
+
     // list of different types of content
     enum TFetchedType
         {
@@ -229,8 +225,8 @@
     void OpenContactDetailsL( const TDesC& aEmailAddress );
     void LaunchRemoteLookupL( const TDesC& aEmailAddress );
     void CreateMessageL( const TDesC& aEmailAddress );
-    
-    void UpdateDownloadIndicatorL( const TPartData& aPart, 
+
+    void UpdateDownloadIndicatorL( const TPartData& aPart,
                                    const TFSProgress& aEvent );
     //fetching related API
     TBool MessagePartFullyFetchedL( TFetchedType aFetchedContentType ) const;
@@ -259,22 +255,22 @@
       // from the move to folder dialog. This is necessary because view swithching is asynchronous.
     static TInt MoveToFolderAndExitL( TAny* aMailViewerVisualiser );
     void FolderSelectedL( TFSMailMsgId aSelectedFolderId,
-                          TFSEmailUiCtrlBarResponse aResponse ); 
-    
+                          TFSEmailUiCtrlBarResponse aResponse );
+
     void UpdateEmailHeaderIndicators();
     TBool IsOpenedInMRViewerL();
     void CopyCurrentToClipBoardL( const TDesC& aArgument) const;
     void OpenLinkInBrowserL( const TDesC& aUrl) const;
     void SaveWebAddressToFavouritesL( const TDesC& aUrl ) const;
     void SetScrollPosition(TInt aPosition);
-    
+
     void CheckMessageBodyL( CFSMailMessage& aMessage, TBool& aMessageBodyStructurePresent, TBool& aMessageBodyContentPresent);
-    
+
 private: // Constructors
-    
+
     void ConstructL();
-    CFsEmailUiHtmlViewerView( CAlfEnv& aEnv, 
-                              CFreestyleEmailUiAppUi& aAppUi, 
+    CFsEmailUiHtmlViewerView( CAlfEnv& aEnv,
+                              CFreestyleEmailUiAppUi& aAppUi,
                               CAlfControlGroup& aControlGroup );
 
 private:
@@ -284,13 +280,13 @@
     THtmlViewerActivationData iActivationData;
     CFSEmailUiAttachmentsListModel* iAttachmentsListModel;
 
-    // Stack of open messages. Messages are owned by this stack. 
+    // Stack of open messages. Messages are owned by this stack.
     CStack<CFSMailMessage, ETrue>* iOpenMessages;
     // Stack of embedded messages. Message are NOT owned by this stack. Similar to iOpenMessages
     // but has NULL pointer in slots which correspond non-embedded messages.
     CStack<CFSMailMessage, EFalse>* iEmbeddedMessages;
     TBool iCreateNewMsgFromEmbeddedMsg;
-        
+
     // <cmail>
     // Temporary mail address for opening editor
     CFSMailAddress* iNewMailTempAddress;
@@ -327,8 +323,8 @@
 	TBool iMoveToFolderOngoing;
     TBool iMovingMeetingRequest;
     CAsyncCallBack* iAsyncCallback;
-    
-    TFSMailMsgId iMoveDestinationFolder;  
+
+    TFSMailMsgId iMoveDestinationFolder;
     	// Meeting request observer stuff.
 		// Pointer to observer to inform, not owned.
 		MESMRIcalViewerObserver* iMrObserverToInform;
@@ -338,10 +334,10 @@
     // Message pointer to a deleted mail from Mrui
     TFSMailMsgId iDeletedMessageFromMrui;
     // Flag selection handler active object for global note
-    CFlagSelectionNoteHandler* iFlagSelectionHandler;  
+    CFlagSelectionNoteHandler* iFlagSelectionHandler;
     TBool iNextOrPrevMessageSelected;
     TBool iMessageIsDeleted;
-    
+
     // Id of last deleted message
     TFSMailMsgId iLastDeletedMessageID;
     };
@@ -354,20 +350,20 @@
     public:  // Constructors and destructor
         static CFlagSelectionNoteHandler* NewL( CFsEmailUiHtmlViewerView& aViewerVisualiser );
         virtual ~CFlagSelectionNoteHandler();
-        void Cancel();       
-        void LaunchFlagListQueryDialogL();       
-            
-    private: 
-    
-        void RunL();       
-        void DoCancel();       
+        void Cancel();
+        void LaunchFlagListQueryDialogL();
+
+    private:
+
+        void RunL();
+        void DoCancel();
         TInt RunError( TInt aError );
-        
+
     private:
         CFlagSelectionNoteHandler(  CFsEmailUiHtmlViewerView& aVoIPDialogObserver );
 
-        
-    private:      
+
+    private:
         CFsEmailUiHtmlViewerView& iViewerView;
         CAknGlobalListQuery* iGlobalFlagQuery;
         HBufC* iPrompt;
--- a/emailuis/emailui/inc/FreestyleEmailUiViewBase.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiViewBase.h	Thu Jul 15 18:19:25 2010 +0300
@@ -101,7 +101,7 @@
     void DoTransition( TBool aDirectionOut );
 
     virtual void FadeOut(TBool aDirectionOut);
-    
+
     /**
      * Prepares application exit. This is called by AppUi during cleanup before AppUi's destructor
      */
@@ -190,7 +190,13 @@
      * Derived classes can call this utility function to set the middle soft key
      * label and ID from the given resource.
      */
-    void ChangeMskCommandL( TInt aLabelResourceId );
+    virtual void ChangeMskCommandL( TInt aLabelResourceId );
+
+    /**
+     * Derived classes can overwrite this method to control status pane
+     * visibility.
+     */
+    virtual TBool IsStatusPaneVisible() const;
 
 // <cmail> Toolbar
 protected: // toobar changes
@@ -319,7 +325,7 @@
     TBool iSendToBackgroundOnDeactivation;
     // View's active status
     TBool iViewActive;
-protected: // to enable overridning 
+protected: // to enable overridning
     TBool iWasActiveControlGroup;
     };
 
--- a/emailuis/emailui/inc/FreestyleMessageHeaderHTML.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleMessageHeaderHTML.h	Thu Jul 15 18:19:25 2010 +0300
@@ -20,6 +20,7 @@
 
 #include <e32base.h>
 #include <biditext.h>  
+#include <babitflags.h>
 
 #include "cfsmailmessage.h"
 #include "cfsmailaddress.h"
@@ -33,32 +34,58 @@
 class CFreestyleMessageHeaderHTML : public CBase
     {
 public:
+    
+    /**
+     * Flags to control exporting
+     */
+    enum TExportFlag
+        {
+        // Header is expanded
+        EHeaderExpanded,
+        // Attachments are expanded
+        EAttachmentExpanded,
+        // To field is expanded
+        EToExpanded,
+        // Cc field is expanded
+        ECcExpanded,
+        // Bcc field is expanded
+        EBccExpanded,
+        
+        // ** For internal use only **         
+        // Load images automatically
+        EAutoLoadImages,
+        // Mirrored layout in use
+        EMirroredLayout        
+        };
+    
+public:
+    
     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
                                   RWriteStream& aWriteStream, 
                                   TInt aVisibleWidth, 
                                   TInt aScrollPosition,
                                   const TBool aAutoLoadImages,                                  
-                                  const TBool aExpanded );
+                                  const TBitFlags& aFlags );
     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
                                   RFile& aFile, 
                                   TInt aVisibleWidth, 
                                   TInt aScrollPosition,
                                   const TBool aAutoLoadImages,
-                                  const TBool aExpanded );
+                                  const TBitFlags& aFlags );
     IMPORT_C static void ExportL( CFSMailMessage& aMailMessage, 
                                   RFs& aFs, 
                                   const TPath& aFilePath, 
                                   TInt aVisibleWidth, 
                                   TInt aScrollPosition,
                                   const TBool aAutoLoadImages,
-                                  const TBool aExpanded );
+                                  const TBitFlags& aFlags );
     
     IMPORT_C static CFreestyleMessageHeaderHTML* NewL( CFSMailMessage& aMailMessage,
                                                        RWriteStream& aWriteStream,
                                                        TInt aVisibleWidth,
                                                        TInt aScrollPosition,
                                                        const TBool aAutoLoadImages,
-                                                       const TBool aExpanded );
+                                                       const TBitFlags& aFlags );
     
     ~CFreestyleMessageHeaderHTML();
     
@@ -70,101 +97,73 @@
                                  TInt aVisibleWidth,
                                  TInt aScrollPosition,
                                  const TBool aAutoLoadImages,
-                                 const TBool aExpanded );
+                                 const TBitFlags& aFlags );
     void ConstructL();
-    
-    void HTMLStartL() const;
-    void HTMLEndL() const;
-    
-    void ExportHTMLHeaderL() const;
-    void HTMLHeaderStartL() const;
-    void HTMLMetaL() const;
-    void HTMLHeaderEndL() const;
-
-    void ExportDisplayImagesTableL() const;
+        
+    void ExportHeaderTablesL() const;
+    void ExportCollapsedHeaderTableL() const;
+    void ExportExpandedHeaderTablesL() const;
 
-    void ExportHTMLBodyL() const;
-    void HTMLBodyStartL() const;
-    void HTMLBodyEndL() const;
-    
-    /*
-     * Writes the subject to iWriteStream and also
-     * takes care of the urls and marks them as hotspots
-     */
-    void WriteSubjectL(TDesC& aText ) const; 
-
-    void ExportCollapseButtonL() const;
-    void ExportTimeAndExpandButtonL() const;
-    void ExportSubjectL() const;
-    void ExportSubjectCollapsedL() const;
-    void ExportFromL() const;
-    void ExportToL() const;
-    void ExportCcL() const;
-    void ExportBccL() const;
-    void ExportSentTimeL() const;
-    void ExportAttachmentsL() const;
-    
-    void ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, 
-                                const RPointerArray<CFSMailAddress>& aEmailAddresses,
-                                const TDesC8& aRowId,
-                                const TDesC8& aTableId,
-                                TInt aHeaderTextResourceId ) const;
-    
-    void AddEmailAddressL( FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, 
-                           const CFSMailAddress& aEmailAddress ) const;
+    void ExportTableVisibilityParameterL( const TDesC& aTableName, const TBitFlags& aFlags ) const;
+    void ExportTableVisibilityParameterL( const TDesC& aTableName, const TBool aVisible ) const;
+    void ExportTableBeginL( const TDesC& aTableName, const TBitFlags& aFlags = TBitFlags() ) const;
+    void ExportTableEndL() const;
+    void ExportInnerTableBeginL( const TDesC& aTableName, const TInt aColSpan, const TBitFlags& aFlags = TBitFlags()  ) const;
+    void ExportInnerTableBeginWithRowBeginL( const TDesC& aTableName, const TInt aColSpan, const TBool aVisible, const TBitFlags& aFlags = TBitFlags() ) const;
+    void ExportInnerTableEndL() const;
+    void ExportInnerTableEndWithRowEndL() const;
     
-    void AddAttachmentL( CFSMailMessagePart& aAttachment ) const;
-
-    void StartHyperlinkL( const TDesC8& aUrl ) const;
-    void EndHyperlinkL() const;
-    
-    void AddImageL( const TDesC8& aImageUrl ) const;
-    void AddImageL( const TDesC8& aImageId, const TDesC8& aImageUrl, const TDesC8& aImageEvent ) const;
-    
-    void StartHeaderTableL( const TDesC8& aTableId, TBool aVisible ) const;
-    void EndHeaderTableL() const;
-
-    void StartTableL( const TDesC8& aTableId ) const;
-    void EndTableL() const;
-
-    HBufC8* ClickImageEventL( const TDesC8& aImageName ) const;
-
-    void AddJavascriptL() const;    
-    
-    HBufC8* HeadingTextLC( TInt aId ) const;
-    HBufC8* HeadingTextLC( TInt aId, TInt aSize ) const;
+    void ExportAttachmentTablesL() const;
+    void ExportCollapsedAttachmentTableL( const TBool aHide ) const;
+    void ExportCollapsedAttachmentsTableRowL() const;
+    void ExportExpandedAttachmentTableL( const TBool aHide ) const;
+    void ExportExpandedAttachmentsTableRowsL() const;
+    void ExportAttachmentsL() const;    
+    void ExportAttachmentL( CFSMailMessagePart& aAttachment ) const;    
+    void ExportAttachmentIconL() const;
 
-    void ExportCollapsedHeaderTableL() const;
-    void ExportExpandedHeaderTableL() const;
-
-    /**
-     * Function for generating follow up icon's HTML code.
-     * Returns NULL if no follow up flags are set.
-     *
-     * @param aShowText Whether to show icon's text after the icon or not.
-     */
-    HBufC8* HTMLHeaderFollowUpIconLC( TBool aShowText ) const;
-    
-    /**
-     * Function for generating priority icon's HTML code.
-     * Returns NULL if mail message's priority is normal.
-     *
-     * @param aShowText Whether to show icon's text after the icon or not.
-     */
-    HBufC8* HTMLHeaderPriorityIconLC( TBool aShowText ) const;
-    void AddStyleSheetL() const;
-    void StartDivL() const;
-    void EndDivL() const;
+    void ExportSenderTableRowL( const TBool aCollapsed ) const;
+    void ExportSenderAddressTableRowL() const;
+    void ExportDateTimeTableRowL( const TInt aColSpan = 1 ) const;
+    void ExportSubjectTableRowL( const TBool aShowLabel = EFalse ) const;
+    void ExportMessageIconsL() const;
+    void ExportFromTableRowL() const;
+    void ExportToTableL() const;
+    void ExportCcTableL() const;
+    void ExportBccTableL() const;
+    void ExportRecipientsTableL( const TDesC& aType, const TInt aLabelResourceId,
+            const RPointerArray<CFSMailAddress>& aRecipients, const TBool aExpanded ) const;
+    void ExportRecipientsL( const TDesC& aType, const RPointerArray<CFSMailAddress>& aRecipients ) const;
+    void ExportExpandRecipientsL( const TDesC& aType, const TInt aCount ) const;
+    void ExportExpandAttachmentsL( const TDesC& aType, const TInt aCount ) const;
+    void ExportLabelTableRowL( const TInt aResourceId, const TInt aColSpan = 1 ) const;
+    void ExportIconL( const TDesC& aIconName ) const;
+    HBufC* SubjectLC() const;
+    TInt CalculateTotalSpaceRequired( const TDesC& aText, CFindItemEngine& aItemEngine, 
+            TInt& aMaxLength ) const;
+    HBufC* CreateLinksLC( const TDesC& aText, const TInt aSearchCases ) const;
+    void ExportHTMLBodyStartL() const;
+    void ExportHTMLBodyEndL() const;
+    void ExportDisplayImagesTableL() const;
+    void ExportBodyStyleL() const;
     
 private:
+    
+    // Table formatting flags
+    enum TTableStyleFlags
+        {
+        // Table is hidden
+        EHidden,
+        // Table width is fixed
+        EFixed
+        };
+
     CFSMailMessage&             iMailMessage; 
     RWriteStream&               iWriteStream;
     TInt                        iVisibleWidth;
     TInt                        iScrollPosition;
-    TBool                       iAutoLoadImages;
-    TBool                       iMirrorLayout;
-    TBool                       iExpanded;
     RPointerArray<CFSMailMessagePart> iAttachments;
+    TBitFlags iExportFlags;
 };
 
 #endif //__CFREESTYLE_MESSAGE_HEADER_HTML_H__
--- a/emailuis/emailui/loc/freestyleemailui.loc	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/loc/freestyleemailui.loc	Thu Jul 15 18:19:25 2010 +0300
@@ -2876,3 +2876,8 @@
 //
 #define qtn_mail_tb_ext_hide_bcc "Hide Bcc"
 
+// d:Additional information for large Email
+// l:cell_tb_ext_pane_t1/opt1
+// r:TB9.2
+//
+#define qtn_mail_viewer_additional_info "--- Message too long ---"
--- a/emailuis/emailui/rom/freestyleemailui.iby	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/rom/freestyleemailui.iby	Thu Jul 15 18:19:25 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -33,18 +33,21 @@
 data=DATAZ_\private\2001E277\backup_registration.xml  private\2001E277\backup_registration.xml
 
 //<cmail> files for html display
-data=DATAZ_\private\2001E277\HtmlFile\attachment.gif private\2001E277\HtmlFile\attachment.gif
 data=DATAZ_\private\2001E277\HtmlFile\email.html private\2001E277\HtmlFile\email.html
 data=DATAZ_\private\2001E277\HtmlFile\email_rtl.html private\2001E277\HtmlFile\email_rtl.html
 data=DATAZ_\private\2001E277\HtmlFile\header.js private\2001E277\HtmlFile\header.js
-data=DATAZ_\private\2001E277\HtmlFile\plus.gif private\2001E277\HtmlFile\plus.gif
-data=DATAZ_\private\2001E277\HtmlFile\minus.gif private\2001E277\HtmlFile\minus.gif
+data=DATAZ_\private\2001E277\HtmlFile\header.css private\2001E277\HtmlFile\header.css
 data=DATAZ_\private\2001E277\HtmlFile\email.js private\2001E277\HtmlFile\email.js
 data=DATAZ_\private\2001E277\HtmlFile\follow_up.png private\2001E277\HtmlFile\follow_up.png
 data=DATAZ_\private\2001E277\HtmlFile\follow_up_complete.png private\2001E277\HtmlFile\follow_up_complete.png
-data=DATAZ_\private\2001E277\HtmlFile\btn_middle.png private\2001E277\HtmlFile\btn_middle.png
-data=DATAZ_\private\2001E277\HtmlFile\todo_high_add.png private\2001E277\HtmlFile\todo_high_add.png
-data=DATAZ_\private\2001E277\HtmlFile\todo_low_add.png private\2001E277\HtmlFile\todo_low_add.png
+data=DATAZ_\private\2001E277\HtmlFile\priority_high.png private\2001E277\HtmlFile\priority_high.png
+data=DATAZ_\private\2001E277\HtmlFile\priority_low.png private\2001E277\HtmlFile\priority_low.png
+data=DATAZ_\private\2001E277\HtmlFile\btn_right.png private\2001E277\HtmlFile\btn_right.png
+data=DATAZ_\private\2001E277\HtmlFile\btn_left.png private\2001E277\HtmlFile\btn_left.png
+data=DATAZ_\private\2001E277\HtmlFile\attachment.png private\2001E277\HtmlFile\attachment.png
+data=DATAZ_\private\2001E277\HtmlFile\expand.png private\2001E277\HtmlFile\expand.png
+data=DATAZ_\private\2001E277\HtmlFile\collapse.png private\2001E277\HtmlFile\collapse.png
+data=DATAZ_\private\2001E277\HtmlFile\hidden.png private\2001E277\HtmlFile\hidden.png
 
 #endif //FF_EMAIL_FRAMEWORK
 
--- a/emailuis/emailui/sis/commonemail.pkg	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/sis/commonemail.pkg	Thu Jul 15 18:19:25 2010 +0300
@@ -67,16 +67,22 @@
 "\epoc32\data\Z\private\10202BE9\2001E277.txt"                   - "c:\private\10202be9\2001E277.txt"
 "\epoc32\data\Z\private\2001E277\backup_registration.xml"        - "c:\private\2001E277\backup_registration.xml"
 
-"\epoc32\data\z\private\2001E277\HtmlFile\attachment.gif"        - "c:\private\2001E277\HtmlFile\attachment.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\email.html"            - "c:\private\2001E277\HtmlFile\email.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"        - "c:\private\2001E277\HtmlFile\email_rtl.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\header.js"             - "c:\private\2001E277\HtmlFile\header.js"
-"\epoc32\data\z\private\2001E277\HtmlFile\plus.gif"              - "c:\private\2001E277\HtmlFile\plus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\minus.gif"             - "c:\private\2001E277\HtmlFile\minus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"         - "c:\private\2001E277\HtmlFile\follow_up.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png" - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_high_add.png"     - "c:\private\2001E277\HtmlFile\todo_high_add.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_low_add.png"      - "c:\private\2001E277\HtmlFile\todo_low_add.png"
+; HTML viewer
+"\epoc32\data\z\private\2001E277\HtmlFile\email.html"               - "c:\private\2001E277\HtmlFile\email.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"           - "c:\private\2001E277\HtmlFile\email_rtl.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.js"                - "c:\private\2001E277\HtmlFile\header.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.css"               - "c:\private\2001E277\HtmlFile\header.css"
+"\epoc32\data\z\private\2001E277\HtmlFile\email.js"                 - "c:\private\2001E277\HtmlFile\email.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"            - "c:\private\2001E277\HtmlFile\follow_up.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png"   - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_right.png"            - "c:\private\2001E277\HtmlFile\btn_right.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_left.png"             - "c:\private\2001E277\HtmlFile\btn_left.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_high.png"        - "c:\private\2001E277\HtmlFile\priority_high.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_low.png"         - "c:\private\2001E277\HtmlFile\priority_low.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\attachment.png"           - "c:\private\2001E277\HtmlFile\attachment.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\hidden.png"               - "c:\private\2001E277\HtmlFile\hidden.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\expand.png"               - "c:\private\2001E277\HtmlFile\expand.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\collapse.png"             - "c:\private\2001E277\HtmlFile\collapse.png"
 
 ; Emailuis / gsemailsettings
 "\epoc32\release\armv5\urel\GSEmailSettingsPluginDll.dll"        - "c:\sys\bin\GSEmailSettingsPluginDll.dll"
--- a/emailuis/emailui/sis/commonemail_loc.pkg	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_loc.pkg	Thu Jul 15 18:19:25 2010 +0300
@@ -68,16 +68,22 @@
 "\epoc32\data\Z\private\10202BE9\2001E277.txt"                   - "c:\private\10202be9\2001E277.txt"
 "\epoc32\data\Z\private\2001E277\backup_registration.xml"        - "c:\private\2001E277\backup_registration.xml"
 
-"\epoc32\data\z\private\2001E277\HtmlFile\attachment.gif"        - "c:\private\2001E277\HtmlFile\attachment.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\email.html"            - "c:\private\2001E277\HtmlFile\email.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"        - "c:\private\2001E277\HtmlFile\email_rtl.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\header.js"             - "c:\private\2001E277\HtmlFile\header.js"
-"\epoc32\data\z\private\2001E277\HtmlFile\plus.gif"              - "c:\private\2001E277\HtmlFile\plus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\minus.gif"             - "c:\private\2001E277\HtmlFile\minus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"         - "c:\private\2001E277\HtmlFile\follow_up.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png" - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_high_add.png"     - "c:\private\2001E277\HtmlFile\todo_high_add.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_low_add.png"      - "c:\private\2001E277\HtmlFile\todo_low_add.png"
+; HTML viewer
+"\epoc32\data\z\private\2001E277\HtmlFile\email.html"               - "c:\private\2001E277\HtmlFile\email.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"           - "c:\private\2001E277\HtmlFile\email_rtl.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.js"                - "c:\private\2001E277\HtmlFile\header.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.css"               - "c:\private\2001E277\HtmlFile\header.css"
+"\epoc32\data\z\private\2001E277\HtmlFile\email.js"                 - "c:\private\2001E277\HtmlFile\email.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"            - "c:\private\2001E277\HtmlFile\follow_up.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png"   - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_right.png"            - "c:\private\2001E277\HtmlFile\btn_right.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_left.png"             - "c:\private\2001E277\HtmlFile\btn_left.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_high.png"        - "c:\private\2001E277\HtmlFile\priority_high.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_low.png"         - "c:\private\2001E277\HtmlFile\priority_low.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\attachment.png"           - "c:\private\2001E277\HtmlFile\attachment.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\hidden.png"               - "c:\private\2001E277\HtmlFile\hidden.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\expand.png"               - "c:\private\2001E277\HtmlFile\expand.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\collapse.png"             - "c:\private\2001E277\HtmlFile\collapse.png"
 
 ; Emailuis / gsemailsettings
 "\epoc32\release\armv5\urel\GSEmailSettingsPluginDll.dll"        - "c:\sys\bin\GSEmailSettingsPluginDll.dll"
--- a/emailuis/emailui/sis/commonemail_udeb.pkg	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_udeb.pkg	Thu Jul 15 18:19:25 2010 +0300
@@ -55,16 +55,22 @@
 "\epoc32\data\Z\private\10202BE9\2001E277.txt"                   - "c:\private\10202be9\2001E277.txt"
 "\epoc32\data\Z\private\2001E277\backup_registration.xml"        - "c:\private\2001E277\backup_registration.xml"
 
-"\epoc32\data\z\private\2001E277\HtmlFile\attachment.gif"        - "c:\private\2001E277\HtmlFile\attachment.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\email.html"            - "c:\private\2001E277\HtmlFile\email.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"        - "c:\private\2001E277\HtmlFile\email_rtl.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\header.js"             - "c:\private\2001E277\HtmlFile\header.js"
-"\epoc32\data\z\private\2001E277\HtmlFile\plus.gif"              - "c:\private\2001E277\HtmlFile\plus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\minus.gif"             - "c:\private\2001E277\HtmlFile\minus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"         - "c:\private\2001E277\HtmlFile\follow_up.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png" - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_high_add.png"     - "c:\private\2001E277\HtmlFile\todo_high_add.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_low_add.png"      - "c:\private\2001E277\HtmlFile\todo_low_add.png"
+; HTML viewer
+"\epoc32\data\z\private\2001E277\HtmlFile\email.html"               - "c:\private\2001E277\HtmlFile\email.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"           - "c:\private\2001E277\HtmlFile\email_rtl.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.js"                - "c:\private\2001E277\HtmlFile\header.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.css"               - "c:\private\2001E277\HtmlFile\header.css"
+"\epoc32\data\z\private\2001E277\HtmlFile\email.js"                 - "c:\private\2001E277\HtmlFile\email.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"            - "c:\private\2001E277\HtmlFile\follow_up.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png"   - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_right.png"            - "c:\private\2001E277\HtmlFile\btn_right.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_left.png"             - "c:\private\2001E277\HtmlFile\btn_left.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_high.png"        - "c:\private\2001E277\HtmlFile\priority_high.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_low.png"         - "c:\private\2001E277\HtmlFile\priority_low.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\attachment.png"           - "c:\private\2001E277\HtmlFile\attachment.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\hidden.png"               - "c:\private\2001E277\HtmlFile\hidden.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\expand.png"               - "c:\private\2001E277\HtmlFile\expand.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\collapse.png"             - "c:\private\2001E277\HtmlFile\collapse.png"
 
 ; Emailuis / gsemailsettings
 "\epoc32\release\armv5\udeb\GSEmailSettingsPluginDll.dll"        - "c:\sys\bin\GSEmailSettingsPluginDll.dll"
--- a/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Thu Jul 15 18:19:25 2010 +0300
@@ -56,16 +56,22 @@
 "\epoc32\data\Z\private\10202BE9\2001E277.txt"                   - "c:\private\10202be9\2001E277.txt"
 "\epoc32\data\Z\private\2001E277\backup_registration.xml"        - "c:\private\2001E277\backup_registration.xml"
 
-"\epoc32\data\z\private\2001E277\HtmlFile\attachment.gif"        - "c:\private\2001E277\HtmlFile\attachment.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\email.html"            - "c:\private\2001E277\HtmlFile\email.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"        - "c:\private\2001E277\HtmlFile\email_rtl.html"
-"\epoc32\data\z\private\2001E277\HtmlFile\header.js"             - "c:\private\2001E277\HtmlFile\header.js"
-"\epoc32\data\z\private\2001E277\HtmlFile\plus.gif"              - "c:\private\2001E277\HtmlFile\plus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\minus.gif"             - "c:\private\2001E277\HtmlFile\minus.gif"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"         - "c:\private\2001E277\HtmlFile\follow_up.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png" - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_high_add.png"     - "c:\private\2001E277\HtmlFile\todo_high_add.png"
-"\epoc32\data\z\private\2001E277\HtmlFile\todo_low_add.png"      - "c:\private\2001E277\HtmlFile\todo_low_add.png"
+; HTML viewer
+"\epoc32\data\z\private\2001E277\HtmlFile\email.html"               - "c:\private\2001E277\HtmlFile\email.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\email_rtl.html"           - "c:\private\2001E277\HtmlFile\email_rtl.html"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.js"                - "c:\private\2001E277\HtmlFile\header.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\header.css"               - "c:\private\2001E277\HtmlFile\header.css"
+"\epoc32\data\z\private\2001E277\HtmlFile\email.js"                 - "c:\private\2001E277\HtmlFile\email.js"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up.png"            - "c:\private\2001E277\HtmlFile\follow_up.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\follow_up_complete.png"   - "c:\private\2001E277\HtmlFile\follow_up_complete.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_right.png"            - "c:\private\2001E277\HtmlFile\btn_right.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\btn_left.png"             - "c:\private\2001E277\HtmlFile\btn_left.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_high.png"        - "c:\private\2001E277\HtmlFile\priority_high.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\priority_low.png"         - "c:\private\2001E277\HtmlFile\priority_low.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\attachment.png"           - "c:\private\2001E277\HtmlFile\attachment.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\hidden.png"               - "c:\private\2001E277\HtmlFile\hidden.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\expand.png"               - "c:\private\2001E277\HtmlFile\expand.png"
+"\epoc32\data\z\private\2001E277\HtmlFile\collapse.png"             - "c:\private\2001E277\HtmlFile\collapse.png"
 
 ; Emailuis / gsemailsettings
 "\epoc32\release\armv5\udeb\GSEmailSettingsPluginDll.dll"        - "c:\sys\bin\GSEmailSettingsPluginDll.dll"
--- a/emailuis/emailui/src/FreestyleEmailUi.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUi.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -21,6 +21,10 @@
 #include "FreestyleEmailUiDocument.h"
 #include "FreestyleEmailUiConstants.h"
 #include <eikstart.h>
+#include <u32std.h>
+#include <MemoryManager.h>
+
+#define __USE_FAST_ALLOCATOR
 
 CApaDocument* CFreestyleEmailUiApplication::CreateDocumentL()
     {
@@ -41,10 +45,42 @@
     return new CFreestyleEmailUiApplication;
     }
 
+#ifdef __USE_FAST_ALLOCATOR
+EXPORT_C TInt UserHeap::SetupThreadHeap( TBool aSubThread, SStdEpocThreadCreateInfo& aInfo )
+    {
+    TInt error( KErrNone );
+    if (!aInfo.iAllocator && aInfo.iHeapInitialSize>0)
+        {
+        // new heap required
+        RHeap* pH = NULL;
+        error = CreateThreadHeap(aInfo, pH);
+        if (!error && !aSubThread)
+            {
+            // main thread - new allocator created and set as default heap
+            MemoryManager::CreateFastAllocator();
+            }
+        }
+    else if (aInfo.iAllocator)
+        {
+        // sharing a heap
+        RAllocator* pA = aInfo.iAllocator;
+        error = pA->Open();
+		if (!error)
+			{
+			User::SwitchAllocator(pA);
+			}
+        }
+    return error;
+    }
+#endif // __USE_FAST_ALLOCATOR
 
 GLDEF_C TInt E32Main()
     {
+#ifdef __USE_FAST_ALLOCATOR
+    // initialize MemmoryManager
+    MemoryManager::InitFastAllocator();
+#endif // __USE_FAST_ALLOCATOR
     return EikStart::RunApplication(NewApplication);
     }
-    
 
+
--- a/emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -13,19 +13,25 @@
 *
 * Description:  Implementation for status indicator
 *
-*/ 
+*/
 
 #include "FreestyleEmailUiAknStatusIndicator.h"
 
 #include <biditext.h>
 #include <AknIconUtils.h>
 #include <AknBidiTextUtils.h>
+#include <AknsUtils.h>
+#include <layoutmetadata.cdl.h>
 
 const TInt KImageMargin = 8;
 const TInt KTextMargin = 4;
-const TInt KRoundBoundaryEllipse = 5;
-const TInt KTuncationCharsWidth = 20;    
+const TInt KRoundBoundaryEllipse = 7;
+const TInt KTuncationCharsWidth = 20;
 
+const TInt KAnimationFps = 15;
+const TInt KAnimationDelayMs = 1000 / KAnimationFps;
+const TInt KSecondsPerFullRotation = 2;
+const TInt KPenSize = 2;
 
 CFreestyleEmailUiAknStatusIndicator* CFreestyleEmailUiAknStatusIndicator::NewL( const TRect& aRect, const CCoeControl* aParent )
     {
@@ -46,41 +52,48 @@
     {
     ClearImage();
     ClearText();
-    
+
     delete iTimer;
     }
 
-void CFreestyleEmailUiAknStatusIndicator::ShowIndicatorL( CFbsBitmap* aBitmap, 
+void CFreestyleEmailUiAknStatusIndicator::ShowIndicatorL( CFbsBitmap* aBitmap,
                                                           CFbsBitmap* aMaskBitmap,
                                                           TDesC* aText,
-                                                          TInt aDuration )
+                                                          TInt aDuration,
+                                                          const TBool aAnimate )
     {
     iTimer->Stop();
 
+    iAnimate = aAnimate;
     SetImage( aBitmap, aMaskBitmap );
     SetTextL( aText );
 
     MakeVisible( ETrue );
     DrawNow();
-    
+
     if ( aDuration >= 0 )
         {
         HideIndicator( aDuration );
         }
+    else if ( iAnimate )
+        {
+        iHideTimeout = KMaxTInt;
+        StartTimer( KAnimationDelayMs );
+        }
     }
 
 void CFreestyleEmailUiAknStatusIndicator::SetTextL( TDesC* aText )
     {
     SetTextFont();
 
-    ClearText();    
-    iText = aText; 
+    ClearText();
+    iText = aText;
     if ( iText )
         {
         iVisualText = HBufC::NewL( iText->Length() + KAknBidiExtraSpacePerLine );
         CalculateVisualText();
-        }    
-    
+        }
+
     if ( IsVisible() )
         {
         DrawNow();
@@ -89,18 +102,34 @@
 
 void CFreestyleEmailUiAknStatusIndicator::HideIndicator( TInt aDelayBeforeHidingInMs )
     {
-    iTimer->Stop();
-    
-    if ( aDelayBeforeHidingInMs == 0 )
+    if ( !aDelayBeforeHidingInMs )
         {
+        iTimer->Stop();
         MakeVisible( EFalse );
+        iAngle = 0;
         }
     else
         {
-        iTimer->Start( aDelayBeforeHidingInMs );
+        if (iAnimate)
+            {
+            iHideTimeout = aDelayBeforeHidingInMs / KAnimationDelayMs;
+            StartTimer( KAnimationDelayMs );
+            }
+        else
+            {
+            iHideTimeout = 0;
+            iTimer->Start( aDelayBeforeHidingInMs );
+            }
         }
     }
 
+void CFreestyleEmailUiAknStatusIndicator::StartTimer( const TInt aTimeOut )
+    {
+    iTimer->Stop();
+    iTimer->Start( aTimeOut );
+    }
+
+
 CCoeControl* CFreestyleEmailUiAknStatusIndicator::CFreestyleEmailUiAknStatusIndicator::ComponentControl( TInt /*aIndex*/ ) const
     {
     return NULL;
@@ -113,55 +142,60 @@
 
 void CFreestyleEmailUiAknStatusIndicator::Draw( const TRect& aRect ) const
     {
-    CWindowGc& gc = SystemGc();
-    gc.Clear( aRect );
-    
     DrawBoundary( aRect );
     DrawImage( iImageRect );
     DrawText( iTextRect );
     }
 
 void CFreestyleEmailUiAknStatusIndicator::SizeChanged()
-    {  
+    {
     CalculateLayout( Rect() );
     ScaleImage();
     CalculateVisualText();
     }
-    
+
 CFreestyleEmailUiAknStatusIndicator::CFreestyleEmailUiAknStatusIndicator()
     : iBitmap( NULL ),
     iMaskBitmap( NULL ),
     iText( NULL ),
     iVisualText( NULL ),
     iTextFont( NULL )
-    {    
+    {
     }
 
 void CFreestyleEmailUiAknStatusIndicator::ConstructL( const TRect& aRect, const CCoeControl* aParent )
     {
-    iTimer = CFSEmailUiGenericTimer::NewL( this ); 
-    
-    if ( !aParent )
+    iTimer = CFSEmailUiGenericTimer::NewL( this );
+   
+    if ( aParent )
+        {
+        SetContainerWindowL( *aParent );
+        }
+    else
         {
         CreateWindowL();
         }
-    else
-        {
-        SetContainerWindowL( *aParent );
-        }
-    
     SetRect( aRect );
     ActivateL();
-    
     MakeVisible( EFalse );
     }
 
 void CFreestyleEmailUiAknStatusIndicator::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
     {
-    HideIndicator();
+    if ( iAnimate && ( iHideTimeout == KMaxTInt || iHideTimeout-- > 0 ) )
+        {
+        StartTimer( KAnimationDelayMs );
+        iAngle -= 360 / (KAnimationFps * KSecondsPerFullRotation);
+        ScaleImage();
+        DrawDeferred();
+        }
+    else
+        {
+        HideIndicator();
+        }
     }
 
-void CFreestyleEmailUiAknStatusIndicator::CalculateLayout( const TRect& aRect ) const
+TRect CFreestyleEmailUiAknStatusIndicator::ImageRect( const TRect& aRect ) const
     {
     TSize imageSize = aRect.Size();
     imageSize.iHeight = imageSize.iHeight - 2 * KImageMargin;
@@ -174,36 +208,62 @@
         {
         imageSize.iHeight = imageSize.iWidth;
         }
-    
+
+    TPoint imageLeftTop;
+    if ( !Layout_Meta_Data::IsMirrored() )
+        {
+        imageLeftTop = TPoint( aRect.iTl.iX + KImageMargin, aRect.iTl.iY + KImageMargin );
+        }
+    else
+        {
+        imageLeftTop = TPoint( aRect.iBr.iX - KImageMargin - imageSize.iWidth, aRect.iTl.iY + KImageMargin );
+        }
+
+    return TRect( imageLeftTop, imageSize );
+    }
+
+TRect CFreestyleEmailUiAknStatusIndicator::TextRect( const TRect& aRect ) const
+    {
+    TSize imageSize = aRect.Size();
+    imageSize.iHeight = imageSize.iHeight - 2 * KImageMargin;
+    imageSize.iWidth = imageSize.iWidth - 2 * KImageMargin;
+    if ( imageSize.iWidth > imageSize.iHeight )
+        {
+        imageSize.iWidth = imageSize.iHeight;
+        }
+    else
+        {
+        imageSize.iHeight = imageSize.iWidth;
+        }
+
     TSize textSize = aRect.Size();
     textSize.iHeight = textSize.iHeight - 2 * KTextMargin;
     textSize.iWidth = textSize.iWidth - 2 * KTextMargin - 2 * KImageMargin - imageSize.iWidth;
-    
-    TLanguage language = User::Language();
-    TBidiText::TDirectionality  direction = TBidiText::ScriptDirectionality( language );    
-    if ( direction == TBidiText::ELeftToRight )
+
+    TPoint textLeftTop;
+    if ( !Layout_Meta_Data::IsMirrored() )
         {
-        TPoint imageLeftTop ( aRect.iTl.iX + KImageMargin, aRect.iTl.iY + KImageMargin );
-        iImageRect.SetRect( imageLeftTop, imageSize );    
-        
-        TPoint textLeftTop ( aRect.iTl.iX + 2*KImageMargin + imageSize.iWidth + KTextMargin, aRect.iTl.iY + KTextMargin );
-        iTextRect.SetRect( textLeftTop, textSize );    
+        textLeftTop = TPoint( aRect.iTl.iX + KImageMargin + imageSize.iWidth + KTextMargin, aRect.iTl.iY + KTextMargin );
         }
     else
         {
-        TPoint imageLeftTop ( aRect.iBr.iX - KImageMargin - imageSize.iWidth, aRect.iTl.iY + KImageMargin );
-        iImageRect.SetRect( imageLeftTop, imageSize );    
-        
-        TPoint textLeftTop ( aRect.iTl.iX + KTextMargin, aRect.iTl.iY + KTextMargin );
-        iTextRect.SetRect( textLeftTop, textSize );    
+        textLeftTop = TPoint( aRect.iTl.iX + KTextMargin, aRect.iTl.iY + KTextMargin );
         }
+
+    return TRect( textLeftTop, textSize );
+    }
+
+void CFreestyleEmailUiAknStatusIndicator::CalculateLayout( const TRect& aRect ) const
+    {
+    iImageRect = ImageRect( aRect );
+    iTextRect = TextRect( aRect );
     }
 
 void CFreestyleEmailUiAknStatusIndicator::SetTextFont() const
     {
     if ( iTextFont )
         return;
-    
+
     const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont );
     iTextFont = CONST_CAST( CFont*, font );
     }
@@ -220,27 +280,65 @@
                                                   visualText,
                                                   *iTextFont,
                                                   MaxWidthInPixels,
-                                                  MaxClippedWidthInPixels );    
+                                                  MaxClippedWidthInPixels );
+        iVisualTextWidth = AknBidiTextUtils::MeasureTextBoundsWidth(
+            *iTextFont, *iVisualText, CFont::TMeasureTextInput::EFVisualOrder );
+        }
+    }
+
+TRgb CFreestyleEmailUiAknStatusIndicator::BackgroundColor() const
+    {
+    TRgb color;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    if ( AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnOtherColors, EAknsCIQsnOtherColorsCG22 ) )
+        {
+        // fallback to default value
+        color = TRgb(197, 197, 197);
         }
+    return color;
+    }
+
+TRgb CFreestyleEmailUiAknStatusIndicator::BorderColor() const
+    {
+    return KRgbBlack;
+    }
+
+TRgb CFreestyleEmailUiAknStatusIndicator::FontColor() const
+    {
+    TRgb color;
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    if ( AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG55 /*EAknsCIQsnTextColorsCG81*/ ) )
+        {
+        // fallback to default value
+        color = KRgbBlack;
+        }
+    return color;
     }
 
 void CFreestyleEmailUiAknStatusIndicator::DrawBoundary( const TRect& aRect ) const
     {
     CWindowGc& gc = SystemGc();
-    gc.SetPenColor( KRgbCyan );
+    gc.SetClippingRect( aRect );
+    gc.SetBrushColor( BackgroundColor() );
+    gc.SetPenColor( BorderColor() );
+    gc.SetPenSize( TSize(KPenSize, KPenSize) );
+    gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+    gc.SetPenStyle( CGraphicsContext::ESolidPen );
     TSize ellipse( KRoundBoundaryEllipse, KRoundBoundaryEllipse );
-    gc.DrawRoundRect( aRect, ellipse);
+    TRect roundRect( aRect );
+    roundRect.Shrink( 2, 2 );
+    gc.DrawRoundRect( roundRect, ellipse);
     }
 
 void CFreestyleEmailUiAknStatusIndicator::DrawImage( const TRect& aRect ) const
     {
     if ( !iBitmap )
         return;
-    
+
     CWindowGc& gc = SystemGc();
     if ( iMaskBitmap )
         {
-        TRect bmpPieceRect(TPoint(0,0), aRect.Size() ); 
+        TRect bmpPieceRect(TPoint(0,0), aRect.Size() );
         gc.BitBltMasked( aRect.iTl, iBitmap, bmpPieceRect, iMaskBitmap, EFalse );
         }
     else
@@ -255,29 +353,24 @@
         return;
     if ( iVisualText->Length() == 0 )
         return;
-    
-    TLanguage language = User::Language();
-    TBidiText::TDirectionality  direction = TBidiText::ScriptDirectionality( language );
-    
-    CGraphicsContext::TTextAlign alignment = CGraphicsContext::ELeft;
-    if ( direction == TBidiText::ERightToLeft )
-        {
-        alignment = CGraphicsContext::ERight;
-        }
-    
+
+    CGraphicsContext::TTextAlign alignment = Layout_Meta_Data::IsMirrored() ?
+        CGraphicsContext::ERight : CGraphicsContext::ELeft;
+
     CWindowGc& gc = SystemGc();
     gc.UseFont( iTextFont );
+    TInt baseline = aRect.Height() / 2 + iTextFont->FontMaxAscent() / 2;
+    gc.SetPenColor(FontColor());
 
-    TInt baseline = aRect.Height() / 2 + iTextFont->FontMaxAscent() / 2; 
-    
-    gc.SetPenColor(KRgbBlack);
-
-    gc.DrawText( *iVisualText, aRect, baseline, alignment, 0);
+    TRect drawRect( aRect );
+    drawRect.Shrink( (drawRect.Width() - iVisualTextWidth) / 2, 0 );
+    gc.DrawText( *iVisualText, drawRect, baseline, alignment, 0);
     }
 
 void CFreestyleEmailUiAknStatusIndicator::SetImage( CFbsBitmap* aBitmap, CFbsBitmap* aMaskBitmap )
     {
     ClearImage();
+    iAngle = 0;
     iBitmap = aBitmap;
     iMaskBitmap = aMaskBitmap;
     ScaleImage();
@@ -288,13 +381,8 @@
     if ( iBitmap )
         {
         AknIconUtils::DisableCompression( iBitmap );
-        AknIconUtils::SetSize( iBitmap, iImageRect.Size(), EAspectRatioPreserved );
+        AknIconUtils::SetSizeAndRotation( iBitmap, iImageRect.Size(), EAspectRatioPreserved, iAngle );
         }
-    if ( iMaskBitmap )
-        {
-        AknIconUtils::DisableCompression( iMaskBitmap );
-        AknIconUtils::SetSize( iMaskBitmap, iImageRect.Size(), EAspectRatioPreserved );
-        }    
     }
 
 void CFreestyleEmailUiAknStatusIndicator::ClearImage()
@@ -309,7 +397,7 @@
     {
     delete iText;
     iText = NULL;
-    
+
     delete iVisualText;
     iVisualText = NULL;
     }
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -878,12 +878,6 @@
         return;
         }
 
-    if ( iActiveMailbox ) 
-        {
-        StartMonitoringL(); // start connect automatically
-        SyncActiveMailBoxL(); // start sync
-        }
-
     // Do nothing if the externally activated view was already active
     if ( iCurrentActiveView->Id() != aViewId )
         {
@@ -3104,7 +3098,7 @@
                     (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) );
 
                 TSize iconSize = LayoutHandler()->statusPaneIconSize();
-                iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount;
+                iConnectionStatusIconAngle -= KConnectionStatusIconRotationAmount;
                 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
                 titlePane->DrawNow();
                 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval);
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -65,12 +65,12 @@
 _LIT8( KStartTag, "<html" );
 _LIT8( KHeadTag, "<head>");
 _LIT8( KHtmlHeader1, "<html><head><title></title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
-_LIT8( KHtmlHeader2, "\"/></head><body>\xD\xA");
+_LIT8( KHtmlHeader2, "\"/></head><body bgcolor=\"#ECECEC\">\xD\xA");
 _LIT8( KHtmlHeader3, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=%S\">\n");
 _LIT8( KHtmlEndTags, "\xD\xA</body></html>\xD\xA");
 _LIT8( KCharsetTag8, "charset");
 _LIT( KCharsetTag, "charset");
-_LIT8( KHTMLEmptyContent, "<HTML><BODY></BODY></HTML>");
+_LIT8( KHTMLEmptyContent, "<html><body></body></html>");
 _LIT( KHTMLDataScheme, "data:0");
 
 
@@ -86,6 +86,11 @@
 _LIT( KURLLoadImages, "cmail://loadImages/" );
 _LIT( KURLCollapseHeader, "cmail://collapseHeader/" );
 _LIT( KURLExpandHeader, "cmail://expandHeader/" );
+_LIT( KURLExpandItem, "cmail://expand_" );
+_LIT( KURLItemTo, "to" );
+_LIT( KURLItemCc, "cc" );
+_LIT( KURLItemBcc, "bcc" );
+_LIT( KURLItemAttachments, "attachments" );
 
 const TText KGreaterThan = 0x3e;
 const TText KLessThan = 0x3c;
@@ -101,14 +106,15 @@
 const TReal KOverlayButtonSizeLs = 0.20; // 25%
 
 
-const TInt KStatusIndicatorHeight = 50;
-const TInt KStatusIndicatorXMargin = 50;
+const TInt KStatusIndicatorHeight = 55;
+const TInt KStatusIndicatorXMargin = 58;
+const TInt KStatusIndicatorBottomMargin = 6;
 
 // CONSTANTS
 // Zoom levels available on the UI
 const TInt KZoomLevels[] = { 75, 100, 125, 150 };
 const TInt KZoomLevelCount = sizeof( KZoomLevels ) / sizeof( TInt );
-const TInt KZoomLevelIndex100 = 100; // 100 in array KZoomLevels
+const TInt KZoomLevelIndex100 = 1; // 100 in array KZoomLevels
 
 // CEUiHtmlViewerSettingsKeyListener
 
@@ -653,9 +659,8 @@
         }
     const TInt visibleWidth(iAppUi.ClientRect().Width());
     CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs, headerHtmlFile, visibleWidth, iScrollPosition,
-                                            iViewerSettings->AutoLoadImages() || iAppUi.DisplayImagesCache().Contains(*iMessage),
-                                            iHeaderExpanded );
-
+            iViewerSettings->AutoLoadImages() || iAppUi.DisplayImagesCache().Contains(*iMessage), iFlags );
+    
     // Remove all previously created files from temporary HTML folder
     EmptyTempHtmlFolderL();
 
@@ -713,7 +718,7 @@
     iLinkContents.Reset();
     iMessageParts.Reset();
     iMessage = NULL;
-    iHeaderExpanded = EFalse;
+    iFlags.ClearAll();
     iScrollPosition = 0;
     }
 
@@ -946,7 +951,7 @@
             CleanupStack::PushL( part );
             RFile contentFile = part->GetContentFileL();
             CleanupClosePushL( contentFile );
-            HBufC8* content = ReadContentFromFileLC( contentFile );
+            HBufC8* content = ReadContentFromFileLC( contentFile, *part );
             linkContent->HandleResolveComplete(
                 part->GetContentType(), KNullDesC(), content );
             CleanupStack::PopAndDestroy( content );
@@ -1126,7 +1131,7 @@
     CleanupClosePushL( htmlFile );
 
     // Read content from given source file
-    HBufC8* content = ReadContentFromFileLC( htmlFile );
+    HBufC8* content = ReadContentFromFileLC( htmlFile, aHtmlBodyPart );
 
     // Write content to target file
     WriteContentToFileL( *content, targetFileName, aHtmlBodyPart );
@@ -1148,13 +1153,33 @@
     targetFileName.Copy( iTempHtmlFolderPath );
     targetFileName.Append( aHtmlFileName );
 
-    HBufC* content = HBufC::NewLC( aTextBodyPart.FetchedContentSize() );
+    TInt contentsize = aTextBodyPart.FetchedContentSize();
+      
+    TInt limit(0);
+    TInt err = iViewerSettings->Repository().Get( KFreestyleMaxBodySize , limit );
+    limit *= KKilo; // cenrep value is in kB, 0 means unlimited
+
+    if ( limit == 0 || err )
+        {
+        limit = KMaxTInt;
+        }
+    
+    TInt size = Min(limit,contentsize);
+    HBufC* content = HBufC::NewLC( size );
     TPtr contentPtr( content->Des() );
 
     aTextBodyPart.GetContentToBufferL( contentPtr, 0 );
-
+    //When we found EFSMsgFlag_BodyTruncated was set, add "--Message too long--" in the end of plain html view
+    if ( limit < contentsize )
+    	{
+		 HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO );
+		 TInt pos = limit - addingText->Length();
+		 contentPtr.Replace(pos,addingText->Length(),*addingText);
+         CleanupStack::PopAndDestroy( addingText );
+         aTextBodyPart.SetFlag(EFSMsgFlag_BodyTruncated);
+    	}
+    
     ConvertToHTML( *content, targetFileName, aTextBodyPart );
-
     CleanupStack::PopAndDestroy( content );
 
     }
@@ -1163,11 +1188,29 @@
 // Reads given file content to buffer and return pointer to it
 // ---------------------------------------------------------------------------
 //
-HBufC8* CFsEmailUiHtmlViewerContainer::ReadContentFromFileLC( RFile& aFile )
+HBufC8* CFsEmailUiHtmlViewerContainer::ReadContentFromFileLC( RFile& aFile, CFSMailMessagePart& aHtmlBodyPart )
     {
     FUNC_LOG;
-    TInt size = 0;
-    User::LeaveIfError( aFile.Size( size ) );
+    TInt fileSize = 0;
+    
+    TInt limit(0);
+    TInt err = iViewerSettings->Repository().Get( KFreestyleMaxBodySize , limit );
+    limit *= KKilo; // cenrep value is in kB, 0 means unlimited
+
+    User::LeaveIfError( aFile.Size( fileSize ) );
+    if ( limit == 0 || err )
+        {
+        limit = KMaxTInt;
+        }
+
+    TInt size = Min( limit, fileSize ); // read no more than limit bytes..
+
+    
+    if ( size < fileSize )
+        {
+        aHtmlBodyPart.SetFlag( EFSMsgFlag_BodyTruncated );
+        }
+    
     HBufC8* buffer = HBufC8::NewLC( size );
     TPtr8 ptr = buffer->Des();
     User::LeaveIfError( aFile.Read( ptr, size ) );
@@ -1253,9 +1296,18 @@
 
         // Write the original content
         User::LeaveIfError( targetFile.Write( buffer ) );
-
+		//When we found EFSMsgFlag_BodyTruncated was set, add "--Message too long--" in the end of html view
+        if( aHtmlBodyPart.GetFlags()&EFSMsgFlag_BodyTruncated )
+        	{
+			HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO );
+			HBufC8* addingText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *addingText );       
+			CleanupStack::PopAndDestroy( addingText );
+			CleanupStack::PushL( addingText8 );
+			User::LeaveIfError( targetFile.Write( *addingText8 ) );
+			CleanupStack::PopAndDestroy( addingText8 );
+        	}
         // Write ending metadata if needed
-        if ( modificationNeeded )
+        if ( modificationNeeded || (aHtmlBodyPart.GetFlags()&EFSMsgFlag_BodyTruncated) )
             {
             INFO("Add end tags");
             User::LeaveIfError( targetFile.Write( KHtmlEndTags ) );
@@ -1363,7 +1415,7 @@
         {
         RFile attachmentFile = aAttachment.GetContentFileL();
         CleanupClosePushL( attachmentFile );
-        HBufC8* content = ReadContentFromFileLC( attachmentFile );
+        HBufC8* content = ReadContentFromFileLC( attachmentFile, aAttachment );
         aEmbeddedLinkContent.HandleResolveComplete(
             aAttachment.GetContentType(), KNullDesC(), content );
         CleanupStack::PopAndDestroy( content );
@@ -1609,9 +1661,9 @@
             TRAP_IGNORE( CFreestyleMessageHeaderHTML::ExportL( *iMessage, iFs,
                 headerHtmlFile, iAppUi.ClientRect().Width(), iScrollPosition,
                 iViewerSettings->AutoLoadImages() || iAppUi.DisplayImagesCache().Contains(*iMessage),
-                iHeaderExpanded ) )
-
-
+                iFlags ) )
+        
+        
         if(!iEventHandler->IsMenuVisible())
             {
             TRAP_IGNORE( ReloadPageL() );
@@ -1775,13 +1827,14 @@
 
 TRect CFsEmailUiHtmlViewerContainer::CalcAttachmentStatusRect()
     {
-    TRect rect = Rect();
+    TRect rect( Rect() );
     TPoint topLeft = rect.iTl;
     TPoint bottomRight = rect.iBr;
-
     TPoint statusTopLeft( topLeft.iX + KStatusIndicatorXMargin, bottomRight.iY - KStatusIndicatorHeight + 1 );
     TPoint statusBottomRight( bottomRight.iX - KStatusIndicatorXMargin, bottomRight.iY );
-    return TRect( statusTopLeft, statusBottomRight );
+    rect = TRect(statusTopLeft, statusBottomRight);
+    rect.Move(0, -KStatusIndicatorBottomMargin);
+    return rect;
     }
 
 void CFsEmailUiHtmlViewerContainer::TouchFeedback()
@@ -1822,16 +1875,35 @@
         else if (aUrl.Compare(KURLCollapseHeader()) == 0)
             {
             TouchFeedback();
-            iHeaderExpanded = EFalse;
+            iFlags.ClearAll();
             return ETrue;
             }
         else if (aUrl.Compare(KURLExpandHeader()) == 0)
             {
             TouchFeedback();
-            iHeaderExpanded = ETrue;
-            return ETrue;
+            iFlags.Set( CFreestyleMessageHeaderHTML::EHeaderExpanded );
+            return ETrue;        
             }
-        else if (aUrl.Left(index).CompareF(KURLSchemeCmail) == 0)
+        else if ( aUrl.Find( KURLExpandItem() ) == 0 ) {
+            const TPtrC item( aUrl.Mid( KURLExpandItem().Length() ) );
+            if ( item.Find( KURLItemTo() ) == 0 )
+                {
+                iFlags.Assign( CFreestyleMessageHeaderHTML::EToExpanded, ETrue );
+                }
+            else if ( item.Find( KURLItemCc() ) == 0 )
+                {
+                iFlags.Assign( CFreestyleMessageHeaderHTML::ECcExpanded, ETrue );
+                }
+            else if ( item.Find( KURLItemBcc() ) == 0 )
+                {
+                iFlags.Assign( CFreestyleMessageHeaderHTML::EBccExpanded, ETrue );
+                }
+            else if ( item.Find( KURLItemAttachments() ) == 0 )
+                {
+                iFlags.Assign( CFreestyleMessageHeaderHTML::EAttachmentExpanded, ETrue );
+                }            
+            return ETrue;        
+        } else if (aUrl.Left(index).CompareF(KURLSchemeCmail) == 0)
             {
             TInt bodyIndex = aUrl.Find(KURLTypeBody);
             if (bodyIndex == KErrNotFound)
@@ -2010,7 +2082,7 @@
     HBufC* statusText = NULL;
     statusText = StringLoader::LoadL(R_FREESTYLE_EMAIL_UI_VIEWER_FETCHING_CONTENT_TEXT);
     iAppUi.FsTextureManager()->ProvideBitmapL(EStatusTextureSynchronising, image, imageMask );
-    iStatusIndicator->ShowIndicatorL( image, imageMask, statusText, aDuration );
+    iStatusIndicator->ShowIndicatorL( image, imageMask, statusText, aDuration, ETrue );
     }
 
 void CFsEmailUiHtmlViewerContainer::MailListModelUpdatedL()
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -63,11 +63,12 @@
 #include "FSDelayedLoader.h"
 #include "FreestyleMessageHeaderURL.h"
 #include "FreestyleEmailUiAknStatusIndicator.h"
-#include <akntoolbar.h>
+
+#include <eiksoftkeyimage.h>
 
-CFsEmailUiHtmlViewerView* CFsEmailUiHtmlViewerView::NewL( 
+CFsEmailUiHtmlViewerView* CFsEmailUiHtmlViewerView::NewL(
     CAlfEnv& aEnv,
-    CFreestyleEmailUiAppUi& aAppUi, 
+    CFreestyleEmailUiAppUi& aAppUi,
     CAlfControlGroup& aControlGroup )
     {
     FUNC_LOG;
@@ -79,7 +80,7 @@
     }
 
 CFsEmailUiHtmlViewerView::CFsEmailUiHtmlViewerView( CAlfEnv& aEnv,
-        CFreestyleEmailUiAppUi& aAppUi, 
+        CFreestyleEmailUiAppUi& aAppUi,
         CAlfControlGroup& aControlGroup )
         : CFsEmailUiViewBase( aControlGroup, aAppUi ),
         iEnv( aEnv )
@@ -96,14 +97,12 @@
         iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
         }
 
-    // <cmail>
     if ( iContainer )
         {
         iContainer->PrepareForExit();
         }
 
     delete iNewMailTempAddress;
-    // </cmail>
     if ( iContainer )
         {
         iContainer->CancelFetch();
@@ -116,8 +115,8 @@
     delete iEmbeddedMessages;
     iEmbeddedMessages = NULL;
     iMessage = NULL;
-    
-    delete iMailBox; 
+
+    delete iMailBox;
     iMailBox = NULL;
     delete iAsyncCallback;
     }
@@ -125,11 +124,11 @@
 void CFsEmailUiHtmlViewerView::ConstructL()
     {
     FUNC_LOG;
-    BaseConstructL( R_FSEMAILUI_HTML_VIEW );
+    BaseConstructL( R_FSEMAILUI_HTML_VIEW_FULLSCREEN );
     iAsyncCallback = new (ELeave) CAsyncCallBack( CActive::EPriorityLow );
     iOpenMessages = new (ELeave) CStack<CFSMailMessage, ETrue>();
     iEmbeddedMessages = new (ELeave) CStack<CFSMailMessage, EFalse>();
-    iNextOrPrevMessageSelected = EFalse; 
+    iNextOrPrevMessageSelected = EFalse;
     iForwardingMessage = EFalse;
     iMessageIsDeleted = EFalse;
     }
@@ -223,7 +222,7 @@
                         CleanupStack::PushL( handler );
                         handler->HandleUrlStandaloneL();
                         CleanupStack::PopAndDestroy( handler );
-                        CleanupStack::PopAndDestroy( url );                                     
+                        CleanupStack::PopAndDestroy( url );
                         }
                     break;
                     case TBrCtlDefs::EElementNone:
@@ -318,7 +317,7 @@
                     params.iMailBoxId = iMessage->GetMailBoxId();
                     params.iFolderId = iMessage->GetFolderId();
                     params.iMessageId = iMessage->GetMessageId();
-                    
+
                     // use package buffer to pass the params
                     TPckgBuf<TAttachmentListActivationData> buf( params );
                     TUid emptyCustomMessageId = { 0 };
@@ -364,12 +363,12 @@
                  {
                  if ( iMessage )
                      {
-                     
+
                      if ( iActivationData.iEmbeddedMessageMode )
                          {
                          iCreateNewMsgFromEmbeddedMsg = ETrue;
                          }
-                     
+
                      HBufC* mailAddress=iMessage->GetSender()->GetEmailAddress().AllocLC();
                      delete iNewMailTempAddress;
                      iNewMailTempAddress = NULL;
@@ -392,7 +391,7 @@
             break;
             }
         }
-    TIMESTAMP( "Html viewer selected operation done" );    
+    TIMESTAMP( "Html viewer selected operation done" );
     }
 
 // ---------------------------------------------------------------------------
@@ -477,13 +476,13 @@
 
     TBool msgBodyStructurePresent ( EFalse );
     TBool msgBodyContentPresent ( EFalse );
-    
+
     if( aCustomMessageId != KHtmlViewerReturnToPrevious)
      {
      ViewEntered( aPrevViewId );
      }
 
-    if ( iMrObserverToInform && 
+    if ( iMrObserverToInform &&
          aCustomMessageId == KStartViewerReturnToPreviousMsg )
         {
         // If returning from view launched by MRUI, complete the ongoing
@@ -515,7 +514,7 @@
         }
 
     CleanupClosePushL( iActivationData.iFile );
-    
+
     if ( !iMessage && iContainer )
         {
         iContainer->ResetContent();
@@ -523,14 +522,14 @@
         iContainer->CancelFetch();
         iContainer->ClearCacheAndLoadEmptyContent();
         }
-    
+
     if ( !iContainer )
         {
         iContainer = CFsEmailUiHtmlViewerContainer::NewL( iAppUi, *this );
         }
-   
+
     // Check whether this activation is actually for a meeting request
-    TBool openedInMrViewer( EFalse );    
+    TBool openedInMrViewer( EFalse );
     if ( THtmlViewerActivationData::EMailMessage == iActivationData.iActivationDataType )
         {
         openedInMrViewer = IsOpenedInMRViewerL();
@@ -539,25 +538,25 @@
     if ( openedInMrViewer )
         {
         // The previous contents are cleared (otherwise they are shown just
-        // before the meeting request viewer kicks in, especially annoying 
+        // before the meeting request viewer kicks in, especially annoying
         // when navigating between prev/next meeting requests by using navi
         // decorator array buttons.
         iContainer->ClearCacheAndLoadEmptyContent();
         ClearMailViewer();
         }
-    
+
     ShowContainerL();
-        
+
     switch ( iActivationData.iActivationDataType )
         {
         case THtmlViewerActivationData::EMailMessage:
             {
-                
+
             if ( iMessage && iAppUi.DownloadInfoMediator() )
                 {
                 iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
                 }
-            
+
             //clean message stack which owns object iMessage
             EraseMessageStack();
             iMessage = NULL;
@@ -566,14 +565,12 @@
             iActivationData.iFolderId,
             iActivationData.iMessageId,
             EFSMsgDataEnvelope  );
-            
-            UpdateToolbarL();
 
             if ( iMessage && iAppUi.DownloadInfoMediator() )
                 {
                 iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
                 }
-            
+
             delete iAttachmentsListModel;
             iAttachmentsListModel = NULL;
 
@@ -586,13 +583,17 @@
                     PushMessageL( iMessage, EFalse );
                     }
 
-                if ( openedInMrViewer )       
+                if ( openedInMrViewer )
                     {
+                    iContainer->DisplayStatusIndicatorL();
+                    iAppUi.GetMailClient()->PrepareMrDescriptionL( iActivationData.iMailBoxId,
+                                                                   iActivationData.iMessageId );
+
                     // Setting MSK empty. This blocks unwanted MSK keypresses before MrViewer is initialized.
                     ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
                     iMrUiActive = ETrue;
-                    iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );  
-                    }                              
+                    iAppUi.MrViewerInstanceL()->ExecuteViewL( *iMessage, *this );
+                    }
                 else
                     {
                     // Attachment list model is not created when opening mrViewer, so attachment options menu is
@@ -602,18 +603,18 @@
                     iAttachmentsListModel->UpdateListL( msgPartData );
                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
                     LoadContentFromMailMessageL( iMessage, ETrue );
-                    }                
+                    }
                 }
             else
                 {
                 User::Leave( KErrNotFound );
                 }
-            
+
             if ( aCustomMessageId != KStartViewerReturnToPreviousMsg && iMessage )
                 {
                 delete iMailBox; iMailBox = NULL;
                 iMailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
-                
+
                 // Change active mailbox if necessary
                 if ( !iMessage->GetMailBoxId().IsNullId() )
                     {
@@ -629,30 +630,27 @@
                 {
                 PushMessageL(iActivationData.iEmbeddedMessage, ETrue);
                 }
-            
+
             iMessage = iOpenMessages->Head();
             iCreateNewMsgFromEmbeddedMsg = EFalse;
-            
+
             delete iAttachmentsListModel;
             iAttachmentsListModel = NULL;
             iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
-            
+
             if ( iOpenMessages->Head()== iOpenMessages->Last() )
                 {
                 TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
                 iAttachmentsListModel->UpdateListL( msgPartData );
-                                
+
                 }
             else{
-                iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );         
-                }                
-            
+                iAttachmentsListModel->UpdateListL( iOpenMessages->Head() );
+                }
+
             CheckMessageBodyL( *iOpenMessages->Head(), msgBodyStructurePresent, msgBodyContentPresent );
             LoadContentFromMailMessageL( iOpenMessages->Head(), ETrue );
-            
-            // update tool bar as some action menu boton should not appear in embbeded messages.
-            UpdateToolbarL();
-            
+
             }
         break;
         case THtmlViewerActivationData::EFile:
@@ -671,17 +669,17 @@
             }
         break;
         }
-    
+
     CleanupStack::PopAndDestroy( &iActivationData.iFile );
     SetMskL();
-    
+
     if(iMessage)
         {
         CFSMailAddress* address = iMessage->GetSender();
         if ( address )
             {
             HBufC* displayName = address->GetDisplayName().AllocLC();
-            
+
             if ( displayName->Length() )
                 {
                 iAppUi.SetTitlePaneTextL( *displayName );
@@ -695,7 +693,7 @@
         CleanupStack::PopAndDestroy( displayName );
             }
         }
-    
+
     if ( !openedInMrViewer && iMessage)
         {
         CFSMailMessagePart* htmlBodyPart = iMessage->HtmlBodyPartL();
@@ -716,7 +714,7 @@
             StartWaitedFetchingL(EMessageStructure);
             iFetchingAlready = ETrue;
             }
-        else 
+        else
             {
             if ( msgBodyStructurePresent && !msgBodyContentPresent )
                 {
@@ -732,88 +730,14 @@
        }
     iNextOrPrevMessageSelected = EFalse;
     iForwardingMessage = EFalse;
-    
+
     //update rect only if it has changed from previous time.
     if ( iContainer->Rect() != ContainerRect()  )
         {
         iContainer->SetRect( ContainerRect() );
         }
-    
-    TIMESTAMP( "Html viewer opened" );    
-    }
 
-// -----------------------------------------------------------------------------
-// CFsEmailUiHtmlViewerView::OfferToolbarEventL
-// -----------------------------------------------------------------------------
-void CFsEmailUiHtmlViewerView::OfferToolbarEventL( TInt aCommand )
-    {
-    FUNC_LOG;
-    switch (aCommand)
-        {
-        case EFsEmailUiTbCmdReply:
-            {
-            HandleCommandL(EFsEmailUiCmdActionsReply);
-            break;
-            }
-
-        case EFsEmailUiTbCmdForward:
-            {
-            HandleCommandL(EFsEmailUiCmdActionsForward);
-            break;
-            }
-        case EFsEmailUiTbCmdDelete:
-            {
-            iAsyncCallback->Cancel();
-            iAsyncCallback->Set( TCallBack( DeleteMail, this ) );
-            iAsyncCallback->SetPriority( CActive::EPriorityHigh );
-            iAsyncCallback->CallBack();
-            break;
-            }
-        case EFsEmailUiTbCmdReplyAll:
-            {
-            HandleCommandL(EFsEmailUiCmdActionsReplyAll);
-            break;
-            }
-        default:
-            break;
-        }
-    }
-
-// -----------------------------------------------------------------------------
-// CFsEmailUiHtmlViewerView::ToolbarResourceId
-// -----------------------------------------------------------------------------
-TInt CFsEmailUiHtmlViewerView::ToolbarResourceId() const
-    {
-    TInt resourceId( R_FREESTYLE_EMAIL_UI_TOOLBAR_HTML_MESSAGE_VIEWER_NO_REPLY_ALL );
-    if (iMessage)
-        {
-        if (!iActivationData.iEmbeddedMessageMode && 
-                TFsEmailUiUtility::CountRecipientsSmart( iAppUi, iMessage ) > 1)
-            {            
-            resourceId = R_FREESTYLE_EMAIL_UI_TOOLBAR_HTML_MESSAGE_VIEWER;
-            }
-        }    
-    return resourceId;
-    }
-
-// -----------------------------------------------------------------------------
-// CFsEmailUiHtmlViewerView::GetInitiallyDimmedItemsL
-// -----------------------------------------------------------------------------
-void CFsEmailUiHtmlViewerView::GetInitiallyDimmedItemsL( const TInt aResourceId,
-                RArray<TInt>& aDimmedItems ) const
-    {
-    if ( R_FREESTYLE_EMAIL_UI_TOOLBAR_HTML_MESSAGE_VIEWER == aResourceId || 
-         R_FREESTYLE_EMAIL_UI_TOOLBAR_HTML_MESSAGE_VIEWER_NO_REPLY_ALL == aResourceId )
-        {
-        if ( iActivationData.iEmbeddedMessageMode )
-            {
-            aDimmedItems.AppendL(EFsEmailUiTbCmdActions);
-            aDimmedItems.AppendL(EFsEmailUiTbCmdDelete);
-            aDimmedItems.AppendL(EFsEmailUiTbCmdReply);
-            aDimmedItems.AppendL(EFsEmailUiTbCmdForward);
-            aDimmedItems.AppendL(EFsEmailUiTbCmdReplyAll);
-            }
-        }
+    TIMESTAMP( "Html viewer opened" );
     }
 
 // -----------------------------------------------------------------------------
@@ -844,7 +768,6 @@
                 iContainer->ClearCacheAndLoadEmptyContent();
             }
         }
-    Toolbar()->SetToolbarObserver( this );
     iMessage = NULL;
     }
 
@@ -854,7 +777,7 @@
     delete iMessage;
     iMessage = NULL;
     CancelFetchings();
-    
+
     if ( iFlagSelectionHandler )
         {
         iFlagSelectionHandler->Cancel();
@@ -870,7 +793,7 @@
 void CFsEmailUiHtmlViewerView::NavigateBackL()
     {
     FUNC_LOG;
-    // clean up current message 
+    // clean up current message
     if ( iMessage && iAppUi.DownloadInfoMediator() )
         {
         iAppUi.DownloadInfoMediator()->StopObserving( this, iMessage->GetMessageId() );
@@ -886,7 +809,7 @@
         delete tmp;
         tmp = NULL;
         }
-    
+
     if ( iFlagSelectionHandler )
         {
         iFlagSelectionHandler->Cancel();
@@ -897,13 +820,13 @@
     // Return to previous message in the stack if there is still some left
     if ( !iOpenMessages->IsEmpty() )
         {
-       
-        THtmlViewerActivationData htmlData; 
+
+        THtmlViewerActivationData htmlData;
         if ( iOpenMessages->Head()!= iOpenMessages->Last() )
             {
             htmlData.iActivationDataType = THtmlViewerActivationData::EmbeddedEmailMessage;
             htmlData.iEmbeddedMessageMode = ETrue;
-           
+
             }
         else
             {
@@ -912,10 +835,10 @@
             htmlData.iFolderId  = iOpenMessages->Head()->GetFolderId();
             htmlData.iMessageId = iOpenMessages->Head()->GetMessageId();
             }
-        
+
         TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
         iAppUi.EnterFsEmailViewL( HtmlViewerId, KStartViewerReturnFromEmbeddedMsg, pckgData );
-      
+
         }
     // In usual case we use the base view implementation
     else
@@ -933,23 +856,52 @@
     }
 
 // ---------------------------------------------------------------------------
+// Wrapper for implementation in view base class
+// ---------------------------------------------------------------------------
+//
+void CFsEmailUiHtmlViewerView::ChangeMskCommandL( TInt /*aLabelResourceId*/ )
+    {
+    CEikButtonGroupContainer* cba( Cba() );
+    if ( cba )
+			{
+      cba->SetCommandSetL( R_FREESTYLE_EMAUIL_UI_SK_OPTIONS_BACK_FULLSCREEN );
+      CEikCba* eikCba( static_cast< CEikCba* >( cba->ButtonGroup() ) );
+      TFileName filename;
+			TFsEmailUiUtility::GetFullIconFileNameL( filename );
+		  if (iActivationData.iEmbeddedMessageMode)
+		  	{
+	      eikCba->UpdateMSKIconL( KAknsIIDQsnIconColors,  filename,
+	          EMbmFreestyleemailuiQgn_graf_cmail_blank,
+	          EMbmFreestyleemailuiQgn_graf_cmail_blank_mask, ETrue );
+		  	}
+		  else
+		    {
+	      eikCba->UpdateMSKIconL( KAknsIIDQsnIconColors,  filename,
+	          EMbmFreestyleemailuiQgn_prop_cmail_action_delete,
+	          EMbmFreestyleemailuiQgn_prop_cmail_action_delete_mask, ETrue );
+	      }
+      }
+    }
+
+// ---------------------------------------------------------------------------
+// Sets status bar layout
+// ---------------------------------------------------------------------------
+//
+TBool CFsEmailUiHtmlViewerView::IsStatusPaneVisible() const
+    {
+    return EFalse;
+    }
+
+// ---------------------------------------------------------------------------
 // Sets status bar layout
 // ---------------------------------------------------------------------------
 //
 void CFsEmailUiHtmlViewerView::SetStatusBarLayout()
     {
-    TInt res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT;
-    if( Layout_Meta_Data::IsLandscapeOrientation() )
-        {
-        // landscape must use different layout
-		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
-        }
-
-    if( StatusPane()->CurrentLayoutResId() != res )
-        {
-        TRAP_IGNORE(
-            StatusPane()->SwitchLayoutL( res ));
-        }
+    if( StatusPane()->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT )
+       {
+       TRAP_IGNORE( StatusPane()->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT ) );
+       }
     }
 
 void CFsEmailUiHtmlViewerView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
@@ -960,29 +912,25 @@
         {
         // Pinch zoom only
         aMenuPane->SetItemDimmed( EFsEmailUiCmdZoomLevel, ETrue );
-    
+
         if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
             {
             // remove help support in pf5250
-            aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
-            }   
-        
-        TBool toolbarExists = EFalse;
-        if( iAppUi.CurrentFixedToolbar() )
-            {
-            toolbarExists = iAppUi.CurrentFixedToolbar()->IsVisible();
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);
             }
-        
+
+        const TBool toolbarExists( EFalse );
+
         // Some commands are blocked when viewing embedded message object
         // or separate HTML file.
         const TBool blockCmds( !iMessage || iActivationData.iEmbeddedMessageMode || toolbarExists );
         const TBool blockReplyALLCmd( toolbarExists || !iMessage || iActivationData.iEmbeddedMessageMode ||
-                TFsEmailUiUtility::CountRecipientsSmart( iAppUi, iMessage ) < 2 );       
+                TFsEmailUiUtility::CountRecipientsSmart( iAppUi, iMessage ) < 2 );
         aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReply, blockCmds );
         aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, blockReplyALLCmd );
         aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsForward, blockCmds );
         aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsDelete, blockCmds );
-        
+
         if( iActivationData.iEmbeddedMessageMode )
             {
             aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, ETrue );
@@ -990,7 +938,7 @@
             aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsMoveMessage, ETrue );
             aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsFlag, ETrue );
             }
-        
+
         TBool hideNext = !ShowNextMessageMenuInOptions();
         TBool blockNextCmd = !iMessage || iActivationData.iEmbeddedMessageMode || hideNext;
         TInt menuPos;
@@ -1004,16 +952,16 @@
             {
             aMenuPane->SetItemDimmed( EFsEmailUiCmdPreviousMessage, blockPrevCmd );
             }
-        
+
         CFSMailFolder* currentFolder = NULL;
         if ( iMessage )
             {
-            TRAP_IGNORE( currentFolder = 
+            TRAP_IGNORE( currentFolder =
                 iAppUi.GetMailClient()->GetFolderByUidL(
-                        iMessage->GetMailBoxId(), 
+                        iMessage->GetMailBoxId(),
                         iMessage->GetFolderId() ) );
             }
-      
+
         if ( currentFolder &&
              currentFolder->GetFolderType() != EFSOutbox )
             {
@@ -1021,14 +969,14 @@
             TBool messageIsRead( iMessage->IsFlagSet( EFSMsgFlag_Read ) );
             aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsRead, messageIsRead );
             aMenuPane->SetItemDimmed( EFsEmailUiCmdMarkAsUnread, !messageIsRead );
-            
+
             // Move to another folder option
-            aMenuPane->SetItemDimmed( 
-                    EFsEmailUiCmdActionsMoveMessage, 
+            aMenuPane->SetItemDimmed(
+                    EFsEmailUiCmdActionsMoveMessage,
                     !iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaMoveToFolder ) );
 
             // Follow-up flag option
-            aMenuPane->SetItemDimmed( 
+            aMenuPane->SetItemDimmed(
                     EFsEmailUiCmdActionsFlag,
                     !( iMailBox && TFsEmailUiUtility::IsFollowUpSupported( *iMailBox ) ) );
             }
@@ -1050,7 +998,7 @@
     iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane,
             CFSEmailUiShortcutBinding::EContextHtmlViewer );
     }
-    
+
 // -----------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::HandleMrCommandL
 // Handle accept/decline/tentative/remove commands given for meeting request
@@ -1063,7 +1011,7 @@
     TFSMailMsgId aMessageId )
     {
     FUNC_LOG;
-    ///any init required? 
+    ///any init required?
     UpdateMessagePtrL( aMailboxId, aFolderId, aMessageId );
 
     if ( aCommandId == EFsEmailUiCmdCalRemoveFromCalendar && iMessage )
@@ -1097,14 +1045,14 @@
 void CFsEmailUiHtmlViewerView::HandleStatusPaneSizeChange()
     {
     CFsEmailUiViewBase::HandleStatusPaneSizeChange();
-	
+
 	HandleViewRectChange();
     }
 
 void CFsEmailUiHtmlViewerView::HandleViewRectChange()
     {
     CFsEmailUiViewBase::HandleViewRectChange();
-     
+
      if ( iContainer )
          {
          iContainer->SetRect( ContainerRect() );
@@ -1114,12 +1062,12 @@
 void CFsEmailUiHtmlViewerView::HandleDynamicVariantSwitchL( CFsEmailUiViewBase::TDynamicSwitchType aType )
     {
     FUNC_LOG;
-    
+
     if ( aType == EScreenLayoutChanged )
         {
         SetStatusBarLayout();
         }
-    
+
     if ( iContainer )
         {
         iContainer->SetRect( ContainerRect() );
@@ -1127,22 +1075,10 @@
         }
     }
 
-TRect  CFsEmailUiHtmlViewerView::ContainerRect() const
+TRect CFsEmailUiHtmlViewerView::ContainerRect() const
     {
-    TRect rect = ClientRect();
-    
-    CAknToolbar* toolbar = iAppUi.CurrentFixedToolbar();
-    if( toolbar && toolbar->IsVisible() && Layout_Meta_Data::IsLandscapeOrientation() )
-        {
-        TPoint pos = toolbar->PositionRelativeToScreen();
-        
-        // In some LS status pane layouts the toolbar will be shown on top of the client area
-        if( pos.iX > 0 )
-            {
-            rect.iBr.iX = pos.iX;
-            }
-        }
-    return rect; 
+    TRect rect( ClientRect() );
+    return rect;
     }
 
 void CFsEmailUiHtmlViewerView::LoadContentFromFileL( const TDesC& aFileName )
@@ -1211,7 +1147,7 @@
 
     TInt reallyDelete( ETrue );
 
-    if ( iAppUi.GetCRHandler()->WarnBeforeDelete() && 
+    if ( iAppUi.GetCRHandler()->WarnBeforeDelete() &&
          !aSilentDelete )
         {
         reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
@@ -1228,43 +1164,43 @@
             HideContainer();
             iContainer->ResetContent();
             }
-        
+
         RArray<TFSMailMsgId> msgIds;
         CleanupClosePushL( msgIds );
-            
+
         msgIds.Append( currentMsgId );
         TFSMailMsgId mailBox = iMessage->GetMailBoxId();
-        TFSMailMsgId folderId = iMessage->GetFolderId();        
- 
-        //Get the id and check if there is a previous message available 
+        TFSMailMsgId folderId = iMessage->GetFolderId();
+
+        //Get the id and check if there is a previous message available
         TFSMailMsgId prevMsgId;
-        TFSMailMsgId prevMsgFolderId;  
-        
+        TFSMailMsgId prevMsgFolderId;
+
         //Get the previous message if it exists
-        TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId, 
-                                                   prevMsgId, 
+        TBool available = iAppUi.IsPreviousMsgAvailable( currentMsgId,
+                                                   prevMsgId,
                                                    prevMsgFolderId );
-        
+
         //Delete the message
-        iLastDeletedMessageID = iMessage->GetMessageId(); 
+        iLastDeletedMessageID = iMessage->GetMessageId();
         iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
         CleanupStack::PopAndDestroy( &msgIds );
 
         // Notify appui of deleted mail item
-        SendEventToAppUiL( TFSEventMailDeletedFromViewer ); 
-        
-       
+        SendEventToAppUiL( TFSEventMailDeletedFromViewer );
+
+
         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
-            {   
+            {
             //Open the previous message or navigate back to list viewer
             if ( available )
                 {
 				iMessageIsDeleted = ETrue;
                 TRAPD( err, iAppUi.MoveToPreviousMsgAfterDeleteL( prevMsgId ) );
                 iMessageIsDeleted = EFalse;
-                
+
                 User::LeaveIfError( err );
-                }   
+                }
             else
                 {
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
@@ -1289,14 +1225,14 @@
     if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
                                      (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 ) // Safety, in list events that only concern active mailbox are handled
         {
-        TFSMailMsgId curMsgId = iMessage->GetMessageId();       
+        TFSMailMsgId curMsgId = iMessage->GetMessageId();
         RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
         TBool cont = ETrue;
         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
             {
             if ( ( curMsgId == ( *removedEntries )[i] ) &&
                     (iDeletedMessageFromMrui != curMsgId) )
-                {                
+                {
                 cont = EFalse;
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
                 if( aEvent == TFSEventMailDeleted  && !iMessageIsDeleted )
@@ -1305,14 +1241,14 @@
                 	// The message we are viewing was deleted => stop here
                 	return;
                     }
-                }            
-            } 
+                }
+            }
         }
-     
+
     if ( iContainer && iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() )
         {
-        if ( aEvent == TFSEventNewMail || 
-             aEvent == TFSEventMailDeleted || 
+        if ( aEvent == TFSEventNewMail ||
+             aEvent == TFSEventMailDeleted ||
              aEvent == TFSEventMailChanged )
             {
             iContainer->MailListModelUpdatedL();
@@ -1320,13 +1256,13 @@
 
         // DSW fix for FAMZ-82YJQ2
         // Dismiss the download status dialog after sync has been finished or cancelled
-        
+
         if ( aEvent == TFSEventMailboxSyncStateChanged )
             {
             TSSMailSyncState* newSyncState = static_cast<TSSMailSyncState*>( aParam1 );
-            if ( newSyncState && ( *newSyncState == FinishedSuccessfully || 
-                                   *newSyncState == SyncCancelled || 
-                                   *newSyncState == Idle || 
+            if ( newSyncState && ( *newSyncState == FinishedSuccessfully ||
+                                   *newSyncState == SyncCancelled ||
+                                   *newSyncState == Idle ||
                                    *newSyncState == SyncError ))
                 {
                 iContainer->HideDownloadStatus();
@@ -1337,7 +1273,7 @@
 
 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
     {
-    FUNC_LOG; 
+    FUNC_LOG;
     /* -- Pinch zoom only --
     TInt zoomLevelIdx = iContainer->ZoomLevelL();
 
@@ -1447,7 +1383,7 @@
             {
             CopyCurrentToClipBoardL( aUrl );
             break;
-            }                   
+            }
         }
     }
 
@@ -1538,28 +1474,7 @@
     HBufC* textData = aEmailAddress.AllocLC();
     CFSMailBox* mailBox = iAppUi.GetMailClient()->GetMailBoxByUidL( iMessage->GetMailBoxId() );
     CleanupStack::PushL( mailBox );
-  
-    //UI options Delete and Actions dimmed in Remote Lookup.
-    const TInt resourceId(ToolbarResourceId());
-    RArray<TInt> dimmedItems;
-    CleanupClosePushL(dimmedItems);
-    GetInitiallyDimmedItemsL(resourceId, dimmedItems); // get the currently dimmed buttons
-    
-    SetToolbarItemDimmed( EFsEmailUiTbCmdActions, ETrue);
-    SetToolbarItemDimmed( EFsEmailUiTbCmdDelete, ETrue);
-        
-    HideToolbar();
     CFsDelayedLoader::InstanceL()->GetContactHandlerL()->LaunchRemoteLookupWithQueryL( *mailBox, *textData );
-    ShowToolbar();  
-    
-    SetToolbarItemDimmed( EFsEmailUiTbCmdActions, EFalse);
-    SetToolbarItemDimmed( EFsEmailUiTbCmdDelete, EFalse);
-   
-    for (TInt i = 0; i < dimmedItems.Count(); i++) // restore the buttons
-        {
-        SetToolbarItemDimmed(dimmedItems[i], ETrue);
-        }
-    CleanupStack::PopAndDestroy(); // dimmedItems.Close()
     CleanupStack::PopAndDestroy( mailBox );
     CleanupStack::PopAndDestroy( textData );
     }
@@ -1641,10 +1556,10 @@
             {
             iContainer->ShowAttachmentDownloadStatusL( TFSProgress::EFSStatus_Status, aAttachment );
             }
-        
+
         if ( savedCount )
             {
-            TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( savedCount );        
+            TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( savedCount );
             }
         }
     }
@@ -1692,19 +1607,19 @@
 
 TBool CFsEmailUiHtmlViewerView::IsEmbeddedMsgSavingAllowed()
     {
-    return iMailBox->HasCapability( 
+    return iMailBox->HasCapability(
                 EFSMboxCapaSupportsSavingOfEmbeddedMessages );
     }
 
-void CFsEmailUiHtmlViewerView::UpdateDownloadIndicatorL( 
-        const TPartData& aPart, 
+void CFsEmailUiHtmlViewerView::UpdateDownloadIndicatorL(
+        const TPartData& aPart,
         const TFSProgress& aEvent )
     {
     FUNC_LOG;
-    
+
     if ( !iMessage || !iContainer || ( aEvent.iError != KErrNone ) )
         return;
-    
+
     TAttachmentData* attachment = NULL;
     const RArray<TAttachmentData>& attachments = iAttachmentsListModel->GetModel();
     for ( TInt i=0; i < attachments.Count(); i++ )
@@ -1715,7 +1630,7 @@
             break;
             }
         }
-    
+
     if ( attachment )
         {
         switch ( aEvent.iProgressStatus )
@@ -1732,17 +1647,17 @@
                     }
                 }
             break;
-            
+
             case TFSProgress::EFSStatus_RequestComplete:
                 {
                 attachment->downloadProgress = KComplete;
                 }
             break;
-            
+
             default:
                 break;
             }
-        
+
         iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
         }
     }
@@ -1764,7 +1679,7 @@
 // CFsEmailUiHtmlViewerView::PushMessageL
 // Message stack handling. Ownership of message is transferred when succesful.
 // -----------------------------------------------------------------------------
-// 
+//
 void CFsEmailUiHtmlViewerView::PushMessageL( CFSMailMessage* aMessage, TBool aIsEmbedded )
     {
     if ( !iOpenMessages || !iEmbeddedMessages )
@@ -1793,12 +1708,12 @@
 // CFsEmailUiHtmlViewerView::PopMessage
 // Message stack handling. Ownership of message is returned.
 // -----------------------------------------------------------------------------
-// 
+//
 CFSMailMessage* CFsEmailUiHtmlViewerView::PopMessage()
     {
     ASSERT( iOpenMessages && iEmbeddedMessages );
     ASSERT( iOpenMessages->Count() == iEmbeddedMessages->Count() );
-    
+
     CFSMailMessage* msg = NULL;
     if ( !iOpenMessages->IsEmpty() )
         {
@@ -1815,7 +1730,7 @@
 // CFsEmailUiHtmlViewerView::EraseMessageStack
 // Message stack handling. All messages in stack are deallocated
 // -----------------------------------------------------------------------------
-// 
+//
 void CFsEmailUiHtmlViewerView::EraseMessageStack()
     {
     ASSERT( iOpenMessages && iEmbeddedMessages );
@@ -1877,7 +1792,7 @@
             }
         iMessage->SaveMessageL(); // Save read status
         SendEventToAppUiL( TFSEventMailChanged );
-    
+
         }
     }
 
@@ -1889,7 +1804,7 @@
     FUNC_LOG;
     TBool available = EFalse;
     // Next/previous message options are inavailable in the embedded mode
-    if ( iMessage && !iActivationData.iEmbeddedMessageMode )    
+    if ( iMessage && !iActivationData.iEmbeddedMessageMode )
         {
         TFSMailMsgId currentMsgId = iMessage->GetMessageId();
         TFSMailMsgId nextMsgId;
@@ -1920,7 +1835,7 @@
             // Stop timer and cancel fetchings before showing next message
             //iFetchingAnimationTimer->Stop();
             CancelFetchings();
-           
+
             // Change empty msk when moving to next
             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
 
@@ -1959,15 +1874,15 @@
         TFSMailMsgId prevMsgId;
         TFSMailMsgId prevMsgFolderId;
         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
-            {          
+            {
             if (iContainer)
                 {
                 iContainer->PrepareForMessageNavigation();
                 }
-        
+
             // Stop timer and cancel fetchings before showing prev message
             CancelFetchings();
-           
+
             // Change empty msk when moving to previous
             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
 
@@ -2200,9 +2115,9 @@
 void CFsEmailUiHtmlViewerView::RequestResponseL( TFSProgress aEvent, TInt aRequestId )
     {
     FUNC_LOG;
-    
+
     TBool reloadContent ( EFalse );
-    
+
     if ( aRequestId == iCurrentPlainTextBodyFetchRequestId && iFetchingPlainTextMessageBody )
         {
         if ( aEvent.iError != KErrNone ||
@@ -2230,7 +2145,7 @@
                 UpdateMessagePtrL( mailboxId, folderId, messageId );
                 reloadContent = ETrue;
                 }
-                          
+
             }
         }
 
@@ -2245,10 +2160,10 @@
         else if ( aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete )
             {
             iAsyncProcessComplete = ETrue;
-            iFetchingHtmlMessageBody = EFalse;           
-            
+            iFetchingHtmlMessageBody = EFalse;
+
             reloadContent = ETrue;
-            
+
             }
         }
     else if ( aRequestId == iCurrentStructureFetchRequestId && iFetchingMessageStructure )
@@ -2281,19 +2196,19 @@
         }
     if ( reloadContent )
         {
-    
+
         if (  iContainer )
             {
-            iContainer->ResetContent();                
+            iContainer->ResetContent();
             if( iMessage )
                 {
-                LoadContentFromMailMessageL( iMessage , EFalse);  
+                LoadContentFromMailMessageL( iMessage , EFalse);
                 SetMskL();
                 }
             }
         }
-            
-    
+
+
     if(iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed)
         {
         iWaitDialog->ProcessFinishedL(); // deletes the dialog
@@ -2361,8 +2276,6 @@
             iAppUi.DownloadInfoMediator()->AddObserver( this, iMessage->GetMessageId() );
             }
         }
-    
-    UpdateToolbarL();
     }
 
 // -----------------------------------------------------------------------------
@@ -2387,13 +2300,13 @@
         iFetchingMessageStructure = EFalse;
         }
     iAsyncProcessComplete = ETrue;
-    
+
     //also cancel embedded images download in DownloadInfoMediator
     if ( iMailBox )
         {
-        TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelAllDownloadsL( iMailBox->GetId() ) );    
+        TRAP_IGNORE( iAppUi.DownloadInfoMediator()->CancelAllDownloadsL( iMailBox->GetId() ) );
         }
-    
+
 
     //<cmail>
     if(iWaitDialog && iDialogNotDismissed)
@@ -2452,7 +2365,7 @@
     iWaitDialog->SetCallback(this);
     iDialogNotDismissed = ETrue;
     iWaitDialog->ExecuteLD(R_FSE_FETCHING_WAIT_DIALOG);
-    */ 
+    */
     if( iMessage )
         {
         StartFetchingMessagePartL( *iMessage, iStartAsyncFetchType );
@@ -2584,7 +2497,7 @@
     return ret;
     }
 
-    
+
 void CFsEmailUiHtmlViewerView::ProcessAsyncCommandL( TESMRIcalViewerOperationType aCommandId,
                                                      const CFSMailMessage& aMessage,
                                                      MESMRIcalViewerObserver* aObserver )
@@ -2718,7 +2631,7 @@
             }
             break;
         case EESMRCmdMailComposeMessage:
-            {           
+            {
             iAppUi.CreateNewMailL();
             iOpResult.iResultCode = KErrNone;
             }
@@ -2854,16 +2767,16 @@
     if ( aResult.iOpType == EESMRViewLaunch )
         {
         iMrUiActive = EFalse;
-        
+
         // load mr content to viewer so we don't end up with empty view
         if (  iContainer )
              {
              iContainer->ResetContent();
              }
-                 
+
          if( iMessage )
              {
-             TRAP_IGNORE( LoadContentFromMailMessageL( iMessage ) );  
+             TRAP_IGNORE( LoadContentFromMailMessageL( iMessage ) );
              TRAP_IGNORE( SetMskL() );
              }
         }
@@ -2900,7 +2813,7 @@
     iMrUiActive = EFalse;
     iMrObserverToInform = NULL;
     }
-    
+
 // -----------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::ClearMailViewer
 // -----------------------------------------------------------------------------
@@ -2958,12 +2871,12 @@
     iEmbeddedMessages = NULL;
     iMessage = NULL;
     CancelFetchings();
-   
+
     delete iMailBox;
     iMailBox = NULL;
     }
 
-void CFsEmailUiHtmlViewerView::ReloadPageL(  ) 
+void CFsEmailUiHtmlViewerView::ReloadPageL(  )
     {
     FUNC_LOG;
     if( iContainer )
@@ -2976,7 +2889,7 @@
     {
     return ( iFetchingHtmlMessageBody || iFetchingMessageStructure || iFetchingPlainTextMessageBody );
     }
-    
+
 // ---------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::UpdateEmailHeaderIndicatorsL
 // ---------------------------------------------------------------------------
@@ -2999,20 +2912,20 @@
     {
     FUNC_LOG;
     TBool retVal( EFalse );
-    CFSMailMessage* msg = iAppUi.GetMailClient()->GetMessageByUidL( 
+    CFSMailMessage* msg = iAppUi.GetMailClient()->GetMessageByUidL(
             iActivationData.iMailBoxId, iActivationData.iFolderId,
             iActivationData.iMessageId, EFSMsgDataEnvelope );
-            
+
     if ( msg )
         {
         CleanupStack::PushL( msg );
-        if ( msg->IsFlagSet( EFSMsgFlag_CalendarMsg ) && 
+        if ( msg->IsFlagSet( EFSMsgFlag_CalendarMsg ) &&
             iAppUi.MrViewerInstanceL() )
             {
             TESMRMeetingRequestMethod mrMethod( EESMRMeetingRequestMethodUnknown );
             mrMethod = iAppUi.MrViewerInstanceL()->ResolveMeetingRequestMethodL( *msg );
             // Opened in MR viewer if request/cancellation or unknown MR
-            retVal = 
+            retVal =
                 mrMethod == EESMRMeetingRequestMethodRequest ||
                 mrMethod == EESMRMeetingRequestMethodCancellation ||
                 mrMethod == EESMRMeetingRequestMethodUnknown;
@@ -3028,8 +2941,8 @@
 void CFsEmailUiHtmlViewerView::CopyCurrentToClipBoardL( const TDesC& aArgument ) const
     {
     FUNC_LOG;
-    
-    // Making sure that we are copying something to the clipboard 
+
+    // Making sure that we are copying something to the clipboard
     if ( aArgument.Length() > 0 )
         {
         HBufC* clipBoardText = aArgument.AllocLC();
@@ -3042,7 +2955,7 @@
         CleanupStack::PopAndDestroy( plainText );
         cb->CommitL();
         CleanupStack::PopAndDestroy( cb );
-        CleanupStack::PopAndDestroy( clipBoardText );     
+        CleanupStack::PopAndDestroy( clipBoardText );
         }
     }
 
@@ -3052,21 +2965,21 @@
 void CFsEmailUiHtmlViewerView::OpenLinkInBrowserL( const TDesC& aUrl ) const
     {
     FUNC_LOG;
-    
+
     // Create session
     RApaLsSession session;
     User::LeaveIfError( session.Connect() );
     CleanupClosePushL( session );
-     
+
     // Gets the default application UID for for the given MIME type
     TUid uid;
     TDataType dataType( _L8( "text/html" ) );
     session.AppForDataType( dataType, uid );
-     
+
     // Runs the default application using the dataType
     TThreadId threadId;
     User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
-     
+
     CleanupStack::PopAndDestroy(); // session
 }
 
@@ -3077,7 +2990,7 @@
     {
     FUNC_LOG;
     HBufC* url = aUrl.AllocLC();
-    
+
     RFavouritesSession fSession;
     User::LeaveIfError( fSession.Connect() );
     CleanupClosePushL( fSession );
@@ -3108,7 +3021,7 @@
     CleanupStack::PopAndDestroy( &fSession );
 
     CleanupStack::PopAndDestroy( url );
-    
+
     if ( error == KErrNone )
         {
         TFsEmailUiUtility::ShowInfoNoteL(
@@ -3122,8 +3035,8 @@
     }
 
 /*
- * Delaying the fetch for MfE till the user scrolls to the bottom of 
- * the message. 
+ * Delaying the fetch for MfE till the user scrolls to the bottom of
+ * the message.
  */
 void CFsEmailUiHtmlViewerView::StartFetchingMessageL()
     {
@@ -3139,13 +3052,13 @@
            {
            type = EMessagePlainTextBodyPart;
            }
-         
-              
+
+
         if ( !MessagePartFullyFetchedL( type ))
            {
            iAsyncProcessComplete = EFalse;
            iStartAsyncFetchType = type;
-           //check to make sure we don't kick off fetch twice for the cases where bodypart 
+           //check to make sure we don't kick off fetch twice for the cases where bodypart
            //not found(OZ)
            if(iMessage && !GetAsyncFetchStatus())
                {
@@ -3164,12 +3077,12 @@
             {
             bodyPart = iMessage->PlainTextBodyPartL();
             }
-        
+
         if ( bodyPart )
             {
             aMessageBodyStructurePresent = ETrue;
             CleanupStack::PushL( bodyPart );
-    
+
             if ( bodyPart->FetchedContentSize() == 0 && bodyPart->ContentSize() != 0 )
                 {
                 aMessageBodyContentPresent = EFalse;
@@ -3178,7 +3091,7 @@
                 {
                 aMessageBodyContentPresent = ETrue;
                 }
-            
+
             CleanupStack::PopAndDestroy( bodyPart );
             }
         else
@@ -3277,7 +3190,7 @@
     return err;
     }
 
-CFlagSelectionNoteHandler::CFlagSelectionNoteHandler(  CFsEmailUiHtmlViewerView& aViewerVisualiser )
+CFlagSelectionNoteHandler::CFlagSelectionNoteHandler( CFsEmailUiHtmlViewerView& aViewerVisualiser )
     : CActive ( EPriorityHigh ),
     iViewerView( aViewerVisualiser )
     {
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -1232,8 +1232,12 @@
                 }
             }
 
-        // if iNewMailIds is not empty - start timer
-        if ( !iNewMailTimer->IsActive() && iNewMailIds.Count() )
+        // start timer only when all conditions are met:
+        //   timer isn`t already active
+        //   there are new mails in the array
+        //   timer event isn`t processing
+        if ( !iNewMailTimer->IsActive() && iNewMailIds.Count() && 
+             iNewMailTimer->iStatus != KErrInUse )
             {
             iNewMailTimer->Start( KNewMailTimerDelay );
             }
@@ -1251,6 +1255,12 @@
     TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
     CFSMailClient* mailClient = iAppUi.GetMailClient();
 
+    // Enter critical section
+    // Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait
+    // to ensure that only one TimerEventL method is processed at time
+    // CFSEmailUiGenericTimer`s iStatus will be used as mutex
+    iNewMailTimer->iStatus = KErrInUse;
+
     for ( TInt i = 0; i < count; i++ )
         {
         CFSMailMessage* msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
@@ -1270,6 +1280,9 @@
         iNewMailIds.Remove( 0 ); 
         }
 
+    // End critical section
+    iNewMailTimer->iStatus = KErrNone;
+
     // if timer stoped then restart if more messages available
     if ( iNewMailIds.Count() && ! iNewMailTimer->IsActive() )
         {
--- a/emailuis/emailui/src/FreestyleEmailUiViewBase.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiViewBase.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -68,9 +68,11 @@
 	                                  const TDesC8& aCustomMessage )
     {
     FUNC_LOG;
+
     SetViewActive( ETrue );
+    StatusPane()->MakeVisible( IsStatusPaneVisible() );
     SetStatusBarLayout();
-    iAppUi.StatusPane()->DrawNow();
+    StatusPane()->DrawNow();
     iFocusVisible = iAppUi.IsFocusShown();
 
     // fix view stack in case of external activation
@@ -102,7 +104,7 @@
     SetNextTransitionOutLong( EFalse );
 
     // Clear status pane indicators
-    CCustomStatuspaneIndicators* indicators = 
+    CCustomStatuspaneIndicators* indicators =
         iAppUi.GetStatusPaneIndicatorContainer();
     if ( indicators )
         {
@@ -114,7 +116,7 @@
 
     // Make sure Alfred display is of correct size (there is some problems with toolbar)
     iAppUi.AlfEnv().PrimaryDisplay().ForceSetVisibleArea(iAppUi.ClientRect());
-    
+
 
     // Finally call child classes activation method
     TRAPD( error, ChildDoActivateL(aPrevViewId, aCustomMessageId, aCustomMessage) );
@@ -128,7 +130,7 @@
         	}
 
         // View activated succesfully
-        DoTransition( EFalse ); 
+        DoTransition( EFalse );
         if ( !iAppUi.SwitchingToBackground() )
             {
             // Change visible control group
@@ -173,6 +175,10 @@
                 }
             CleanupStack::PopAndDestroy(); // dimmedItems.Close()
             toolbar->SetToolbarObserver(this);
+ 			if(resourceId == R_FREESTYLE_EMAIL_UI_TOOLBAR_FOLDER_LIST)
+            	{
+            	toolbar->SetToolbarVisibility(EFalse);
+				}
             SetToolbar(toolbar);
             ShowToolbar();
             }
@@ -282,14 +288,14 @@
 void CFsEmailUiViewBase::FadeOut( TBool /* aDirectionOut */ )
 	{
 	FUNC_LOG;
-    // should be overriden ( if needed ) to use polymorphism 
+    // should be overriden ( if needed ) to use polymorphism
 	// to hide or show CAlfVisuals used in views
 	}
 
 
 // ---------------------------------------------------------------------------
 // Check if transition effects are enabled and run the effect if needed.
-// if not enabled it calls FadeOut virtual methods only 
+// if not enabled it calls FadeOut virtual methods only
 //
 void CFsEmailUiViewBase::DoTransition( TBool aDirectionOut )
     {
@@ -300,7 +306,7 @@
         }
     else
         {
-    	// FadeOut method should be overridden and use by polymorphism only when needed 
+    	// FadeOut method should be overridden and use by polymorphism only when needed
     	FadeOut( aDirectionOut ); // used for hide/show visuals without transition time
     	}
     }
@@ -480,7 +486,7 @@
 void CFsEmailUiViewBase::HandleAppForegroundEventL( TBool aForeground )
     {
     FUNC_LOG;
-    HandleForegroundEventL(aForeground);    
+    HandleForegroundEventL(aForeground);
     if ( aForeground )
         {
         // Activate control group in case the view was activated when
@@ -629,7 +635,7 @@
             // Email app should be hidden once the view gets deactivated. Note that hiding
             // should not happen before control group switching is over because that
             // may cause views of other Alfred apps to get distorted.
-            if( !iAppUi.EmbeddedAppIsPreviousApp() ) // if previous app is embedded app, 
+            if( !iAppUi.EmbeddedAppIsPreviousApp() ) // if previous app is embedded app,
                 //do not need hide FSEmail app when previous app view gets deactivated.
                 {
                 iSendToBackgroundOnDeactivation = ETrue;
@@ -673,6 +679,14 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFsEmailUiViewBase::IsStatusPaneVisible
+// -----------------------------------------------------------------------------
+TBool CFsEmailUiViewBase::IsStatusPaneVisible() const
+    {
+    return ETrue;
+    }
+
+// -----------------------------------------------------------------------------
 // CFsEmailUiViewBase::HasToolbar
 // Method to check whether the view has toolbar defined or not.
 // -----------------------------------------------------------------------------
--- a/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -31,70 +31,34 @@
 #include "FreestyleEmailUiUtilities.h"
 #include "ncsconstants.h"
 
-
-
-_LIT8( KExpandHeaderIconFileName, "plus.gif");
-_LIT8( KCollapseHeaderIconFileName, "minus.gif");
-_LIT8( KAttachementIconGeneral, "attachment.gif");
-_LIT8( KFollowUpIconFileName, "follow_up.png");
-_LIT8( KFollowUpCompleteIconFileName, "follow_up_complete.png");
-_LIT8( KPriorityHighIconFileName, "todo_high_add.png");
-_LIT8( KPriorityLowIconFileName, "todo_low_add.png");
+_LIT( KAlignRight, "right" );
+_LIT( KAlignLeft, "left" );
+_LIT( KRtl, "rtl" );
+_LIT( KLtr, "ltr" );
 
-_LIT8( KCollapsedHeaderTableName, "collapsed_header" );
-_LIT8( KExpandedHeaderTableName, "expanded_header" );
-_LIT8( KToTableName, "to_table");
-_LIT8( KCcTableName, "cc_table");
-_LIT8( KBccTableName, "bcc_table");
-_LIT8( KAttachmentTableName, "attachment_table");
-_LIT8( KFromTableName,"from_table");
-
-_LIT8( KFromFieldName, "from_field");
-_LIT8( KToFieldName, "to_field");
-_LIT8( KCcFieldName, "cc_field");
-_LIT8( KBccFieldName, "bcc_field");
-_LIT8( KSentFieldName, "sent_field");
-_LIT8( KSubjectFieldName, "subject_field");
+const TInt KMaxRecipientsShown( 10 );
+const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 );
 
-_LIT8( KToImageName, "to_img");
-_LIT8( KCcImageName, "cc_img");
-_LIT8( KBccImageName, "bcc_img");
-_LIT8( KAttachmentImageName, "attachment_img");
-_LIT8( KFollowUpImageName, "follow_up_img");
-_LIT8( KFollowUpCompleteImageName, "follow_up_complete_img");
-_LIT8( KPriorityHighImageName, "todo_high_add_img");
-_LIT8( KPriorityLowImageName, "todo_low_add_img");
-
-_LIT8( KSpace8, " ");
+_LIT8( KTableRowBegin, "<tr>" );
+_LIT8( KTableRowEnd, "</tr>\n" );
+_LIT8( KTableCellEnd, "</td>" );
 
-_LIT8( KHTMLImgTagId, "<image id=\"" );
-_LIT8( KHTMLImgTagSrcBefore, "\" border=\"0\" src=\"" );
-_LIT8( KHTMLImgTagSrcAfter, "\">" );
-
-_LIT8( KMetaHeader, "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n" );
-
-_LIT8( KDisplayImagesLeftToRight,
-        "<script language=\"javascript\">var g_autoLoadImages = %d;</script>\n<table style=\"display: none;\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\">%S</td><td align=\"right\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td></tr></table>" );
-
-_LIT8( KDisplayImagesRightToLeft,
-        "<script language=\"javascript\">var g_autoLoadImages = %d;</script>\n<table style=\"display: none;\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\"><input type=\"submit\" class=\"button\" value=\"%S\" onClick=\"displayImagesButtonPressed()\"/></td><td align=\"right\">%S</td></tr></table>" );
-_LIT8 ( KProtocolIdentifier, "://" );
-const TInt KMaxEventLength( 256 );
-const TInt KFreestyleMessageHeaderHTMLRightMarginInPx( 10 );
-const TInt KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth( 5 );
+_LIT( KSchemeSeparator, "://" );
+_LIT( KUrlFormat, "<a href=\"%S\">%S</a>" );
+_LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" );
 
 // Define this to allow theme colorin for the header
-#undef __USE_THEME_COLOR_FOR_HEADER    
+#define __USE_THEME_COLOR_FOR_HEADER    
 
 EXPORT_C CFreestyleMessageHeaderHTML* CFreestyleMessageHeaderHTML::NewL( CFSMailMessage& aMailMessage, 
                                                                          RWriteStream& aWriteStream,
                                                                          TInt aVisibleWidth,
                                                                          TInt aScrollPosition,
                                                                          const TBool aAutoLoadImages,
-                                                                         const TBool aExpanded 
+                                                                         const TBitFlags& aFlags 
                                                                          )
     {
-    CFreestyleMessageHeaderHTML* self = new (ELeave) CFreestyleMessageHeaderHTML( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aExpanded);
+    CFreestyleMessageHeaderHTML* self = new (ELeave) CFreestyleMessageHeaderHTML( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags);
     self->ConstructL();
     return self;
     }
@@ -104,9 +68,9 @@
                                                     TInt aVisibleWidth,
                                                     TInt aScrollPosition,
                                                     const TBool aAutoLoadImages,
-                                                    const TBool aExpanded )
+                                                    const TBitFlags& aFlags )
     {
-    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aExpanded);
+    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, aWriteStream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags);
     CleanupStack::PushL( headerHtml );
     headerHtml->ExportL();
     CleanupStack::PopAndDestroy( headerHtml );
@@ -117,13 +81,13 @@
                                                     TInt aVisibleWidth,
                                                     TInt aScrollPosition,
                                                     const TBool aAutoLoadImages,
-                                                    const TBool aExpanded )
+                                                    const TBitFlags& aFlags )
     {
     RFileWriteStream fwstream;
     fwstream.Attach( aFile, 0 );
     CleanupClosePushL( fwstream );
     
-    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aExpanded );
+    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags );
     CleanupStack::PushL( headerHtml );
     headerHtml->ExportL();
     CleanupStack::PopAndDestroy( headerHtml );
@@ -137,13 +101,13 @@
                                                     TInt aVisibleWidth,
                                                     TInt aScrollPosition,
                                                     const TBool aAutoLoadImages,
-                                                    const TBool aExpanded )
+                                                    const TBitFlags& aFlags )
     {
     RFileWriteStream fwstream;
     User::LeaveIfError( fwstream.Replace( aFs, aFilePath, EFileStreamText | EFileWrite) );
     CleanupClosePushL( fwstream );
     
-    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aExpanded);
+    CFreestyleMessageHeaderHTML* headerHtml = CFreestyleMessageHeaderHTML::NewL( aMailMessage, fwstream, aVisibleWidth, aScrollPosition, aAutoLoadImages, aFlags);
     CleanupStack::PushL( headerHtml );
     headerHtml->ExportL();
     CleanupStack::PopAndDestroy( headerHtml );
@@ -156,28 +120,20 @@
     iAttachments.ResetAndDestroy();
     }
 
-EXPORT_C void CFreestyleMessageHeaderHTML::ExportL() const
-    {
-    HTMLStartL();
-    ExportHTMLHeaderL();
-    ExportHTMLBodyL();
-    HTMLEndL();
-    }
-
 CFreestyleMessageHeaderHTML::CFreestyleMessageHeaderHTML( CFSMailMessage& aMailMessage,  
                                                           RWriteStream& aWriteStream,
                                                           TInt aVisibleWidth,
                                                           TInt aScrollPosition,
                                                           const TBool aAutoLoadImages,
-                                                          const TBool aExpanded )
+                                                          const TBitFlags& aFlags )
     : iMailMessage( aMailMessage ),
     iWriteStream( aWriteStream ),
     iVisibleWidth( aVisibleWidth - KFreestyleMessageHeaderHTMLRightMarginInPx ),
     iScrollPosition( aScrollPosition ),
-    iAutoLoadImages( aAutoLoadImages ),
-    iMirrorLayout( AknLayoutUtils::LayoutMirrored() ),
-    iExpanded( aExpanded  )
+    iExportFlags( aFlags )
     {
+    iExportFlags.Assign( EAutoLoadImages, aAutoLoadImages );
+    iExportFlags.Assign( EMirroredLayout, AknLayoutUtils::LayoutMirrored() );
     }
 
 void CFreestyleMessageHeaderHTML::ConstructL()
@@ -185,1008 +141,614 @@
     iMailMessage.AttachmentListL( iAttachments );
     }
 
-void CFreestyleMessageHeaderHTML::HTMLStartL() const
+EXPORT_C void CFreestyleMessageHeaderHTML::ExportL() const
     {
-    iWriteStream.WriteL(_L8("<html"));
-    if ( iMirrorLayout )
-        {
-        iWriteStream.WriteL(_L8(" dir=\"rtl\""));
-        }
-    else
-        {
-        iWriteStream.WriteL(_L8(" dir=\"ltr\""));
-        }
-    iWriteStream.WriteL(_L8(" xmlns=\"http://www.w3.org/1999/xhtml\">\n"));
-    iWriteStream.CommitL();
+    ExportBodyStyleL();
+    ExportHTMLBodyStartL();
+    ExportHeaderTablesL();
+    ExportHTMLBodyEndL();    
     }
 
-void CFreestyleMessageHeaderHTML::HTMLEndL() const
+void CFreestyleMessageHeaderHTML::ExportHTMLBodyStartL() const
     {
-    iWriteStream.WriteL(_L8("</html>\n"));
+    _LIT( KHtmlBodyStart, "<html dir=\"%S\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Email Header</title>\n<script language=\"javascript\" src=\"header.js\"></script>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"header.css\"/>\n</head>\n<body onLoad = \"init(%d)\">\n" );
+    //_LIT( KHtmlBodyStart, "<html dir=\"%S\" xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n<title>Email Header</title>\n<script language=\"javascript\" src=\"header.js\"></script>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"header%d.css\"/>\n</head>\n<body onLoad = \"init(%d)\">\n" );
+    const TPtrC direction(  iExportFlags.IsSet( EMirroredLayout ) ? KRtl() : KLtr() );
+    HBufC* formatBuffer = HBufC::NewLC( KHtmlBodyStart().Length() + direction.Length() + 16 );
+    formatBuffer->Des().Format( KHtmlBodyStart(), &direction, iScrollPosition );
+    //formatBuffer->Des().Format( KHtmlBodyStart(), &direction, Math::Random() % 2, iScrollPosition );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
     iWriteStream.CommitL();
     }
 
-void CFreestyleMessageHeaderHTML::ExportHTMLHeaderL() const
+void CFreestyleMessageHeaderHTML::ExportInnerTableBeginWithRowBeginL( const TDesC& aTableName, const TInt aColSpan, 
+        const TBool aVisible, const TBitFlags& aFlags ) const
+    {
+    iWriteStream.WriteL( KTableRowBegin() );
+    ExportTableVisibilityParameterL( aTableName, aVisible );
+    ExportInnerTableBeginL( aTableName, aColSpan, aFlags );
+    }
+
+
+void CFreestyleMessageHeaderHTML::ExportInnerTableBeginL( const TDesC& aTableName, const TInt aColSpan, 
+        const TBitFlags& aFlags ) const
+    {
+    _LIT( KHidden, " style=\"display: none;\"");
+    _LIT( KFixed, " class=\"fixed\"");   
+    _LIT( KTableHeader, "<td colspan=\"%d\"><table id=\"%S\" width=\"100%%\"%S%S>\n" );
+    const TPtrC style( aFlags.IsClear( EHidden ) ? KNullDesC() : KHidden() );
+    const TPtrC fixed( aFlags.IsClear( EFixed ) ? KNullDesC() : KFixed() );
+    HBufC* formatBuffer = HBufC::NewLC( KTableHeader().Length() + aTableName.Length() + 16 + style.Length() + fixed.Length() );
+    formatBuffer->Des().Format( KTableHeader(), aColSpan, &aTableName, &style, &fixed );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
+    }
+
+void CFreestyleMessageHeaderHTML::ExportTableVisibilityParameterL( const TDesC& aTableName, const TBitFlags& aFlags ) const
+    {   
+    ExportTableVisibilityParameterL( aTableName, aFlags.IsClear( EHidden ) );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportTableVisibilityParameterL( const TDesC& aTableName, const TBool aVisible ) const
+    {   
+    _LIT( KTrue, "true" );
+    _LIT( KFalse, "false" );
+    _LIT( KVisibilityParameter, "<script type=\"text/javascript\">var is_%S_visible=%S;</script>" );
+    const TPtrC visible( aVisible ? KTrue() : KFalse() );
+    HBufC* formatBuffer = HBufC::NewLC( KVisibilityParameter().Length() + aTableName.Length() + visible.Length() );
+    formatBuffer->Des().Format( KVisibilityParameter(), &aTableName, &visible );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );        
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf
+    }
+
+void CFreestyleMessageHeaderHTML::ExportTableBeginL( const TDesC& aTableName, const TBitFlags& aFlags ) const
+    {   
+    _LIT( KFixed, " class=\"fixed\"");   
+    _LIT( KTableHeader, "<table id=\"%S\" width=\"%dpx\"%S%S>\n" );
+    const TPtrC style( aFlags.IsClear( EHidden ) ? KNullDesC() : KNullDesC() );
+    const TPtrC fixed( aFlags.IsClear( EFixed ) ? KNullDesC() : KFixed() );
+    ExportTableVisibilityParameterL( aTableName, aFlags );   
+    HBufC* formatBuffer = HBufC::NewLC( KTableHeader().Length() + aTableName.Length() + 16 + style.Length() + fixed.Length() );
+    formatBuffer->Des().Format( KTableHeader(), &aTableName, iVisibleWidth, &style, &fixed );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
+    }
+
+void CFreestyleMessageHeaderHTML::ExportInnerTableEndL() const
+    {
+    ExportTableEndL();
+    iWriteStream.WriteL( KTableCellEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportInnerTableEndWithRowEndL() const
+    {
+    ExportInnerTableEndL();
+    iWriteStream.WriteL( KTableRowEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportTableEndL() const
     {
-    HTMLHeaderStartL();
-    HTMLMetaL();
-    iWriteStream.WriteL( _L8("<title>Email Header</title>\n") );
-    AddJavascriptL();
-    AddStyleSheetL();
-    HTMLHeaderEndL();
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( _L("</table>\n") );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy(); // utf    
+    }
+
+void CFreestyleMessageHeaderHTML::ExportSenderTableRowL( const TBool aCollapsed ) const
+    {
+    _LIT( KStyleExpand, "expand" );
+    _LIT( KStyleCollapse, "collapse" );
+    _LIT( KExpandFunction, "expandHeader(true)" );
+    _LIT( KCollapseFunction, "collapseHeader(true)" );
+    _LIT( KSenderFormat, "<tr><td align=\"%S\" class=\"sender_name\"><div class=\"truncate\">%S</div></td><td valign=\"top\" rowSpan=\"2\" class=\"button_cell\"><button value=\"submit\" onClick=\"%S\" class=\"%S\"></button></td></tr>\n" );
+    const CFSMailAddress* sender( iMailMessage.GetSender() );
+    TPtrC displayName( sender->GetDisplayName() );
+    if ( !displayName.Length() )
+        {
+        displayName.Set( sender->GetEmailAddress() );
+        }
+    const TPtrC function( aCollapsed ? KExpandFunction() : KCollapseFunction() );
+    const TPtrC style( aCollapsed ? KStyleExpand() : KStyleCollapse() );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KSenderFormat().Length() + displayName.Length() + align.Length() + function.Length() + style.Length() );
+    formatBuffer->Des().Format( KSenderFormat(), &align, &displayName, &function, &style );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
+    }
+
+void CFreestyleMessageHeaderHTML::ExportSenderAddressTableRowL() const
+    {
+    _LIT( KSenderAddressFormat, "<tr><td colspan=\"2\" align=\"%S\"><div class=\"truncate\"><a class=\"sender_address\" href=\"cmail://from/%S\">%S</a></div></td></tr>\n" );
+    const CFSMailAddress* sender( iMailMessage.GetSender() );
+    const TPtrC emailAddress( sender->GetEmailAddress() );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KSenderAddressFormat().Length() + emailAddress.Length() * 2 + align.Length() );
+    formatBuffer->Des().Format( KSenderAddressFormat(), &align, &emailAddress, &emailAddress );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
+    }
+
+void CFreestyleMessageHeaderHTML::ExportLabelTableRowL( const TInt aResourceId, const TInt aColSpan ) const
+    {
+    _LIT( KLabelFormat, "<tr><td align=\"%S\" colspan=\"%d\" class=\"label\">%S</td></tr>\n" );
+    HBufC* labelText = StringLoader::LoadLC( aResourceId );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KLabelFormat().Length() + labelText->Length() + align.Length() + 8 );
+    formatBuffer->Des().Format( KLabelFormat(), &align, aColSpan, labelText );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 3 ); // labelText, formatBuffer, utf    
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportFromTableRowL() const
+    {
+    ExportLabelTableRowL( R_FREESTYLE_EMAIL_UI_VIEWER_FROM );
+    ExportSenderAddressTableRowL();
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportExpandRecipientsL( const TDesC& aType, const TInt aCount ) const
+    {
+    _LIT( KExpandRecipientsFormat, "<tr><td align=\"%S\"><a class=\"recipient\" href=\"cmail://expand_%S/\" onclick=\"handleHeaderDisplay('%S_collapsed','%S_expanded')\">%S</a></td></tr>\n" );
+    HBufC* text =  StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEWER_N_MORE_RECIPIENTS, aCount );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KExpandRecipientsFormat().Length() + text->Length() + align.Length() + aType.Length() * 3 );
+    formatBuffer->Des().Format( KExpandRecipientsFormat(), &align, &aType, &aType, &aType, text );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 3 ); // text, formatBuffer, utf    
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportExpandAttachmentsL( const TDesC& aType, const TInt aCount ) const
+    {
+    _LIT( KExpandRecipientsFormat, "<td align=\"%S\" class=\"attachment\"><a href=\"cmail://expand_%S/\" onclick=\"handleHeaderDisplay('%S_collapsed','%S_expanded')\">%S</a></td>" );
+    HBufC* text =  StringLoader::LoadLC( R_FSE_VIEWER_ATTACHMENTS_TEXT, aCount );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KExpandRecipientsFormat().Length() + text->Length() + align.Length() + aType.Length() * 3 );
+    formatBuffer->Des().Format( KExpandRecipientsFormat(), &align, &aType, &aType, &aType, text );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 3 ); // text, formatBuffer, utf    
     }
 
-void CFreestyleMessageHeaderHTML::HTMLHeaderStartL() const
+void  CFreestyleMessageHeaderHTML::ExportRecipientsTableL( const TDesC& aType, const TInt aLabelResourceId, 
+        const RPointerArray<CFSMailAddress>& aRecipients, const TBool aExpanded ) const
+    {  
+    if ( aRecipients.Count() > 0 )
+        { 
+        TBool innerTableExpanded( aExpanded );
+        TBitFlags flags;
+        flags.Assign( EHidden, iExportFlags.IsClear( EHeaderExpanded ) );
+        _LIT( KTableNameFormat, "%S_table" );
+        HBufC* outerTableName = HBufC::NewLC( KTableNameFormat().Length() + aType.Length() );
+        outerTableName->Des().Format( KTableNameFormat(), &aType );
+        ExportTableBeginL( *outerTableName, flags );
+        CleanupStack::PopAndDestroy(); // outerTableName
+        
+        ExportLabelTableRowL( aLabelResourceId, 2 );
+        const TBool showCollapsed( aRecipients.Count() > KMaxRecipientsShown );
+        TBitFlags tableFlags;
+        tableFlags.Set( EFixed );        
+        if ( showCollapsed )
+            {
+            _LIT( KFormatCollapsed, "%S_collapsed" );
+            HBufC* tableName = HBufC::NewLC( KFormatCollapsed().Length() + 8 );
+            tableName->Des().Format( KFormatCollapsed(), &aType );
+            ExportInnerTableBeginWithRowBeginL( *tableName, 2, !innerTableExpanded, tableFlags );
+            CleanupStack::PopAndDestroy(); // tableName
+            ExportExpandRecipientsL( aType, aRecipients.Count() );        
+            ExportInnerTableEndWithRowEndL();
+            tableFlags.Set( EHidden );
+            }
+        else
+            {
+            innerTableExpanded = ETrue;
+            }
+        _LIT( KFormatExpanded, "%S_expanded" );
+        HBufC* tableName = HBufC::NewLC( KFormatExpanded().Length() + 8 );
+        tableName->Des().Format( KFormatExpanded(), &aType );
+        ExportInnerTableBeginWithRowBeginL( *tableName, 2, innerTableExpanded, tableFlags );
+        CleanupStack::PopAndDestroy(); // tableName
+        ExportRecipientsL( aType, aRecipients );
+        ExportInnerTableEndWithRowEndL();        
+        ExportTableEndL();
+        }
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportRecipientsL( const TDesC& aType, 
+        const RPointerArray<CFSMailAddress>& aRecipients) const
+    {
+    _LIT( KRecipientFormat, "<tr><td align=\"%S\"><div class=\"truncate\"><a class=\"recipient\" href=\"cmail://%S/%S\">%S</a></div></td></tr>" );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    for ( TInt i = 0; i < aRecipients.Count(); i++ )
+        {
+        const CFSMailAddress* sender( aRecipients[ i ] );
+        TPtrC displayName( sender->GetDisplayName() );
+        const TPtrC emailAddress( sender->GetEmailAddress() );
+        if ( !displayName.Length() )
+            {
+            displayName.Set( emailAddress );
+            }   
+        HBufC* formatBuffer = HBufC::NewLC( KRecipientFormat().Length() + align.Length() + aType.Length() + emailAddress.Length() + displayName.Length() );
+        formatBuffer->Des().Format( KRecipientFormat(), &align, &aType, &emailAddress, &displayName );
+        HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+        CleanupStack::PushL( utf );
+        iWriteStream.WriteL( *utf );
+        CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf    
+        }
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportToTableL() const
+    {
+    ExportRecipientsTableL( _L("to"), R_FREESTYLE_EMAIL_UI_VIEWER_TO, iMailMessage.GetToRecipients(), iExportFlags.IsSet( EToExpanded ) );
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportCcTableL() const
+    {
+    ExportRecipientsTableL( _L("cc"), R_FREESTYLE_EMAIL_UI_VIEWER_CC, iMailMessage.GetCCRecipients(), iExportFlags.IsSet( ECcExpanded ) );
+    }
+
+void  CFreestyleMessageHeaderHTML::ExportBccTableL() const
+    {
+    ExportRecipientsTableL( _L("bcc"), R_FREESTYLE_EMAIL_UI_VIEWER_BCC, iMailMessage.GetBCCRecipients(), iExportFlags.IsSet( EBccExpanded ) );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportDateTimeTableRowL( const TInt aColSpan ) const
     {
-    iWriteStream.WriteL(_L8("<head>"));
+    _LIT( KDateTimeFormat, "<tr><td colspan=\"%d\" align=\"%S\" class=\"datetime\">%S%S%S</td></tr>\n" );
+    HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage );
+    HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* formatBuffer = HBufC::NewLC( KDateTimeFormat().Length() + dateText->Length() + timeText->Length() +  KSentLineDateAndTimeSeparatorText().Length() + align.Length() + 3 );
+    formatBuffer->Des().Format( KDateTimeFormat(), aColSpan, &align, dateText, &KSentLineDateAndTimeSeparatorText(), timeText );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 4 ); // dateText, timeText, formatBuffer, utf   
+    }
+
+void CFreestyleMessageHeaderHTML::ExportSubjectTableRowL( const TBool aShowLabel ) const
+    {
+    _LIT( KClassSubject, "subject" );
+    TPtrC subjectClass( KClassSubject() );
+    if ( aShowLabel )
+        {
+        _LIT( KClassSubjectIntended, "subject_intended");
+        ExportLabelTableRowL( R_FREESTYLE_EMAIL_UI_VIEWER_SUBJECT, 2 );
+        subjectClass.Set( KClassSubjectIntended() );
+        }
+    _LIT( KSubjectFormat, "<tr><td align=\"%S\" class=\"%S\">%S</td><td align=\"center\" valign=\"bottom\" width=\"1\">");
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* subject = SubjectLC();
+    HBufC* formatBuffer = HBufC::NewLC( KSubjectFormat().Length() + align.Length() + subject->Length() + subjectClass.Length() );
+    formatBuffer->Des().Format( KSubjectFormat(), &align, &subjectClass, subject );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 3 ); // subject, formatBuffer, utf
+    ExportMessageIconsL();
+    iWriteStream.WriteL( KTableCellEnd() );
+    iWriteStream.WriteL( KTableRowEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportMessageIconsL() const
+    {
+    _LIT( KPriorityLow, "priority_low" );
+    _LIT( KPriorityHigh, "priority_high" );
+    _LIT( KFollowUp, "follow_up" );
+    _LIT( KFollowUpComplete, "follow_up_complete" );
+    
+    TBool iconShown( EFalse );
+    
+    if ( iMailMessage.IsFlagSet( EFSMsgFlag_Low ) )
+        {
+        ExportIconL( KPriorityLow() );
+        iconShown = ETrue;
+        }
+    else if ( iMailMessage.IsFlagSet( EFSMsgFlag_Important ) )
+        {
+        ExportIconL( KPriorityHigh() );    
+        iconShown = ETrue;
+        }
+    
+    if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUp ) )
+        {
+        ExportIconL( KFollowUp() );
+        iconShown = ETrue;
+        }
+    else if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUpComplete ) )
+        {
+        ExportIconL( KFollowUpComplete() );    
+        iconShown = ETrue;
+        }
+    if ( iconShown )
+        {
+        iWriteStream.WriteL( _L8("<div class=\"icon_cell\"></div>") );
+        }
+    }
+
+void CFreestyleMessageHeaderHTML::ExportHeaderTablesL() const        
+    {
+    ExportCollapsedHeaderTableL();
+    ExportExpandedHeaderTablesL();
+    ExportAttachmentTablesL();
+    ExportDisplayImagesTableL();
+    }
+
+void CFreestyleMessageHeaderHTML::ExportCollapsedHeaderTableL() const
+    {
+    TBitFlags flags;
+    flags.Set( EFixed );
+    flags.Assign( EHidden, iExportFlags.IsSet( EHeaderExpanded ) );
+    ExportTableBeginL( _L("header_collapsed"), flags );
+    ExportSenderTableRowL( ETrue );
+    ExportDateTimeTableRowL();
+    ExportTableEndL();
+    flags.Clear( EFixed );
+    ExportTableBeginL( _L("header_collapsed_2"), flags );
+    ExportSubjectTableRowL();
+    ExportTableEndL();
     iWriteStream.CommitL();
     }
 
-void CFreestyleMessageHeaderHTML::HTMLMetaL() const
+void CFreestyleMessageHeaderHTML::ExportExpandedHeaderTablesL() const
     {
-    // Html file representing email header fields, is always constructed locally
-    // in the phone, and it is always of charset UTF-8 irrespective of what
-    // the email html-format body is
-    iWriteStream.WriteL( KMetaHeader );
+    TBitFlags flags;
+    flags.Set( EFixed );
+    flags.Assign( EHidden, iExportFlags.IsClear( EHeaderExpanded ) );
+    ExportTableBeginL( _L("header_expanded"), flags );
+    ExportSenderTableRowL( EFalse );
+    ExportFromTableRowL();
+    ExportTableEndL();
+    ExportToTableL();
+    ExportCcTableL();
+    ExportBccTableL();
+    flags.Clear( EFixed );
+    ExportTableBeginL( _L("header_expanded_2"), flags );
+    ExportDateTimeTableRowL( 2 );
+    ExportSubjectTableRowL();
+    ExportTableEndL();
     iWriteStream.CommitL();
     }
 
-void CFreestyleMessageHeaderHTML::HTMLHeaderEndL() const
+void CFreestyleMessageHeaderHTML::ExportAttachmentTablesL() const
+    {
+    const TInt attachmentCount( iAttachments.Count() );
+    if ( attachmentCount )
+        {
+        if ( attachmentCount > 1 )
+            {
+            ExportCollapsedAttachmentTableL( iExportFlags.IsSet( EAttachmentExpanded ) );
+            ExportExpandedAttachmentTableL( iExportFlags.IsClear( EAttachmentExpanded ) );
+            }
+        else
+            {
+            ExportExpandedAttachmentTableL( EFalse );        
+            }
+        }
+    }
+
+void CFreestyleMessageHeaderHTML::ExportAttachmentIconL() const
+    {    
+    _LIT8( KCellBegin, "<td width=\"1\" valign=\"top\" class=\"attachment\">" );
+    iWriteStream.WriteL( KCellBegin() );
+    _LIT( KAttachment, "attachment" );
+    ExportIconL( KAttachment() );
+    iWriteStream.WriteL( KTableCellEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportCollapsedAttachmentTableL( const TBool aHide ) const
+    {
+    TBitFlags flags;
+    flags.Assign( EHidden, aHide );
+    ExportTableBeginL( _L("attachments_collapsed"), flags );
+    ExportCollapsedAttachmentsTableRowL();
+    ExportTableEndL();
+    }
+
+void CFreestyleMessageHeaderHTML::ExportCollapsedAttachmentsTableRowL() const
     {
-    iWriteStream.WriteL(_L8("</head>\n"));
-    iWriteStream.CommitL();
+    iWriteStream.WriteL( KTableRowBegin() );
+    ExportAttachmentIconL();
+    ExportExpandAttachmentsL( _L("attachments"), iAttachments.Count() );
+    iWriteStream.WriteL( KTableRowEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportExpandedAttachmentTableL( const TBool aHide ) const
+    {    
+    TBitFlags flags;
+    flags.Assign( EHidden, aHide );
+    ExportTableBeginL( _L("attachments_expanded"), flags );
+    ExportExpandedAttachmentsTableRowsL();
+    ExportTableEndL();
+    }
+
+void CFreestyleMessageHeaderHTML::ExportExpandedAttachmentsTableRowsL() const
+    {
+    iWriteStream.WriteL( KTableRowBegin() );
+    ExportAttachmentIconL();
+    ExportAttachmentsL();
+    iWriteStream.WriteL( KTableRowEnd() );
+    }
+
+void CFreestyleMessageHeaderHTML::ExportAttachmentsL() const
+    {
+    ExportInnerTableBeginL( _L("_attachments_expanded"), 1 );
+    for ( TInt i = 0; i < iAttachments.Count(); i++ )
+        {
+        ExportAttachmentL( *iAttachments[ i ] );
+        }
+    ExportInnerTableEndL();
+    }
+
+void CFreestyleMessageHeaderHTML::ExportAttachmentL( CFSMailMessagePart& aAttachment ) const
+    {
+    _LIT( KAttachmentFormat, "<tr><td align=\"%S\" class=\"attachment\"><a href=\"cmail://attachment/%d\">%S (%S)</a></td></tr>\n" );
+    const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
+    HBufC* size = TFsEmailUiUtility::CreateSizeDescLC( aAttachment.ContentSize(), EFalse );
+    const TPtrC attachmentName( aAttachment.AttachmentNameL() );
+    HBufC* formatBuffer = HBufC::NewLC( KAttachmentFormat().Length() + align.Length() + size->Length() + attachmentName.Length() + 16 );
+    formatBuffer->Des().Format( KAttachmentFormat(), &align, aAttachment.GetPartId().Id(), &attachmentName, size );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 3 ); // size, formatBuffer, utf
     }
 
-void CFreestyleMessageHeaderHTML::ExportHTMLBodyL() const
+void CFreestyleMessageHeaderHTML::ExportIconL( const TDesC& aIconName ) const
+    {
+    _LIT( KMessageIconFormat, "<img src=\"%S.png\" class=\"icon\"/>" );
+    HBufC* formatBuffer = HBufC::NewLC( KMessageIconFormat().Length() + aIconName.Length() );
+    formatBuffer->Des().Format( KMessageIconFormat(), &aIconName );
+    HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+    CleanupStack::PushL( utf );
+    iWriteStream.WriteL( *utf );
+    CleanupStack::PopAndDestroy( 2 ); // formatBuffer, utf
+    }
+
+HBufC* CFreestyleMessageHeaderHTML::SubjectLC() const
+    {
+    return CreateLinksLC( iMailMessage.GetSubject(), CFindItemEngine::EFindItemSearchURLBin );
+    }
+
+TInt CFreestyleMessageHeaderHTML::CalculateTotalSpaceRequired( const TDesC& aText, 
+        CFindItemEngine& aItemEngine, TInt& aMaxLength ) const
+    {
+    TInt totalLength( 0 );
+    aMaxLength = KMinTInt;
+    CFindItemEngine::SFoundItem item;
+    aItemEngine.ResetPosition();
+    for ( TBool available( aItemEngine.Item( item ) ); available; available = aItemEngine.NextItem( item ) )
+        {
+        totalLength += item.iLength;
+        if ( item.iItemType == CFindItemEngine::EFindItemSearchURLBin )
+            {
+            const TPtrC url( aText.Mid( item.iStartPos, item.iLength ) );
+            if (  url.FindF( KSchemeSeparator() ) == KErrNotFound )
+                {
+                totalLength += KUrlFormatWithHttp().Length();
+                }
+            else
+                {
+                totalLength += KUrlFormat().Length();        
+                }
+            aMaxLength = ( aMaxLength < item.iLength ) ? item.iLength : aMaxLength;
+            }
+        }
+    aItemEngine.ResetPosition();
+    return totalLength;
+    }
+
+HBufC* CFreestyleMessageHeaderHTML::CreateLinksLC( const TDesC& aText, const TInt aSearchCases ) const
     {
-    HTMLBodyStartL();
-    ExportCollapsedHeaderTableL();
-    ExportExpandedHeaderTableL();
-    ExportAttachmentsL();
-    ExportDisplayImagesTableL();
-    HTMLBodyEndL();
+    HBufC* result = NULL;
+    CFindItemEngine* itemEngine = CFindItemEngine::NewL( aText, 
+            CFindItemEngine::TFindItemSearchCase( aSearchCases ) );
+    CleanupStack::PushL ( itemEngine );
+    if ( itemEngine->ItemCount() > 0 )
+        {
+        RBuf buf;
+        TInt maxLength;
+        buf.CreateL( CalculateTotalSpaceRequired( aText, *itemEngine, maxLength ) + aText.Length() );
+        buf.CleanupClosePushL();
+        TInt currentReadPosition( 0 );
+        CFindItemEngine::SFoundItem item;
+        HBufC* urlBuffer = HBufC::NewLC( KUrlFormatWithHttp().Length() + maxLength * 2 );
+        for ( TBool available( itemEngine->Item( item ) ); available; available = itemEngine->NextItem( item ) )
+            {
+            // Append characters from currentReadPosition to iStartPos
+            buf.Append( aText.Mid( currentReadPosition, item.iStartPos - currentReadPosition ) );
+            const TPtrC url( aText.Mid( item.iStartPos, item.iLength ) );
+            TPtrC format( KUrlFormat() );
+            if ( url.FindF( KSchemeSeparator() ) == KErrNotFound )
+                {
+                format.Set( KUrlFormatWithHttp() );
+                }
+            urlBuffer->Des().Format( format, &url, &url );
+            buf.Append( *urlBuffer );
+            currentReadPosition = item.iStartPos + item.iLength;
+            }
+        CleanupStack::PopAndDestroy(); // urlBuffer
+        // Append characters that are left in buffer
+        buf.Append( aText.Mid( currentReadPosition ) );
+        result = buf.AllocL();
+        CleanupStack::PopAndDestroy(); // buf.Close()
+        }
+    else
+        {
+        result = aText.AllocL();
+        }
+    CleanupStack::PopAndDestroy( itemEngine );
+    CleanupStack::PushL( result );
+    return result;
+    }
+
+void CFreestyleMessageHeaderHTML::ExportHTMLBodyEndL() const
+    {
+    iWriteStream.WriteL( _L8("</body>\n</html>\n") );
+    iWriteStream.CommitL();
     }
 
 void CFreestyleMessageHeaderHTML::ExportDisplayImagesTableL() const
     {
-    if (!iAutoLoadImages)
+    _LIT( KDisplayImagesLeftToRight,
+            "<script language=\"javascript\">var g_autoLoadImages = %d;</script><table style=\"display: none\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\">%S</td><td align=\"right\"><button value=\"submit\" class=\"submitBtn\" onClick=\"displayImagesButtonPressed()\"><span><span class=\"buttonText\">%S</span></span></button></td></tr></table>" );
+    
+    _LIT( KDisplayImagesRightToLeft,
+            "<script language=\"javascript\">var g_autoLoadImages = %d;</script><table style=\"display: none\" id=\"displayImagesTable\" width=\"%dpx\"><tr><td align=\"left\"><button value=\"submit\" class=\"submitBtn\" onClick=\"displayImagesButtonPressed()\"><span><span class=\"buttonText\">%S</span></span></button></td><td align=\"right\">%S</td></tr></table>" );
+
+    if ( iExportFlags.IsClear( EAutoLoadImages ) )
         {
-        _LIT8(KDescription, "");
-        //_LIT8(KButton, "Display images");
-        HBufC8* description = KDescription().AllocLC(); //HeadingTextLC(R_FREESTYLE_EMAIL_UI_IMAGES_ARE_NOT_DISPLAYED);
-        HBufC8* button = HeadingTextLC(R_FREESTYLE_EMAIL_UI_DISPLAY_IMAGES); // KButton().AllocLC();
-        HBufC8* formatBuffer = NULL;
-        if (iMirrorLayout)
+        _LIT(KDescription, "");
+        HBufC* description = KDescription().AllocLC(); //StringLoader::LoadLC(R_FREESTYLE_EMAIL_UI_IMAGES_ARE_NOT_DISPLAYED);
+        HBufC* button = StringLoader::LoadLC(R_FREESTYLE_EMAIL_UI_DISPLAY_IMAGES);
+        HBufC* formatBuffer = NULL;
+        if ( iExportFlags.IsSet( EMirroredLayout ) )
             {
-            formatBuffer = HBufC8::NewLC(KDisplayImagesRightToLeft().Length() + description->Length() + button->Length() + 8);
+            formatBuffer = HBufC::NewLC(KDisplayImagesRightToLeft().Length() + description->Length() + button->Length() + 8);
             formatBuffer->Des().Format(
                     KDisplayImagesRightToLeft(),
-                    iAutoLoadImages,
+                    EFalse,
                     iVisibleWidth,
                     button,
                     description);
             }
         else
             {
-            formatBuffer = HBufC8::NewLC(KDisplayImagesLeftToRight().Length() + description->Length() + button->Length() + 8);
+            formatBuffer = HBufC::NewLC(KDisplayImagesLeftToRight().Length() + description->Length() + button->Length() + 8);
             formatBuffer->Des().Format(
                     KDisplayImagesLeftToRight(),
-                    iAutoLoadImages,
+                    EFalse,
                     iVisibleWidth,
                     description,
                     button);
             }
-        iWriteStream.WriteL(*formatBuffer);
-        CleanupStack::PopAndDestroy(3); // description, button, formatBuffer
+        HBufC8* utf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *formatBuffer );
+        CleanupStack::PushL( utf );
+        iWriteStream.WriteL( *utf );
+        CleanupStack::PopAndDestroy( 4 ); // description, button, formatBuffer, utf
         iWriteStream.CommitL();
         }
     }
 
-void CFreestyleMessageHeaderHTML::HTMLBodyStartL() const
-    {
-    TBuf8<KFreestyleMessageHeaderHTMLRightMarginInPx> scrollPos;
-    scrollPos.AppendNum(iScrollPosition);
-    iWriteStream.WriteL(_L8("<body onLoad = \"init("));
-    iWriteStream.WriteL(scrollPos);
-    iWriteStream.WriteL(_L8(")\">\n"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportCollapsedHeaderTableL() const
-    {
-    StartHeaderTableL( KCollapsedHeaderTableName, !iExpanded );
-    ExportTimeAndExpandButtonL();
-    ExportSubjectCollapsedL();
-    EndHeaderTableL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportExpandedHeaderTableL() const
-    {
-    StartHeaderTableL( KExpandedHeaderTableName, iExpanded );
-    ExportCollapseButtonL();
-    ExportFromL();
-    ExportToL();
-    ExportCcL();
-    ExportBccL();
-    ExportSentTimeL();
-    ExportSubjectL();
-    EndHeaderTableL();
-    }
-
-// -----------------------------------------------------------------------------
-// CFreestyleMessageHeaderHTML::WriteSubjectL
-// Writes the subject to iWriteStream and also
-// takes care of the urls and marks them as hotspots
-// -----------------------------------------------------------------------------
-//
-void CFreestyleMessageHeaderHTML::WriteSubjectL(TDesC& aText ) const
-    {
-    /* 
-    * Add these to searchcases to make it also search 
-    * for emailaddress and phonenumber :
-    * CFindItemEngine::EFindItemSearchMailAddressBin |
-    * CFindItemEngine::EFindItemSearchPhoneNumberBin |
-    */
-    // Search for urls    
-    TInt searchCases = CFindItemEngine::EFindItemSearchURLBin;
-                       
-    CFindItemEngine* itemEngine =
-              CFindItemEngine::NewL ( aText,
-                       ( CFindItemEngine::TFindItemSearchCase ) searchCases );
-    CleanupStack::PushL (itemEngine );
-
-    const CArrayFixFlat<CFindItemEngine::SFoundItem>
-            * foundItems = itemEngine->ItemArray ( );
-    
-    TInt index = 0;
-    // For each found item
-    for (TInt i=0; i<foundItems->Count ( ); ++i )
-        {
-        // iItemType, iStartPos, iLength
-        const CFindItemEngine::SFoundItem& item = foundItems->At (i );
-        HBufC* valueBuf = aText.Mid (item.iStartPos, item.iLength ).AllocL ( );
-        CleanupStack::PushL (valueBuf );
-        // We write the normal text to iWriteStream before and between the links in the header subject field
-        if(item.iStartPos > 0)
-            {
-            TInt itemstart = item.iStartPos;
-            HBufC* normalText = aText.Mid(index, itemstart-index).Alloc();
-            CleanupStack::PushL( normalText );
-            HBufC8* normalText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *normalText );
-            CleanupStack::PushL( normalText8 );
-            iWriteStream.WriteL( *normalText8 );
-            CleanupStack::PopAndDestroy( 2 ); //normalText8m, normalText
-            }        
-        switch (item.iItemType )
-            {
-            /* To make header subjectfield to recognise also phonenumber and emailadress just 
-             * add CFindItemEngine::EFindItemSearchMailAddressBin & 
-             * CFindItemEngine::EFindItemSearchPhoneNumberBin cases here.
-             */
-            case CFindItemEngine::EFindItemSearchURLBin:
-                {
-                HBufC8* url8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *valueBuf );
-                CFreestyleMessageHeaderURL *fsurl = FreestyleMessageHeaderURLFactory::CreateEmailSubjectUrlL(*valueBuf);
-                delete fsurl;
-                CleanupStack::PushL( url8 );
-                StartHyperlinkL(*url8);
-                iWriteStream.WriteL(*url8);
-                EndHyperlinkL();
-                CleanupStack::PopAndDestroy( url8 );
-
-                break;
-                }
-            default:
-                {
-                break;
-                }
-            }        
-        index = item.iStartPos+item.iLength;
-        CleanupStack::PopAndDestroy (valueBuf );
-        }
-        //Write the rest of the subject to subject field if we are not 
-        //at the end of the subject already, or if there wasn't any
-        //url items write the whole subject field here
-        if(index < aText.Length() )
-            {
-            HBufC* normalText = aText.Mid(index, aText.Length()-index).Alloc();
-            CleanupStack::PushL( normalText );
-            HBufC8* normalText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *normalText );
-            CleanupStack::PushL( normalText8 );
-            iWriteStream.WriteL( *normalText8 );
-            CleanupStack::PopAndDestroy( 2 ); //normalText8m, normalText
-            }
-    CleanupStack::PopAndDestroy (itemEngine );
-    }
-
-HBufC8* CFreestyleMessageHeaderHTML::HTMLHeaderFollowUpIconLC( TBool aShowText ) const
-    {
-    HBufC8* followUpText8( NULL );
-    HBufC8* followUpCompletedText8( NULL );
-        
-    // Reserve space with worst case scenario in mind. 
-    TInt textLength( 0 );
-    if ( aShowText )
-        {
-        // Follow up completed.
-        HBufC* followUpCompletedText = StringLoader::LoadLC( 
-                R_FREESTYLE_EMAIL_UI_VIEWER_COMPLETED );
-        followUpCompletedText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( 
-                *followUpCompletedText );
-        CleanupStack::PopAndDestroy( followUpCompletedText );
-        CleanupStack::PushL( followUpCompletedText8 );
-        
-        // Follow up.
-        HBufC* followUpText = StringLoader::LoadLC( 
-                R_FREESTYLE_EMAIL_UI_VIEWER_FOLLOWUP );
-        followUpText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( 
-                *followUpText );
-        CleanupStack::PopAndDestroy( followUpText );
-        CleanupStack::PushL( followUpText8 );
-    
-        textLength += KHTMLImgTagId().Length() +
-                      KFollowUpCompleteImageName().Length() +
-                      KHTMLImgTagSrcBefore().Length() +
-                      KFollowUpCompleteIconFileName().Length() +
-                      KHTMLImgTagSrcAfter().Length() +
-                      ( followUpText8->Length() >= followUpCompletedText8->Length() ?
-                      followUpText8->Length() : followUpCompletedText8->Length() ); 
-        }
-    else
-        {
-        // Plain icon and no text.
-        textLength += KHTMLImgTagId().Length() + 
-                      KFollowUpCompleteImageName().Length() +
-                      KHTMLImgTagSrcBefore().Length() +
-                      KFollowUpCompleteIconFileName().Length() +
-                      KHTMLImgTagSrcAfter().Length();
-        }
-
-    // Allocate space.
-    HBufC8* iconText8 = HBufC8::NewLC( textLength );    
-        
-    // Generate HTML code
-    TPtr8 iconPtr( iconText8->Des() );
-        
-    if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUp ) )
-        {
-        iconPtr.Append( KHTMLImgTagId );
-        iconPtr.Append( KFollowUpImageName );
-        iconPtr.Append( KHTMLImgTagSrcBefore );
-        iconPtr.Append( KFollowUpIconFileName );
-        iconPtr.Append( KHTMLImgTagSrcAfter );
-        if ( aShowText && followUpText8 )
-            {
-            iconPtr.Append( followUpText8->Des() );
-            }
-        }
-    else if ( iMailMessage.IsFlagSet( EFSMsgFlag_FollowUpComplete ) )
-        {
-        iconPtr.Append( KHTMLImgTagId );
-        iconPtr.Append( KFollowUpCompleteImageName );
-        iconPtr.Append( KHTMLImgTagSrcBefore );
-        iconPtr.Append( KFollowUpCompleteIconFileName );
-        iconPtr.Append( KHTMLImgTagSrcAfter );
-        if ( aShowText && followUpCompletedText8 )
-            {
-            iconPtr.Append( followUpCompletedText8->Des() );
-            }
-        }
-    else
-        {
-        // No follow up flag set.
-        CleanupStack::PopAndDestroy( iconText8 );
-        iconText8 = NULL;
-        }
-
-    if ( aShowText )
-        {
-        if ( iconText8 )
-            {
-            CleanupStack::Pop( iconText8 );
-            }
-        CleanupStack::PopAndDestroy( followUpText8 );
-        CleanupStack::PopAndDestroy( followUpCompletedText8 );
-        if ( iconText8 )
-            {
-            CleanupStack::PushL( iconText8 );
-            }
-        }
-    
-    return iconText8;
-    }
-
-HBufC8* CFreestyleMessageHeaderHTML::HTMLHeaderPriorityIconLC( TBool aShowText ) const
-    {
-    HBufC8* highPrioText8( NULL );
-    HBufC8* lowPrioText8( NULL );
-        
-    // Reserve space with worst case scenario in mind. 
-    TInt textLength( 0 );
-    if ( aShowText )
-        {
-        // High priority.
-        HBufC* highPrioText = StringLoader::LoadLC( 
-                R_FREESTYLE_EMAIL_UI_VIEWER_HIGH_PRIO );
-        highPrioText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( 
-                *highPrioText );
-        CleanupStack::PopAndDestroy( highPrioText );
-        CleanupStack::PushL( highPrioText8 );
-    
-        // Low priority.
-        HBufC* lowPrioText = StringLoader::LoadLC( 
-                R_FREESTYLE_EMAIL_UI_VIEWER_LOW_PRIO );
-        lowPrioText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( 
-                *lowPrioText );
-        CleanupStack::PopAndDestroy( lowPrioText );
-        CleanupStack::PushL( lowPrioText8 );
-            
-        textLength += KHTMLImgTagId().Length() +
-                      KPriorityHighImageName().Length() +
-                      KHTMLImgTagSrcBefore().Length() +
-                      KPriorityHighIconFileName().Length() +
-                      KHTMLImgTagSrcAfter().Length() +
-                      ( lowPrioText8->Length() >= highPrioText8->Length() ?
-                      lowPrioText8->Length() : highPrioText8->Length() ); 
-        }
-    else
-        {
-        // Plain icon and no text.
-        textLength += KHTMLImgTagId().Length() + 
-                      KPriorityHighImageName().Length() +
-                      KHTMLImgTagSrcBefore().Length() +
-                      KPriorityHighIconFileName().Length() +
-                      KHTMLImgTagSrcAfter().Length();
-        }
-
-    // Allocate space.
-    HBufC8* iconText8 = HBufC8::NewLC( textLength );    
-        
-    // Generate HTML code
-    TPtr8 iconPtr( iconText8->Des() );
-        
-    if ( iMailMessage.IsFlagSet( EFSMsgFlag_Low ) )
-        {
-        iconPtr.Append( KHTMLImgTagId );
-        iconPtr.Append( KPriorityLowImageName );
-        iconPtr.Append( KHTMLImgTagSrcBefore );
-        iconPtr.Append( KPriorityLowIconFileName );
-        iconPtr.Append( KHTMLImgTagSrcAfter );
-        if ( aShowText && lowPrioText8 )
-            {
-            iconPtr.Append( lowPrioText8->Des() );
-            }
-        }
-    else if ( iMailMessage.IsFlagSet( EFSMsgFlag_Important ) )
-        {
-        iconPtr.Append( KHTMLImgTagId );
-        iconPtr.Append( KPriorityHighImageName );
-        iconPtr.Append( KHTMLImgTagSrcBefore );
-        iconPtr.Append( KPriorityHighIconFileName );
-        iconPtr.Append( KHTMLImgTagSrcAfter );
-        if ( aShowText && highPrioText8 )
-            {
-            iconPtr.Append( highPrioText8->Des() );
-            }
-        }
-    else
-        {
-        // No priority flag set.
-        CleanupStack::PopAndDestroy( iconText8 );
-        iconText8 = NULL;
-        }
-
-    if ( aShowText )
-        {
-        if ( iconText8 )
-            {
-            CleanupStack::Pop( iconText8 );
-            }
-        CleanupStack::PopAndDestroy( lowPrioText8 );
-        CleanupStack::PopAndDestroy( highPrioText8 );
-        if ( iconText8 )
-            {
-            CleanupStack::PushL( iconText8 );
-            }
-        }
-    
-    return iconText8;
-    }
-
-void CFreestyleMessageHeaderHTML::HTMLBodyEndL() const
-    {
-    iWriteStream.WriteL(_L8("</body>\n"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportCollapseButtonL() const
-    {
-    TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
-    tableWidth.AppendNum( iVisibleWidth );
-
-    // Add "Collapse" button as its own table with its own width
-    iWriteStream.WriteL( _L8("<tr><td>\n") );
-    iWriteStream.WriteL( _L8("<table id =\"table_minus_icon\" border=\"0\" width=\"") );
-    iWriteStream.WriteL( tableWidth );
-    iWriteStream.WriteL( _L8("px\">\n") );
-    iWriteStream.WriteL( _L8("<tr>\n") );
-
-    iWriteStream.WriteL( _L8("<td valign=\"top\"") );
-    if ( !iMirrorLayout )
-        {
-        iWriteStream.WriteL( _L8(" align=\"right\"") );
-        iWriteStream.WriteL( _L8(" style=\"padding-right: 10px;\">\n") );
-        }
-    else
-        {
-        iWriteStream.WriteL( _L8(" align=\"left\"") );
-        iWriteStream.WriteL( _L8(" style=\"padding-left: 10px;\">\n") );
-        }
-    iWriteStream.WriteL( _L8("<input type=\"submit\" id=\"collapse\" value=\"\" class=\"collapse\"") );
-    iWriteStream.WriteL( _L8(" onClick=\"collapseHeader(true)\"/>") );
-    iWriteStream.WriteL( _L8("</td>\n") );
-
-    iWriteStream.WriteL( _L8("</tr>\n"));
-    iWriteStream.WriteL( _L8("</table></td></tr>\n"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportTimeAndExpandButtonL() const
-    {
-    // set the width, using the visible screen width
-    TBuf8<KFreestyleMessageHeaderHTMLMaxBufferSizeForWidth> tableWidth;
-    tableWidth.AppendNum( iVisibleWidth );
-
-    // start first row: table with the sent info and the '+' icon
-    iWriteStream.WriteL(_L8("<tr><td><table id=\"table_sent_and_plus\" border=\"0\" width=\""));
-    iWriteStream.WriteL( tableWidth );
-    iWriteStream.WriteL( _L8("px\">\n"));
-    
-    iWriteStream.WriteL(_L8("<tr>\n"));
-    
-    // add Sent time and date
-    iWriteStream.WriteL(_L8("<td id=\"sent_initial\""));
-
-    if ( !iMirrorLayout )
-        {
-        iWriteStream.WriteL(_L8(" align=\"left\""));
-        }
-    else
-        {
-        iWriteStream.WriteL(_L8(" align=\"right\""));
-        }
-    iWriteStream.WriteL(_L8(" valign=\"bottom\">"));
-    
-    HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage );
-    HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage );
-
-    TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length();
-    HBufC* sentTimeText = HBufC::NewLC( len );
-    TPtr sentTimeTextPtr = sentTimeText->Des();
-    sentTimeTextPtr.Append( *dateText );
-    sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText );
-    sentTimeTextPtr.Append( *timeText );
-    HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr );
-    CleanupStack::PushL( sentTimeText8 );
-    iWriteStream.WriteL( *sentTimeText8 );
-    CleanupStack::PopAndDestroy( sentTimeText8 );
-    CleanupStack::PopAndDestroy( sentTimeText );
-    CleanupStack::PopAndDestroy( timeText );
-    CleanupStack::PopAndDestroy( dateText );
-    
-    iWriteStream.WriteL(_L8("</td>\n"));
-
-    // Add "expand" button on the same line as Sent time and date
-    iWriteStream.WriteL(_L8("<td valign=\"top\""));
-    if ( !iMirrorLayout )
-        {
-        iWriteStream.WriteL(_L8(" align=\"right\""));
-        iWriteStream.WriteL(_L8(" style=\"padding-right: 10px;\">\n"));
-        }
-    else
-        {
-        iWriteStream.WriteL(_L8(" align=\"left\""));
-        iWriteStream.WriteL(_L8(" style=\"padding-left: 10px;\">\n"));
-        }
-    iWriteStream.WriteL(_L8("<input type=\"submit\" id=\"expand\" value=\"\" class=\"expand\""));
-    iWriteStream.WriteL(_L8(" onClick=\"expandHeader(true)\"/>"));
-    iWriteStream.WriteL(_L8("</td>\n"));
-
-    // finish first row
-    iWriteStream.WriteL(_L8("</tr>\n"));  
-    iWriteStream.WriteL(_L8("</table></td></tr>\n"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportSubjectL() const
+void CFreestyleMessageHeaderHTML::ExportBodyStyleL() const
     {
-    iWriteStream.WriteL( _L8("<tr id=\"") );
-    iWriteStream.WriteL( KSubjectFieldName );
-    iWriteStream.WriteL( _L8("\">") );
-
-
-    iWriteStream.WriteL( _L8("<td width=\"1\">") );
-    iWriteStream.WriteL( _L8("<b>") );
-    HBufC8* subjectHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SUBJECT );
-    iWriteStream.WriteL( *subjectHeadingText );
-    CleanupStack::PopAndDestroy( subjectHeadingText );
-    iWriteStream.WriteL( _L8("</b>") );
-    iWriteStream.WriteL( _L8("</td>") );
-    iWriteStream.WriteL( _L8("</tr>\n") );
-    
-    // subject text
-    iWriteStream.WriteL( _L8("<tr>") );
-    iWriteStream.WriteL( _L8("<td>") );
-	HBufC* subject = iMailMessage.GetSubject().Alloc();
-    /*
-     * Writes the subject to iWriteStream and also
-     * takes care of the urls and marks them as hotspots
-     */
-    WriteSubjectL(*subject);
-
-    iWriteStream.WriteL( _L8("</td>") );
-    iWriteStream.WriteL( _L8("</tr>\n") );
-    // Write icons (if necessary).
-    HBufC8* followUp = HTMLHeaderFollowUpIconLC( ETrue );
-    HBufC8* priority = HTMLHeaderPriorityIconLC( ETrue );
-   
-    if ( priority )
-       {
-       iWriteStream.WriteL(_L8("<tr><td>"));
-       iWriteStream.WriteL( *priority );
-       iWriteStream.WriteL(_L8("</td></tr>"));
-       CleanupStack::PopAndDestroy( priority);
-       }
-   
-    if ( followUp )
-       {
-       iWriteStream.WriteL(_L8("<tr><td>"));
-       iWriteStream.WriteL( *followUp );
-       iWriteStream.WriteL(_L8("</td></tr>"));
-       CleanupStack::PopAndDestroy( followUp );
-       }
-
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportSubjectCollapsedL() const
-    {
-    iWriteStream.WriteL(_L8("<tr>\n"));
-    iWriteStream.WriteL(_L8("<td id=\"subject_initial\""));
-    if ( !iMirrorLayout )
-        {
-        iWriteStream.WriteL(_L8(" align=\"left\""));
-        }
-    else
-        {
-        iWriteStream.WriteL(_L8(" align=\"right\""));
-        }
-    iWriteStream.WriteL(_L8("><b>"));
-
-    HBufC* subject = iMailMessage.GetSubject().Alloc();
-    /*
-     * Writes the subject to iWriteStream and also
-     * takes care of the urls and marks them as hotspots
-     */
-    WriteSubjectL(*subject);
-
-    iWriteStream.WriteL(_L8("</b>"));
-
-    // Write icons (if necessary).
-    HBufC8* followUp = HTMLHeaderFollowUpIconLC( EFalse );
-    HBufC8* priority = HTMLHeaderPriorityIconLC( EFalse );
-
-    if ( priority )
-        {
-        iWriteStream.WriteL( *priority );
-        CleanupStack::PopAndDestroy( priority);
-        }
-
-    if ( followUp )
-        {
-        iWriteStream.WriteL( *followUp );
-        CleanupStack::PopAndDestroy( followUp );
-        }
-
-    iWriteStream.WriteL(_L8("</td></tr>\n"));  // finish subject row
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportFromL() const
-    {
-    RPointerArray<CFSMailAddress> froms;
-    CleanupClosePushL( froms );
-    CFSMailAddress* from = iMailMessage.GetSender();  // ownership not transferred
-    if ( from )
-        {
-        froms.AppendL( from );
-        }
-    ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom, froms, 
-                           KFromFieldName, KFromTableName, R_FREESTYLE_EMAIL_UI_VIEWER_FROM );
-    CleanupStack::PopAndDestroy( &froms );
-    }
-
-void CFreestyleMessageHeaderHTML::ExportToL() const
-    {
-    RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetToRecipients();
-    ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::EEmailAddressTypeTo, recipients,
-                           KToFieldName, KToTableName, R_FREESTYLE_EMAIL_UI_VIEWER_TO );
-    }
-
-void CFreestyleMessageHeaderHTML::ExportCcL() const
-    {
-    RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetCCRecipients();
-    ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::EEmailAddressTypeCc, recipients,
-                           KCcFieldName, KCcTableName, R_FREESTYLE_EMAIL_UI_VIEWER_CC );
-    }
-
-void CFreestyleMessageHeaderHTML::ExportBccL() const
-    {
-    RPointerArray<CFSMailAddress>& recipients = iMailMessage.GetBCCRecipients();
-    ExportEmailAddressesL( FreestyleMessageHeaderURLFactory::EEmailAddressTypeBcc, recipients,
-                           KBccFieldName, KBccTableName, R_FREESTYLE_EMAIL_UI_VIEWER_BCC );
-    }
-
-void CFreestyleMessageHeaderHTML::ExportSentTimeL() const
-    {
-
-    iWriteStream.WriteL( _L8("<tr id=\"") );
-    iWriteStream.WriteL( KSentFieldName );
-    iWriteStream.WriteL( _L8("\">") );
-
-
-    iWriteStream.WriteL( _L8("<td width=\"1\">") );
-    iWriteStream.WriteL( _L8("<b>") );
-    HBufC8* sentHeadingText = HeadingTextLC( R_FREESTYLE_EMAIL_UI_VIEWER_SENT );
-    iWriteStream.WriteL( *sentHeadingText );
-    CleanupStack::PopAndDestroy( sentHeadingText );
-    iWriteStream.WriteL( _L8("</b>") );
-    iWriteStream.WriteL( _L8("</td>") );
-    iWriteStream.WriteL( _L8("</tr>\n") );
-
-    iWriteStream.WriteL( _L8("<tr>") );
-    iWriteStream.WriteL( _L8("<td>") );
-
-    HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &iMailMessage );
-    HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &iMailMessage );
-
-    TInt len = dateText->Length() + KSentLineDateAndTimeSeparatorText().Length() + timeText->Length();
-    HBufC* sentTimeText = HBufC::NewLC( len );
-    TPtr sentTimeTextPtr = sentTimeText->Des();
-    sentTimeTextPtr.Append( *dateText );
-    sentTimeTextPtr.Append( KSentLineDateAndTimeSeparatorText );
-    sentTimeTextPtr.Append( *timeText );
-    HBufC8* sentTimeText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sentTimeTextPtr );
-    CleanupStack::PushL( sentTimeText8 );
-    iWriteStream.WriteL( *sentTimeText8 );
-    CleanupStack::PopAndDestroy( sentTimeText8 );
-    CleanupStack::PopAndDestroy( sentTimeText );
-    CleanupStack::PopAndDestroy( timeText );
-    CleanupStack::PopAndDestroy( dateText );
-
-    iWriteStream.WriteL( _L8("</td>") );
-
-    iWriteStream.WriteL( _L8("</tr>\n") );
-
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::ExportAttachmentsL() const
-    {
-    TInt attachmentsCount (iAttachments.Count());
-    if ( attachmentsCount)
-        {
-        // The attachments table consists of one row that contains 2 cells
-        // first cell contains the attachment icon
-        // second cell contains a table which contains the attachments list
-
-        // start attachments table
-        iWriteStream.WriteL( _L8("<table id=\"") ); 
-        iWriteStream.WriteL( KAttachmentTableName );
-        iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\">\n") );  // width is set at 100% intentionally
-        
-        // add attachment icon
-        // start row
-        iWriteStream.WriteL( _L8("<tr>\n") );
-        iWriteStream.WriteL( _L8("<td width=\"1\" valign=\"top\"") );
-        iWriteStream.WriteL(_L8(" align=\"left\""));
-
-        iWriteStream.WriteL( _L8("><image src=\"") );
-        
-        iWriteStream.WriteL( KAttachementIconGeneral );
-        iWriteStream.WriteL( _L8("\" ></td>\n") );
-        // start table of attachments as a table within a cell
-        iWriteStream.WriteL( _L8("<td>\n") );
-        iWriteStream.WriteL(_L8("<table id=\"table_attachments_list\" border=\"0\" width=\"100%\">\n"));
-
-        for (TInt i=0; i < attachmentsCount; i++)
-            {
-            AddAttachmentL( *iAttachments[i] );
-            }
-
-        iWriteStream.WriteL(_L8("</table>\n")); // end table_attachments_list
-        iWriteStream.WriteL( _L8("</td>\n") );
-        
-        iWriteStream.WriteL( _L8("</tr>\n") );
-        iWriteStream.WriteL(_L8("</table>\n")); // end attachments table
-        }
-    }
-
-void CFreestyleMessageHeaderHTML::ExportEmailAddressesL(FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType, 
-                                                        const RPointerArray<CFSMailAddress>& aEmailAddresses,
-                                                        const TDesC8& aRowId,
-                                                        const TDesC8& /*aTableId*/,
-                                                        TInt aHeaderTextResourceId ) const
-    {
-    if ( aEmailAddresses.Count() )
-        {
-        // begin table row
-        iWriteStream.WriteL( _L8("<tr id=\"")); 
-        iWriteStream.WriteL( aRowId );
-        iWriteStream.WriteL( _L8("\">") );
-        
-        // heading text
-        iWriteStream.WriteL( _L8("<td><b>"));
-        HBufC8* headingText = HeadingTextLC( aHeaderTextResourceId );
-        iWriteStream.WriteL( *headingText );
-        CleanupStack::PopAndDestroy( headingText );
-        iWriteStream.WriteL( _L8("</b></td>"));
-        
-        iWriteStream.WriteL( _L8("</tr>\n") );  // end table row      
-        
-        // add addresses, one address per row
-        TInt count( aEmailAddresses.Count() );
-        for (TInt i = 0; i < count; ++i )
-            {
-            iWriteStream.WriteL( _L8("<tr><td style=\"padding: 0px 0px 7px 0px;\">") );
-            AddEmailAddressL (aEmailAddressType, *aEmailAddresses[i] );
-            iWriteStream.WriteL( _L8("</td></tr>\n") );
-            }
-
-        iWriteStream.CommitL();
-        }
-    }
-
-void CFreestyleMessageHeaderHTML::AddEmailAddressL( FreestyleMessageHeaderURLFactory::TEmailAddressType aEmailAddressType,
-                                                    const CFSMailAddress& aEmailAddress ) const
-    {
-    CFreestyleMessageHeaderURL* emailUrl = FreestyleMessageHeaderURLFactory::CreateEmailAddressUrlL( aEmailAddressType, aEmailAddress );
-    CleanupStack::PushL( emailUrl );
-
-    HBufC* url = emailUrl->ExternalizeL();
-    CleanupStack::PushL( url );
-    HBufC8* url8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *url );
-    CleanupStack::PushL( url8 );
-    StartHyperlinkL( *url8 );
-    CleanupStack::PopAndDestroy( url8 );
-    CleanupStack::PopAndDestroy( url );
-
-    HBufC8* displayName8 = NULL;
-    //  ENLN-7ZVBES
-    //  Display name not shown in From:, instead, email address is shown
-    if ( (aEmailAddress.GetDisplayName().Length() > 0) && aEmailAddressType != FreestyleMessageHeaderURLFactory::EEmailAddressTypeFrom )
-        {
-        displayName8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aEmailAddress.GetDisplayName() );
-        }
-    else
-        {
-        displayName8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( aEmailAddress.GetEmailAddress() );
-        }
-    CleanupStack::PushL( displayName8 );
-    iWriteStream.WriteL( *displayName8 );
-    CleanupStack::PopAndDestroy( displayName8 );
-
-    EndHyperlinkL();
-
-    CleanupStack::PopAndDestroy( emailUrl );
-    }
-
-void CFreestyleMessageHeaderHTML::AddAttachmentL( CFSMailMessagePart& aAttachment ) const
-    {
-    iWriteStream.WriteL( _L8("<tr><td style=\"padding: 0px 0px 7px 0px;\">") ); // pad bottom to allow some space between the lines
-
-    TUint id = aAttachment.GetPartId().Id();
-    TBuf<32> itemId;
-    itemId.AppendNum( id );
-    CFreestyleMessageHeaderURL* attnUrl = FreestyleMessageHeaderURLFactory::CreateAttachmentUrlL( itemId );
-    CleanupStack::PushL( attnUrl );
-    HBufC* attnUrlText = attnUrl->ExternalizeL();
-    CleanupStack::PushL( attnUrlText );
-    HBufC8* attnUrlText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *attnUrlText );
-    CleanupStack::PushL( attnUrlText8 );
-    StartHyperlinkL( *attnUrlText8 );
-    CleanupStack::PopAndDestroy( attnUrlText8 );
-    CleanupStack::PopAndDestroy( attnUrlText );
-    CleanupStack::PopAndDestroy( attnUrl );
-
-    TDesC& attnName = aAttachment.AttachmentNameL();
-    HBufC8* attnName8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( attnName );
-    CleanupStack::PushL( attnName8 );
-    iWriteStream.WriteL( *attnName8 );
-    CleanupStack::PopAndDestroy( attnName8 );
-
-    HBufC* sizeDesc = TFsEmailUiUtility::CreateSizeDescLC(aAttachment.ContentSize(), EFalse);
-
-    TBuf8<48> sizeText;
-    
-    // Add right to left marker as "(" and ")" are messing up the html language markers
-    // and &rlm is only added in mirror layout 
-    if( iMirrorLayout )  
-        {
-    sizeText.Append( KSpace8 );
-    sizeText.Append( _L8( "&rlm;" ) );
-        }
-    
-    sizeText.Append( KSpace8 );
-    sizeText.Append( _L8("(") );
-    HBufC8* sizeDesc8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sizeDesc->Des() );
-    CleanupStack::PushL( sizeDesc8 );
-    sizeText.Append( sizeDesc8->Des() );
-    CleanupStack::PopAndDestroy( sizeDesc8 );
-    CleanupStack::PopAndDestroy( sizeDesc );
-    sizeText.Append( _L8(")") );
-    
-    if( iMirrorLayout )
-        {
-    sizeText.Append( KSpace8 );
-    sizeText.Append( _L8( "&rlm;" ) );
-        }
-    
-    iWriteStream.WriteL( sizeText );
-
-    EndHyperlinkL();
-
-    iWriteStream.WriteL( _L8("</td></tr>\n") );
-    iWriteStream.CommitL();
-    }
-
-
-void CFreestyleMessageHeaderHTML::StartHyperlinkL( const TDesC8& aUrl ) const
-    {
-    iWriteStream.WriteL( _L8("<a href=\"") );
-    if ( aUrl.FindF( KProtocolIdentifier() ) == KErrNotFound )
-    	{
-        iWriteStream.WriteL( _L8("http://"));
-    	}
-    iWriteStream.WriteL( aUrl );
-    iWriteStream.WriteL( _L8("\">"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::EndHyperlinkL() const
-    {
-    iWriteStream.WriteL( _L8("</a>") );
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::AddImageL( const TDesC8& aImageUrl ) const
-    {
-    iWriteStream.WriteL( _L8("<image border=\"0\" src=\"") );
-    iWriteStream.WriteL( aImageUrl );
-    iWriteStream.WriteL( _L8("\">"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::AddImageL( const TDesC8& aImageId,
-                                             const TDesC8& aImageUrl,
-                                             const TDesC8& aImageEvent ) const
-    {
-    iWriteStream.WriteL( _L8("<image id=\"") );
-    iWriteStream.WriteL( aImageId );
-    iWriteStream.WriteL( _L8("\" ") );
-    iWriteStream.WriteL( _L8("border=\"0\" src=\"") );
-    iWriteStream.WriteL( aImageUrl );
-    iWriteStream.WriteL( _L8("\" "));
-    iWriteStream.WriteL( aImageEvent );
-    iWriteStream.WriteL( _L8(">"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::AddJavascriptL() const
-    {
-    iWriteStream.WriteL( _L8("<script language=\"javascript\" src=\"header.js\"></script>\n"));
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::StartHeaderTableL( const TDesC8& aTableId,
-    TBool /*aVisible*/ ) const
-    {
-    iWriteStream.WriteL( _L8("<table id=\"") );
-    iWriteStream.WriteL( aTableId );
-    iWriteStream.WriteL( _L8("\" border=\"0\" width=\"100%\"") );
-    iWriteStream.WriteL( _L8(">\n") );
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::EndHeaderTableL() const
-    {
-    EndTableL();
-    }
-
-void CFreestyleMessageHeaderHTML::StartTableL( const TDesC8& aTableId ) const
-    {
-    iWriteStream.WriteL( _L8("<table id=\"") );
-    iWriteStream.WriteL( aTableId );
-    iWriteStream.WriteL( _L8("\" border=\"1\">\n") );
-    iWriteStream.CommitL();
-    }
-
-void CFreestyleMessageHeaderHTML::EndTableL() const
-    {
-    iWriteStream.WriteL( _L8("</table>\n") );
-    iWriteStream.CommitL();
-    }
-
-HBufC8* CFreestyleMessageHeaderHTML::ClickImageEventL( const TDesC8& aImageName ) const
-    {
-    TBuf8<KMaxEventLength> event;
-    if ( aImageName.Compare( KToImageName ) == 0 )
-        {
-        event.Append( _L8("onClick=\"toggleField('") );
-        event.Append( KToTableName );
-        event.Append( _L8("', '") );
-        event.Append( KToImageName );
-        event.Append( _L8("')\"") );
-        }
-    else if ( aImageName.Compare( KCcImageName ) == 0 )
-        {
-        event.Append( _L8("onClick=\"toggleField('") );
-        event.Append( KCcTableName );
-        event.Append( _L8("', '") );
-        event.Append( KCcImageName );
-        event.Append( _L8("')\"") );
-        }
-    else if ( aImageName.Compare( KBccImageName ) == 0 )
-        {
-        event.Append( _L8("onClick=\"toggleField('") );
-        event.Append( KBccTableName );
-        event.Append( _L8("', '") );
-        event.Append( KBccImageName );
-        event.Append( _L8("')\"") );
-        }
-    else if ( aImageName.Compare( KAttachmentImageName ) == 0 )
-        {
-        event.Append( _L8("onClick=\"toggleField('") );
-        event.Append( KAttachmentTableName );
-        event.Append( _L8("', '") );
-        event.Append( KAttachmentImageName );
-        event.Append( _L8("')\"") );
-        }
-    else
-        {
-        User::Leave(KErrNotSupported);
-        }
-    return event.AllocL();
-    }
-
-HBufC8* CFreestyleMessageHeaderHTML::HeadingTextLC( TInt aId ) const
-    {
-    HBufC* headingText = StringLoader::LoadLC( aId );
-    HBufC8* headingText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *headingText );
-    CleanupStack::PopAndDestroy( headingText );
-    CleanupStack::PushL( headingText8 );
-    return headingText8;
-    }
-
-HBufC8* CFreestyleMessageHeaderHTML::HeadingTextLC( TInt aId, TInt aSize ) const
-    {
-    HBufC* headingText = StringLoader::LoadLC( aId, aSize );
-    HBufC8* headingText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *headingText );
-    CleanupStack::PopAndDestroy( headingText );
-    CleanupStack::PushL( headingText8 );
-    return headingText8;
-    }
-
-void CFreestyleMessageHeaderHTML::AddStyleSheetL() const
-    {
-    // Add an internal style sheet
-    // If the style becomes numerous or complicated, consider using an external style sheet
-    
     iWriteStream.WriteL( _L8("<style type=\"text/css\">\n") );
-    
-    // define a div class "header", specifying the background color
-    // for the email header part
-    
 #ifdef __USE_THEME_COLOR_FOR_HEADER    
     MAknsSkinInstance* skin = AknsUtils::SkinInstance();
     TRgb textColor;
@@ -1209,38 +771,11 @@
          CleanupStack::PopAndDestroy(); // formatBuffer
          }
 #else
-     iWriteStream.WriteL( _L8("body { color: black; background-color: lightblue; }\n") );
+     //iWriteStream.WriteL( _L8("body { color: black; background-color: lightblue; }\n") );
+     iWriteStream.WriteL( _L8("body { color: black; background-color: #c5c5c5; }\n") );
 #endif // __USE_THEME_COLOR_FOR_HEADER    
-    
-    // set font size to 75% of the default size
-    // because, at the default size, the header text is too big relative to the text in the email body
-    // Note: since the text in the body is too small at "normal" level, 
-    // we have the text size level in the browser set to "Larger" which is 20% larger than the specified size
-    // the "larger" size affects all text which includes the header.
-    iWriteStream.WriteL( _L8("td { font-family:arial,sans-serif ; font-size:75% }\n") );
-    iWriteStream.WriteL( _L8(".button { background: url('btn_middle.png') repeat-x top left; border: 1px solid #546284; height: 32px; font-size:19px; font-weight: bold; color: #344a6c; font-family:arial,sans-serif; }\n") );
-    iWriteStream.WriteL( _L8("input { color: black; position: relative; border: 0; cursor: pointer; overflow: visible; }\n") );
-    iWriteStream.WriteL( _L8("input.expand { width: 55px; height: 36px; background: transparent url('"));
-    iWriteStream.WriteL( KExpandHeaderIconFileName );
-    iWriteStream.WriteL( _L8("') no-repeat top left; }\n") );
-    iWriteStream.WriteL( _L8("input.collapse { width: 55px; height: 36px; background: transparent url('"));
-    iWriteStream.WriteL( KCollapseHeaderIconFileName );
-    iWriteStream.WriteL( _L8("') no-repeat top left; }\n") );
     iWriteStream.WriteL( _L8("</style>\n") );
     iWriteStream.CommitL();
     }
 
-void CFreestyleMessageHeaderHTML::StartDivL() const
-    {
-    // Add div, using "header" class
-    iWriteStream.WriteL( _L8("<div class=\"header\">\n") );
-    iWriteStream.CommitL();
-    }
-    
-void CFreestyleMessageHeaderHTML::EndDivL() const
-    {
-    iWriteStream.WriteL( _L8("</div>\n") );
-    iWriteStream.CommitL();
-    }
-
-
+                                
--- a/emailuis/emailui/src/ncscomposeview.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeview.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -450,6 +450,9 @@
         // Simulate a back key to exit embedded app 
         // so that email editor could show on the top level.
         TKeyEvent KeyEvent = TKeyEvent();
+        // this is neccesary for photogalery image viewer (don't remove)
+        KeyEvent.iScanCode = EStdKeyUpArrow;
+        rwsSession.SimulateKeyEvent( KeyEvent );
         KeyEvent.iCode = EKeyCBA2;
         rwsSession.SimulateKeyEvent( KeyEvent );
 
@@ -1407,6 +1410,13 @@
     self->iContainer->SwitchChangeMskOff( ETrue );
     TRAP( error, ok = attachmentControl->AppendAttachmentToListL(
                 self->iAttachmentAddType) );
+
+    if( error == KErrNoMemory )
+    	{
+        TRAP_IGNORE( TFsEmailUiUtility::ShowErrorNoteL( 
+            R_FREESTYLE_EMAIL_ERROR_GENERAL_UNABLE_TO_COMPLETE,
+            ETrue ) );
+    	}
     self->iContainer->SwitchChangeMskOff( EFalse );
     self->iAddingAttachmentDialogOpened = EFalse;
     
--- a/emailuis/uicomponents/inc/fstreevisualizerbase.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/uicomponents/inc/fstreevisualizerbase.h	Thu Jul 15 18:19:25 2010 +0300
@@ -654,7 +654,7 @@
          * Leave-safe constructor
          */
         static CDragHandler* NewL(CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout,
-                const TBitFlagsT<TUint>& aFlags );
+                const TBitFlags& aFlags );
 
         /**
          * Destructor
@@ -711,7 +711,7 @@
         /**
          * Private constructor
          */
-        CDragHandler(CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout, const TBitFlagsT<TUint>& aFlags);
+        CDragHandler(CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout, const TBitFlags& aFlags);
 
         /**
          * Leave safe construct.
@@ -726,7 +726,7 @@
     private:
 
         CFsTreeVisualizerBase& iTree;
-        TBitFlagsT<TUint> iFlags;
+        TBitFlags iFlags;
         TTimeIntervalMicroSeconds32 iHighlightTimeout;
         CPeriodic* iHighlightTimer;
         TTime iStartTime;
@@ -734,7 +734,7 @@
         TPoint iLastPointerPosition;
         TPoint iDrag;
         TFsTreeItemId iItemId;
-        const TBitFlagsT<TUint>& iTreeVisualizerFlags;
+        const TBitFlags& iTreeVisualizerFlags;
         TDragDirection iDragDirection;
         };
 
@@ -2358,11 +2358,23 @@
 		/**
 		 * List is shown in popup mode.
 		 */
-        EPopupMode
+        EPopupMode,
+        
+        /**
+         * Informs tactile feedback that item was added i.e. does not 
+         * play feedback.
+         */
+        EListModelUpdate,
+
+        /**
+         * This flag is checked when trying to focus item. Focus is ignored 
+         * if list is being panned. 
+         */        
+        EListPanning
     };
 
     // Flags
-    TBitFlagsT<TUint> iFlags;
+    TBitFlags iFlags;
 
     // ETrue when the stylus/finger is currently pressed down
     TBool iTouchPressed;
--- a/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -1530,7 +1530,7 @@
 //
 void CFsTreeVisualizerBase::SetFocusVisibility( TBool aShow )
     {
-    if ( iFocusVisible != aShow )
+    if ( ( iFocusVisible && !aShow ) || ( !iFocusVisible && aShow ) )
         {
         iFocusVisible = aShow;
         TRAP_IGNORE(
@@ -1549,9 +1549,9 @@
     if (iDragHandler && iOwnerControl->ControlGroup()->AcceptInput())
         {
         TPointerEvent::TType type = aEvent.PointerEvent().iType;
-        const TInt id(EventItemId(aEvent));
+        const TFsTreeItemId id(EventItemId(aEvent));
         INFO_1("visual: $%x", aEvent.Visual());
-        if (KErrNotFound != id || type == TPointerEvent::EDrag ||
+        if ( KFsTreeNoneID != id || type == TPointerEvent::EDrag ||
                 type  == TPointerEvent::EButtonRepeat ||
                 type  == TPointerEvent::EButton1Up ||
                 type  == TPointerEvent::EButton1Down)
@@ -1597,6 +1597,7 @@
                         }*/
                     iDragHandler->PointerUp( aEvent.PointerEvent(), id );
                     iFlags.Clear(EIgnorePointerUpAction);
+                    iFlags.Clear( EListPanning );
                     break;
                     }
                 case TPointerEvent::EDrag:
@@ -1684,7 +1685,7 @@
 TFsTreeItemId CFsTreeVisualizerBase::VisualItemId(const CAlfVisual* aVisual) const
     {
     FUNC_LOG;
-    TInt itemId(KErrNotFound);
+    TFsTreeItemId itemId( KFsTreeNoneID );
     if (aVisual)
         {
         aVisual->PropertyFindInteger(KPropertyItemId(), &itemId);
@@ -2887,7 +2888,7 @@
 void CFsTreeVisualizerBase::RemoveItemL(TFsTreeItemId aItemId)
     {
     FUNC_LOG;
-    TInt removedindex = iWorld.IndexOfItem(aItemId);
+    const TInt removedindex(iWorld.IndexOfItem(aItemId));
     iWorld.RemoveL(aItemId);
     if (iFocusedItem == aItemId)
         {
@@ -5051,7 +5052,9 @@
 void CFsTreeVisualizerBase::SetPanningPosition(const TPoint& aDelta)
     {
     FUNC_LOG;
-    iPhysics->RegisterPanningPosition(aDelta);
+    iPhysics->RegisterPanningPosition(aDelta);    
+    iFlags.Set( EListPanning );
+    SetFocusVisibility( EFalse );
     }
 
 // ---------------------------------------------------------------------------
@@ -5228,7 +5231,7 @@
 //
 CFsTreeVisualizerBase::CDragHandler* CFsTreeVisualizerBase::CDragHandler::NewL(
         CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout,
-        const TBitFlagsT<TUint>& aFlags)
+        const TBitFlags& aFlags)
     {
     FUNC_LOG;
     CDragHandler* self = new (ELeave) CDragHandler(aTree, aHighlightTimeout,
@@ -5427,7 +5430,7 @@
 //
 CFsTreeVisualizerBase::CDragHandler::CDragHandler(
         CFsTreeVisualizerBase& aTree, const TInt aHighlightTimeout,
-        const TBitFlagsT<TUint>& aFlags) :
+        const TBitFlags& aFlags) :
     iTree(aTree), iHighlightTimeout(aHighlightTimeout * 1000),
             iTreeVisualizerFlags(aFlags)
     {
@@ -5462,12 +5465,7 @@
 //
 TBool CFsTreeVisualizerBase::IsFocusShown()
     {
-    if( iTouchPressed || iFocusVisible )
-        {
-        return ETrue;
-        }
-
-    return EFalse;
+    return ( iTouchPressed || iFocusVisible ) && iFlags.IsClear( EListPanning );
     }
 
 
--- a/ipsservices/ipssosplugin/inc/ipsplgpop3fetchoperation.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgpop3fetchoperation.h	Thu Jul 15 18:19:25 2010 +0300
@@ -68,6 +68,11 @@
         */
         virtual TFSProgress GetFSProgressL() const;
         
+        /**
+        *
+        */
+        virtual TInt IpsOpType() const;
+        
     protected:
 
         /**
--- a/ipsservices/ipssosplugin/inc/ipsplgsearch.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgsearch.h	Thu Jul 15 18:19:25 2010 +0300
@@ -367,11 +367,16 @@
         /**
          * @param aCriteria Sorting criterias.
          */
-        TMsgContainer( 
-            const TMsvId& aId, 
+
+
+        /*TMsgContainer(
+            const TMsvId& aId,
             const TFSMailSortCriteria& aCriteria,
-            CMsvSession& aMsvSession );
-        
+            CMsvSession& aMsvSession );*/
+
+        TMsgContainer( const TMsvEntry& aEntry,
+            const TFSMailSortCriteria& aCriteria );
+
         /**
          * @param aMsgContainer MsgContainer to be compared.
          * @return ETrue, when content is greater than in parameter.
@@ -446,17 +451,19 @@
         /**
          * Entry to be used for compare operations.
          */
-        TMsvId iId;
+        //TMsvId iId;
                 
         /**
          * Reference to existing sort criteria.
          */
         const TFSMailSortCriteria& iCriteria;
         
+        TMsvEntry iEntry;
+
         /**
          * Message server session.
          */
-        CMsvSession& iMsvSession;
+        //CMsvSession& iMsvSession;
         };
 
     /**
--- a/ipsservices/ipssosplugin/inc/ipsplgsearch.inl	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgsearch.inl	Thu Jul 15 18:19:25 2010 +0300
@@ -209,7 +209,7 @@
 //
 TMsvId CIpsPlgSearch::TMsgContainer::Id() const
     {
-    return iId;
+    return iEntry.Id();
     }
 
 // End of File
--- a/ipsservices/ipssosplugin/inc/ipsplgsosbaseplugin.hrh	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgsosbaseplugin.hrh	Thu Jul 15 18:19:25 2010 +0300
@@ -65,6 +65,7 @@
     EIpsOpTypeImap4SyncOp,
     EIpsOpTypePop3SyncOp,
     EIpsOpTypeOnlineOp,
-    EIpsOpTypeImap4PopulateOp
+    EIpsOpTypeImap4PopulateOp,
+    EIpsOpTypePop3PopulateOp
     };
 #endif /*IPSSOSPLUGIN_HRH_*/
--- a/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -425,11 +425,23 @@
                 *iTempSelection, param, this->iStatus);
         iState = EStateInfoEntryChange;
         SetActive();
+        
+        if ( iEventHandler )
+              {
+              iEventHandler->SetNewPropertyEvent( 
+                      iService, KIpsSosEmailSyncStarted, KErrNone );
+              } 
         }
     else
         {
         iState = EStateIdle;
         CompleteObserver();
+        
+        if ( iEventHandler )
+            {
+            iEventHandler->SetNewPropertyEvent( 
+                iService, KIpsSosEmailSyncCompleted, KErrNone );
+            }               
         }
     }
 
--- a/ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -378,5 +378,14 @@
     return result;
     }
 
+// ----------------------------------------------------------------------------
+// CIpsPlgPop3FetchOperation::IpsOpType()
+// ----------------------------------------------------------------------------
+// 
+TInt CIpsPlgPop3FetchOperation::IpsOpType() const
+    {
+    FUNC_LOG;
+    return EIpsOpTypePop3PopulateOp;
+    }
 // EOF
 
--- a/ipsservices/ipssosplugin/src/ipsplgsearch.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsearch.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -107,8 +107,9 @@
 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
 // ---------------------------------------------------------------------------
 //
-CIpsPlgSearch::TMsgContainer::TMsgContainer( 
-    const TMsvId& aId, 
+/*
+CIpsPlgSearch::TMsgContainer::TMsgContainer(
+    const TMsvId& aId,
     const TFSMailSortCriteria& aCriteria,
     CMsvSession& aMsvSession )
     :
@@ -118,6 +119,13 @@
     {
     FUNC_LOG;
     }
+*/
+CIpsPlgSearch::TMsgContainer::TMsgContainer( const TMsvEntry& aEntry,
+    const TFSMailSortCriteria& aCriteria ) :
+    iCriteria( aCriteria ), iEntry( aEntry )
+    {
+    FUNC_LOG;
+    }
 
 // ---------------------------------------------------------------------------
 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
@@ -136,12 +144,12 @@
         break;
         
     case EFSMailSortByDate:
-        result = Entry( iId ).iDate > Entry( aMsgContainer.Id() ).iDate;
+        result = iEntry.iDate > aMsgContainer.iEntry.iDate;
         break;
 
     case EFSMailSortBySender:
         {
-        HBufC* leftSender = NULL;
+        /*HBufC* leftSender = NULL;
         HBufC* rightSender = NULL;
         
         GetSenderStringsCC( 
@@ -151,13 +159,14 @@
             rightSender );
         
         result = *leftSender > *rightSender;
-        CleanupStack::PopAndDestroy( 2, leftSender ); 
+        CleanupStack::PopAndDestroy( 2, leftSender );*/
+        result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
         }
         break;
     
     case EFSMailSortBySubject:
         {
-        HBufC* leftSubject = NULL;
+        /*HBufC* leftSubject = NULL;
         HBufC* rightSubject = NULL;
         
         GetSubjectStringsCC( 
@@ -167,28 +176,29 @@
             rightSubject );
 
         result = *leftSubject > *rightSubject;
-        CleanupStack::PopAndDestroy( 2, leftSubject ); 
+        CleanupStack::PopAndDestroy( 2, leftSubject );*/
+        result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
         }
         break;
 
     case EFSMailSortByPriority:
-        result = Entry( iId ).Priority() > Entry( aMsgContainer.Id() ).Priority();        
+        result = iEntry.Priority() > aMsgContainer.iEntry.Priority();
         break;
     
     case EFSMailSortByFlagStatus:
-        result = Entry( iId ).New() > Entry( aMsgContainer.Id() ).New();
+        result = iEntry.New() > aMsgContainer.iEntry.New();
         break;
     
     case EFSMailSortByUnread:
-        result = Entry( iId ).Unread() > Entry( aMsgContainer.Id() ).Unread();
+        result = iEntry.Unread() > aMsgContainer.iEntry.Unread();
         break;
     
     case EFSMailSortBySize:
-        result = Entry( iId ).iSize > Entry( aMsgContainer.Id() ).iSize;
+        result = iEntry.iSize > aMsgContainer.iEntry.iSize;
         break;
     
     case EFSMailSortByAttachment:
-        result = Entry( iId ).iDate > Entry( aMsgContainer.Id() ).iDate;        
+        result = iEntry.iDate > aMsgContainer.iEntry.iDate;
         break;
         }
            
@@ -212,12 +222,12 @@
         break;
         
     case EFSMailSortByDate:
-        result = Entry( iId ).iDate >= Entry( aMsgContainer.Id() ).iDate;
+        result = iEntry.iDate >= aMsgContainer.iEntry.iDate;
         break;
         
     case EFSMailSortBySender:
         {
-        HBufC* leftSender = NULL;
+        /*HBufC* leftSender = NULL;
         HBufC* rightSender = NULL;
         
         GetSenderStringsCC( 
@@ -227,13 +237,14 @@
             rightSender );
         
         result = *leftSender >= *rightSender;
-        CleanupStack::PopAndDestroy( 2, leftSender ); 
+        CleanupStack::PopAndDestroy( 2, leftSender );*/
+        result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
         }
         break;
         
     case EFSMailSortBySubject:
         {
-        HBufC* leftSubject = NULL;
+        /*HBufC* leftSubject = NULL;
         HBufC* rightSubject = NULL;
         
         GetSubjectStringsCC( 
@@ -243,32 +254,33 @@
             rightSubject );
 
         result = *leftSubject >= *rightSubject;
-        CleanupStack::PopAndDestroy( 2, leftSubject ); 
+        CleanupStack::PopAndDestroy( 2, leftSubject );*/
+        result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
         }
         break;
-            
+
     case EFSMailSortByPriority:
-        result = Entry( iId ).Priority() >= Entry( aMsgContainer.Id() ).Priority();        
+        result = iEntry.Priority() >= aMsgContainer.iEntry.Priority();
         break;
-    
+
     case EFSMailSortByFlagStatus:
-        result = Entry( iId ).New() >= Entry( aMsgContainer.Id() ).New();
+        result = iEntry.New() >= aMsgContainer.iEntry.New();
         break;
-    
+
     case EFSMailSortByUnread:
-        result = Entry( iId ).Unread() >= Entry( aMsgContainer.Id() ).Unread();
+        result = iEntry.Unread() >= aMsgContainer.iEntry.Unread();
         break;
-    
+
     case EFSMailSortBySize:
-        result = Entry( iId ).iSize >= Entry( aMsgContainer.Id() ).iSize;
+        result = iEntry.iSize >= aMsgContainer.iEntry.iSize;
         break;
-    
+
     case EFSMailSortByAttachment:
-        result = Entry( iId ).iDate >= Entry( aMsgContainer.Id() ).iDate;        
+        result = iEntry.iDate >= aMsgContainer.iEntry.iDate;
         break;
         }
-        
-    return result;        
+
+    return result;
     }
 
 // ---------------------------------------------------------------------------
@@ -288,12 +300,12 @@
         break;
         
     case EFSMailSortByDate:
-        result = Entry( iId ).iDate <= Entry( aMsgContainer.Id() ).iDate;
+        result = iEntry.iDate <= aMsgContainer.iEntry.iDate;
         break;
 
     case EFSMailSortBySender:
         {
-        HBufC* leftSender = NULL;
+        /*HBufC* leftSender = NULL;
         HBufC* rightSender = NULL;
         
         GetSenderStringsCC( 
@@ -303,13 +315,14 @@
             rightSender );
         
         result = *leftSender <= *rightSender;
-        CleanupStack::PopAndDestroy( 2, leftSender ); 
+        CleanupStack::PopAndDestroy( 2, leftSender );*/
+        result = iEntry.iDetails > aMsgContainer.iEntry.iDetails;
         }
         break;
     
     case EFSMailSortBySubject:
         {
-        HBufC* leftSubject = NULL;
+        /*HBufC* leftSubject = NULL;
         HBufC* rightSubject = NULL;
         
         GetSubjectStringsCC( 
@@ -319,34 +332,36 @@
             rightSubject );
 
         result = *leftSubject <= *rightSubject;
-        CleanupStack::PopAndDestroy( 2, leftSubject ); 
+        CleanupStack::PopAndDestroy( 2, leftSubject );*/
+        result = iEntry.iDescription > aMsgContainer.iEntry.iDescription;
         }
         break;
 
     case EFSMailSortByPriority:
-        result = Entry( iId ).Priority() <= Entry( aMsgContainer.Id() ).Priority();        
+        result = iEntry.Priority() <= aMsgContainer.iEntry.Priority();
         break;
-    
+
     case EFSMailSortByFlagStatus:
-        result = Entry( iId ).New() <= Entry( aMsgContainer.Id() ).New();
+        result = iEntry.New() <= aMsgContainer.iEntry.New();
         break;
-    
+
     case EFSMailSortByUnread:
-        result = Entry( iId ).Unread() <= Entry( aMsgContainer.Id() ).Unread();
+        result = iEntry.Unread() <= aMsgContainer.iEntry.Unread();
         break;
-    
+
     case EFSMailSortBySize:
-        result = Entry( iId ).iSize <= Entry( aMsgContainer.Id() ).iSize;
+        result = iEntry.iSize <= aMsgContainer.iEntry.iSize;
         break;
-    
+
     case EFSMailSortByAttachment:
-        result = Entry( iId ).iDate <= Entry( aMsgContainer.Id() ).iDate;        
+        result = iEntry.iDate <= aMsgContainer.iEntry.iDate;
         break;
         }
         
     return result;        
     }
 
+/*
 // ---------------------------------------------------------------------------
 // CIpsPlgSearch::TMsgContainer::GetSenderStringsCC()
 // ---------------------------------------------------------------------------
@@ -386,7 +401,7 @@
     aRightSubject = entry.iDescription.Alloc();
     TRAP_IGNORE( CleanupStack::PushL( aRightSubject ) );
     }
-
+*/
 // ---------------------------------------------------------------------------
 // CIpsPlgSearch::TMsgContainer::TMsgContainer()
 // ---------------------------------------------------------------------------
@@ -395,10 +410,11 @@
     const TMsgContainer& aMsgContainer )
     {
     FUNC_LOG;
-    iId = aMsgContainer.Id();
+    iEntry = aMsgContainer.iEntry;
+    /*Id() = aMsgContainer.Id();*/
     return *this;
     }
-
+/*
 // ---------------------------------------------------------------------------
 // CIpsPlgSearch::TMsgContainer::Entry()
 // ---------------------------------------------------------------------------
@@ -423,6 +439,7 @@
     aMsvSession.GetEntry( aId, service, entry );
     return entry;
     }
+    */
 
 // ======== CLASS CIPSPLGSEARCH ========     
     
@@ -993,11 +1010,11 @@
                  ( entry.iMtm.iUid == KSenduiMtmSmtpUidValue ||
                    entry.iMtm.iUid == iPlugin.MtmId().iUid ) )
                 {
-                iEmailMessages.AppendL( TMsgContainer( 
-                    entry.Id(), iCurrentSearch.iSortCriteria, iMsvSession ) );
-                }        
+                iEmailMessages.AppendL( TMsgContainer( entry,
+                    iCurrentSearch.iSortCriteria ) );
+                }
             }
-        }    
+        }
     }
 
 //Ask client if it wants to change the search prority (i.e. to enable search for contact)
--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -655,6 +655,7 @@
             iOperations[i]->BaseOperation();
         if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
                ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
+                || baseOp->IpsOpType() == EIpsOpTypePop3PopulateOp		   
                 || baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp
                 || baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
             {
@@ -2198,7 +2199,8 @@
     if ( op && (
             op->IpsOpType() == EIpsOpTypeImap4SyncOp  ||
              op->IpsOpType() == EIpsOpTypePop3SyncOp ||
-             op->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
+             op->IpsOpType() == EIpsOpTypeImap4PopulateOp ||
+             op->IpsOpType() == EIpsOpTypePop3PopulateOp ) )
         {
         service = op->Service();
         }
--- a/ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -141,6 +141,7 @@
        
        if ( baseOp && baseOp->FSMailboxId() == aMailboxId &&
             ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp ||
+              baseOp->IpsOpType() == EIpsOpTypePop3PopulateOp ||		
               baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp ||
               baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
            {
@@ -168,6 +169,7 @@
 
        if ( baseOp && baseOp->FSMailboxId() == aMailBoxId &&
               ( baseOp->IpsOpType() == EIpsOpTypePop3SyncOp
+               || baseOp->IpsOpType() == EIpsOpTypePop3PopulateOp		  
                || baseOp->IpsOpType() == EIpsOpTypeImap4SyncOp
                || baseOp->IpsOpType() == EIpsOpTypeOnlineOp
                || baseOp->IpsOpType() == EIpsOpTypeImap4PopulateOp ) )
--- a/ipsservices/ipssossettings/src/ipssetdataapi.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetdataapi.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -45,7 +45,8 @@
 #include "ipssetdataapi.h"
 #include "ipssetwizardadapter.h"
 
-#include "ipssetwizardsettingscenrepkeys.h" 
+#include "ipssetwizardsettingscenrepkeys.h"
+#include "freestyleemailcenrepkeys.h"
 #include "ipssetdatasignature.h"
 
 const TInt KIpsDataApiMaxPassLen = 256;
@@ -443,10 +444,7 @@
         TInt err3 = repository->Set(
             ECRKMaxAccountsReached, EFalse );
 
-        if ( err3 != KErrNone )
-            {
-            }
-        
+       
         delete repository;
         repository = NULL;
         }
@@ -667,6 +665,18 @@
     FUNC_LOG;
     TInt sizeLimit = aImap4Settings.BodyTextSizeLimit();
     
+	
+    CRepository* centRep = NULL;
+    TRAP_IGNORE( centRep = CRepository::NewL( KFreestyleEmailCenRep ) );
+    
+    TInt limit( 0 );
+    TInt err = centRep->Get( KFreestyleMaxBodySize , limit );
+	limit *= KKilo;
+	if ( limit == 0 || err )
+        {
+        limit = KMaxTInt;
+        }
+    
     if ( sizeLimit == KIpsSetDataHeadersOnly )
         {
         aInfo.iTotalSizeLimit = KIpsSetDataHeadersOnly;
@@ -675,7 +685,7 @@
         {        
         aInfo.iTotalSizeLimit = KMaxTInt;
         aInfo.iAttachmentSizeLimit = KMaxTInt;
-        aInfo.iBodyTextSizeLimit = KMaxTInt;
+        aInfo.iBodyTextSizeLimit = limit;
         aInfo.iMaxEmailSize = KMaxTInt;
         aInfo.iPartialMailOptions = ENoSizeLimits;
         aInfo.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
@@ -684,7 +694,7 @@
         {
         aInfo.iTotalSizeLimit = KMaxTInt; 
         aInfo.iAttachmentSizeLimit = 0;
-        aInfo.iBodyTextSizeLimit = KMaxTInt;
+        aInfo.iBodyTextSizeLimit = limit;
         aInfo.iMaxEmailSize = KMaxTInt;
         aInfo.iPartialMailOptions = EBodyAlternativeText;
         aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText;
@@ -695,7 +705,7 @@
         // set zero when it not documentated does total size overrides these 
         aInfo.iAttachmentSizeLimit = 0;
         aInfo.iMaxEmailSize = sizeLimit*1024;
-        aInfo.iBodyTextSizeLimit = sizeLimit*1024;
+        aInfo.iBodyTextSizeLimit = Min(sizeLimit*1024, limit);
         aInfo.iPartialMailOptions = EBodyAlternativeText;
         aInfo.iGetMailBodyParts = EGetImap4EmailBodyAlternativeText;
         }
--- a/meetingrequest/mrgui/inc/cmrfieldcontainer.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/inc/cmrfieldcontainer.h	Thu Jul 15 18:19:25 2010 +0300
@@ -27,53 +27,66 @@
 class MMRFieldContainerObserver;
 
 // CLASS DECLARATIONS
-NONSHARABLE_CLASS( CMRFieldContainer ) : 
+NONSHARABLE_CLASS( CMRFieldContainer ) :
     public CCoeControl,
     public MESMRListObserver
     {
     public: // Creation and destruction
         /**
          * Static constructor.
-         * 
+         *
          * @return New instance of this class
          */
-        static CMRFieldContainer* NewL( 
-                MESMRFieldStorage& aFactory, 
+        static CMRFieldContainer* NewL(
+                MESMRFieldStorage& aFactory,
                 const CCoeControl& aParent );
         /**
          * Destructor
          */
         ~CMRFieldContainer();
-        
+
     public: // Interface
-                 
-         /**
-          * Return focused field.
-          * @return Focused list item or NULL if no focused item
-          */
-         CESMRField* FocusedField() const;
-         
-         /**
-          * Moves focus up one step.
-          * 
-          * @param aHiddenFocus, in case of hidden focus use case, ETrue. 
-          * @return TKeyResponse, if key response was used or not
-          */
-         TKeyResponse MoveFocusUpL( TBool aHiddenFocus );
+
+        /**
+        * Return focused field.
+        * @return Focused list item or NULL if no focused item
+        */
+        CESMRField* FocusedField() const;
+
+        /**
+        * Moves focus up one step.
+        *
+        * @param aHiddenFocus, in case of hidden focus use case, ETrue.
+        * @return TKeyResponse, if key response was used or not
+        */
+        TKeyResponse MoveFocusUpL( TBool aHiddenFocus );
 
-         /**
-          * Moves focus down one step.
-          * 
-          * @param aHiddenFocus, in case of hidden focus use case, ETrue. 
-          * @return TKeyResponse, if key response was used or not
-          */
-         TKeyResponse MoveFocusDownL( TBool aHiddenFocus );
-         
-         /**
-          * Moves focus visible if it is partly or completely out of
-          * viewable area.
-          */
-         void SetFieldContainerObserver( MMRFieldContainerObserver* aObserver );
+        /**
+        * Moves focus down one step.
+        *
+        * @param aHiddenFocus, in case of hidden focus use case, ETrue.
+        * @return TKeyResponse, if key response was used or not
+        */
+        TKeyResponse MoveFocusDownL( TBool aHiddenFocus );
+
+        /**
+        * Moves focus visible if it is partly or completely out of
+        * viewable area.
+        */
+        void SetFieldContainerObserver( MMRFieldContainerObserver* aObserver );
+
+        /**
+         * Scrolls field container. This is called by list pane during
+         * kinetic scrolling.
+         * @param aTl new top left corner of the container
+         */
+        void ScrollContainer( const TPoint& aTl );
+
+        /**
+         * Synchronizes field container and visible field positions after
+         * kinetic scrolling.
+         */
+        void Synchronize();
         
     public: // From MESMRListObserver
         void ControlSizeChanged( CESMRField* aField );
@@ -86,15 +99,17 @@
         void ScrollControlVisible( TInt aInd );
         void RePositionFields( TInt aAmount );
         TRect ViewableAreaRect();
-        
+
     public: // From CCoeControl
         TSize MinimumSize();
-        
+
     private: // From CCoeControl
         TInt CountComponentControls() const;
         CCoeControl* ComponentControl( TInt aIndex ) const;
         void SizeChanged();
-        
+        void Draw( const TRect& aRect ) const;
+        void HandlePointerEventL( const TPointerEvent &aPointerEvent );
+
     private: // Implementation
         CMRFieldContainer( MESMRFieldStorage& aFactory );
         void ConstructL( const CCoeControl& aParent );
@@ -103,7 +118,8 @@
         TInt LastVisibleField( TESMREntryFieldId aFieldId );
         void DoSetFocusL( TInt aNewFocusIndex );
         TKeyResponse MoveFocusVisibleL();
-        
+        void SetScrolling( TBool aScrolling );                
+
     private: // Data
         // Own: Informs listapane about needed position changes
         MMRFieldContainerObserver* iObserver;
@@ -111,9 +127,10 @@
         MESMRFieldStorage& iFactory;
         /// Own: Current focus index
         TInt iFocusedFieldIndex;
-
+        /// Own: Flag for kinetic scrolling state
+        TBool iScrolling;
     };
-    
+
 #endif // CMRFIELDCONTAINER_H
 
 // End of file
--- a/meetingrequest/mrgui/inc/cmrlistpane.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/inc/cmrlistpane.h	Thu Jul 15 18:19:25 2010 +0300
@@ -143,6 +143,11 @@
          * after list pane construction.
          */
         void ReActivateL();
+        
+        /**
+         * Records drawing commands of the visible fields 
+         */
+        void RecordFields();
 
     public: // MMRFieldContainerObserver
         void ScrollFieldsUp( TInt aPx );
@@ -184,6 +189,7 @@
         void ForwardReceivedPointerEventsToChildrenL();
         void HandleTactileFeedback( const TTouchLogicalFeedback& aType );
         TBool FeedbackScrollMarginExceeded( TInt aMargin );
+        void UpdatePosition();
 
     private: // Data
         /// Ref: Storage for list items.
@@ -216,6 +222,12 @@
         TInt iPreviousVerticalScrollIndex;
         /// Own: This records default field height for tactile feedback during scroll
         TInt iDefaultFieldHeight;
+        /// Own: Flag to determine if pointer event is being processed
+        TBool iPointerEventInProgress;
+        /// Own: Flag to determine if position is being changed
+        TBool iPositionChanged;
+        /// Own: Updated field container position
+        TPoint iUpdatedPanePoint;
     };
 
 #endif // CMRLISTPANE_H
--- a/meetingrequest/mrgui/mrfieldbuildercommon/bwins/esmrfieldbuildercommonu.def	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/bwins/esmrfieldbuildercommonu.def	Thu Jul 15 18:19:25 2010 +0300
@@ -119,4 +119,7 @@
 	?ResetActionMenuL@CESMRRichTextViewer@@QBEXXZ @ 118 NONAME ; void CESMRRichTextViewer::ResetActionMenuL(void) const
 	?SupportsLongTapFunctionalityL@CESMRField@@UAEHABUTPointerEvent@@@Z @ 119 NONAME ; int CESMRField::SupportsLongTapFunctionalityL(struct TPointerEvent const &)
 	?PointerEventOccuresOnALinkL@CESMRRichTextViewer@@QAEHABUTPointerEvent@@@Z @ 120 NONAME ; int CESMRRichTextViewer::PointerEventOccuresOnALinkL(struct TPointerEvent const &)
+	?RecordField@CESMRField@@QAEXXZ @ 121 NONAME ; void CESMRField::RecordField(void)
+	?Draw@CESMRField@@UBEXABVTRect@@@Z @ 122 NONAME ; void CESMRField::Draw(class TRect const &) const
+	?MoveToScreen@CESMRField@@QAEXH@Z @ 123 NONAME ; void CESMRField::MoveToScreen(int)
 
--- a/meetingrequest/mrgui/mrfieldbuildercommon/eabi/esmrfieldbuildercommonu.def	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/eabi/esmrfieldbuildercommonu.def	Thu Jul 15 18:19:25 2010 +0300
@@ -149,3 +149,7 @@
 	_ZNK19CESMRRichTextViewer12GetFocusLinkEv @ 148 NONAME
 	_ZN10CESMRField29SupportsLongTapFunctionalityLERK13TPointerEvent @ 149 NONAME
 	_ZN19CESMRRichTextViewer27PointerEventOccuresOnALinkLERK13TPointerEvent @ 150 NONAME
+	_ZN10CESMRField11RecordFieldEv @ 151 NONAME
+	_ZN10CESMRField12MoveToScreenEi @ 152 NONAME
+	_ZNK10CESMRField4DrawERK5TRect @ 153 NONAME
+
--- a/meetingrequest/mrgui/mrfieldbuildercommon/group/esmrfieldbuildercommon.mmp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/group/esmrfieldbuildercommon.mmp	Thu Jul 15 18:19:25 2010 +0300
@@ -48,6 +48,7 @@
 SOURCE      cmrattachmentprogressinfo.cpp
 SOURCE      cmrfilemanager.cpp
 SOURCE      cmrgrid.cpp
+SOURCE      cmrrecordinggc.cpp
 
 LIBRARY esmrcommon.lib
 LIBRARY esmrfieldevent.lib
@@ -81,6 +82,7 @@
 LIBRARY apgrfx.lib
 LIBRARY apmime.lib
 LIBRARY egul.lib
+LIBRARY ws32.lib
 
 #if defined( ENABLE_TRACES ) && defined( TRACE_INTO_FILE )
 LIBRARY flogger.lib
--- a/meetingrequest/mrgui/mrfieldbuildercommon/inc/cesmrfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/inc/cesmrfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -34,12 +34,12 @@
 
 class MESMRListObserver;
 class MESMRCalEntry;
-class CESMRBorderLayer;
 class CMRBackground;
 class MTouchFeedback;
 class MESMRFieldValidator;
 class CEikMenuPane;
 class MTouchFeedback;
+class CMRRecordingGc;
 
 // Enumeration for border type
 enum TESMRFieldFocusType
@@ -348,6 +348,17 @@
      IMPORT_C virtual TBool SupportsLongTapFunctionalityL(
     		 const TPointerEvent &aPointerEvent );
 
+    /**
+     * Moves field to and away from screen
+     * @param aVisible if ETrue, field is moved to screen
+     */
+    IMPORT_C void MoveToScreen( TBool aVisible );
+
+    /**
+     * Records field drawing commands to custom graphics context
+     */
+    IMPORT_C void RecordField();
+
 protected:
 
     /**
@@ -423,6 +434,7 @@
     IMPORT_C virtual TInt CountComponentControls() const;
     IMPORT_C virtual CCoeControl* ComponentControl( TInt aInd ) const;
     IMPORT_C virtual TSize MinimumSize();
+    IMPORT_C void Draw( const TRect& aRect ) const;
 
 protected: // From base class CCoeControl
 
@@ -464,11 +476,12 @@
 
 private:
     void AquireTactileFeedback();
+    void DrawControl( CCoeControl* aControl ) const;
 
 protected: // data
     /// Own: control which is surrounded by border
     CCoeControl* iExtControl;
-    /// Ref: Observer for notifying list component
+    /// Ref: Observer for notifying field container
     MESMRListObserver* iObserver;
     /// Ref: Id for this field.
     TESMREntryFieldId iFieldId;
@@ -504,6 +517,8 @@
     MESMRFieldValidator* iValidator;
     /// Own: lock status
     TBool iLocked;
+    /// Own: Cache for drawing commands
+    CMRRecordingGc* iRecordingGc;
     };
 
-#endif
+#endif // CESMRFIELD_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/inc/cmrrecordinggc.h	Thu Jul 15 18:19:25 2010 +0300
@@ -0,0 +1,211 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Recording graphics context used to cache drawing commands.
+*
+*/
+
+
+#include <w32std.h>
+#include <gdi.h>
+
+class CFbsBitmap;
+class CFbsBitGc;
+class CFbsBitmapDevice;
+
+NONSHARABLE_CLASS( CMRRecordingGc ) : public CWindowGc
+    {
+public:
+
+    CMRRecordingGc( CWindowGc& aRealGc );
+	~CMRRecordingGc();
+		
+public:
+    
+	/**
+	 * Flush recorded drawing commands from buffer to the real
+	 * graphics context.
+	 * 
+	 * @param aRect Target rectangle to draw
+	 */
+	void FlushBuffer( const TRect& aRect );
+	
+	/**
+	 * Delete recorded drawing commands
+	 */
+    void PurgeBuffer();
+    
+public: // From CGraphicsContext
+    
+    void SetOrigin(const TPoint &aPoint=TPoint(0,0));
+    
+protected:
+    
+    // From CWindowGc
+    	
+	void Activate( RDrawableWindow &aDevice );
+	void Deactivate();
+
+	// From CGraphicsContext
+	CGraphicsDevice* Device() const;
+	void SetDrawMode(TDrawMode aDrawingMode);
+	void SetClippingRect(const TRect& aRect);
+	void CancelClippingRect();
+	void Reset();
+
+	void UseFont(const CFont *aFont);
+	void DiscardFont();
+	void SetUnderlineStyle(TFontUnderline aUnderlineStyle);
+	void SetStrikethroughStyle( TFontStrikethrough aStrikethroughStyle );
+	
+	void SetWordJustification(TInt aExcessWidth,TInt aNumGaps);
+	void SetCharJustification(TInt aExcessWidth,TInt aNumChars);
+
+	void SetPenColor(const TRgb &aColor);
+	void SetPenStyle(TPenStyle aPenStyle);
+	void SetPenSize(const TSize& aSize);
+
+	void SetBrushColor(const TRgb &aColor);
+	void SetBrushStyle(TBrushStyle aBrushStyle);
+	void SetBrushOrigin(const TPoint &aOrigin);
+	void UseBrushPattern(const CFbsBitmap *aDevice);
+	void DiscardBrushPattern();
+
+	void MoveTo(const TPoint &aPoint);
+	void MoveBy(const TPoint &aPoint);
+	void Plot(const TPoint &aPoint);
+
+	void DrawArc(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
+	void DrawLine(const TPoint &aPoint1,const TPoint &aPoint2);
+	void DrawLineTo(const TPoint &aPoint);
+	void DrawLineBy( const TPoint& aPoint );
+	
+	void DrawPolyLine(const CArrayFix<TPoint> *aPointList);
+	void DrawPolyLine(const TPoint* aPointList,TInt aNumPoints);
+
+	void DrawPie(const TRect &aRect,const TPoint &aStart,const TPoint &aEnd);
+	void DrawEllipse(const TRect &aRect);
+	void DrawRect(const TRect &aRect);
+	void DrawRoundRect(const TRect &aRect,const TSize &aEllipse);
+	TInt DrawPolygon(const CArrayFix<TPoint> *aPointList,TFillRule aFillRule=EAlternate);
+	TInt DrawPolygon(const TPoint* aPointList,TInt aNumPoints,TFillRule aFillRule=EAlternate);
+
+	void DrawBitmap(const TPoint &aTopLeft, const CFbsBitmap *aDevice);
+	void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice);
+	void DrawBitmap(const TRect &aDestRect, const CFbsBitmap *aDevice, const TRect &aSourceRect);
+	void DrawBitmapMasked(const TRect& aDestRect, const CFbsBitmap* aBitmap, const TRect& aSourceRect, const CFbsBitmap* aMaskBitmap, TBool aInvertMask);
+	void DrawBitmapMasked(const TRect& aDestRect, const CWsBitmap* aBitmap, const TRect& aSourceRect, const CWsBitmap* aMaskBitmap, TBool aInvertMask);
+
+	void DrawText(const TDesC &aBuf,const TPoint &aPos);
+	void DrawText(const TDesC &aBuf,const TRect &aBox,TInt aBaselineOffset,TTextAlign aHoriz=ELeft,TInt aLeftMrg=0);
+
+	// From CBitmapContext
+	void Clear();
+	void Clear(const TRect &aRect);
+	void CopyRect(const TPoint &anOffset,const TRect &aRect);
+	void BitBlt(const TPoint &aPos, const CFbsBitmap *aBitmap);
+	void BitBlt(const TPoint &aDestination, const CFbsBitmap *aBitmap, const TRect &aSource);
+	void BitBltMasked(const TPoint& aPoint,const CFbsBitmap* aBitmap,const TRect& aSourceRect,const CFbsBitmap* aMaskBitmap,TBool aInvertMask);
+	void BitBlt(const TPoint &aPoint, const CWsBitmap *aBitmap);
+	void BitBlt(const TPoint &aDestination, const CWsBitmap *aBitmap, const TRect &aSource);
+	void BitBltMasked(const TPoint& aPoint,const CWsBitmap *aBitmap,const TRect& aSourceRect,const CWsBitmap *aMaskBitmap,TBool aInvertMask);
+	void MapColors(const TRect& aRect,const TRgb* aColors,TInt aNumPairs=2,TBool aMapForwards=ETrue);
+
+	void DrawTextVertical(const TDesC& aText,const TPoint& aPos,TBool aUp);
+	void DrawTextVertical(const TDesC& aText,const TRect& aBox,TInt aBaselineOffset,TBool aUp,TTextAlign aVert=ELeft,TInt aMargin=0);
+
+	//=================Extra functions specific to wserv GDI==============
+	void SetDitherOrigin(const TPoint& aPoint);
+	TInt SetClippingRegion(const TRegion &aRegion);
+	void CancelClippingRegion();
+	void SetOpaque(TBool aDrawOpaque=ETrue);
+
+	// From CFbsBitGc
+	void SetFaded(TBool aFaded);
+	void SetFadingParameters(TUint8 aBlackMap,TUint8 aWhiteMap);
+	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CFbsBitmap* aSrcBmp, const TRect& aSrcRect, const CFbsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
+	TInt AlphaBlendBitmaps(const TPoint& aDestPt, const CWsBitmap* aSrcBmp, const TRect& aSrcRect, const CWsBitmap* aAlphaBmp, const TPoint& aAlphaPt);
+	
+	TAny* Interface( TUid aInterfaceId );
+    const TAny* Interface( TUid aInterfaceId ) const;
+    
+protected:  
+    TInt APIExtension( TUid aUid, TAny*& aOutput, TAny* aInput );
+    
+private:
+    
+    /**
+     * Buffer item to store drawing command and parameters
+     */
+    NONSHARABLE_CLASS( CBufferItem ) : public CBase
+        {
+        public:
+        enum TCommandType
+            {
+            EShortText,
+            ELongText,
+            ESetPenColor,
+            EBitBlt1,
+            EBitBlt2,
+            EBitBltMasked1,
+            EUseFont,
+            EDiscardFont,
+            ESetDrawMode,
+            ESetClippingRect,
+            ECancelClippingRect,
+            ESetBrushColor,
+            ESetBrushStyle,
+            EDrawRect,
+            EClear,
+            EDrawLine,
+            ESetUnderlineStyle,
+            ESetStrikethroughStyle
+            };
+        
+        public:
+            ~CBufferItem();
+            
+            /**
+             * Translated commaned with given point
+             */
+            void Translate( const TPoint& aPoint );
+            
+            TInt iType;
+            HBufC* iText;
+            TPoint iPosition;
+            TRect iBox;
+            TInt iBaseLineOffset;
+            //TTextAlign iHorizontal;
+            TInt iLeftMargin;
+            TRgb iColor;
+            const CFbsBitmap* iBitmap;
+            const CFbsBitmap* iMask;
+            TRect iSource;
+            TBool iInvertMask;
+            const CFont* iFont;
+            //TDrawMode iDrawMode;
+            //TBrushStyle iBrushStyle;
+            TRect iRect;
+            TInt iValue;
+        };
+        
+    CBufferItem* BufferItem();
+        
+    /// Ref: Real window GC for actual drawing
+    CWindowGc& iRealGc;
+    /// Own: Array of recorded drawing commands
+    RPointerArray<CBufferItem> iItems;
+    /// Own: Recording origin relative to real context
+    TPoint iOrigin;
+    };
+
--- a/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -23,6 +23,7 @@
 #include "cesmrfieldcommandevent.h"
 #include "cmrbackground.h"
 #include "esmrcommands.h"
+#include "cmrrecordinggc.h"
 
 #include "emailtrace.h"
 
@@ -34,6 +35,12 @@
 #include <AknUtils.h>
 #include <touchfeedback.h>
 
+namespace
+{
+// Off-screen x coordinate for fields
+const TInt KOffScreenPositionX = 1000;
+}
+
 // ======== MEMBER FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
@@ -65,6 +72,7 @@
         iEventQueue->RemoveObserver( this );
         }
     delete iBackground;
+    delete iRecordingGc;
     }
 
 // ---------------------------------------------------------------------------
@@ -79,6 +87,7 @@
 
     iBackground = CMRBackground::NewL();
     this->SetBackground( iBackground );
+    iRecordingGc = new( ELeave ) CMRRecordingGc( SystemGc() );
     }
 
 // ---------------------------------------------------------------------------
@@ -219,6 +228,23 @@
     }
 
 // ---------------------------------------------------------------------------
+// CESMRField::Draw
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CESMRField::Draw( const TRect& aRect ) const
+    {
+    FUNC_LOG;
+
+    // Draw only if field is not on screen
+    if ( Position().iX != Parent()->Position().iX )
+        {
+        // Flush cached drawing commands from custom graphics context
+        iRecordingGc->FlushBuffer( aRect );
+        }
+
+    }
+
+// ---------------------------------------------------------------------------
 // CESMRField::HandlePointerEventL
 // ---------------------------------------------------------------------------
 //
@@ -256,11 +282,17 @@
 EXPORT_C void CESMRField::SetContainerWindowL(const CCoeControl& aContainer)
     {
     FUNC_LOG;
+
+    // Use container window from aContainer
+    // This will set also aContainer as MOP parent and CCoeControl parent
     CCoeControl::SetContainerWindowL( aContainer );
-    if ( iExtControl )
+
+    // Set this same window and this as parent for component controls
+    TInt count( CountComponentControls() );
+
+    for ( TInt i = 0; i < count; ++i )
         {
-        iExtControl->SetContainerWindowL( aContainer );
-        iExtControl->SetParent( this );
+        ComponentControl( i )->SetContainerWindowL( *this );
         }
     }
 
@@ -322,6 +354,7 @@
     {
     FUNC_LOG;
     iOutlineFocus = aFocus;
+
     if ( iExtControl )
         {
         iExtControl->SetFocus( aFocus );
@@ -829,6 +862,9 @@
     FUNC_LOG;
     delete iExtControl;
     iExtControl = aControl;
+
+    // Set also container window
+    iExtControl->SetContainerWindowL( *this );
     }
 
 // ---------------------------------------------------------------------------
@@ -856,7 +892,7 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C TBool CESMRField::SupportsLongTapFunctionalityL(
-		const TPointerEvent &aPointerEvent )
+		const TPointerEvent& /*aPointerEvent*/ )
 	{
     FUNC_LOG;
     // Subclasses may override for field specific actions
@@ -864,6 +900,41 @@
 	}
 
 // ---------------------------------------------------------------------------
+// CESMRField::MoveToScreen
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CESMRField::MoveToScreen( TBool aVisible )
+    {
+    FUNC_LOG
+
+    // Check that field is activated
+    if ( IsActivated() )
+        {
+        TPoint pos( Position() );
+
+        if ( aVisible )
+            {
+            // Set x coordinate to parent (field container) x coordinate
+            pos.iX = Parent()->Position().iX;
+            }
+        else
+            {
+            // Move field outside screen
+            pos.iX = KOffScreenPositionX;
+            // Record field drawing commands
+            RecordField();
+            }
+
+        if ( pos != Position() )
+            {
+            // Set new position only if it different from current one
+            // Setting new position potentially causes relayout in field
+            SetPosition( pos );
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // CESMRField::HandleTactileFeedbackL
 // ---------------------------------------------------------------------------
 //
@@ -892,6 +963,74 @@
 		}
     }
 
+// ---------------------------------------------------------------------------
+// CESMRField::RecordField
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CESMRField::RecordField()
+    {
+    FUNC_LOG;
+
+    // Record only activated field
+    if ( IsActivated() )
+        {
+        // Purge old draw commands
+        iRecordingGc->PurgeBuffer();
+
+        // Set recording graphics context to be used for drawing
+        SetCustomGc( iRecordingGc );
+
+        // Set gc origin to point (-x,-y)
+        // This will cause drawing commands to be relative to point (0,0)
+        iRecordingGc->SetOrigin( -iPosition );
+
+        // Draw custom background if available
+        const MCoeControlBackground* bg = Background();
+        if ( bg )
+            {
+            bg->Draw( *iRecordingGc, *this, Rect() );
+            }
+
+        // Draw child controls
+        DrawControl( this );
+
+        // Reset custom gc
+        SetCustomGc( NULL );
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CESMRField::DrawControl
+// ---------------------------------------------------------------------------
+//
+void CESMRField::DrawControl( CCoeControl* aControl ) const
+    {
+    TInt count( aControl->CountComponentControls() );
+
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CCoeControl* control = aControl->ComponentControl( i );
+
+        // Draw only non-window owning children
+        if ( !control->OwnsWindow() )
+            {
+            TRect rect( control->Rect() );
+
+            // Draw control background if available
+            const MCoeControlBackground* bg = control->Background();
+            if ( bg )
+                {
+                bg->Draw( *iRecordingGc, *control, rect );
+                }
+
+            // Draw control foreground
+            control->DrawForeground( rect );
+
+            // Draw child components
+            DrawControl( control );
+            }
+        }
+    }
 
 // EOF
 
--- a/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 *  Description : CEikRichTextEditor based Rich Text viewer
-*  Version     : %version: e002sa32#42.1.2 %
+*  Version     : %version: e002sa33#45.3 %
 *
 */
 
@@ -333,7 +333,6 @@
         switch ( aPointerEvent.iType )
             {
             case TPointerEvent::EButton1Down:
-            case TPointerEvent::EDrag:
                 {
                 RRegion linkArea;
                 CleanupClosePushL( linkArea );
@@ -352,6 +351,7 @@
                             {
                             iCntMenuHdlr->Reset();
                             iCntMenuHdlr->SetContactMenuObserver( this );
+
                             HighlightLinkL( *link );
                             DrawDeferred();
                             }
@@ -395,7 +395,7 @@
                 }
             }
 
-        if ( !linkFound )
+        if ( !linkFound && TPointerEvent::EDrag != aPointerEvent.iType )
             {
             // Tap on plain text
             TextView()->ClearSelectionL();
@@ -924,10 +924,18 @@
                 {
                 type = CESMRRichTextLink::ETypePhoneNumber;
 
-                // Remove unsupported characters from phone number
+                // patch the symbian level error , 10.120.22.141 this kind of url should not 
+                // be recognized to be a phone number.
                 TPtr phonePtr = valueBuf->Des ( );
-                CommonPhoneParser::ParsePhoneNumber (phonePtr,
-                        CommonPhoneParser::EContactCardNumber );
+                if( phonePtr.Find(_L(".")) == KErrNotFound )
+                	{
+                     CommonPhoneParser::ParsePhoneNumber (phonePtr,
+                       CommonPhoneParser::EContactCardNumber );
+                	}
+                else
+                	{
+                    type = (CESMRRichTextLink::TType) -1 ;
+                    }
                 break;
                 }
             case CFindItemEngine::EFindItemSearchURLBin:
@@ -1106,12 +1114,12 @@
     if ( iOpenActionMenu )
         {
         // Activate link as actions have been discovered
+        iOpenActionMenu = EFalse;
         TRAP_IGNORE(  LinkSelectedL() );
         }
 
     // Reset menu observer
-    iCntMenuHdlr->SetContactMenuObserver( NULL );
-    iOpenActionMenu = EFalse;
+    iCntMenuHdlr->SetContactMenuObserver( NULL );    
     }
 
 // -----------------------------------------------------------------------------
@@ -1121,8 +1129,11 @@
 void CESMRRichTextViewer::ShowContextMenuL()
     {
     FUNC_LOG;
-    iOpenActionMenu = EFalse;
-    ProcessCommandL( EAknSoftkeyContextOptions );
+    
+    if ( !iOpenActionMenu )
+        {
+        ProcessCommandL( EAknSoftkeyContextOptions );
+        }
     }
 
 // -----------------------------------------------------------------------------
@@ -1154,15 +1165,8 @@
                 CFont::TMeasureTextInput::EFVisualOrder );
 
         TPoint tl( posInfo.iEdge );
+        tl.iY -= iFont->FontMaxAscent();
 
-        if ( AknLayoutUtils::LayoutMirrored() )
-            {
-            // move top left x to end of text
-			// will be handled further, if all mr fields need to be changed the order from right to left.
-            //tl.iX -= textWidth;
-            }
-
-        tl.iY -= iFont->FontMaxAscent();
         TPoint br( tl.iX + textWidth, tl.iY + iFont->FontMaxHeight() );
 
         TRect rect( Rect() );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/src/cmrrecordinggc.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -0,0 +1,1355 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:    Recording graphics context used to cache drawing commands
+*
+*/
+
+
+
+#include <bitdev.h>
+#include <graphics/gdi/gdiconsts.h>
+#include <graphics/gdi/gdistructs.h>
+#include <e32err.h>
+
+#include "cmrrecordinggc.h"
+#include "emailtrace.h"
+
+namespace
+{
+
+#ifdef _DEBUG
+_LIT( KPanicCategory, "CMRRecordingGc" );
+
+enum TPanic
+    {
+    EBadArgument = 0,
+    ENotSupported
+    };
+
+void Panic( TPanic aPanic )
+    {
+    User::Panic( KPanicCategory, aPanic );
+    }
+
+#endif // _DEBUG
+
+}
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::CMRRecordingGc
+// -----------------------------------------------------------------------------
+//
+CMRRecordingGc::CMRRecordingGc( CWindowGc& aRealGc )
+    : CWindowGc( static_cast<CWsScreenDevice*>( aRealGc.Device() ) ),
+      iRealGc( aRealGc )
+    {
+    FUNC_LOG;
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::~CMRRecordingGc
+// -----------------------------------------------------------------------------
+//
+CMRRecordingGc::~CMRRecordingGc()
+    {
+    FUNC_LOG;
+    
+    iItems.ResetAndDestroy();
+    }
+    
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::FlushBuffer
+// -----------------------------------------------------------------------------
+//
+void CMRRecordingGc::FlushBuffer( const TRect& aRect )
+    {
+    FUNC_LOG;
+    
+    if ( iItems.Count() == 0 )
+        {
+        return;
+        }
+        
+    CBufferItem* item = NULL;
+    
+    // Use real  graphics context
+    CBitmapContext* gc = &iRealGc;
+    
+    // Set graphics context origin relative to the drawing position
+    gc->SetOrigin( aRect.iTl );
+    
+    for ( TInt i = 0; i < iItems.Count(); ++i )
+        {
+        item = iItems[i];
+                
+        switch ( item->iType )
+            {
+            case CBufferItem::EShortText:
+                gc->DrawText( *item->iText, item->iPosition );
+                break;
+                
+            case CBufferItem::ELongText:
+                gc->DrawText(
+                        *item->iText,
+                        item->iBox,
+                        item->iBaseLineOffset,
+                        TTextAlign( item->iValue ), //iHorizontal,
+                        item->iLeftMargin );
+                break;
+                
+            case CBufferItem::ESetPenColor:
+                gc->SetPenColor( item->iColor );
+                break;
+                                        
+            case CBufferItem::EBitBltMasked1:
+                gc->BitBltMasked(
+                        item->iPosition,
+                        item->iBitmap,
+                        item->iBox,
+                        item->iMask,
+                        item->iInvertMask );
+                break;
+                
+            case CBufferItem::EUseFont:
+                gc->UseFont( item->iFont );
+                break;
+                
+            case CBufferItem::EDiscardFont:
+                gc->DiscardFont();
+                break;
+                
+            case CBufferItem::ESetDrawMode:
+                gc->SetDrawMode( TDrawMode( item->iValue ) );
+                break;
+                
+            case CBufferItem::ESetClippingRect:
+                gc->SetClippingRect( item->iBox );
+                break;
+                
+            case CBufferItem::ECancelClippingRect:
+                gc->CancelClippingRect();
+                break;
+                
+            case CBufferItem::ESetBrushColor:
+                gc->SetBrushColor( item->iColor );
+                break;
+                
+            case CBufferItem::ESetBrushStyle:
+                gc->SetBrushStyle( TBrushStyle( item->iValue ) );//iBrushStyle );
+                break;
+
+            case CBufferItem::EDrawRect:
+                gc->DrawRect( item->iRect );
+                break;
+                
+            case CBufferItem::EClear:
+                gc->Clear( item->iRect );
+                break;
+                
+            case CBufferItem::EDrawLine:
+                gc->DrawLine( item->iRect.iTl, item->iRect.iBr );
+                break;
+            case CBufferItem::ESetUnderlineStyle:
+                gc->SetUnderlineStyle( TFontUnderline( item->iValue ) );
+                break;
+            case CBufferItem::ESetStrikethroughStyle:
+                gc->SetStrikethroughStyle( TFontStrikethrough( item->iValue ) );
+                break;
+            default:
+                break;
+            }
+        }
+                
+    // Reset gc
+    gc->Reset();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::PurgeBuffer
+// -----------------------------------------------------------------------------
+//
+void CMRRecordingGc::PurgeBuffer()
+    {
+    FUNC_LOG;
+    
+    iItems.ResetAndDestroy();
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::CBufferItem::~CBufferItem
+// -----------------------------------------------------------------------------
+//
+CMRRecordingGc::CBufferItem::~CBufferItem()
+    {
+    FUNC_LOG;
+    
+    delete iText;
+    delete iBitmap;
+    delete iMask;
+    }
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::CBufferItem::Translate
+// -----------------------------------------------------------------------------
+//
+void CMRRecordingGc::CBufferItem::Translate( const TPoint& aPoint )
+    {
+    FUNC_LOG;
+    
+    iBox.Move( aPoint );
+    iPosition += aPoint;
+    iRect.Move( aPoint );
+    }
+
+
+// -----------------------------------------------------------------------------
+// CMRRecordingGc::BufferItem
+// -----------------------------------------------------------------------------
+//
+CMRRecordingGc::CBufferItem* CMRRecordingGc::BufferItem()
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = NULL;
+    
+    TRAP_IGNORE(
+            {
+            buffer = new ( ELeave ) CBufferItem ;
+            CleanupStack::PushL( buffer );
+            iItems.AppendL( buffer );
+            CleanupStack::Pop( buffer );
+            buffer->iPosition.SetXY( -1, -1 );
+            } );
+    
+    return buffer;
+    }
+        
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Activate
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Activate( RDrawableWindow& /*aDevice*/ )
+    {
+    FUNC_LOG;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Deactivate
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Deactivate()
+    {
+    FUNC_LOG;
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Device
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+CGraphicsDevice* CMRRecordingGc::Device() const
+    {
+    FUNC_LOG;
+    
+    return NULL;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetOrigin
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetOrigin( const TPoint& aPoint )
+    {
+    FUNC_LOG;
+    
+    iOrigin = aPoint;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetDrawMode
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetDrawMode( TDrawMode aDrawingMode )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetDrawMode;
+        buffer->iValue = aDrawingMode;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetClippingRect
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetClippingRect( const TRect& aRect )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetClippingRect;
+        buffer->iBox = aRect;
+        buffer->iPosition = aRect.iTl;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::CancelClippingRect
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::CancelClippingRect()
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ECancelClippingRect;
+        }
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetClippingRegion
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::SetClippingRegion( const TRegion& /*aRegion*/ )
+    {
+    FUNC_LOG;
+    
+    return 0;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// void CMRRecordingGc::Reset
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Reset()
+    {
+    FUNC_LOG;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::UseFont
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::UseFont( const CFont* aFont )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EUseFont;
+        buffer->iFont = aFont;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DiscardFont
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DiscardFont()
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EDiscardFont;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetUnderlineStyle
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetUnderlineStyle( TFontUnderline aUnderlineStyle )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+        
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetUnderlineStyle;
+        buffer->iValue = aUnderlineStyle;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetStrikethroughStyle
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetStrikethroughStyle(
+        TFontStrikethrough aStrikethroughStyle )
+    {
+    FUNC_LOG;
+    CBufferItem* buffer = BufferItem();
+        
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetStrikethroughStyle;
+        buffer->iValue = aStrikethroughStyle;
+        }
+    }
+    
+
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetWordJustification
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetWordJustification(
+        TInt /*aExcessWidth*/, 
+        TInt /*aNumGaps*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetCharJustification
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetCharJustification(
+        TInt /*aExcessWidth*/, 
+        TInt /*aNumChars*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetPenColor
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetPenColor( const TRgb& aColor )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetPenColor;
+        buffer->iColor = aColor;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetPenStyle
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetPenStyle( TPenStyle /*aPenStyle*/ )
+    {
+    FUNC_LOG;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetPenSize
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetPenSize( const TSize& /*aSize*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetBrushColor
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetBrushColor( const TRgb& aColor )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetBrushColor;
+        buffer->iColor = aColor;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetBrushStyle
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetBrushStyle( TBrushStyle aBrushStyle )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ESetBrushStyle;
+        buffer->iValue = aBrushStyle;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetBrushOrigin
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetBrushOrigin( const TPoint& /*aOrigin*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::UseBrushPattern
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::UseBrushPattern( const CFbsBitmap* /*aDevice*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DiscardBrushPattern
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DiscardBrushPattern()
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::MoveTo
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::MoveTo( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::MoveBy
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::MoveBy( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Plot
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Plot( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawArc
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawArc(
+        const TRect& /*aRect*/,
+        const TPoint& /*aStart*/,
+        const TPoint& /*aEnd*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawLine
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawLine(
+        const TPoint& aPoint1,
+        const TPoint& aPoint2 )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EDrawLine;
+        buffer->iRect.iTl = aPoint1;
+        buffer->iRect.iBr = aPoint2;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawLineTo
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawLineTo( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawLineBy
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawLineBy( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawPolyLine
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawPolyLine( const CArrayFix<TPoint>* /*aPointList*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawPolyLine
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawPolyLine(
+        const TPoint* /*aPointList*/, 
+        TInt /*aNumPoints*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawPie
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawPie(
+        const TRect& /*aRect*/,
+        const TPoint& /*aStart*/, 
+        const TPoint& /*aEnd*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawEllipse
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawEllipse( const TRect& /*aRect*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawRect
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawRect( const TRect& aRect )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EDrawRect;
+        buffer->iRect = aRect;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawRoundRect
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawRoundRect(
+        const TRect& /*aRect*/,
+        const TSize& /*aEllipse*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawPolygon
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::DrawPolygon(
+        const CArrayFix<TPoint>* /*aPointList*/,
+        TFillRule /*aFillRule*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    
+    return KErrNotSupported;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawPolygon
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::DrawPolygon(
+        const TPoint* /*aPointList*/,
+        TInt /*aNumPoints*/,
+        TFillRule /*aFillRule*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    
+    return KErrNotSupported;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawBitmap
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawBitmap(
+        const TPoint& /*aTopLeft*/,
+        const CFbsBitmap* /*aDevice*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawBitmap
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawBitmap(
+        const TRect& /*aDestRect*/,
+        const CFbsBitmap* /*aDevice*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawBitmap
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawBitmap(
+        const TRect& /*aDestRect*/,
+        const CFbsBitmap* /*aDevice*/,
+        const TRect& /*aSourceRect*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawBitmapMasked
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawBitmapMasked(
+        const TRect& /*aDestRect*/,
+        const CFbsBitmap* /*aBitmap*/,
+        const TRect& /*aSourceRect*/, 
+        const CFbsBitmap* /*aMaskBitmap*/,
+        TBool /*aInvertMask*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawBitmapMasked
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawBitmapMasked(
+        const TRect& /*aDestRect*/,
+        const CWsBitmap* /*aBitmap*/, 
+        const TRect& /*aSourceRect*/, 
+        const CWsBitmap* /*aMaskBitmap*/, 
+        TBool /*aInvertMask*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawText
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawText( const TDesC& aBuf, const TPoint& aPos )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EShortText;
+        TRAP_IGNORE( buffer->iText = aBuf.AllocL() );
+        buffer->iPosition = aPos;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawText
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawText(
+        const TDesC& aBuf,
+        const TRect& aBox, 
+        TInt aBaselineOffset,
+        TTextAlign aHoriz,
+        TInt aLeftMrg )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::ELongText;
+        TRAP_IGNORE( buffer->iText = aBuf.AllocL() );
+        buffer->iBox = aBox;
+        buffer->iBaseLineOffset = aBaselineOffset;
+        buffer->iValue = aHoriz;
+        buffer->iLeftMargin = aLeftMrg;
+        buffer->iPosition = aBox.iTl;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Clear
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Clear()
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Clear
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::Clear( const TRect& aRect )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EClear;
+        buffer->iRect = aRect;
+        buffer->Translate( iOrigin );
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::CopyRect
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::CopyRect(
+        const TPoint& /*aOffset*/, 
+        const TRect& /*aRect */ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBlt
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBlt(
+        const TPoint& /*aPos*/, 
+        const CFbsBitmap* /*aBitmap*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBlt
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBlt(
+        const TPoint& aDestination,
+        const CFbsBitmap* aBitmap,
+        const TRect& aSource )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EBitBlt2;
+        buffer->iPosition = aDestination + iOrigin;
+        
+        // Duplicate bitmap
+        CFbsBitmap* bitmap = NULL;
+        TRAP_IGNORE( bitmap = new( ELeave ) CFbsBitmap; )
+        bitmap->Duplicate( aBitmap->Handle() );
+        buffer->iBitmap = bitmap;
+        buffer->iBox = aSource;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBltMasked
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBltMasked(
+        const TPoint& aPoint,
+        const CFbsBitmap* aBitmap,
+        const TRect& aSourceRect, 
+        const CFbsBitmap* aMaskBitmap, 
+        TBool aInvertMask )
+    {
+    FUNC_LOG;
+    
+    CBufferItem* buffer = BufferItem();
+    
+    if ( buffer )
+        {
+        buffer->iType = CBufferItem::EBitBltMasked1;
+        buffer->iPosition = aPoint + iOrigin;
+        buffer->iBox = aSourceRect;
+        buffer->iInvertMask = aInvertMask;
+        
+        // Make a duplicate of passed in bitmap, so that to make sure
+        // the bitmap won't be freed when FlushBuffer(). (Duplicate
+        // only increases the access count for bitmap)
+        CFbsBitmap* bitmap = NULL;
+        CFbsBitmap* maskBitmap = NULL;
+        TRAP_IGNORE( bitmap = new (ELeave) CFbsBitmap; )
+        TRAP_IGNORE( maskBitmap = new (ELeave) CFbsBitmap; )
+        bitmap->Duplicate(aBitmap->Handle());
+        maskBitmap->Duplicate(aMaskBitmap->Handle());
+        buffer->iBitmap = bitmap;
+        buffer->iMask = maskBitmap;
+        }
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBlt
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBlt(
+        const TPoint& /*aPoint*/,
+        const CWsBitmap* /*aBitmap*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBlt
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBlt(
+        const TPoint& /*aDestination*/,
+        const CWsBitmap* /*aBitmap*/, 
+        const TRect& /*aSource*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::BitBltMasked
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::BitBltMasked(
+        const TPoint& /*aPoint*/,
+        const CWsBitmap* /*aBitmap*/, 
+        const TRect& /*aSourceRect*/, 
+        const CWsBitmap* /*aMaskBitmap*/, 
+        TBool /*aInvertMask*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::MapColors
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::MapColors(
+        const TRect& /*aRect*/, 
+        const TRgb* /*aColors*/,
+        TInt /*aNumPairs*/, 
+        TBool /*aMapForwards*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawTextVertical
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawTextVertical(
+        const TDesC& /*aText*/, 
+        const TPoint& /*aPos*/, 
+        TBool /*aUp*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::DrawTextVertical
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::DrawTextVertical(
+        const TDesC& /*aText*/,
+        const TRect& /*aBox*/, 
+        TInt /*aBaselineOffset*/, 
+        TBool /*aUp*/,
+        TTextAlign /*aVert*/, 
+        TInt /*aMargin*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetDitherOrigin
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetDitherOrigin( const TPoint& /*aPoint*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::CancelClippingRegion
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::CancelClippingRegion()
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetOpaque
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetOpaque( TBool /*aDrawOpaque*/ )
+    {
+    FUNC_LOG;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetFaded
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetFaded( TBool /*aFaded*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::SetFadingParameters
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+void CMRRecordingGc::SetFadingParameters(
+        TUint8 /*aBlackMap*/,
+        TUint8 /*aWhiteMap*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::AlphaBlendBitmaps
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::AlphaBlendBitmaps(
+        const TPoint& /*aDestPt*/, 
+        const CFbsBitmap* /*aSrcBmp*/, 
+        const TRect& /*aSrcRect*/,
+        const CFbsBitmap* /*aAlphaBmp*/,
+        const TPoint& /*aAlphaPt*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    
+    return KErrNotSupported;
+    }
+    
+    
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::AlphaBlendBitmaps
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::AlphaBlendBitmaps(
+        const TPoint& /*aDestPt*/,
+        const CWsBitmap* /*aSrcBmp*/,
+        const TRect& /*aSrcRect*/, 
+        const CWsBitmap* /*aAlphaBmp*/, 
+        const TPoint& /*aAlphaPt*/ )
+    {
+    FUNC_LOG;
+        
+    __ASSERT_DEBUG( EFalse, Panic( ENotSupported ) );
+    
+    return KErrNotSupported;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Interface
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TAny* CMRRecordingGc::Interface( TUid /*aInterfaceId*/ )
+    {
+    FUNC_LOG;
+        
+    return NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::Interface
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+const TAny* CMRRecordingGc::Interface( TUid /*aInterfaceId*/ ) const
+    {
+    FUNC_LOG;
+    
+    return NULL;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMRRecordingGc::APIExtension
+// From class CWindowGc
+// ---------------------------------------------------------------------------
+//
+TInt CMRRecordingGc::APIExtension(
+        TUid aUid,
+        TAny*& /*aOutput*/,
+        TAny* aInput )
+    {
+    FUNC_LOG;
+    
+    if (aUid == KDrawTextInContextUid)
+        {
+        __ASSERT_DEBUG( aInput, Panic( EBadArgument ) );
+        TDrawTextInContextInternal* contextParam = 
+            static_cast<TDrawTextInContextInternal*>(aInput);
+        const TTextParameters* params = &contextParam->iParam;
+        __ASSERT_DEBUG( params, Panic( EBadArgument ) );
+        TPtrC textToDraw = contextParam->iText.Mid(
+                params->iStart, 
+                params->iEnd - params->iStart );
+        DrawText( textToDraw, contextParam->iPosition );
+		return KErrNone;
+        }
+    else
+        {
+		return KErrNotSupported;
+        }
+    }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdescriptionfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdescriptionfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -60,7 +60,6 @@
 
 public: // From CCoeControl
     TKeyResponse OfferKeyEventL(const TKeyEvent& aEvent, TEventCode aType );
-    void SetContainerWindowL( const CCoeControl& aContainer );
     TSize MinimumSize();
     void SizeChanged();
     TInt CountComponentControls() const;
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdetailedsubjectfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerdetailedsubjectfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -81,7 +81,6 @@
     TInt CountComponentControls() const;
     CCoeControl* ComponentControl( TInt aInd ) const;
     void SizeChanged();
-    void SetContainerWindowL( const CCoeControl& aContainer );
 
 public: // From MEikEdwinSizeObserver
     TBool HandleEdwinSizeEventL(
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerlocationfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cesmrviewerlocationfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -75,7 +75,6 @@
         TInt CountComponentControls() const;
         CCoeControl* ComponentControl( TInt aInd ) const;
         void SizeChanged();
-        void SetContainerWindowL( const CCoeControl& aContainer );
         void GetCursorLineVerticalPos(TInt& aUpper, TInt& aLower);
 
     protected: // From MEikEdwinSizeObserver
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrmulticalenfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrmulticalenfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -57,8 +57,7 @@
     TInt CountComponentControls() const;
     CCoeControl* ComponentControl( TInt aIndex ) const;
     void SizeChanged();
-    void SetContainerWindowL( const CCoeControl& aContainer );
-
+    
 private:
     /**
      * Constructor.
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrviewerattachmentfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/inc/cmrviewerattachmentfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -78,7 +78,6 @@
     CCoeControl* ComponentControl( TInt aInd ) const;
     void SizeChanged();
     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-    void SetContainerWindowL( const CCoeControl& aControl );
 
 protected: // From MEikEdwinSizeObserver
     TBool HandleEdwinSizeEventL( CEikEdwin* aEdwin, TEdwinSizeEvent aType, TSize aDesirableEdwinSize);
@@ -109,8 +108,6 @@
     CMRImage* iLockIcon;
     // Owned. Attachment list.
     CESMRRichTextViewer* iRichTextViewer;
-    // Not owned. CBA.
-    CEikButtonGroupContainer* iButtonGroupContainer;
     // Own. Background control context.
     CAknsBasicBackgroundControlContext* iBgCtrlContext;
     // Attachment count
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
  *  Description : ESMR location field implementation
- *  Version     : %version: e002sa32#53.1.2 %
+ *  Version     : %version: e002sa32#53.1.3 %
  *
  */
 
@@ -410,8 +410,9 @@
     if ( aEnabled )
         {
         iWaypointIcon = CMRImage::NewL(
-                NMRBitmapManager::EMRBitmapLocationWaypoint, ETrue );
-        iWaypointIcon->SetParent( this );
+                NMRBitmapManager::EMRBitmapLocationWaypoint,
+                this,
+                ETrue );
         }
 
     SizeChanged();
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsubjectfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsubjectfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -561,7 +561,9 @@
             iPriorityIcon = NULL;
             
             iPriorityIcon = CMRImage::NewL( 
-                  NMRBitmapManager::EMRBitmapPriorityHigh, ETrue );
+                  NMRBitmapManager::EMRBitmapPriorityHigh,
+                  this,
+                  ETrue );
             iPriorityIcon->SetParent( this );
             if( iCurrentPriority == EFSCalenMRPriorityNormal )
             	{
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmdatefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmdatefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -80,12 +80,10 @@
 void CESMRViewerAlarmDateField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateStart );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateStart, this );
     }
 
 // ---------------------------------------------------------------------------
@@ -258,8 +256,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -86,12 +86,12 @@
 void CESMRViewerAlarmField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarm );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapAlarm,
+            this );
     }
 
 // ---------------------------------------------------------------------------
@@ -302,8 +302,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmtimefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralarmtimefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -78,12 +78,10 @@
 void CESMRViewerAlarmTimeField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarmClock );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAlarmClock, this );
     }
 
 // ---------------------------------------------------------------------------
@@ -256,8 +254,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralldayeventfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrvieweralldayeventfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -79,12 +79,12 @@
 void CESMRViewerAllDayEventField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapCheckBoxOn );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapCheckBoxOn,
+            this );
     }
 
 // ---------------------------------------------------------------------------
@@ -232,8 +232,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdescriptionfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdescriptionfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -117,6 +117,7 @@
         TPtrC text = aEntry.Entry().DescriptionL();
         iRichTextViewer->SetTextL( &text, ETrue );
         iRichTextViewer->SetMargins( KMargin );
+        iRichTextViewer->ApplyLayoutChangesL();
         }
     iDisableRedraw = ETrue;
     }
@@ -148,17 +149,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CESMRViewerDescriptionField::SetContainerWindowL()
-// ---------------------------------------------------------------------------
-//
-void CESMRViewerDescriptionField::SetContainerWindowL( const CCoeControl& aContainer )
-    {
-    CESMRField::SetContainerWindowL( aContainer );
-    iRichTextViewer->SetContainerWindowL( aContainer );
-    iRichTextViewer->SetParent( this );
-    }
-
-// ---------------------------------------------------------------------------
 // CESMRViewerDescriptionField::MinimumSize()
 // ---------------------------------------------------------------------------
 //
@@ -271,6 +261,11 @@
         iObserver->ControlSizeChanged ( this );
         }
 
+    if ( !iOutlineFocus )
+        {
+        RecordField();
+        }
+    
     return iDisableRedraw;
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdetailedsubjectfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerdetailedsubjectfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -115,9 +115,10 @@
 void CESMRViewerDetailedSubjectField::ConstructL()
     {
     FUNC_LOG;
-    iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapOccasion );
-    iFieldIcon->SetParent( this );
-
+    iFieldIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapOccasion,
+            this );
+    
     iRichTextViewer = CESMRRichTextViewer::NewL( this );
     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
     iRichTextViewer->SetEdwinSizeObserver( this );
@@ -199,14 +200,16 @@
     	if( entry.PriorityL() == EFSCalenMRPriorityHigh )
     		{
     		iPriorityIcon = CMRImage::NewL(
-    				NMRBitmapManager::EMRBitmapPriorityHigh, ETrue );
-    		iPriorityIcon->SetParent( this );
+    				NMRBitmapManager::EMRBitmapPriorityHigh,
+    				this,
+    				ETrue );
     		}
     	if( entry.PriorityL() == EFSCalenMRPriorityLow )
     		{
     		iPriorityIcon = CMRImage::NewL(
-    				NMRBitmapManager::EMRBitmapPriorityLow, ETrue );
-    		iPriorityIcon->SetParent( this );
+    				NMRBitmapManager::EMRBitmapPriorityLow,
+    				this,
+    				ETrue );
     		}
     	}
 
@@ -265,12 +268,12 @@
         delete iFieldIcon;
         iFieldIcon = NULL;
 
-        iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapSubject );
-        iFieldIcon->SetParent( this );
-
-        DrawDeferred();
+        iFieldIcon = CMRImage::NewL(
+                NMRBitmapManager::EMRBitmapSubject,
+                this );
         }
-    iDisableRedraw = ETrue;
+    
+    SizeChanged();
     }
 
 // ---------------------------------------------------------------------------
@@ -303,6 +306,12 @@
     if ( iObserver && aEdwin == iRichTextViewer )
        {
        iObserver->ControlSizeChanged( this );
+       
+       if ( !iOutlineFocus )
+           {
+           RecordField();
+           }
+       
        reDraw = ETrue;
        }
 
@@ -418,8 +427,10 @@
 
 	delete iPriorityIcon;
 	iPriorityIcon = NULL;
-	iPriorityIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iPriorityIcon->SetParent( this );
+	iPriorityIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
@@ -589,18 +600,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CESMRViewerDetailedSubjectField::SetContainerWindowL
-// ---------------------------------------------------------------------------
-//
-void CESMRViewerDetailedSubjectField::SetContainerWindowL(
-        const CCoeControl& aContainer )
-    {
-    CCoeControl::SetContainerWindowL( aContainer );
-    iRichTextViewer->SetContainerWindowL( aContainer );
-    iRichTextViewer->SetParent( this );
-    }
-
-// ---------------------------------------------------------------------------
 // CESMRViewerDetailedSubjectField::SupportsLongTapFunctionalityL
 // ---------------------------------------------------------------------------
 //
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -120,6 +120,7 @@
     else
         {
         iRichTextViewer->SetTextL( &text, ETrue );
+        iRichTextViewer->ApplyLayoutChangesL();
         }
 
     // If the geo value has set, the waypoint icon has to be shown on right
@@ -130,9 +131,10 @@
     	{
     	if( geoValue && geoValue->GetLatLong( dummy, dummy ) )
     		{
-    		iWaypointIcon =
-    		CMRImage::NewL( NMRBitmapManager::EMRBitmapLocationWaypoint, ETrue );
-    		iWaypointIcon->SetParent( this );
+    		iWaypointIcon = CMRImage::NewL(
+    		        NMRBitmapManager::EMRBitmapLocationWaypoint,
+    		        this,
+    		        ETrue );
     		}
     	}
     }
@@ -163,6 +165,7 @@
     if ( iObserver && aEdwin == iRichTextViewer )
         {
         iObserver->ControlSizeChanged( this );
+        RecordField();
         reDraw = ETrue;
         }
 
@@ -185,8 +188,9 @@
 //
 void CESMRViewerLocationField::ConstructL( )
     {
-	iFieldButton = CMRButton::NewL( NMRBitmapManager::EMRBitmapLocation );
-    iFieldButton->SetParent( this );
+	iFieldButton = CMRButton::NewL(
+	        NMRBitmapManager::EMRBitmapLocation,
+	        this );
     iFieldButton->SetObserver(this);
 
     iRichTextViewer = CESMRRichTextViewer::NewL( this );
@@ -277,12 +281,19 @@
 
     if ( aEnabled )
         {
-        iWaypointIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLocationWaypoint, ETrue );
-        iWaypointIcon->SetParent( this );
+        iWaypointIcon = CMRImage::NewL(
+                NMRBitmapManager::EMRBitmapLocationWaypoint,
+                this,
+                ETrue );
         }
 
     // Relayout
     SizeChanged();
+    
+    if ( !iOutlineFocus )
+        {
+        RecordField();
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -411,20 +422,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CESMRViewerLocationField::SetContainerWindowL
-// ---------------------------------------------------------------------------
-//
-void CESMRViewerLocationField::SetContainerWindowL(
-        const CCoeControl& aContainer )
-    {
-    CCoeControl::SetContainerWindowL( aContainer );
-    iRichTextViewer->SetContainerWindowL( aContainer );
-    iRichTextViewer->SetParent( this );
-    iFieldButton->SetContainerWindowL( aContainer );
-    iFieldButton->SetParent( this );
-    }
-
-// ---------------------------------------------------------------------------
 // CESMRViewerLocationField::HandleLongtapEventL
 // ---------------------------------------------------------------------------
 //
@@ -486,9 +483,11 @@
 
 	delete iWaypointIcon;
 	iWaypointIcon = NULL;
-	iWaypointIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
+	iWaypointIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 
-	iWaypointIcon->SetParent( this );
 	iWaypointIcon->SetObserver( this );
 	}
 
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerpriorityfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerpriorityfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -78,13 +78,11 @@
 void CESMRViewerPriorityField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapPriorityNormal );
-    iIcon->SetParent( this );
-
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapPriorityNormal, this );
+    
     HBufC* priorityText = StringLoader::LoadLC(
                         R_QTN_CALENDAR_MEETING_OPT_PRIORITY_NORMAL,
                         iEikonEnv );
@@ -163,9 +161,8 @@
 
         delete iIcon;
         iIcon = NULL;
-        iIcon = CMRImage::NewL( bitmapId );
-        iIcon->SetParent( this );
-
+        iIcon = CMRImage::NewL( bitmapId, this );
+        
         // This needs to be called so icon will be redrawn
         SizeChanged();
         }
@@ -291,8 +288,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencedatefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencedatefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -85,8 +85,9 @@
 void CESMRViewerRecurrenceDateField::ConstructL()
     {
     FUNC_LOG;
-    iRepeatTopic = CMRLabel::NewL();
-    iRepeatDate = CMRLabel::NewL();
+    CESMRField::ConstructL( NULL );
+    iRepeatTopic = CMRLabel::NewL( this );
+    iRepeatDate = CMRLabel::NewL( this );
 
     iRepeatTopic->SetTextL( KNullDesC );
     iRepeatDate->SetTextL( KNullDesC );
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerrecurrencefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -87,12 +87,10 @@
 void CESMRViewerRecurrenceField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapRecurrence );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapRecurrence, this );
     }
 
 // -----------------------------------------------------------------------------
@@ -291,8 +289,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstartdatefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstartdatefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -96,12 +96,10 @@
     {
     FUNC_LOG;
 
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateStart );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateStart, this );
     }
 
 // -----------------------------------------------------------------------------
@@ -259,8 +257,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstopdatefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerstopdatefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -92,12 +92,10 @@
 //
 void CESMRViewerStopDateField::ConstructL()
     {
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateEnd );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapDateEnd, this );
     }
 
 // ---------------------------------------------------------------------------
@@ -291,8 +289,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewersyncfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewersyncfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -76,12 +76,12 @@
 void CESMRViewerSyncField::ConstructL()
     {
     FUNC_LOG;
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapSynchronization );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapSynchronization,
+            this );
     }
 
 // ---------------------------------------------------------------------------
@@ -264,8 +264,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewertimefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewertimefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -99,12 +99,10 @@
     {
     FUNC_LOG;
 
-    iLabel = CMRLabel::NewL();
-    iLabel->SetParent( this );
+    iLabel = CMRLabel::NewL( this );
     CESMRField::ConstructL( iLabel ); // ownership transfered
 
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapClock );
-    iIcon->SetParent( this );
+    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapClock, this );
     }
 
 // ---------------------------------------------------------------------------
@@ -303,8 +301,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -178,8 +178,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
@@ -228,16 +230,13 @@
     {
     FUNC_LOG;
 
-    iCalenName = CMRLabel::NewL();
+    iCalenName = CMRLabel::NewL( this );
     CESMRField::ConstructL( iCalenName );
     iCalenName->SetTextL( KNullDesC() );
 
-    TGulAlignment align;
-    align.SetHAlignment( EHLeft );
-    align.SetVAlignment( EVCenter );
-    iCalenName->SetAlignment( align );
-
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapCalendarSelection );
+    iIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapCalendarSelection,
+            this );
 
     }
 
@@ -291,12 +290,12 @@
         {
         case 0:
             {
-            control = iCalenName;
+            control = iIcon;
             break;
             }
         case 1:
             {
-            control = iIcon;
+            control = iCalenName;
             break;
             }
         case 2:
@@ -371,21 +370,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMRMultiCalenField::SetContainerWindowL
-// ---------------------------------------------------------------------------
-//
-void CMRMultiCalenField::SetContainerWindowL(
-        const CCoeControl& aContainer )
-    {
-    FUNC_LOG;
-    CCoeControl::SetContainerWindowL( aContainer );
-    iCalenName->SetContainerWindowL( aContainer );
-    iCalenName->SetParent( this );
-    iIcon->SetContainerWindowL( aContainer );
-    iIcon->SetParent( this );
-    }
-
-// ---------------------------------------------------------------------------
 // CMRMultiCalenField::SetTextDimmed
 // ---------------------------------------------------------------------------
 //
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -246,8 +246,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
@@ -288,18 +290,15 @@
 void CMRUnifiedEditorField::ConstructL( )
     {
     FUNC_LOG;
-    iType = CMRLabel::NewL();
+    iType = CMRLabel::NewL( this );
     CESMRField::ConstructL( iType );
     iType->SetTextL( KNullDesC() );
 
-    TGulAlignment align;
-    align.SetHAlignment( EHLeft );
-    align.SetVAlignment( EVCenter );
-    iType->SetAlignment( align );
-
     // An icon is required for layouting the field. Actual correct icon
     // is set after InternalizeL.
-    iIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapEventTypeMeeting );
+    iIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapEventTypeMeeting,
+            this );
     }
 
 // ---------------------------------------------------------------------------
@@ -485,7 +484,7 @@
 
     delete iIcon;
     iIcon = NULL;
-    iIcon = CMRImage::NewL( bitmapId );
+    iIcon = CMRImage::NewL( bitmapId, this );
     }
 
 // EOF
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -133,8 +133,9 @@
     FUNC_LOG;
     SetComponentsToInheritVisibility( ETrue );
 
-    iFieldIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapAttachment );
-    iFieldIcon->SetParent( this );
+    iFieldIcon = CMRImage::NewL(
+            NMRBitmapManager::EMRBitmapAttachment,
+            this );
 
     iRichTextViewer = CESMRRichTextViewer::NewL( this );
     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
@@ -283,9 +284,9 @@
     switch ( aInd )
         {
         case 0:
-            return iRichTextViewer;
+            return iFieldIcon;
         case 1:
-            return iFieldIcon;
+            return iRichTextViewer;
         case 2:
         	return iLockIcon;
         default:
@@ -400,23 +401,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CMRViewerAttachmentsField::SetContainerWindowL()
-// ---------------------------------------------------------------------------
-//
-void CMRViewerAttachmentsField::SetContainerWindowL( const CCoeControl& aControl )
-    {
-    FUNC_LOG;
-    CESMRField::SetContainerWindowL( aControl );
-    iRichTextViewer->SetContainerWindowL( aControl );
-    iRichTextViewer->SetParent( this );
-
-    iFieldIcon->SetContainerWindowL( aControl );
-    iFieldIcon->SetParent( this );
-
-    iButtonGroupContainer = CEikButtonGroupContainer::Current();
-    }
-
-// ---------------------------------------------------------------------------
 // CMRViewerAttachmentsField::HandleEdwinSizeEventL
 // ---------------------------------------------------------------------------
 //
@@ -435,6 +419,11 @@
            {
            iObserver->ControlSizeChanged( this );
            reDraw = ETrue;
+           
+           if ( !iOutlineFocus )
+               {
+               RecordField();
+               }
            }
         }
 
@@ -642,11 +631,6 @@
             iRichTextViewer->SetLineSpacingL( LineSpacing() );
             }
 
-        iRichTextViewer->ApplyLayoutChangesL();
-
-        iRichTextViewer->SetMargins( KMargin ); // What's this?
-        iRichTextViewer->HandleTextChangedL();
-
         while ( attachmentLinks.Count() > 0 )
             {
             CESMRRichTextLink* link = attachmentLinks[0];
@@ -655,6 +639,11 @@
             iRichTextViewer->AddLinkL( link );
             CleanupStack::Pop( link );
             }
+
+        iRichTextViewer->ApplyLayoutChangesL();
+
+        iRichTextViewer->SetMargins( KMargin ); // What's this?
+        iRichTextViewer->HandleTextChangedL();
         }
 
     CleanupStack::PopAndDestroy( &attachmentLinks );
@@ -831,8 +820,10 @@
 
 	delete iLockIcon;
 	iLockIcon = NULL;
-	iLockIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
-	iLockIcon->SetParent( this );
+	iLockIcon = CMRImage::NewL(
+	        NMRBitmapManager::EMRBitmapLockField,
+	        this,
+	        ETrue );
 	}
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponsefield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponsefield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -46,12 +46,12 @@
          * @return New response field object.
          */
         static CESMRResponseField* NewL(MESMRResponseObserver* aResponseObserver);
-    
+
         /**
          * C++ Destructor.
          */
         ~CESMRResponseField();
-    
+
     public: // From CCoeControl
         TInt CountComponentControls() const;
         CCoeControl* ComponentControl( TInt aInd ) const;
@@ -59,7 +59,7 @@
         TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent,  TEventCode aType );
         void FocusChanged( TDrawNow aDrawNow );
         TSize MinimumSize();
-        
+
     public: // From CESMRField
         void InitializeL();
         void InternalizeL( MESMRCalEntry& aEntry );
@@ -67,7 +67,7 @@
         void SetOutlineFocusL( TBool aFocus );
         TBool HandleSingletapEventL( const TPoint& aPosition );
         void HandleLongtapEventL( const TPoint& aPosition );
-        
+
     public: // New methods
         /**
          * Set the response observer for this class.
@@ -75,27 +75,26 @@
          * @param aResponseObserver - Response observer
          */
         void AddObserver( MESMRResponseObserver* aResponseObserver );
-    
+
         /**
          * Calls onwards the SetFont() method for all the items in the array
          *
          * @param aFont - Font to be set.
          */
         void SetFont( const CFont* aFont );
-        
+
         /**
          * Selects the current item.
          * @return ETrue if item is selectable
          */
         TBool ItemSelectedL();
-    
+
     private: // Implementation
         CESMRResponseField(MESMRResponseObserver* aResponseObserver);
         void ConstructL();
         void HandleCancelledEventItemsL( MESMRCalEntry& aEntry );
-        CCoeControl* ControlItem( TInt aIndex );
         TBool HandleTapEventL( const TPoint& aPosition );
-    
+
     private:
         /// Own: Conflict popup
         CESMRConflictPopup* iConfPopup ;
@@ -103,7 +102,7 @@
         RPointerArray <CESMRResponseItem> iResponseItemArray;
         /// Observer for the response
         MESMRResponseObserver* iResponseObserver;
-        /// Currently selected index 
+        /// Currently selected index
         TInt iSelectionIndex;
         /// Font for the label text
         const CFont* iFont;
@@ -112,18 +111,18 @@
         /// iESMRstatic accessed
         TBool iESMRStaticAccessed;
         /// whether a normal response
-        TBool iNormalResponse;  
+        TBool iNormalResponse;
         /// whether a remove response
-        TBool iRemoveResponse;      
+        TBool iRemoveResponse;
         /// Judge if there is any event conflict with current event.
         TBool iConflicted;
         /// Judge whether it has implemented HandleSingletapEventL
         TBool iPointEvent;
-        /// Judge whether the long tap have been consumed. 
+        /// Judge whether the long tap have been consumed.
         /// To avoid the same event be handled by
         /// HandleSingletapEventL() when HandleLongtapEventL().
         TBool iLongTapEventConsumed;
-     
+
     };
 
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponseitem.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrresponseitem.h	Thu Jul 15 18:19:25 2010 +0300
@@ -49,6 +49,7 @@
         TInt CountComponentControls() const;
         CCoeControl* ComponentControl( TInt aInd ) const;
         void SizeChanged();
+        void SetContainerWindowL( const CCoeControl& aContainer );
     
     public: // New methods
         /**
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerattendeesfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerattendeesfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -54,7 +54,6 @@
     CCoeControl* ComponentControl( TInt aInd ) const;
     void SizeChanged( );
     TKeyResponse OfferKeyEventL( const TKeyEvent& aEvent, TEventCode aType );
-    void SetContainerWindowL(const CCoeControl& aContainer);
     TSize MinimumSize();
 
 protected: // From CESMRField
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerfromfield.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/inc/cesmrviewerfromfield.h	Thu Jul 15 18:19:25 2010 +0300
@@ -65,7 +65,6 @@
         CCoeControl* ComponentControl( TInt aInd ) const;
         void SizeChanged();
         TSize MinimumSize();
-        void SetContainerWindowL(const CCoeControl& aContainer);
 
     protected: // From MEikEdwinSizeObserver
         TBool HandleEdwinSizeEventL(
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -97,9 +97,12 @@
     {
     FUNC_LOG;
 
+    CESMRField::ConstructL( NULL );
+
     // Add pls resopond item to this field.
     CESMRResponseItem* responseItem =
         CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
+    responseItem->SetContainerWindowL( *this );
     iResponseItemArray.AppendL( responseItem );
     CleanupStack::Pop( responseItem );
     }
@@ -147,26 +150,23 @@
     TInt count( iResponseItemArray.Count() );
     TRect parentRect( Rect() );
     TRect rect;
-    for( TInt i = 1; i <= count; ++i )
+    for( TInt i = 0; i < count; ++i )
         {
         TAknLayoutRect choiceLayoutRect =
-            NMRLayoutManager::GetFieldRowLayoutRect( parentRect, i );
+            NMRLayoutManager::GetFieldRowLayoutRect( parentRect, i + 1 );
         rect = parentRect;
         // Move the row down then it will be drawn to correct position.
         // controlIndex+1 tells the fields index.
         TInt movement = choiceLayoutRect.Rect().Height();
-        rect.Move( 0, movement * ( i - 1 ) );
+        rect.Move( 0, movement * i );
 
         TInt leftMargin = choiceLayoutRect.Rect().iTl.iX;
         TInt rightMargin = choiceLayoutRect.Rect().iBr.iX;
-        if ( AknLayoutUtils::LayoutMirrored() )
-            {
-            leftMargin -= parentRect.iTl.iX;
-            rightMargin -= parentRect.iTl.iX;
-            }
+        leftMargin -= parentRect.iTl.iX;
+        rightMargin -= parentRect.iTl.iX;
 
         AknLayoutUtils::LayoutControl(
-                ControlItem( i - 1 ),
+                ComponentControl( i ),
                 rect,
                 choiceLayoutRect.Color().Value(),
                 leftMargin,
@@ -176,6 +176,7 @@
                 choiceLayoutRect.Rect().Width(),
                 choiceLayoutRect.Rect().Height() );
         }
+    RecordField();
     }
 
 // -----------------------------------------------------------------------------
@@ -301,6 +302,7 @@
         // Construct the item to show conflicts info, and insert it to the beginning of array
         CESMRResponseItem* conflictItem =
             CESMRResponseItem::NewLC( EESMRCmdUndefined, KNullDesC, EFalse );
+        conflictItem->SetContainerWindowL( *this );
         iResponseItemArray.Insert( conflictItem, 0 );
         CleanupStack::Pop( conflictItem );
 
@@ -689,20 +691,5 @@
     return handled;
     }
 
-// -----------------------------------------------------------------------------
-// CESMRResponseField::ControlItem
-// -----------------------------------------------------------------------------
-//
-CCoeControl* CESMRResponseField::ControlItem( TInt aIndex )
-    {
-    CCoeControl* control = NULL;
-    if( aIndex < iResponseItemArray.Count() )
-        {
-        control = static_cast<CCoeControl*>( iResponseItemArray[aIndex] );
-        }
-
-    return control;
-    }
-
 // EOF
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -94,7 +94,7 @@
 void CESMRResponseItem::ConstructL( const TDesC& aItemText, TBool aHasIcon )
     {
     FUNC_LOG;
-    iSelectionLabel = CMRLabel::NewL();
+    iSelectionLabel = CMRLabel::NewL( this );
     iSelectionLabel->SetTextL( aItemText );
 
     // Response item might not have icon. e.g. topic line
@@ -299,6 +299,24 @@
     }
 
 // -----------------------------------------------------------------------------
+// CESMRResponseItem::SetContainerWindowL
+// -----------------------------------------------------------------------------
+//
+void CESMRResponseItem::SetContainerWindowL( const CCoeControl& aContainer )
+    {
+    FUNC_LOG;
+    
+    CCoeControl::SetContainerWindowL( aContainer );
+    
+    TInt count( CountComponentControls() );
+    
+    for ( TInt i = 0; i < count; ++i )
+        {
+        ComponentControl( i )->SetContainerWindowL( *this );
+        }
+    }
+
+// -----------------------------------------------------------------------------
 // CESMRResponseItem::IconL
 // -----------------------------------------------------------------------------
 //
@@ -312,7 +330,7 @@
         {
         iconID = NMRBitmapManager::EMRBitmapCheckBoxOn;
         }
-    CMRImage* icon = CMRImage::NewL( iconID );
+    CMRImage* icon = CMRImage::NewL( iconID, this );
     return icon;
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerattendeesfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerattendeesfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -80,8 +80,7 @@
     SetFieldId ( (iRole == CCalAttendee::EReqParticipant) ? EESMRFieldAttendee
             : EESMRFieldOptAttendee );
 
-    iTitle = CMRLabel::NewL();
-    iTitle->SetParent( this );
+    iTitle = CMRLabel::NewL( this );
 
     iRichTextViewer = CESMRRichTextViewer::NewL (this );
     CESMRField::ConstructL( iRichTextViewer ); // ownership transferred
@@ -341,18 +340,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// CESMRViewerAttendeesField::SetContainerWindowL()
-// ---------------------------------------------------------------------------
-//
-void CESMRViewerAttendeesField::SetContainerWindowL(
-        const CCoeControl& aContainer )
-    {
-    CESMRField::SetContainerWindowL( aContainer );
-    iRichTextViewer->SetContainerWindowL( aContainer );
-    iRichTextViewer->SetParent( this );
-    }
-
-// ---------------------------------------------------------------------------
 // CESMRViewerAttendeesField::MinimumSize()
 // ---------------------------------------------------------------------------
 //
@@ -428,10 +415,17 @@
     {
     FUNC_LOG;
     iExpandedSize = aSize;
+    
     if ( iObserver && iDisableRedraw )
         {
         iObserver->ControlSizeChanged ( this );
+        
+        if ( !iOutlineFocus )
+            {
+            RecordField();
+            }
         }
+    
     return iDisableRedraw;
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerfromfield.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrviewerfromfield.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -269,6 +269,11 @@
     if ( iObserver )
         {
         iObserver->ControlSizeChanged ( this );
+        
+        if ( !iOutlineFocus )
+            {
+            RecordField();
+            }
         }
     return iDisableRedraw;
     }
@@ -345,20 +350,5 @@
         }
     }
 
-// ---------------------------------------------------------------------------
-// CESMRViewerFromField::SetContainerWindowL()
-// ---------------------------------------------------------------------------
-//
-void CESMRViewerFromField::SetContainerWindowL(const CCoeControl& aContainer)
-    {
-    FUNC_LOG;
-    CESMRField::SetContainerWindowL( aContainer );
-    if ( iRichTextViewer )
-        {
-        iRichTextViewer->SetContainerWindowL( aContainer );
-        iRichTextViewer->SetParent( this );
-        }
-    }
-
 //EOF
 
--- a/meetingrequest/mrgui/src/cesmrview.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/src/cesmrview.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -968,7 +968,8 @@
     FUNC_LOG;
     CCoeControl::HandleResourceChange( aType );
     TInt error = KErrNone;
-
+    TBool record = ETrue;
+    
     switch ( aType )
         {
         case  KAknsMessageSkinChange:
@@ -989,14 +990,21 @@
             }
         default:
             {
+            record = EFalse;
             break;
             }
         }
 
     if ( error != KErrNone )
         {
+        record = EFalse;
         iCoeEnv->HandleError( error );
         }
+    
+    if ( record )
+        {
+        iListPane->RecordFields();
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/src/cmrfieldcontainer.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/src/cmrfieldcontainer.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -24,6 +24,9 @@
 
 namespace { // codescanner::namespace
 
+// Off screen field x coordinate
+const TInt KOffScreenPositionX =  1000;
+
 /**
  * Vertical scroll margin
  */
@@ -79,8 +82,8 @@
 // CMRFieldContainer::NewL
 // ---------------------------------------------------------------------------
 //
-CMRFieldContainer* CMRFieldContainer::NewL( 
-        MESMRFieldStorage& aFactory, 
+CMRFieldContainer* CMRFieldContainer::NewL(
+        MESMRFieldStorage& aFactory,
         const CCoeControl& aParent )
     {
     FUNC_LOG;
@@ -100,7 +103,7 @@
     FUNC_LOG;
     CCoeControl::SetComponentsToInheritVisibility( ETrue );
     SetContainerWindowL( aParent );
-    
+
     TBool focusSet( EFalse );
     const TInt count( iFactory.Count() );
     for ( TInt i = 0; i < count; i++ )
@@ -114,7 +117,6 @@
 
         // Initialize field
         field->InitializeL();
-        User::LeaveIfError( field->SetParent( this ) );
 
         if ( !focusSet
              && field->IsVisible()
@@ -161,10 +163,10 @@
     {
     FUNC_LOG;
     /*
-     * Moves focus up after key event. If aHiddenFocus, moves focus 
+     * Moves focus up after key event. If aHiddenFocus, moves focus
      * to the first visible field in the bottom of the viewable area.
      */
-     
+
     if( aHiddenFocus )
         {
         return MoveFocusVisibleL();
@@ -194,17 +196,19 @@
                         iFocusedFieldIndex = ind;
                         field->SetCurrentItemIndex( iFocusedFieldIndex );
 
-                        // Remove focus from previous position 
+                        // Remove focus from previous position
                         focusedField->SetOutlineFocusL( EFalse );
                         focusedField->SetFocus( EFalse );
-                        
+                        focusedField->MoveToScreen( EFalse );
+
                         // Set focus to new position
                         field->SetOutlineFocusL( ETrue );
                         field->SetFocus( ETrue );
+                        field->MoveToScreen( ETrue );
 
                         // Scrollbar and physics update is done here
                         ScrollControlVisible( iFocusedFieldIndex );
-                        
+
                         DrawDeferred();
                         }
 
@@ -224,10 +228,10 @@
     {
     FUNC_LOG;
     /*
-     * Moves focus down after key event. If aHiddenFocus, moves focus 
+     * Moves focus down after key event. If aHiddenFocus, moves focus
      * to the first visible field in the top of the viewable area.
      */
-    
+
     if( aHiddenFocus )
         {
         return MoveFocusVisibleL();
@@ -258,17 +262,19 @@
                     iFocusedFieldIndex = ind;
                     field->SetCurrentItemIndex( iFocusedFieldIndex );
 
-                    // Remove focus from previous position 
+                    // Remove focus from previous position
                     focusedField->SetOutlineFocusL( EFalse );
                     focusedField->SetFocus( EFalse );
-                    
+                    focusedField->MoveToScreen( EFalse );
+
                     // Set focus to new position
                     field->SetOutlineFocusL( ETrue );
                     field->SetFocus( ETrue );
+                    field->MoveToScreen( ETrue );
 
                     // Scrollbar and physics update is done here
                     ScrollControlVisible( iFocusedFieldIndex );
-                    
+
                     DrawDeferred();
                     }
 
@@ -287,13 +293,13 @@
     {
     FUNC_LOG;
     /*
-     * Move focus to first completely visible field in the view, 
+     * Move focus to first completely visible field in the view,
      * if focus was in a field that was not visible in the view.
      * Use case: After pointer scroll focus is hidden. User presses
      * arrow keys -> Focus appears to the first visible field on the upper
      * or bottom part of the viewable area.
      */
-    
+
     TKeyResponse response( EKeyWasNotConsumed );
 
     CESMRField* focusedField = FocusedField();
@@ -355,16 +361,16 @@
         // Remove existing focus
         focusedField->SetOutlineFocusL( EFalse );
         focusedField->SetFocus( EFalse );
-        
+
         // Set focus to new field
         visibleField->SetOutlineFocusL( ETrue );
         visibleField->SetFocus( ETrue );
 
         response = EKeyWasConsumed;
-        
+
         DrawDeferred();
         }
-    
+
     return response;
     }
 
@@ -372,7 +378,7 @@
 // CMRFieldContainer::SetFieldContainerObserver
 // ---------------------------------------------------------------------------
 //
-void CMRFieldContainer::SetFieldContainerObserver( 
+void CMRFieldContainer::SetFieldContainerObserver(
         MMRFieldContainerObserver* aObserver )
     {
     FUNC_LOG;
@@ -386,7 +392,16 @@
 TInt CMRFieldContainer::CountComponentControls() const
     {
     FUNC_LOG;
-    return iFactory.Count();
+
+    // If field container is scrolling, container will draw also children
+    TInt count( 0 );
+
+    if ( !iScrolling )
+        {
+        count = iFactory.Count();
+        }
+
+    return count;
     }
 
 // ---------------------------------------------------------------------------
@@ -409,11 +424,12 @@
     /*
      * Returns the minimum size required by the field container
      */
-    
+
     TSize containerSize;
-    
+
+    // Calculate height as the sum of the heights of the visible fields
     const TInt count( iFactory.Count() );
-    
+
     for ( TInt i(0); i < count; ++i )
         {
         CESMRField* field = iFactory.Field( i );
@@ -423,9 +439,9 @@
             containerSize.iHeight += rect.Height();
             }
         }
-    
+
     containerSize.iWidth = Parent()->Rect().Width();
-    
+
     return containerSize;
     }
 
@@ -436,17 +452,12 @@
 void CMRFieldContainer::SizeChanged()
     {
     FUNC_LOG;
-    
-    // TEST CODE:
-    TRect fieldcontainerRect = Rect();
-    TRect parentRect = Parent()->Rect();
-    
 
-    // For example when orientation changes, we might need to scroll 
+    // For example when orientation changes, we might need to scroll
     // the currently focused control visible again. This handles also
     // scrollbar and physics updates.
-    ScrollControlVisible( KErrNotFound ); 
-    
+    ScrollControlVisible( KErrNotFound );
+
     TPoint tl( Position() );
 
     const TInt count( iFactory.Count() );
@@ -458,7 +469,15 @@
 
         if ( field->IsVisible() )
             {
-            LayoutField( *field, tl );
+            TPoint pos( tl );
+
+            // If field is not focused, layout it outside screen
+            if ( i != iFocusedFieldIndex )
+                {
+                pos.iX = KOffScreenPositionX;
+                }
+
+            LayoutField( *field, pos );
 
             TInt height = field->Size().iHeight;
             tl.iY += height;
@@ -466,6 +485,29 @@
         }
     }
 
+
+// ---------------------------------------------------------------------------
+// CMRFieldContainer::HandlePointerEventL
+// ---------------------------------------------------------------------------
+//
+void CMRFieldContainer::HandlePointerEventL( const TPointerEvent &aPointerEvent )
+    {
+    FUNC_LOG;
+
+    // Find out to which field this pointer event is intended to
+    TInt fieldCount( iFactory.Count() );
+
+    for( TInt i = 0; i < fieldCount; ++i )
+        {
+        CCoeControl* field = iFactory.Field( i );
+        if( field->Rect().Contains( aPointerEvent.iPosition ) &&
+                field->IsVisible() )
+            {
+            field->HandlePointerEventL( aPointerEvent );
+            }
+        }
+    }
+
 // ---------------------------------------------------------------------------
 // CMRFieldContainer::ControlSizeChanged
 // ---------------------------------------------------------------------------
@@ -474,8 +516,8 @@
     {
     FUNC_LOG;
     /*
-     * Called whenever a fields size has changed. Requires always 
-     * relayouting. 
+     * Called whenever a fields size has changed. Requires always
+     * relayouting.
      */
 
     if ( !aField )
@@ -490,7 +532,7 @@
         if( size != old )
             {
             aField->SetSize( size );
-            
+
             TPoint tl( aField->Position() );
             TInt index = IndexByFieldId( iFactory, aField->FieldId() );
 
@@ -500,19 +542,19 @@
 
             // Fields have been re-layouted / moved. This requires resetting
             // the size of this field container.
-            SetSize( MinimumSize() );
-            
+            SetSizeWithoutNotification( MinimumSize() );
+
             // Update also scrollbar and physics
             iObserver->UpdateScrollBarAndPhysics();
-            
-            if( index == iFocusedFieldIndex )
+
+            if( index <= iFocusedFieldIndex )
                 {
                 // Scroll this field completely visible, if required.
-                // This updates also scrollbar and physics if scrolling 
+                // This updates also scrollbar and physics if scrolling
                 // is done.
                 ScrollControlVisible( iFocusedFieldIndex );
                 }
-            
+
             DrawDeferred();
             }
         }
@@ -528,7 +570,7 @@
     /*
      * Inserts field visible and layouts it.
      */
-    
+
     CESMRField* field = iFactory.FieldById( aFieldId );
 
     if ( field && !field->IsVisible() )
@@ -541,8 +583,8 @@
         TInt prevIndex = index - 1;
 
         // Get previous visible field position
-        // Index 0 must be included in attendee field case, 
-        // to avoid field collision. But in response field, 
+        // Index 0 must be included in attendee field case,
+        // to avoid field collision. But in response field,
         // causes misplacing of area.
         if ( ( prevIndex >= 0 ) && ( aFieldId != EESMRFieldResponseArea ) )
             {
@@ -558,19 +600,21 @@
 
         // Layout field
         LayoutField( *field, tl);
+        // Move field off screen if it is not focused
+        field->MoveToScreen( index == iFocusedFieldIndex );
 
         // Move following fields
         tl.iY += field->Size().iHeight;
         MoveFields( ++index, tl );
 
-        // Set fieldcontainer size again, because 
+        // Set fieldcontainer size again, because
         // the amount of fields has changed.
-        SetSize( MinimumSize() );
-        
+        SetSizeWithoutNotification( MinimumSize() );
+
         // Scrollbar and physics require updating.
         iObserver->UpdateScrollBarAndPhysics();
         }
-    
+
     DrawDeferred();
     }
 
@@ -583,7 +627,7 @@
     FUNC_LOG;
     /*
      * Sets field non-visible and moves other fields accordingly.
-     * Does not delete the field. 
+     * Does not delete the field.
      */
     CESMRField* field = iFactory.FieldById( aFieldId );
 
@@ -596,19 +640,19 @@
         TPoint pos( field->Position() );
         MoveFields( index, pos );
 
-        // Set fieldcontainer size again, because 
+        // Set fieldcontainer size again, because
         // the amount of fields has changed.
-        SetSize( MinimumSize() );
-        
+        SetSizeWithoutNotification( MinimumSize() );
+
         // Scrollbar and physics require updating.
         iObserver->UpdateScrollBarAndPhysics();
-        
-        if ( focused && !field->IsNonFocusing() )            
+
+        if ( focused && !field->IsNonFocusing() )
             {
-            // Set focus to next field, or if removed field was the last 
+            // Set focus to next field, or if removed field was the last
             // field, then move focus to last visible field
-            TInt lastVisibleFieldIndex( LastVisibleField( aFieldId ) ); 
-            
+            TInt lastVisibleFieldIndex( LastVisibleField( aFieldId ) );
+
             // If field was the last one...
             if( lastVisibleFieldIndex == index )
                 {
@@ -633,10 +677,10 @@
     {
     FUNC_LOG;
     /*
-     * Returns ETrue/EFalse if the field with given field id is 
+     * Returns ETrue/EFalse if the field with given field id is
      * visible or not.
      */
-    
+
     TBool ret( EFalse );
 
     CESMRField* field = iFactory.FieldById( aField );
@@ -685,9 +729,9 @@
     {
     FUNC_LOG;
     /*
-     * Checks if focused field is completely visible in the viewable area. 
+     * Checks if focused field is completely visible in the viewable area.
      */
-    
+
     // Fetch the position information about currently focused field:
     CESMRField* field = iFactory.Field( iFocusedFieldIndex );
     TBool ret( EFalse );
@@ -710,7 +754,7 @@
     /*
      * Scrolls the field with the given index visible
      */
-    
+
     CESMRField* field = NULL;
     if ( aInd == KErrNotFound )
         {
@@ -722,10 +766,10 @@
         }
 
     ASSERT( field );
-    
+
     TRect fieldRect( field->Position(), field->Size() );
     TRect parentRect( Parent()->Rect() );
-    
+
     /*
      * Case 1: Field's height is less than the viewable area height,
      * let's scroll the whole field visible.
@@ -735,17 +779,17 @@
         // Scrolling down, let's move fields up
         if( fieldRect.iBr.iY > parentRect.iBr.iY )
             {
-            iObserver->ScrollFieldsUp( 
+            iObserver->ScrollFieldsUp(
                     fieldRect.iBr.iY - parentRect.iBr.iY );
             }
         // scrolling up, let's move field down
         if( fieldRect.iTl.iY < parentRect.iTl.iY )
             {
-            iObserver->ScrollFieldsDown( 
+            iObserver->ScrollFieldsDown(
                     parentRect.iTl.iY - fieldRect.iTl.iY );
             }
         }
-    
+
     /*
      * Case 2: Field's height is more than the viewable area's height.
      */
@@ -757,22 +801,22 @@
             // Focus to this field is coming from above
             if( field->PreItemIndex() < field->CurrentItemIndex() )
                 {
-                // Let's scroll the top of the field to the 
+                // Let's scroll the top of the field to the
                 // top of the viewable area
-                iObserver->ScrollFieldsUp( 
+                iObserver->ScrollFieldsUp(
                                    fieldRect.iTl.iY - parentRect.iTl.iY );
-                
+
                 }
             // Focus to this field is coming from below
             if( field->PreItemIndex() > field->CurrentItemIndex() )
                 {
                 // Let's scroll the bottom of the field to the
                 // bottom of the viewable area
-                iObserver->ScrollFieldsDown( 
+                iObserver->ScrollFieldsDown(
                                    parentRect.iBr.iY - fieldRect.iBr.iY );
                 }
             }
-        
+
         // Field is in edit mode
         if( field->FieldMode() == EESMRFieldModeEdit )
             {
@@ -792,14 +836,14 @@
                 // move field focus line bottom to view bottom
                 TInt px = focusFieldVisibleBottom - viewHeight;
 
-                
+
                 // if focus on last field: add margin height to
                 // scroll amount.
                 if ( iFocusedFieldIndex == iFactory.Count()-1 )
                     {
                     px += KVerticalScrollMargin;
                     }
-                
+
                 // Scrollbar and physics update is done here
                 iObserver->ScrollFieldsUp( px );
                 }
@@ -820,7 +864,7 @@
                     iObserver->ScrollFieldsDown( px );
                     }
                 }
-            }        
+            }
         }
     }
 
@@ -831,7 +875,7 @@
 void CMRFieldContainer::RePositionFields( TInt aAmount )
     {
     FUNC_LOG;
-    
+
     // Movement downwards
     if( aAmount >= 0 )
         {
@@ -864,20 +908,20 @@
     {
     FUNC_LOG;
     /*
-     * Moves fields from the given index towards the last item. 
+     * Moves fields from the given index towards the last item.
      * This function does not update scrollbar or physics.
      */
-    
+
     const TInt count( iFactory.Count() );
-    
+
     for ( TInt i = aIndex; i < count; ++i )
         {
         CESMRField* field = iFactory.Field( i );
-        
+
         if ( field->IsVisible() )
             {
             field->SetPosition( aTl );
-            
+
             aTl.iY += field->Size().iHeight;
             }
         }
@@ -894,26 +938,25 @@
      * Layouts given field according to the size required by the field and
      * given TPoint. This function does not update scrollbar or physics.
      */
-    
+
     TSize size( aField.MinimumSize() );
-    aField.SetPosition( aTl );
-    aField.SetSize( size );
+    aField.SetExtent( aTl, size );
     }
 
 // ---------------------------------------------------------------------------
 // CMRFieldContainer::IsLastVisibleField
 // ---------------------------------------------------------------------------
 //
-TInt CMRFieldContainer::LastVisibleField( 
+TInt CMRFieldContainer::LastVisibleField(
         TESMREntryFieldId aFieldId )
     {
     /*
      * Helper function to find out the last visible field in the list.
      */
-    
+
     TInt lastVisibleFieldIndex( 0 );
     TInt count( iFactory.Count() );
-    
+
     // Go through fields from last field towards the first field
     for( TInt i( 1 ); i > count; ++i )
         {
@@ -923,22 +966,22 @@
             // ... Compare it to the given field index ...
             if( iFactory.Field( count - i )->FieldId() == aFieldId )
                 {
-                // ... And if match is found, given fieldId is the 
+                // ... And if match is found, given fieldId is the
                 // the last visible field.
-                lastVisibleFieldIndex = 
+                lastVisibleFieldIndex =
                     IndexByFieldId( iFactory, aFieldId );
                 }
             else
                 {
                 // Otherwise return the found last visible field.
-                lastVisibleFieldIndex = 
-                    IndexByFieldId( iFactory, 
+                lastVisibleFieldIndex =
+                    IndexByFieldId( iFactory,
                                     iFactory.Field( count - i )->FieldId() );
                 }
             break;
             }
         }
-    
+
     return lastVisibleFieldIndex;
     }
 
@@ -952,7 +995,7 @@
     /*
      * Sets the focus according to the given index.
      */
-    
+
     TInt count( iFactory.Count() );
     aNewFocusIndex = Max( 0, Min( aNewFocusIndex, count - 1 ) );
 
@@ -963,7 +1006,7 @@
 
         // Get next focused field
         CESMRField* field = iFactory.Field( aNewFocusIndex );
-        
+
         // Do sanity checks
         while ( aNewFocusIndex < count && !field->IsVisible() )
             {
@@ -980,27 +1023,133 @@
             }
 
         ASSERT( field->IsVisible() );
-        
+
         // Update current and previous item indexes
         field->SetPreItemIndex( iFocusedFieldIndex );
         iFocusedFieldIndex = aNewFocusIndex;
         field->SetCurrentItemIndex( iFocusedFieldIndex );
-        
+
         // Remove focus from old
         old->SetOutlineFocusL( EFalse );
         old->SetFocus( EFalse );
-        
+        old->MoveToScreen( EFalse );
+
         // update focus index to new index
         field->SetOutlineFocusL( ETrue );
         field->SetFocus( ETrue );
-        
+        field->MoveToScreen( ETrue );
+
         // This handles also scrollbar and physics updating,
         // if view scrolling is done.
-        ScrollControlVisible( iFocusedFieldIndex ); 
-        
+        ScrollControlVisible( iFocusedFieldIndex );
+
         DrawDeferred();
         }
     }
 
 
+// ---------------------------------------------------------------------------
+// CMRFieldContainer::SetScrolling
+// ---------------------------------------------------------------------------
+//
+void CMRFieldContainer::SetScrolling( TBool aScrolling )
+    {
+    FUNC_LOG;
+
+    iScrolling = aScrolling;
+
+    // Move focused field away from screen if container is scrolling.
+    // Otherwise move it to screen.
+    CESMRField* field = iFactory.Field( iFocusedFieldIndex );
+    field->MoveToScreen( !iScrolling );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMRFieldContainer::Draw
+// ---------------------------------------------------------------------------
+//
+void CMRFieldContainer::Draw( const TRect& aRect ) const
+    {
+    FUNC_LOG;
+
+    // Get visible screen area from parent (list pane)
+    TRect parent( Parent()->Rect() );
+
+    // Current container position used to calculate actual field positions
+    TPoint tl( iPosition );
+
+    // Field index to skip
+    TInt fieldToSkip = KErrNotFound;
+
+    if ( !iScrolling )
+        {
+        // Container is not scrolling. Don't draw focused field from buffer
+        fieldToSkip = iFocusedFieldIndex;
+        }
+
+    // Draw all visible fields which are not on screen
+    TInt count( iFactory.Count() );
+
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CESMRField* field = iFactory.Field( i );
+        if ( field->IsVisible() )
+            {
+            // Calculate actual field rect on screen
+            TRect screenRect( tl, field->Size() );
+
+            // Draw field if it intersects with screen visible area
+            if ( i != fieldToSkip
+                 && screenRect.Intersects( parent ) )
+                {
+                field->Draw( screenRect );
+                }
+            // Move next field top left corner
+            tl.iY += screenRect.Height();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// CMRFieldContainer::ScrollContainer
+// ---------------------------------------------------------------------------
+//
+void CMRFieldContainer::ScrollContainer( const TPoint& aTl )
+    {
+    FUNC_LOG;
+
+    // Set scrolling flag and move focused field off screen
+    SetScrolling( ETrue );
+    // Update control position,
+    // but dont propagate the change to component controls
+    iPosition = aTl;
+    }
+
+// ---------------------------------------------------------------------------
+// CMRFieldContainer::Synchronize
+// ---------------------------------------------------------------------------
+//
+void CMRFieldContainer::Synchronize()
+    {
+    FUNC_LOG;
+
+    // Set actual control positions (y-coordinate) to visible fields
+    TPoint tl( iPosition );
+
+    TInt count( iFactory.Count() );
+
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CESMRField* field = iFactory.Field( i );
+        if ( field->IsVisible() )
+            {
+            TPoint pos( field->Position().iX, tl.iY );
+            tl.iY += field->Size().iHeight;
+            field->SetPosition( pos );
+            }
+        }
+    SetScrolling( EFalse );
+    }
+
 // End of file
--- a/meetingrequest/mrgui/src/cmrlistpane.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/src/cmrlistpane.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -155,8 +155,12 @@
 void CMRListPane::InternalizeL( MESMRCalEntry& aEntry )
     {
     FUNC_LOG;
+
     iFactory.InternalizeL( aEntry );
 
+    // Record visible fields
+    RecordFields();
+
     // This is called to make sure everything is drawn correctly
     DrawDeferred();
     }
@@ -368,7 +372,6 @@
     // Long tap functionality may vary between fields
     // ==> Command field to execute action related to long tap
     TInt count( iFactory.Count() );
-
     for ( TInt i = 0; i < count; ++i )
         {
         CESMRField* field = iFactory.Field( i );
@@ -460,17 +463,19 @@
 void CMRListPane::ScrollFieldsUp( TInt aPx )
     {
     FUNC_LOG;
-    TPoint point = iFieldContainer->Position();
-    point.iY -= aPx;
+    iPositionChanged = ETrue;
 
-    // This initializes Draw also
-    iFieldContainer->SetPosition( point );
+    iUpdatedPanePoint = iFieldContainer->Position();
+    iUpdatedPanePoint.iY -= aPx;
 
-    // Non-kinetic scrolling executed. Update
-    // new position to physics.
-    iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() );
-
-    DoUpdateScrollBar( UpdatedFocusPosition() );
+    if ( !iPointerEventInProgress )
+        {
+        // We can updace view only if pointer event processing
+        // is not ongoing.
+        // If pointer event processing is ongoing, view is updated
+        // in CMRListPane::HandlePointerEventL method.
+        UpdatePosition();
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -480,16 +485,20 @@
 void CMRListPane::ScrollFieldsDown( TInt aPx )
     {
     FUNC_LOG;
-    TPoint point = iFieldContainer->Position();
-    point.iY += aPx;
+
+    iPositionChanged = ETrue;
+
+    iUpdatedPanePoint = iFieldContainer->Position();
+    iUpdatedPanePoint.iY += aPx;
 
-    // This initializes Draw also
-    iFieldContainer->SetPosition( point );
-    // Non-kinetic scrolling executed. Update
-    // new position to physics.
-    iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() );
-
-    DoUpdateScrollBar( UpdatedFocusPosition() );
+    if ( !iPointerEventInProgress )
+        {
+        // We can updace view only if pointer event processing
+        // is not ongoing.
+        // If pointer event processing is ongoing, view is updated
+        // in CMRListPane::HandlePointerEventL method.
+        UpdatePosition();
+        }
     }
 
 
@@ -499,6 +508,7 @@
 //
 void CMRListPane::UpdateScrollBarAndPhysics()
     {
+    FUNC_LOG;
     // Update physics world size
     iPhysics->InitPhysics();
 
@@ -513,6 +523,7 @@
 //
 void CMRListPane::ShowControl( TESMREntryFieldId aFieldId )
     {
+    FUNC_LOG;
     iFieldContainer->ShowControl( aFieldId );
     }
 
@@ -522,6 +533,7 @@
 //
 TBool CMRListPane::IsControlVisible( TESMREntryFieldId aFieldId )
     {
+    FUNC_LOG;
     return iFieldContainer->IsControlVisible( aFieldId );
     }
 // ---------------------------------------------------------------------------
@@ -530,6 +542,7 @@
 //
 TESMREntryFieldId CMRListPane::GetResponseFieldsFieldId()
     {
+    FUNC_LOG;
     CESMRField* rfield = iFactory.FieldById( EESMRFieldResponseArea );
 
     if ( rfield && rfield->IsVisible() && !rfield->IsNonFocusing() )
@@ -577,6 +590,26 @@
     }
 
 // ---------------------------------------------------------------------------
+// CMRListPane::RecordFields
+// ---------------------------------------------------------------------------
+//
+void CMRListPane::RecordFields()
+    {
+    FUNC_LOG;
+
+    // Loop all visible fields and record them
+    TInt count( iFactory.Count() );
+    for ( TInt i = 0; i < count; ++i )
+        {
+        CESMRField* field = iFactory.Field( i );
+        if ( field->IsVisible() )
+            {
+            field->RecordField();
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // CMRListPane::HandlePointerEventL
 // ---------------------------------------------------------------------------
 //
@@ -588,6 +621,8 @@
         return;
         }
 
+    iPointerEventInProgress = ETrue;
+
     // If new down event is received, and
     // iLongTapEventInProgess flag is still ETrue, we need to
     // set it back to EFalse -> Long tap event cannot be in progress
@@ -610,7 +645,7 @@
         	}
         }
 
-    if( !iPhysicsActionOngoing )
+    if( !iPhysicsActionOngoing && TPointerEvent::EDrag != aPointerEvent.iType )
     	{
 		UpdateClickedField( aPointerEvent );
 
@@ -635,6 +670,15 @@
 			iLongTapEventInProgess = EFalse;
             }
     	}
+
+    if ( iPositionChanged )
+        {
+        // Position has changed during pointer event processing
+        // ==> adjusting UI to correct position.
+        UpdatePosition();
+        }
+
+    iPointerEventInProgress = EFalse;
     }
 
 // ---------------------------------------------------------------------------
@@ -689,7 +733,7 @@
 	if( FeedbackScrollMarginExceeded(
 			Abs( verticalScrollIndex - iPreviousVerticalScrollIndex ) ) )
 		{
-		HandleTactileFeedback( ETouchFeedbackSlider );
+		HandleTactileFeedback( ETouchFeedbackSensitiveList );
 
 		iPreviousVerticalScrollIndex = verticalScrollIndex;
 		}
@@ -731,8 +775,18 @@
 		for( TInt i = 0; i < count; ++i )
 			{
 			CESMRField* field = iFactory.Field( i );
-			if ( field->IsVisible() &&
-					field->Rect().Contains( aPointerEvent.iPosition ) )
+
+            // Calculate actual screen rect for field.
+            // If field does not have focus, it is layouted off screen
+            TPoint pos( field->Position() );
+            if ( !field->HasOutlineFocus() )
+                {
+                pos.iX = field->Parent()->Position().iX;
+                }
+            TRect rect( pos, field->Size() );
+
+            if ( field->IsVisible()
+                 && rect.Contains( aPointerEvent.iPosition ) )
 				{
 				CESMRField* focusedField = iFieldContainer->FocusedField();
 
@@ -746,7 +800,18 @@
 						iFieldContainer->SetControlFocusedL( field->FieldId() );
 						}
 					}
-
+                else
+                    {
+                    // If field is not focused from coecontrol's point of view
+                    // due to focus strategy, we have to set the field
+                    // focused again.
+                    if( !field->IsFocused() )
+                        {
+                        field->SetOutlineFocusL( ETrue );
+                        field->SetFocus( ETrue );
+                        DrawDeferred();
+                        }
+                    }
 				break;
 				}
 			}
@@ -764,12 +829,23 @@
 
     for( TInt i = 0; i < fieldCount; ++i )
         {
-        if( iFactory.Field( i )->Rect().Contains(
-                aPointerEvent.iPosition ) )
+        CESMRField* field = iFactory.Field( i );
+
+        // Calculate actual screen rect for field.
+        // If field does not have focus, it is layouted off screen
+        TPoint pos( field->Position() );
+        if ( !field->HasOutlineFocus() )
+            {
+            pos.iX = field->Parent()->Position().iX;
+            }
+        TRect rect( pos, field->Size() );
+
+        if( rect.Contains( aPointerEvent.iPosition )
+            && field->IsVisible() )
             {
             if( aPointerEvent.iType == TPointerEvent::EButton1Down )
                 {
-                iClickedField = iFactory.Field( i );
+                iClickedField = field;
                 }
             }
         }
@@ -840,4 +916,21 @@
     return ret;
     }
 
+// ---------------------------------------------------------------------------
+// CMRListPane::UpdatePosition
+// ---------------------------------------------------------------------------
+//
+void CMRListPane::UpdatePosition()
+    {
+    // This initializes Draw also
+    iFieldContainer->SetPosition( iUpdatedPanePoint );
+
+    // Non-kinetic scrolling executed. Update
+    // new position to physics.
+    iPhysics->UpdateVerticalScrollIndex( UpdatedFocusPosition() );
+    DoUpdateScrollBar( UpdatedFocusPosition() );
+
+    iPositionChanged = EFalse;
+    }
+
 // End of file
--- a/meetingrequest/mrgui/src/cmrlistpanephysics.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrgui/src/cmrlistpanephysics.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -26,19 +26,13 @@
 #include "emailtrace.h"
 
 
-namespace { // codescanner::namespace
-
-const TInt KCustomDragTreshold( 10 );
-
-} // namespace
-
 // ---------------------------------------------------------------------------
 // CMRListPanePhysics::CMRListPanePhysics
 // ---------------------------------------------------------------------------
 //
 CMRListPanePhysics::CMRListPanePhysics(
-        CCoeControl& aParent, 
-        CMRFieldContainer& aViewControl, 
+        CCoeControl& aParent,
+        CMRFieldContainer& aViewControl,
         MMRPhysicsObserver& aPhysicsObserver )
     : iParent( aParent ),
       iViewControl( aViewControl ),
@@ -67,23 +61,23 @@
 // CMRListPanePhysics::NewL
 // ---------------------------------------------------------------------------
 //
-CMRListPanePhysics* CMRListPanePhysics::NewL( 
-        CCoeControl& aParent, 
+CMRListPanePhysics* CMRListPanePhysics::NewL(
+        CCoeControl& aParent,
         CMRFieldContainer& aViewControl,
         MMRPhysicsObserver& aPhysicsObserver )
     {
     FUNC_LOG;
-    CMRListPanePhysics* self = 
-        new ( ELeave ) CMRListPanePhysics( 
-                aParent, 
-                aViewControl, 
+    CMRListPanePhysics* self =
+        new ( ELeave ) CMRListPanePhysics(
+                aParent,
+                aViewControl,
                 aPhysicsObserver );
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop( self );
     return self;
     }
-        
+
 // ---------------------------------------------------------------------------
 // CMRListPanePhysics::~CMRListPanePhysics
 // ---------------------------------------------------------------------------
@@ -93,7 +87,7 @@
     FUNC_LOG;
     delete iPhysics;
     }
-        
+
 // ---------------------------------------------------------------------------
 // CMRListPanePhysics::HandlePointerEventL
 // ---------------------------------------------------------------------------
@@ -112,25 +106,28 @@
     // Down
     if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
         {
+        if ( iPhysics->OngoingPhysicsAction()
+             != CAknPhysics::EAknPhysicsActionNone )
+            {
+            iPhysics->StopPhysics();
+            }
+        
         // Save start time and start point
         iStartTime.HomeTime();
         iStartPoint = aPointerEvent.iPosition;
         iDragPoint = iStartPoint;
         }
-    
+
     // Drag
     else if ( aPointerEvent.iType == TPointerEvent::EDrag )
         {
         // Check how position was changed and report to physics
         TPoint deltaPoint( iDragPoint - aPointerEvent.iPosition );
-        if( Abs( deltaPoint.iY ) < KCustomDragTreshold )
+        if( Abs( deltaPoint.iY ) > iPhysics->DragThreshold() )
         	{
-			deltaPoint.iX = 0;
-			deltaPoint.iY = 0;
+			iDragPoint = aPointerEvent.iPosition;
+			iPhysics->RegisterPanningPosition( deltaPoint );
         	}
-        
-        iDragPoint = aPointerEvent.iPosition;
-        iPhysics->RegisterPanningPosition( deltaPoint );
         }
 
     // Up
@@ -138,16 +135,13 @@
         {
         // Calculate dragging distance
         TPoint drag( iStartPoint - aPointerEvent.iPosition );
-        
-        if( Abs( drag.iY ) < KCustomDragTreshold )
+
+        if( Abs( drag.iY ) > iPhysics->DragThreshold() )
         	{
-			drag.iX = 0;
-			drag.iY = 0;
+            // Start physics
+            physicsStarted = iPhysics->StartPhysics( drag, iStartTime );
         	}
-        
-        // Start physics
-        physicsStarted = iPhysics->StartPhysics( drag, iStartTime );
-        
+
         if( physicsStarted )
         	{
 			aEventsBlocked = ETrue;
@@ -156,11 +150,11 @@
         	{
 			aEventsBlocked = EFalse;
         	}
-        }    
-    
+        }
+
     // Record previous pointer event
     iPreviousPointerEvent = aPointerEvent;
-    
+
     return physicsStarted;
     }
 
@@ -174,24 +168,24 @@
     if ( !iFeatureEnabled )
         {
         return;
-        }    
+        }
     TRect parentRect( iParent.Rect() );
 
     iWorldSize.iHeight = iViewControl.MinimumSize().iHeight;
     iWorldSize.iWidth = iViewControl.MinimumSize().iWidth;
-    
+
     iViewSize.iHeight = parentRect.Height();
     iViewSize.iWidth = parentRect.Width();
-    
+
     if( iWorldSize.iHeight < iViewSize.iHeight )
         {
     	iWorldSize.iHeight = iViewSize.iHeight;
         }
-    
+
+
 
-    
     iPhysics->ResetFriction();
-    
+
     TRAP_IGNORE( iPhysics->InitPhysicsL( iWorldSize, iViewSize, EFalse ) );
     iPhysics->UpdateViewWindowControl( &iParent );
     }
@@ -206,7 +200,7 @@
     if ( !iFeatureEnabled )
         {
         return;
-        }    
+        }
     iWorldSize.iHeight = aWorldHeight;
     }
 
@@ -230,20 +224,21 @@
         }
 
     iVerScrollIndex = aNewPosition.iY - iViewSize.iHeight / 2;
-    
+
     // Parents position is taken into account, by
     // adding the extra x and y coordinates to field containers
     // new position.
-    iViewControl.SetPosition( TPoint( 
-            iParent.Position().iX, 
-            -iVerScrollIndex + iParent.Position().iY ) );
-    
+    TPoint pos(
+            iParent.Position().iX,
+            -iVerScrollIndex + iParent.Position().iY );
+    iViewControl.ScrollContainer( pos );
+
     // Draw only when drawing is allowed
     if ( aDrawNow )
         {
-        iParent.DrawDeferred();
+        iParent.DrawNow();
         }
-    
+
     // Vertical scroll index has changed, we need to update scroll bar also
     iPhysicsObserver.UpdateScrollBarDuringOngoingPhysics();
     }
@@ -256,6 +251,9 @@
     {
     FUNC_LOG;
     iPhysicsObserver.PhysicsEmulationEnded();
+    
+    // Synchronize field container position
+    iViewControl.Synchronize();
     }
 
 // ---------------------------------------------------------------------------
@@ -269,12 +267,12 @@
         {
         return TPoint( iParent.Position() );
         }
-    
+
     // This is the default implementation
-    TPoint viewPosition( 
-            iViewSize.iWidth / 2, 
+    TPoint viewPosition(
+            iViewSize.iWidth / 2,
             iViewSize.iHeight / 2 + iVerScrollIndex );
-    
+
     return viewPosition;
     }
 
@@ -287,7 +285,7 @@
     FUNC_LOG;
     if ( iFeatureEnabled )
         {
-        // Physics' new position is updated to this member, when field 
+        // Physics' new position is updated to this member, when field
         // container is scrolled by someone else than physics.
         iVerScrollIndex = aVerScrollIndex;
         }
--- a/meetingrequest/mrguicommon/bwins/mrguicommonu.def	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/bwins/mrguicommonu.def	Thu Jul 15 18:19:25 2010 +0300
@@ -7,76 +7,76 @@
 	?GetContactManager@CESMRContactManagerHandler@@QAEAAVCVPbkContactManager@@XZ @ 6 NONAME ; class CVPbkContactManager & CESMRContactManagerHandler::GetContactManager(void)
 	?SetCommandObserver@CESMRContactMenuHandler@@QAEXPAVMEikCommandObserver@@@Z @ 7 NONAME ; void CESMRContactMenuHandler::SetCommandObserver(class MEikCommandObserver *)
 	?AddObserverL@CESMRContactManagerHandler@@QAEXPAVMESMRContactManagerObserver@@@Z @ 8 NONAME ; void CESMRContactManagerHandler::AddObserverL(class MESMRContactManagerObserver *)
-	?SetColor@NMRColorManager@@YAXAAVCCoeControl@@W4TMRColorId@1@@Z @ 9 NONAME ; void NMRColorManager::SetColor(class CCoeControl &, enum NMRColorManager::TMRColorId)
-	?Color@NMRColorManager@@YA?AVTRgb@@W4TMRColorId@1@@Z @ 10 NONAME ; class TRgb NMRColorManager::Color(enum NMRColorManager::TMRColorId)
-	?OptionsMenuAvailable@CESMRContactMenuHandler@@QAEHXZ @ 11 NONAME ; int CESMRContactMenuHandler::OptionsMenuAvailable(void)
-	?IsReady@CESMRContactManagerHandler@@QAEHXZ @ 12 NONAME ; int CESMRContactManagerHandler::IsReady(void)
-	?SendAsVCalendarL@CESMRSendUI@@QAEXHAAVCCalEntry@@@Z @ 13 NONAME ; void CESMRSendUI::SendAsVCalendarL(int, class CCalEntry &)
-	??0CESMRRecurrence@@QAE@XZ @ 14 NONAME ; CESMRRecurrence::CESMRRecurrence(void)
-	?LoadTextL@CESMRAlarm@@QAEXPAVCCoeEnv@@@Z @ 15 NONAME ; void CESMRAlarm::LoadTextL(class CCoeEnv *)
-	?GetSkinBasedBitmapLC@NMRBitmapManager@@YAXW4TMRBitmapId@1@AAPAVCFbsBitmap@@1VTSize@@@Z @ 16 NONAME ; void NMRBitmapManager::GetSkinBasedBitmapLC(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, class TSize)
-	??1RESMRStatic@@QAE@XZ @ 17 NONAME ; RESMRStatic::~RESMRStatic(void)
-	??1CMRImage@@UAE@XZ @ 18 NONAME ; CMRImage::~CMRImage(void)
-	?ExecuteL@CESMRGlobalNote@@SAXW4TESMGlobalNoteType@1@@Z @ 19 NONAME ; void CESMRGlobalNote::ExecuteL(enum CESMRGlobalNote::TESMGlobalNoteType)
-	?ExecuteL@CESMRConfirmationQuery@@SAHW4TESMRConfirmationQueryType@1@@Z @ 20 NONAME ; int CESMRConfirmationQuery::ExecuteL(enum CESMRConfirmationQuery::TESMRConfirmationQueryType)
-	?RecurrenceText@CESMRRecurrence@@QAEAAVHBufC16@@XZ @ 21 NONAME ; class HBufC16 & CESMRRecurrence::RecurrenceText(void)
-	?NewL@CESMRGlobalNote@@SAPAV1@W4TESMGlobalNoteType@1@@Z @ 22 NONAME ; class CESMRGlobalNote * CESMRGlobalNote::NewL(enum CESMRGlobalNote::TESMGlobalNoteType)
-	?ExecuteL@CESMRConfirmationQuery@@SAHABVTDesC16@@@Z @ 23 NONAME ; int CESMRConfirmationQuery::ExecuteL(class TDesC16 const &)
-	?Id@CESMRAlarm@@QAEHXZ @ 24 NONAME ; int CESMRAlarm::Id(void)
-	?ExecuteLD@CESMRGlobalNote@@QAEXXZ @ 25 NONAME ; void CESMRGlobalNote::ExecuteLD(void)
-	?ExecuteLD@CESMRListQuery@@QAEHXZ @ 26 NONAME ; int CESMRListQuery::ExecuteLD(void)
-	?GetFieldLayoutRect@NMRLayoutManager@@YA?AVTAknLayoutRect@@ABVTRect@@H@Z @ 27 NONAME ; class TAknLayoutRect NMRLayoutManager::GetFieldLayoutRect(class TRect const &, int)
-	?SetValueL@CESMRContactMenuHandler@@QAEXABVTDesC16@@W4TValueType@1@@Z @ 28 NONAME ; void CESMRContactMenuHandler::SetValueL(class TDesC16 const &, enum CESMRContactMenuHandler::TValueType)
-	?GetBitmapStruct@NMRBitmapManager@@YA?AVTMRBitmapStruct@1@W4TMRBitmapId@1@@Z @ 29 NONAME ; class NMRBitmapManager::TMRBitmapStruct NMRBitmapManager::GetBitmapStruct(enum NMRBitmapManager::TMRBitmapId)
-	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@@Z @ 30 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType)
-	?Close@RESMRStatic@@QAEXXZ @ 31 NONAME ; void RESMRStatic::Close(void)
-	?LaunchPopupL@CMRStylusPopupMenu@@QAEXV?$TArray@VTMenuItem@CMRStylusPopupMenu@@@@ABVTPoint@@@Z @ 32 NONAME ; void CMRStylusPopupMenu::LaunchPopupL(class TArray<class CMRStylusPopupMenu::TMenuItem>, class TPoint const &)
-	?NewL@CESMRListQuery@@SAPAV1@W4TESMRListQueryType@1@AAV?$RArray@H@@@Z @ 33 NONAME ; class CESMRListQuery * CESMRListQuery::NewL(enum CESMRListQuery::TESMRListQueryType, class RArray<int> &)
-	?ShowActionMenuL@CESMRContactMenuHandler@@QAEXXZ @ 34 NONAME ; void CESMRContactMenuHandler::ShowActionMenuL(void)
-	?ContactMenuHandlerL@RESMRStatic@@QAEAAVCESMRContactMenuHandler@@XZ @ 35 NONAME ; class CESMRContactMenuHandler & RESMRStatic::ContactMenuHandlerL(void)
-	??0TMenuItem@CMRStylusPopupMenu@@QAE@ABVTDesC16@@H@Z @ 36 NONAME ; CMRStylusPopupMenu::TMenuItem::TMenuItem(class TDesC16 const &, int)
-	??1CESMRRecurrence@@UAE@XZ @ 37 NONAME ; CESMRRecurrence::~CESMRRecurrence(void)
-	??0RESMRStatic@@QAE@XZ @ 38 NONAME ; RESMRStatic::RESMRStatic(void)
-	?DisplaySendCascadeMenuL@CESMRSendUI@@QAEXAAVCEikMenuPane@@@Z @ 39 NONAME ; void CESMRSendUI::DisplaySendCascadeMenuL(class CEikMenuPane &)
-	?ExecuteLD@CESMRListQuery@@QAEHAAV?$RArray@VTPtrC16@@@@@Z @ 40 NONAME ; int CESMRListQuery::ExecuteLD(class RArray<class TPtrC16> &)
-	?ExecuteOptionsMenuL@CESMRContactMenuHandler@@QAEXH@Z @ 41 NONAME ; void CESMRContactMenuHandler::ExecuteOptionsMenuL(int)
-	?NewL@CESMRSendUI@@SAPAV1@H@Z @ 42 NONAME ; class CESMRSendUI * CESMRSendUI::NewL(int)
-	??1CMRLabel@@UAE@XZ @ 43 NONAME ; CMRLabel::~CMRLabel(void)
-	?CurrentFieldIndex@RESMRStatic@@QAEHXZ @ 44 NONAME ; int RESMRStatic::CurrentFieldIndex(void)
-	?GetSkinBasedBitmap@NMRBitmapManager@@YAHW4TMRBitmapId@1@AAPAVCFbsBitmap@@1VTSize@@@Z @ 45 NONAME ; int NMRBitmapManager::GetSkinBasedBitmap(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, class TSize)
-	?RemoveObserver@CESMRContactManagerHandler@@QAEXPAVMESMRContactManagerObserver@@@Z @ 46 NONAME ; void CESMRContactManagerHandler::RemoveObserver(class MESMRContactManagerObserver *)
-	?ConstructFromResourceL@CESMRAlarm@@QAEXAAVTResourceReader@@@Z @ 47 NONAME ; void CESMRAlarm::ConstructFromResourceL(class TResourceReader &)
-	?RecurrenceValue@CESMRRecurrence@@QAE?AW4TESMRRecurrenceValue@@XZ @ 48 NONAME ; enum TESMRRecurrenceValue CESMRRecurrence::RecurrenceValue(void)
-	?RelativeTimeInMinutes@CESMRAlarm@@QAE?AVTTimeIntervalMinutes@@XZ @ 49 NONAME ; class TTimeIntervalMinutes CESMRAlarm::RelativeTimeInMinutes(void)
-	?CanSendL@CESMRSendUI@@QAEHH@Z @ 50 NONAME ; int CESMRSendUI::CanSendL(int)
-	?DisplaySendMenuItemL@CESMRSendUI@@QAEXAAVCEikMenuPane@@H@Z @ 51 NONAME ; void CESMRSendUI::DisplaySendMenuItemL(class CEikMenuPane &, int)
-	??1CMRButton@@UAE@XZ @ 52 NONAME ; CMRButton::~CMRButton(void)
-	?SetColor@NMRColorManager@@YAXAAVCEikTTimeEditor@@W4TMRColorId@1@@Z @ 53 NONAME ; void NMRColorManager::SetColor(class CEikTTimeEditor &, enum NMRColorManager::TMRColorId)
-	?ContactManagerHandlerL@RESMRStatic@@QAEAAVCESMRContactManagerHandler@@XZ @ 54 NONAME ; class CESMRContactManagerHandler & RESMRStatic::ContactManagerHandlerL(void)
-	?ExecuteEditBeforeSendL@CESMRListQuery@@SAHW4TESMRAttendeeStatus@@@Z @ 55 NONAME ; int CESMRListQuery::ExecuteEditBeforeSendL(enum TESMRAttendeeStatus)
-	?NewL@CMRButton@@SAPAV1@W4TMRBitmapId@NMRBitmapManager@@W4TScaleMode@@@Z @ 56 NONAME ; class CMRButton * CMRButton::NewL(enum NMRBitmapManager::TMRBitmapId, enum TScaleMode)
-	?GetLayoutRect@NMRLayoutManager@@YA?AVTAknLayoutRect@@ABVTRect@@W4TMRLayout@1@@Z @ 57 NONAME ; class TAknLayoutRect NMRLayoutManager::GetLayoutRect(class TRect const &, enum NMRLayoutManager::TMRLayout)
-	?Reset@CESMRContactMenuHandler@@QAEXXZ @ 58 NONAME ; void CESMRContactMenuHandler::Reset(void)
-	?SetContactMenuObserver@CESMRContactMenuHandler@@QAEXPAVMMRContactMenuObserver@@@Z @ 59 NONAME ; void CESMRContactMenuHandler::SetContactMenuObserver(class MMRContactMenuObserver *)
-	?ExecuteL@CESMRGUIListQuery@@SAHW4TESMRListQueryType@1@@Z @ 60 NONAME ; int CESMRGUIListQuery::ExecuteL(enum CESMRGUIListQuery::TESMRListQueryType)
-	?ConnectL@RESMRStatic@@QAEXXZ @ 61 NONAME ; void RESMRStatic::ConnectL(void)
-	?ExecuteEditBeforeSendWithSendOptOnlyL@CESMRListQuery@@SAHW4TESMRAttendeeStatus@@@Z @ 62 NONAME ; int CESMRListQuery::ExecuteEditBeforeSendWithSendOptOnlyL(enum TESMRAttendeeStatus)
-	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@AAV?$RArray@H@@@Z @ 63 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType, class RArray<int> &)
-	?NewL@CESMRListQuery@@SAPAV1@W4TESMRListQueryType@1@@Z @ 64 NONAME ; class CESMRListQuery * CESMRListQuery::NewL(enum CESMRListQuery::TESMRListQueryType)
-	?GetTextComponentLayout@NMRLayoutManager@@YA?AVTAknTextComponentLayout@@W4TMRTextLayout@1@@Z @ 65 NONAME ; class TAknTextComponentLayout NMRLayoutManager::GetTextComponentLayout(enum NMRLayoutManager::TMRTextLayout)
-	?ConstructFromResourceL@CESMRRecurrence@@QAEXPAVCCoeEnv@@AAVTResourceReader@@@Z @ 66 NONAME ; void CESMRRecurrence::ConstructFromResourceL(class CCoeEnv *, class TResourceReader &)
-	?GetWindowComponentLayout@NMRLayoutManager@@YA?AVTAknWindowComponentLayout@@W4TMRLayout@1@@Z @ 67 NONAME ; class TAknWindowComponentLayout NMRLayoutManager::GetWindowComponentLayout(enum NMRLayoutManager::TMRLayout)
-	?InitOptionsMenuL@CESMRContactMenuHandler@@QAEXPAVCEikMenuPane@@@Z @ 68 NONAME ; void CESMRContactMenuHandler::InitOptionsMenuL(class CEikMenuPane *)
-	?Relative@CESMRAlarm@@QAEHXZ @ 69 NONAME ; int CESMRAlarm::Relative(void)
-	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@AAV?$RArray@VTPtrC16@@@@@Z @ 70 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType, class RArray<class TPtrC16> &)
-	??0CESMRAlarm@@QAE@XZ @ 71 NONAME ; CESMRAlarm::CESMRAlarm(void)
-	?SetCurrentFieldIndex@RESMRStatic@@QAEXH@Z @ 72 NONAME ; void RESMRStatic::SetCurrentFieldIndex(int)
-	?GetMaskIconBitmapLC@NMRBitmapManager@@YAXW4TMRBitmapId@1@AAPAVCFbsBitmap@@1HVTSize@@@Z @ 73 NONAME ; void NMRBitmapManager::GetMaskIconBitmapLC(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, int, class TSize)
-	??1CESMRSendUI@@UAE@XZ @ 74 NONAME ; CESMRSendUI::~CESMRSendUI(void)
-	?NewL@CMRLabel@@SAPAV1@XZ @ 75 NONAME ; class CMRLabel * CMRLabel::NewL(void)
-	??1CMRStylusPopupMenu@@UAE@XZ @ 76 NONAME ; CMRStylusPopupMenu::~CMRStylusPopupMenu(void)
-	?NewL@CMRStylusPopupMenu@@SAPAV1@AAVMEikMenuObserver@@@Z @ 77 NONAME ; class CMRStylusPopupMenu * CMRStylusPopupMenu::NewL(class MEikMenuObserver &)
-	??1CESMRAlarm@@UAE@XZ @ 78 NONAME ; CESMRAlarm::~CESMRAlarm(void)
-	?NewL@CMRImage@@SAPAV1@W4TMRBitmapId@NMRBitmapManager@@HW4TScaleMode@@@Z @ 79 NONAME ; class CMRImage * CMRImage::NewL(enum NMRBitmapManager::TMRBitmapId, int, enum TScaleMode)
+	?NewL@CMRButton@@SAPAV1@W4TMRBitmapId@NMRBitmapManager@@PBVCCoeControl@@W4TScaleMode@@@Z @ 9 NONAME ; class CMRButton * CMRButton::NewL(enum NMRBitmapManager::TMRBitmapId, class CCoeControl const *, enum TScaleMode)
+	?SetColor@NMRColorManager@@YAXAAVCCoeControl@@W4TMRColorId@1@@Z @ 10 NONAME ; void NMRColorManager::SetColor(class CCoeControl &, enum NMRColorManager::TMRColorId)
+	?Color@NMRColorManager@@YA?AVTRgb@@W4TMRColorId@1@@Z @ 11 NONAME ; class TRgb NMRColorManager::Color(enum NMRColorManager::TMRColorId)
+	?OptionsMenuAvailable@CESMRContactMenuHandler@@QAEHXZ @ 12 NONAME ; int CESMRContactMenuHandler::OptionsMenuAvailable(void)
+	?IsReady@CESMRContactManagerHandler@@QAEHXZ @ 13 NONAME ; int CESMRContactManagerHandler::IsReady(void)
+	?SendAsVCalendarL@CESMRSendUI@@QAEXHAAVCCalEntry@@@Z @ 14 NONAME ; void CESMRSendUI::SendAsVCalendarL(int, class CCalEntry &)
+	??0CESMRRecurrence@@QAE@XZ @ 15 NONAME ; CESMRRecurrence::CESMRRecurrence(void)
+	?NewL@CMRLabel@@SAPAV1@PBVCCoeControl@@@Z @ 16 NONAME ; class CMRLabel * CMRLabel::NewL(class CCoeControl const *)
+	?NewL@CMRImage@@SAPAV1@W4TMRBitmapId@NMRBitmapManager@@PBVCCoeControl@@HW4TScaleMode@@@Z @ 17 NONAME ; class CMRImage * CMRImage::NewL(enum NMRBitmapManager::TMRBitmapId, class CCoeControl const *, int, enum TScaleMode)
+	?LoadTextL@CESMRAlarm@@QAEXPAVCCoeEnv@@@Z @ 18 NONAME ; void CESMRAlarm::LoadTextL(class CCoeEnv *)
+	?GetSkinBasedBitmapLC@NMRBitmapManager@@YAXW4TMRBitmapId@1@AAPAVCFbsBitmap@@1VTSize@@@Z @ 19 NONAME ; void NMRBitmapManager::GetSkinBasedBitmapLC(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, class TSize)
+	??1RESMRStatic@@QAE@XZ @ 20 NONAME ; RESMRStatic::~RESMRStatic(void)
+	??1CMRImage@@UAE@XZ @ 21 NONAME ; CMRImage::~CMRImage(void)
+	?ExecuteL@CESMRGlobalNote@@SAXW4TESMGlobalNoteType@1@@Z @ 22 NONAME ; void CESMRGlobalNote::ExecuteL(enum CESMRGlobalNote::TESMGlobalNoteType)
+	?ExecuteL@CESMRConfirmationQuery@@SAHW4TESMRConfirmationQueryType@1@@Z @ 23 NONAME ; int CESMRConfirmationQuery::ExecuteL(enum CESMRConfirmationQuery::TESMRConfirmationQueryType)
+	?RecurrenceText@CESMRRecurrence@@QAEAAVHBufC16@@XZ @ 24 NONAME ; class HBufC16 & CESMRRecurrence::RecurrenceText(void)
+	?NewL@CESMRGlobalNote@@SAPAV1@W4TESMGlobalNoteType@1@@Z @ 25 NONAME ; class CESMRGlobalNote * CESMRGlobalNote::NewL(enum CESMRGlobalNote::TESMGlobalNoteType)
+	?ExecuteL@CESMRConfirmationQuery@@SAHABVTDesC16@@@Z @ 26 NONAME ; int CESMRConfirmationQuery::ExecuteL(class TDesC16 const &)
+	?Id@CESMRAlarm@@QAEHXZ @ 27 NONAME ; int CESMRAlarm::Id(void)
+	?ExecuteLD@CESMRGlobalNote@@QAEXXZ @ 28 NONAME ; void CESMRGlobalNote::ExecuteLD(void)
+	?ExecuteLD@CESMRListQuery@@QAEHXZ @ 29 NONAME ; int CESMRListQuery::ExecuteLD(void)
+	?GetFieldLayoutRect@NMRLayoutManager@@YA?AVTAknLayoutRect@@ABVTRect@@H@Z @ 30 NONAME ; class TAknLayoutRect NMRLayoutManager::GetFieldLayoutRect(class TRect const &, int)
+	?SetValueL@CESMRContactMenuHandler@@QAEXABVTDesC16@@W4TValueType@1@@Z @ 31 NONAME ; void CESMRContactMenuHandler::SetValueL(class TDesC16 const &, enum CESMRContactMenuHandler::TValueType)
+	?GetBitmapStruct@NMRBitmapManager@@YA?AVTMRBitmapStruct@1@W4TMRBitmapId@1@@Z @ 32 NONAME ; class NMRBitmapManager::TMRBitmapStruct NMRBitmapManager::GetBitmapStruct(enum NMRBitmapManager::TMRBitmapId)
+	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@@Z @ 33 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType)
+	?Close@RESMRStatic@@QAEXXZ @ 34 NONAME ; void RESMRStatic::Close(void)
+	?LaunchPopupL@CMRStylusPopupMenu@@QAEXV?$TArray@VTMenuItem@CMRStylusPopupMenu@@@@ABVTPoint@@@Z @ 35 NONAME ; void CMRStylusPopupMenu::LaunchPopupL(class TArray<class CMRStylusPopupMenu::TMenuItem>, class TPoint const &)
+	?NewL@CESMRListQuery@@SAPAV1@W4TESMRListQueryType@1@AAV?$RArray@H@@@Z @ 36 NONAME ; class CESMRListQuery * CESMRListQuery::NewL(enum CESMRListQuery::TESMRListQueryType, class RArray<int> &)
+	?ShowActionMenuL@CESMRContactMenuHandler@@QAEXXZ @ 37 NONAME ; void CESMRContactMenuHandler::ShowActionMenuL(void)
+	?ContactMenuHandlerL@RESMRStatic@@QAEAAVCESMRContactMenuHandler@@XZ @ 38 NONAME ; class CESMRContactMenuHandler & RESMRStatic::ContactMenuHandlerL(void)
+	??0TMenuItem@CMRStylusPopupMenu@@QAE@ABVTDesC16@@H@Z @ 39 NONAME ; CMRStylusPopupMenu::TMenuItem::TMenuItem(class TDesC16 const &, int)
+	??1CESMRRecurrence@@UAE@XZ @ 40 NONAME ; CESMRRecurrence::~CESMRRecurrence(void)
+	??0RESMRStatic@@QAE@XZ @ 41 NONAME ; RESMRStatic::RESMRStatic(void)
+	?DisplaySendCascadeMenuL@CESMRSendUI@@QAEXAAVCEikMenuPane@@@Z @ 42 NONAME ; void CESMRSendUI::DisplaySendCascadeMenuL(class CEikMenuPane &)
+	?ExecuteLD@CESMRListQuery@@QAEHAAV?$RArray@VTPtrC16@@@@@Z @ 43 NONAME ; int CESMRListQuery::ExecuteLD(class RArray<class TPtrC16> &)
+	?ExecuteOptionsMenuL@CESMRContactMenuHandler@@QAEXH@Z @ 44 NONAME ; void CESMRContactMenuHandler::ExecuteOptionsMenuL(int)
+	?NewL@CESMRSendUI@@SAPAV1@H@Z @ 45 NONAME ; class CESMRSendUI * CESMRSendUI::NewL(int)
+	??1CMRLabel@@UAE@XZ @ 46 NONAME ; CMRLabel::~CMRLabel(void)
+	?CurrentFieldIndex@RESMRStatic@@QAEHXZ @ 47 NONAME ; int RESMRStatic::CurrentFieldIndex(void)
+	?GetSkinBasedBitmap@NMRBitmapManager@@YAHW4TMRBitmapId@1@AAPAVCFbsBitmap@@1VTSize@@@Z @ 48 NONAME ; int NMRBitmapManager::GetSkinBasedBitmap(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, class TSize)
+	?RemoveObserver@CESMRContactManagerHandler@@QAEXPAVMESMRContactManagerObserver@@@Z @ 49 NONAME ; void CESMRContactManagerHandler::RemoveObserver(class MESMRContactManagerObserver *)
+	?ConstructFromResourceL@CESMRAlarm@@QAEXAAVTResourceReader@@@Z @ 50 NONAME ; void CESMRAlarm::ConstructFromResourceL(class TResourceReader &)
+	?RecurrenceValue@CESMRRecurrence@@QAE?AW4TESMRRecurrenceValue@@XZ @ 51 NONAME ; enum TESMRRecurrenceValue CESMRRecurrence::RecurrenceValue(void)
+	?RelativeTimeInMinutes@CESMRAlarm@@QAE?AVTTimeIntervalMinutes@@XZ @ 52 NONAME ; class TTimeIntervalMinutes CESMRAlarm::RelativeTimeInMinutes(void)
+	?CanSendL@CESMRSendUI@@QAEHH@Z @ 53 NONAME ; int CESMRSendUI::CanSendL(int)
+	?DisplaySendMenuItemL@CESMRSendUI@@QAEXAAVCEikMenuPane@@H@Z @ 54 NONAME ; void CESMRSendUI::DisplaySendMenuItemL(class CEikMenuPane &, int)
+	??1CMRButton@@UAE@XZ @ 55 NONAME ; CMRButton::~CMRButton(void)
+	?SetColor@NMRColorManager@@YAXAAVCEikTTimeEditor@@W4TMRColorId@1@@Z @ 56 NONAME ; void NMRColorManager::SetColor(class CEikTTimeEditor &, enum NMRColorManager::TMRColorId)
+	?ContactManagerHandlerL@RESMRStatic@@QAEAAVCESMRContactManagerHandler@@XZ @ 57 NONAME ; class CESMRContactManagerHandler & RESMRStatic::ContactManagerHandlerL(void)
+	?ExecuteEditBeforeSendL@CESMRListQuery@@SAHW4TESMRAttendeeStatus@@@Z @ 58 NONAME ; int CESMRListQuery::ExecuteEditBeforeSendL(enum TESMRAttendeeStatus)
+	?GetLayoutRect@NMRLayoutManager@@YA?AVTAknLayoutRect@@ABVTRect@@W4TMRLayout@1@@Z @ 59 NONAME ; class TAknLayoutRect NMRLayoutManager::GetLayoutRect(class TRect const &, enum NMRLayoutManager::TMRLayout)
+	?Reset@CESMRContactMenuHandler@@QAEXXZ @ 60 NONAME ; void CESMRContactMenuHandler::Reset(void)
+	?SetContactMenuObserver@CESMRContactMenuHandler@@QAEXPAVMMRContactMenuObserver@@@Z @ 61 NONAME ; void CESMRContactMenuHandler::SetContactMenuObserver(class MMRContactMenuObserver *)
+	?ExecuteL@CESMRGUIListQuery@@SAHW4TESMRListQueryType@1@@Z @ 62 NONAME ; int CESMRGUIListQuery::ExecuteL(enum CESMRGUIListQuery::TESMRListQueryType)
+	?ConnectL@RESMRStatic@@QAEXXZ @ 63 NONAME ; void RESMRStatic::ConnectL(void)
+	?ExecuteEditBeforeSendWithSendOptOnlyL@CESMRListQuery@@SAHW4TESMRAttendeeStatus@@@Z @ 64 NONAME ; int CESMRListQuery::ExecuteEditBeforeSendWithSendOptOnlyL(enum TESMRAttendeeStatus)
+	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@AAV?$RArray@H@@@Z @ 65 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType, class RArray<int> &)
+	?NewL@CESMRListQuery@@SAPAV1@W4TESMRListQueryType@1@@Z @ 66 NONAME ; class CESMRListQuery * CESMRListQuery::NewL(enum CESMRListQuery::TESMRListQueryType)
+	?GetTextComponentLayout@NMRLayoutManager@@YA?AVTAknTextComponentLayout@@W4TMRTextLayout@1@@Z @ 67 NONAME ; class TAknTextComponentLayout NMRLayoutManager::GetTextComponentLayout(enum NMRLayoutManager::TMRTextLayout)
+	?ConstructFromResourceL@CESMRRecurrence@@QAEXPAVCCoeEnv@@AAVTResourceReader@@@Z @ 68 NONAME ; void CESMRRecurrence::ConstructFromResourceL(class CCoeEnv *, class TResourceReader &)
+	?GetWindowComponentLayout@NMRLayoutManager@@YA?AVTAknWindowComponentLayout@@W4TMRLayout@1@@Z @ 69 NONAME ; class TAknWindowComponentLayout NMRLayoutManager::GetWindowComponentLayout(enum NMRLayoutManager::TMRLayout)
+	?InitOptionsMenuL@CESMRContactMenuHandler@@QAEXPAVCEikMenuPane@@@Z @ 70 NONAME ; void CESMRContactMenuHandler::InitOptionsMenuL(class CEikMenuPane *)
+	?Relative@CESMRAlarm@@QAEHXZ @ 71 NONAME ; int CESMRAlarm::Relative(void)
+	?ExecuteL@CESMRListQuery@@SAHW4TESMRListQueryType@1@AAV?$RArray@VTPtrC16@@@@@Z @ 72 NONAME ; int CESMRListQuery::ExecuteL(enum CESMRListQuery::TESMRListQueryType, class RArray<class TPtrC16> &)
+	??0CESMRAlarm@@QAE@XZ @ 73 NONAME ; CESMRAlarm::CESMRAlarm(void)
+	?SetCurrentFieldIndex@RESMRStatic@@QAEXH@Z @ 74 NONAME ; void RESMRStatic::SetCurrentFieldIndex(int)
+	?GetMaskIconBitmapLC@NMRBitmapManager@@YAXW4TMRBitmapId@1@AAPAVCFbsBitmap@@1HVTSize@@@Z @ 75 NONAME ; void NMRBitmapManager::GetMaskIconBitmapLC(enum NMRBitmapManager::TMRBitmapId, class CFbsBitmap * &, class CFbsBitmap * &, int, class TSize)
+	??1CESMRSendUI@@UAE@XZ @ 76 NONAME ; CESMRSendUI::~CESMRSendUI(void)
+	??1CMRStylusPopupMenu@@UAE@XZ @ 77 NONAME ; CMRStylusPopupMenu::~CMRStylusPopupMenu(void)
+	?NewL@CMRStylusPopupMenu@@SAPAV1@AAVMEikMenuObserver@@@Z @ 78 NONAME ; class CMRStylusPopupMenu * CMRStylusPopupMenu::NewL(class MEikMenuObserver &)
+	??1CESMRAlarm@@UAE@XZ @ 79 NONAME ; CESMRAlarm::~CESMRAlarm(void)
 	?GetColorStruct@NMRColorManager@@YA?AVTMRColorStruct@1@W4TMRColorId@1@@Z @ 80 NONAME ; class NMRColorManager::TMRColorStruct NMRColorManager::GetColorStruct(enum NMRColorManager::TMRColorId)
 
--- a/meetingrequest/mrguicommon/eabi/mrguicommonu.def	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/eabi/mrguicommonu.def	Thu Jul 15 18:19:25 2010 +0300
@@ -87,18 +87,16 @@
 	_ZN26CESMRContactManagerHandler14RemoveObserverEP27MESMRContactManagerObserver @ 86 NONAME
 	_ZN26CESMRContactManagerHandler17GetContactManagerEv @ 87 NONAME
 	_ZN26CESMRContactManagerHandler7IsReadyEv @ 88 NONAME
-	_ZN8CMRImage4NewLEN16NMRBitmapManager11TMRBitmapIdEi10TScaleMode @ 89 NONAME
+	_ZN8CMRImage4NewLEN16NMRBitmapManager11TMRBitmapIdEPK11CCoeControli10TScaleMode @ 89 NONAME
 	_ZN8CMRImageD0Ev @ 90 NONAME
 	_ZN8CMRImageD1Ev @ 91 NONAME
 	_ZN8CMRImageD2Ev @ 92 NONAME
-	_ZN8CMRLabel4NewLEv @ 93 NONAME
+	_ZN8CMRLabel4NewLEPK11CCoeControl @ 93 NONAME
 	_ZN8CMRLabelD0Ev @ 94 NONAME
 	_ZN8CMRLabelD1Ev @ 95 NONAME
 	_ZN8CMRLabelD2Ev @ 96 NONAME
-	_ZN9CMRButton4NewLEN16NMRBitmapManager11TMRBitmapIdE10TScaleMode @ 97 NONAME
+	_ZN9CMRButton4NewLEN16NMRBitmapManager11TMRBitmapIdEPK11CCoeControl10TScaleMode @ 97 NONAME
 	_ZN9CMRButtonD0Ev @ 98 NONAME
 	_ZN9CMRButtonD1Ev @ 99 NONAME
 	_ZN9CMRButtonD2Ev @ 100 NONAME
-	_ZTI8CMRLabel @ 101 NONAME
-	_ZTV8CMRLabel @ 102 NONAME
 
--- a/meetingrequest/mrguicommon/inc/cmrbutton.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/inc/cmrbutton.h	Thu Jul 15 18:19:25 2010 +0300
@@ -34,11 +34,13 @@
      * Two-phased constructor.
      *
      * @param aBitmapId
+     * @param aParent parent control
      * @param aScaleMode 
      * @return Pointer to created and initialized mr image object.
      */
      IMPORT_C static CMRButton* NewL(
-             NMRBitmapManager::TMRBitmapId aBitmapId, 
+             NMRBitmapManager::TMRBitmapId aBitmapId,
+             const CCoeControl* aParent = NULL,
              TScaleMode aScaleMode = EAspectRatioPreserved );
 
     /**
@@ -53,7 +55,9 @@
      * C++ default constructor
      */
     CMRButton( TScaleMode aScaleMode );
-    void ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId );
+    void ConstructL(
+            NMRBitmapManager::TMRBitmapId aBitmapId,
+            const CCoeControl* aParent );
     
 private:
     TScaleMode iScaleMode;
--- a/meetingrequest/mrguicommon/inc/cmrimage.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/inc/cmrimage.h	Thu Jul 15 18:19:25 2010 +0300
@@ -35,11 +35,13 @@
      * Two-phased constructor.
      *
      * @param aBitmapId
+     * @param aParent parent control
      * @param aScaleMode 
      * @return Pointer to created and initialized mr image object.
      */
     IMPORT_C static CMRImage* NewL(
             NMRBitmapManager::TMRBitmapId aBitmapId,
+            const CCoeControl* aParent = NULL,
             TBool aIsMaskIcon = EFalse,
             TScaleMode aScaleMode = EAspectRatioPreserved
             );
@@ -56,7 +58,10 @@
     * C++ default constructor
     */
    CMRImage( TScaleMode aScaleMode );
-   void ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId, TBool aIsMaskIcon );
+   void ConstructL(
+           NMRBitmapManager::TMRBitmapId aBitmapId,
+           const CCoeControl* aParent,
+           TBool aIsMaskIcon );
    void CreateIconL( NMRBitmapManager::TMRBitmapId aBitmapId );
    void CreateMaskIconL( NMRBitmapManager::TMRBitmapId aBitmapId );
     
--- a/meetingrequest/mrguicommon/inc/cmrlabel.h	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/inc/cmrlabel.h	Thu Jul 15 18:19:25 2010 +0300
@@ -25,14 +25,15 @@
 
 // CLASS DECLARATIONS
 
-class CMRLabel : public CEikLabel
+NONSHARABLE_CLASS( CMRLabel ) : public CEikLabel
     {
     public:
         /**
          * Static construtor
+         * @param aParent parent control
          * @return New instance of this class
          */
-        IMPORT_C static CMRLabel* NewL();
+        IMPORT_C static CMRLabel* NewL( const CCoeControl* aParent = NULL );
         /**
          * Destructor
          */
@@ -46,7 +47,7 @@
         
     private: // Implementation
         CMRLabel();
-        void ConstructL();
+        void ConstructL( const CCoeControl* aParent );
         
     private: // Data
     };
--- a/meetingrequest/mrguicommon/src/cmrbutton.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/src/cmrbutton.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -30,11 +30,14 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C  CMRButton* CMRButton::NewL(
-             NMRBitmapManager::TMRBitmapId aBitmapId, TScaleMode aScaleMode )
+        NMRBitmapManager::TMRBitmapId aBitmapId,
+        const CCoeControl* aParent,
+        TScaleMode aScaleMode
+        )
     {
     CMRButton* self = new (ELeave) CMRButton( aScaleMode );
     CleanupStack::PushL( self );
-    self->ConstructL( aBitmapId );
+    self->ConstructL( aBitmapId, aParent );
     CleanupStack::Pop( self );
     return self;
     }
@@ -74,7 +77,9 @@
 // CMRButton::ConstructL
 // ---------------------------------------------------------------------------
 //
-void CMRButton::ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId )
+void CMRButton::ConstructL(
+        NMRBitmapManager::TMRBitmapId aBitmapId,
+        const CCoeControl* aParent )
     {
     CFbsBitmap* bitMap( NULL );
     CFbsBitmap* bitMapMask( NULL );
@@ -93,6 +98,11 @@
             KNullDesC(), 
             KNullDesC(), 
             KAknButtonNoFrame | KAknButtonPressedDownFrame );
+    
+    if ( aParent )
+        {
+        SetContainerWindowL( *aParent );
+        }
     }
 
 // EOF
--- a/meetingrequest/mrguicommon/src/cmrimage.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/src/cmrimage.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -30,12 +30,13 @@
 //
 EXPORT_C  CMRImage* CMRImage::NewL(
              NMRBitmapManager::TMRBitmapId aBitmapId, 
+             const CCoeControl* aParent,
              TBool aIsMaskIcon,
              TScaleMode aScaleMode )
     {
     CMRImage* self = new (ELeave) CMRImage( aScaleMode );
     CleanupStack::PushL( self );
-    self->ConstructL( aBitmapId, aIsMaskIcon );
+    self->ConstructL( aBitmapId, aParent, aIsMaskIcon );
     CleanupStack::Pop( self );
     return self;
     }
@@ -74,10 +75,12 @@
 // CMRImage::ConstructL
 // ---------------------------------------------------------------------------
 //
-void CMRImage::ConstructL( NMRBitmapManager::TMRBitmapId aBitmapId,
-						   TBool aIsMaskIcon  )
+void CMRImage::ConstructL(
+        NMRBitmapManager::TMRBitmapId aBitmapId,
+        const CCoeControl* aParent,
+        TBool aIsMaskIcon  )
     {
-    if( aIsMaskIcon )
+    if ( aIsMaskIcon )
     	{
     	CreateMaskIconL( aBitmapId );
     	}
@@ -85,6 +88,11 @@
     	{
     	CreateIconL( aBitmapId );
     	}
+    
+    if ( aParent )
+        {
+        SetContainerWindowL( *aParent );
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrguicommon/src/cmrlabel.cpp	Mon Jun 21 15:20:54 2010 +0300
+++ b/meetingrequest/mrguicommon/src/cmrlabel.cpp	Thu Jul 15 18:19:25 2010 +0300
@@ -29,13 +29,13 @@
 // CMRLabel::NewL
 // ---------------------------------------------------------------------------
 //
-EXPORT_C CMRLabel* CMRLabel::NewL()
+EXPORT_C CMRLabel* CMRLabel::NewL( const CCoeControl* aParent )
     {
     FUNC_LOG;
     
     CMRLabel* self = new (ELeave) CMRLabel();
     CleanupStack::PushL( self );
-    self->ConstructL();
+    self->ConstructL( aParent );
     CleanupStack::Pop( self );
     return self;
     }
@@ -44,12 +44,17 @@
 // CMRLabel::ConstructL
 // ---------------------------------------------------------------------------
 //
-void CMRLabel::ConstructL()
+void CMRLabel::ConstructL( const CCoeControl* aParent )
     {
     FUNC_LOG;
 
     NMRColorManager::SetColor( *this, 
                                NMRColorManager::EMRMainAreaTextColor );
+    
+    if ( aParent )
+        {
+        SetContainerWindowL( *aParent );
+        }
     }
 
 // ---------------------------------------------------------------------------