Revision: 201013 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 14 Apr 2010 15:42:15 +0300
branchRCL_3
changeset 17 8592a65ad3fb
parent 16 4ce476e64c59
child 19 b13141f05c3d
Revision: 201013 Kit: 201015
emailcontacts/contactactionmenu/src/cfsccontactactionmenulist.cpp
emailservices/emailclientapi/src/emailmailbox.cpp
emailservices/emailclientapi/src/emailmessage.cpp
emailservices/emailframework/commonlib/inc/cmailboxstateext.h
emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp
emailservices/emailserver/cmailhandlerplugin/data/emailwidget.rss
emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsif.h
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsifconsts.h
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h
emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp
emailservices/emailserver/src/FsEmailGlobalDialogsAppUi.cpp
emailservices/emailstore/base_plugin/BWINS/basepluginU.DEF
emailservices/emailstore/base_plugin/EABI/basepluginU.DEF
emailservices/emailstore/base_plugin/group/BasePlugin.mmp
emailservices/emailstore/base_plugin/inc/BasePlugin.h
emailservices/emailstore/base_plugin/src/BasePlugin.cpp
emailservices/emailstore/base_plugin/src/basepluginmisc.cpp
emailservices/emailstore/base_plugin/src/baseplugintranslator.cpp
emailuis/emailui/data/FreestyleEmailUi.rss
emailuis/emailui/data/FreestyleEmailUiSettingsList.rssi
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h
emailuis/emailui/inc/FreestyleEmailUiLayoutHandler.h
emailuis/emailui/inc/FreestyleEmailUiSendAttachmentsListControl.h
emailuis/emailui/inc/ncsaddressinputfield.h
emailuis/emailui/inc/ncscomposeview.h
emailuis/emailui/inc/ncsheadercontainer.h
emailuis/emailui/inc/ncspopuplistbox.h
emailuis/emailui/inc/ncssubjectfield.h
emailuis/emailui/loc/freestyleemailui.loc
emailuis/emailui/sendasmtm/inc/cfssendashelper.h
emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp
emailuis/emailui/src/FreestyleEmailUiAppui.cpp
emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp
emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
emailuis/emailui/src/ncsaddressinputfield.cpp
emailuis/emailui/src/ncscomposeview.cpp
emailuis/emailui/src/ncscomposeviewcontainer.cpp
emailuis/emailui/src/ncsheadercontainer.cpp
emailuis/emailui/src/ncspopuplistbox.cpp
emailuis/emailui/src/ncssubjectfield.cpp
emailuis/uicomponents/group/fs_generic.mmp
emailuis/uicomponents/src/fscontrolbutton.cpp
emailuis/widget/hsps/00/manifest.dat
emailuis/widget/loc/emailwidget.loc
ipsservices/ipssosplugin/src/ipsplgsmtpservice.cpp
ipsservices/ipssossettings/data/ipssetuimailsettings.ra
ipsservices/ipssossettings/inc/ipssetuifolderlistarray.h
ipsservices/ipssossettings/inc/ipssetuifolderlistarray.inl
ipsservices/ipssossettings/src/ipssetuifolderlistarray.cpp
ipsservices/ipssossettings/src/ipssetuifoldersubscription.cpp
meetingrequest/mrgui/inc/cmrlistpane.h
meetingrequest/mrgui/inc/mmrphysicsobserver.h
meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmralarmfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrcheckbox.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrpriorityfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrrecurencefield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsyncfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmralarmonofffield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrattachmentsfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp
meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrattendeefield.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp
meetingrequest/mrgui/src/cmrlistpane.cpp
meetingrequest/mrgui/src/cmrlistpanephysics.cpp
--- a/emailcontacts/contactactionmenu/src/cfsccontactactionmenulist.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailcontacts/contactactionmenu/src/cfsccontactactionmenulist.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -27,14 +27,14 @@
 #include <coeaui.h>
 #include <coefontprovider.h>
 #include <gulfont.h>
-#include <AknBidiTextUtils.h> 
-#include <AknLayoutFont.h> 
-#include <AknLayout2ScalableDataDef.h>
-#include <AknLayout2ScalableDef.h>
+#include <aknbiditextutils.h> 
+#include <aknlayoutfont.h> 
+#include <aknlayout2scalabledatadef.h>
+#include <aknlayout2scalabledef.h>
 #include <layoutmetadata.cdl.h>
-#include <CdlEngine.h>
+#include <cdlengine.h>
 #include <coemain.h>
-#include <AknsListBoxBackgroundControlContext.h> 
+#include <aknslistboxbackgroundcontrolcontext.h> 
 
 #include <aknlayoutscalable_apps.cdl.h>
 #include <layoutmetadata.cdl.h>
--- a/emailservices/emailclientapi/src/emailmailbox.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailclientapi/src/emailmailbox.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -434,26 +434,26 @@
     TAny* aParam3 )
     {
     const TEventMapFunc KMailboxEventHandlers[] = {
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::IgnoreEventL,
-    CEmailMailbox::TObserverEventMapper::NewMessageL,
-    CEmailMailbox::TObserverEventMapper::MessageChangedL,
-    CEmailMailbox::TObserverEventMapper::MessageDeletedL,
-    CEmailMailbox::TObserverEventMapper::MessageMoved,
-    CEmailMailbox::TObserverEventMapper::MessageCopiedL,
-    CEmailMailbox::TObserverEventMapper::NewFolderL,
-    CEmailMailbox::TObserverEventMapper::FolderChangeL,
-    CEmailMailbox::TObserverEventMapper::FoldersDeletedL,
-    CEmailMailbox::TObserverEventMapper::FoldersMovedL,
-    CEmailMailbox::TObserverEventMapper::ExceptionL
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::IgnoreEventL,
+    &CEmailMailbox::TObserverEventMapper::NewMessageL,
+    &CEmailMailbox::TObserverEventMapper::MessageChangedL,
+    &CEmailMailbox::TObserverEventMapper::MessageDeletedL,
+    &CEmailMailbox::TObserverEventMapper::MessageMoved,
+    &CEmailMailbox::TObserverEventMapper::MessageCopiedL,
+    &CEmailMailbox::TObserverEventMapper::NewFolderL,
+    &CEmailMailbox::TObserverEventMapper::FolderChangeL,
+    &CEmailMailbox::TObserverEventMapper::FoldersDeletedL,
+    &CEmailMailbox::TObserverEventMapper::FoldersMovedL,
+    &CEmailMailbox::TObserverEventMapper::ExceptionL
     };
 
     TMailboxId id( aMailbox.Id() );
--- a/emailservices/emailclientapi/src/emailmessage.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailclientapi/src/emailmessage.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -643,8 +643,7 @@
     CleanupStack::PushL( part );
     CEmailAttachment* att = CEmailAttachment::NewLC(iPluginData, iMsgContentId, part, EAPIOwns);
     iAttachments.AppendL( att );
-
-    CleanupStack::Pop(); // part, att
+    CleanupStack::Pop(2); // part, att
     
     return att;
     }
--- a/emailservices/emailframework/commonlib/inc/cmailboxstateext.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailframework/commonlib/inc/cmailboxstateext.h	Wed Apr 14 15:42:15 2010 +0300
@@ -19,7 +19,7 @@
 #define CMAILBOXSTATEEXT_H
 
 #include "cemailextensionbase.h"
-#include "CFSMailCommon.h"
+#include "cfsmailcommon.h"
 
 // interface UID value passed to CFSMailClient::ExtensionL
 const TUid KEmailMailboxStateExtensionUid        = { 0x2001E28B };
--- a/emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -27,12 +27,9 @@
 // -----------------------------------------------------------------------------
 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler(  
     MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager)
-{
+    {
     FUNC_LOG;
-
-	// store pointer to TLS
-	TInt err = Dll::SetTls(static_cast<TAny*>(this));
-}
+    }
 
 // -----------------------------------------------------------------------------
 // CFSMailRequestHandler::~CFSMailRequestHandler
--- a/emailservices/emailserver/cmailhandlerplugin/data/emailwidget.rss	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/data/emailwidget.rss	Wed Apr 14 15:42:15 2010 +0300
@@ -35,4 +35,5 @@
 //
 RESOURCE TBUF r_emailwidget_text_setup_email                 { buf=qtn_hscr_ew_configure_email; }
 RESOURCE TBUF r_emailwidget_text_mailbox_and_mailcount       { buf=qtn_hscr_ew_email_count; }
+RESOURCE TBUF r_emailwidget_text_hs_page_full                { buf=qtn_cmail_hs_widget_full_notification; }
 //
--- a/emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp	Wed Apr 14 15:42:15 2010 +0300
@@ -103,3 +103,7 @@
 LIBRARY                         apparc.lib
 LIBRARY                         cmaillogger.lib
 LIBRARY                         flogger.lib
+LIBRARY                         hsccapiclient.lib
+LIBRARY                         hscontentcontrol.lib
+LIBRARY                         hscontentinfo.lib
+LIBRARY                         aknnotify.lib
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h	Wed Apr 14 15:42:15 2010 +0300
@@ -21,6 +21,7 @@
 
 #include <aknappui.h>
 #include <memailobserverlistener.h> // base class
+#include <AknGlobalNote.h>
 
 // FSMailServer classes (base classes and callback interfaces)
 #include "fsnotificationhandlerbase.h"
@@ -133,9 +134,40 @@
     
     /**
      *
-     */    
+     */
     void CleanWaitingForNewMailbox();
 
+    /**
+     *
+     */
+    void SetWaitingForNewWidget( const TFSMailMsgId aMailbox );
+    
+    /**
+     *
+     */
+    void CleanWaitingForNewWidget();
+
+    /**
+     *
+     */
+    TFSMailMsgId WaitingForNewWidget();
+
+    /**
+     *
+     */
+    void AssociateWidgetToSetting( const TDesC& aContentId,
+                                   const TFSMailMsgId aMailbox );
+
+    /**
+     *
+     */    
+    TBool Associated( const TDesC& aContentId );
+
+    /**
+     *
+     */
+    void DisplayHSPageFullNoteL();
+        
 protected:
     /**
      * From CFSNotificationHandlerBase
@@ -410,6 +442,10 @@
     // tells if email wizard is started from widget and it is still running
     // and to which widget next added account is added.
     HBufC*                             iWaitingForNewMailbox;
+    //
+    TFSMailMsgId                       iWaitingForNewWidget;
+    //
+    CAknGlobalNote*                    iQuery;
     };
 
 #endif  //__CMAILCPSHANDLER_H__
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsif.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsif.h	Wed Apr 14 15:42:15 2010 +0300
@@ -25,6 +25,10 @@
 #include <liwgenericparam.h>
 #include <fbs.h>
 #include <data_caging_path_literals.hrh>
+#include <hsccapiclient.h>
+#include <hscontentcontrol.h>
+#include <hscontentinfo.h>
+#include <hscontentinfoarray.h>
 
 #include "cmailcpshandler.h"
 #include "cmailcpsifconsts.h"
@@ -36,7 +40,9 @@
  *  @lib fsmailserver.exe
  *  @since S60 v5.1
  */
-NONSHARABLE_CLASS( CMailCpsIf ) : public CBase, public MLiwNotifyCallback
+NONSHARABLE_CLASS( CMailCpsIf ) : public CBase,
+                                  public MHsContentControl,
+                                  public MLiwNotifyCallback
     {
 public:
     /**
@@ -170,6 +176,11 @@
      * 
      */	
 	TInt GetWidgetInstanceCount();
+	
+    /**
+     * 
+     */	
+	void AddWidgetToHomescreenL( const TFSMailMsgId aMailbox );
 
 private:
     
@@ -247,6 +258,13 @@
      */
     void ResetPublishedDataL( const TDesC& aContentId );
 
+    //
+    // -------------------------- from base classes-----------------------------
+    //
+    virtual void NotifyWidgetListChanged(); // MHsContentControl
+    virtual void NotifyViewListChanged(); // MHsContentControl
+    virtual void NotifyAppListChanged(); // MHsContentControl
+    
 public:
 	//
     RPointerArray<HBufC>    iInstIdList;
@@ -272,6 +290,8 @@
 	TBool 					iAllowedToPublish[KMaxMailboxCount];
 	// From configuration: are homescreen notifications observed or ignored
 	TBool                   iIgnoreHsNotifications;
+	
+	CHsCcApiClient*         iContentControlClient;
     };
 
 #endif /*CMAILCPSIF_H_*/
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsifconsts.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpsifconsts.h	Wed Apr 14 15:42:15 2010 +0300
@@ -34,6 +34,9 @@
 _LIT( KLessThan,"<");
 _LIT( KAt,"@");
 _LIT( KDot,".");
+_LIT( KSkinPrefix, "SKIN(" );
+
+_LIT( KSkinPostfix, "):");
 _LIT( KMifPrefix, "mif(");
 // Mif file name and path, drive letter need to be parsed run time
 _LIT( KMifPath, "\\resource\\apps\\cmailhandlerplugin.mif");
@@ -50,6 +53,8 @@
 //
 
 _LIT(KPubId, "0x2001F413:CMailWidget");
+_LIT8(KConfId8, "0x2001e272");
+
 _LIT(KContTypeText, "text");
 _LIT(KContTypeImage, "image");
 
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h	Wed Apr 14 15:42:15 2010 +0300
@@ -102,13 +102,6 @@
     void RemoveMailboxL( const TFSMailMsgId aMailbox );
 
     /**
-     * Removes mailbox from widget settings
-     * @param aIndex refers to index in mailbox array that is returned by
-     *        CMailCpsSettings::Mailboxes()
-     */
-    void RemoveMailboxL( const TInt aIndex );
-
-    /**
      * Gets maximum row count
      * @return maximum row count
      */
@@ -188,6 +181,13 @@
      *
      */    
     TBool GetNewMailState( const TFSMailMsgId& aMailBox );
+
+    /**
+     * Find next free CenRep key to store setting.
+     * @param aContentId Id of widget instance
+     * @return true if account is associated to content id, false if not
+     */    
+    TBool Associated( const TDesC& aContentId );
     
 protected:
     /**
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -50,9 +50,12 @@
 //
 CMailCpsHandler::CMailCpsHandler( MFSNotificationHandlerMgr& aOwner ): 
     CFSNotificationHandlerBase( aOwner ),
-    iWaitingForNewMailbox(NULL)
+    iWaitingForNewMailbox( NULL ),
+    iWaitingForNewWidget()
     {
     FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( KNullUid );
+    iWaitingForNewWidget.SetId( 0 );
     }
 
 // ---------------------------------------------------------
@@ -140,14 +143,7 @@
             {
             mailboxId = mailbox->GetId().Id();
             }
-        if ( !mailboxId )
-            {
-            // Remove box from settings
-            iSettings->RemoveMailboxL( ii );
-            // Array indexing changes now since one item was deleted
-            ii--;
-            }
-        else
+        if ( mailboxId )
             {
             CleanupStack::PushL( mailbox );
             CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox );
@@ -863,6 +859,10 @@
         {
         iSettings->AssociateWidgetToSetting( iWaitingForNewMailbox->Des(), aMailbox );
         }
+    else
+        {
+        iLiwIf->AddWidgetToHomescreenL( aMailbox );
+        }
     }
 
 // ---------------------------------------------------------
@@ -1828,3 +1828,76 @@
         iWaitingForNewMailbox = NULL;
         }
     }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::SetWaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+void CMailCpsHandler::SetWaitingForNewWidget( const TFSMailMsgId aMailbox )
+    {
+    FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( aMailbox.PluginId() );
+    iWaitingForNewWidget.SetId( aMailbox.Id() );   
+    }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::CleanWaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+void CMailCpsHandler::CleanWaitingForNewWidget()
+    {
+    FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( KNullUid );
+    iWaitingForNewWidget.SetId( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::WaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+TFSMailMsgId CMailCpsHandler::WaitingForNewWidget()
+    {
+    FUNC_LOG;
+    return iWaitingForNewWidget;    
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsSettings::AssociateWidgetToSetting
+// ---------------------------------------------------------------------------
+//
+void CMailCpsHandler::AssociateWidgetToSetting( const TDesC& aContentId,
+                                                const TFSMailMsgId aMailbox )
+    {
+    FUNC_LOG;
+    iSettings->AssociateWidgetToSetting( aContentId, aMailbox );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMailCpsHandler::Associated
+// ---------------------------------------------------------------------------
+//
+TBool CMailCpsHandler::Associated( const TDesC& aContentId )
+    {
+    FUNC_LOG;    
+    return iSettings->Associated( aContentId );
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsSettings::DisplayHSPageFullNoteL
+// ---------------------------------------------------------------------------
+//
+void CMailCpsHandler::DisplayHSPageFullNoteL()
+    {
+    FUNC_LOG;
+    if (!iQuery)
+        {
+        iQuery = CAknGlobalNote::NewL();
+        iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
+        }   
+    HBufC* str( NULL );
+    str = StringLoader::LoadLC( R_EMAILWIDGET_TEXT_HS_PAGE_FULL );
+    iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des());
+    CleanupStack::PopAndDestroy( str );    
+    }
+    
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -75,6 +75,8 @@
     PublisherRegisteryActionL();
     
     ResetPublishedDataL( KCPAll );
+    
+    iContentControlClient = CHsCcApiClient::NewL( this );
     }
 
 // ---------------------------------------------------------------------------
@@ -95,6 +97,10 @@
     delete iServiceHandler;
     iInstIdList.ResetAndDestroy();  
     CCoeEnv::Static()->DeleteResourceFile( iResourceFileOffset );
+    if ( iContentControlClient ) 
+        {
+        delete iContentControlClient;
+        }
     }
 
 // ---------------------------------------------------------
@@ -624,8 +630,28 @@
 
     if (!iconIds.Length())
         {
-        TBuf<KMaxDescLen> id;
-        iconIds.Copy( KMifPrefix );
+        TBuf<KMaxDescLen> id;    
+        if ( aBitmapId == EMbmCmailhandlerpluginQgn_stat_message_mail_uni )
+            {
+            iconIds.Append( KSkinPrefix );
+            id.Num( EAknsMajorGeneric );
+            iconIds.Append( id );
+            iconIds.Append( KSpace );
+            id.Num( EAknsMinorGenericQgnStatMessageMailUni );
+            iconIds.Append( id );
+            iconIds.Append( KSkinPostfix );                    
+            }
+        else if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_outbox_msg )
+            {
+            iconIds.Append( KSkinPrefix );
+            id.Num( EAknsMajorGeneric );
+            iconIds.Append( id );
+            iconIds.Append( KSpace );
+            id.Num( EAknsMinorGenericQgnIndiCmailOutboxMsg );
+            iconIds.Append( id );
+            iconIds.Append( KSkinPostfix );
+            }
+        iconIds.Append( KMifPrefix );
         iconIds.Append( mifParse.FullName() );
         iconIds.Append( KSpace );
         id.Num( aBitmapId );
@@ -869,8 +895,9 @@
                              {
                              // Publishing to homescreen suspended.
                              HBufC* cid = contentid.AllocLC();
-                             TInt widgetInstance = FindWidgetInstanceId(cid->Des());
-                             iAllowedToPublish[widgetInstance] = EFalse;
+	                         TInt widgetInstance = FindWidgetInstanceId(cid->Des());
+							 if(widgetInstance>=0)
+                             	iAllowedToPublish[widgetInstance] = EFalse;
                              CleanupStack::PopAndDestroy( cid );
                              }
                          else if (trigger.Compare(KResume16) == 0)
@@ -894,14 +921,26 @@
                              {
                              // Widget added to homescreen
                              HBufC* cid = contentid.AllocLC();
-                             iInstIdList.AppendL( contentid.AllocL() );
-                             if ( iMailCpsHandler->TotalMailboxCountL() )
+                             if ( cid->Length() > 0 )
                                  {
-                                 iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
-                                 }
-                             else
-                                 {
-                                 iMailCpsHandler->LaunchEmailWizardL(cid->Des());
+                                 iInstIdList.AppendL( contentid.AllocL() );
+                                 TFSMailMsgId mailBox( iMailCpsHandler->WaitingForNewWidget() );
+                                 if ( mailBox.Id() > 0 )
+                                     {
+                                     // Associate new mailbox to widget setting
+                                     iMailCpsHandler->AssociateWidgetToSetting( 
+                                             cid->Des(),
+                                             mailBox );
+                                     iMailCpsHandler->CleanWaitingForNewWidget();
+                                     }
+                                 else if ( iMailCpsHandler->TotalMailboxCountL() )
+                                     {
+                                     iMailCpsHandler->LaunchWidgetSettingsL(cid->Des());
+                                     }
+                                 else
+                                     {
+                                     iMailCpsHandler->LaunchEmailWizardL(cid->Des());
+                                     }
                                  }
                              CleanupStack::PopAndDestroy( cid );
                              }
@@ -1042,3 +1081,79 @@
     outParam->Reset();
     inParam->Reset();
     }
+
+// ---------------------------------------------------------------------------
+// CMailCpsIf::AddWidgetToHomescreenL
+// ---------------------------------------------------------------------------
+//
+void CMailCpsIf::AddWidgetToHomescreenL( const TFSMailMsgId aMailbox )
+    {
+    FUNC_LOG;
+    
+    for ( TInt i = 0; i < iInstIdList.Count(); i++ )
+        {
+        if ( !iMailCpsHandler->Associated(iInstIdList[i]->Des()) )
+            {
+            // Empty e-mail widget found. Associate new account to it.
+            iMailCpsHandler->AssociateWidgetToSetting( 
+                    iInstIdList[i]->Des(),
+                    aMailbox );
+            return;
+            }
+        }
+    
+    CHsContentInfoArray* widgets = CHsContentInfoArray::NewL();
+    CleanupStack::PushL( widgets );
+    iContentControlClient->WidgetListL( *widgets );   
+    CHsContentInfo* widgetContentInfo( NULL );
+
+    for ( TInt i = 0; i < widgets->Array().Count(); i++ )
+        {
+        widgetContentInfo = widgets->Array()[i];
+        if (!widgetContentInfo->Uid().Compare(KConfId8))
+            {
+            // E-mail widget found
+            widgetContentInfo->SetCanBeRemoved( ETrue );
+            if ( iContentControlClient->AddWidgetL( *widgetContentInfo ) == KErrNone )
+                {
+                // Widget added succesfully. Wait PluginStartup event from HS.
+                iMailCpsHandler->SetWaitingForNewWidget( aMailbox );
+                }
+            else
+                {
+                iMailCpsHandler->DisplayHSPageFullNoteL();
+                }
+            break;
+            }
+        }
+    CleanupStack::PopAndDestroy();
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMailCpsIf::NotifyWidgetListChanged
+// ---------------------------------------------------------------------------
+//
+void CMailCpsIf::NotifyWidgetListChanged()
+    {
+    FUNC_LOG;
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsIf::NotifyViewListChanged
+// ---------------------------------------------------------------------------
+//
+void CMailCpsIf::NotifyViewListChanged()
+    {
+    FUNC_LOG;
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsIf::NotifyAppListChanged
+// ---------------------------------------------------------------------------
+//
+void CMailCpsIf::NotifyAppListChanged()
+    {
+    FUNC_LOG;
+    }
+
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -145,6 +145,7 @@
             ret = ResolveMailbox( value, mailbox );
             if ( ret )
                 {
+				INFO("CMailCpsSettings::LoadSettingsL(): Error: ignore this entry");
                 // Resolving encountered error, ignore this entry
                 ret = iCenRep->Reset( KCMailMailboxIdBase+ii );
                 ret = iCenRep->Reset( KCMailPluginIdBase+ii );
@@ -216,7 +217,8 @@
     FUNC_LOG;
     RPointerArray<CFSMailBox> mailboxarray;
     TInt err = iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxarray );
-    if( !err )
+	INFO_1("CMailCpsSettings::ResolveMailbox(): : ListMailBoxes() returns %d", err);
+    if( !err ) // KErrNone = 0
         {
         err = KErrNotFound;
         aMsg.SetId( aMailboxId );
@@ -227,13 +229,11 @@
                 {
                 // Mailbox found
                 aMsg.SetPluginId( mailboxarray[ii]->GetId().PluginId() );
-                return err = KErrNone;
+                err = KErrNone; 
+                break;
                 }
             }
         }
-    else
-        {
-        }
     mailboxarray.ResetAndDestroy();
     return err;
     }
@@ -386,40 +386,16 @@
         {
         if( iMailboxArray[ii].Id() == aMailbox.Id() )
             {
-            RemoveMailboxL( ii );
+            TBuf<KMaxDescLen> cid;
+            GetContentId( aMailbox.Id(), 1, cid );
+            DissociateWidgetFromSettingL( cid );
+            iMailboxArray.Remove( ii );
             break;
             }
         }
     }
 
 // ---------------------------------------------------------------------------
-// CMailCpsSettings::RemoveMailboxL
-// ---------------------------------------------------------------------------
-//
-void CMailCpsSettings::RemoveMailboxL( const TInt aIndex )
-    {
-    FUNC_LOG;
-    
-    // Remove mailbox from local array
-    TFSMailMsgId mailboxId = iMailboxArray[aIndex];
-    iMailboxArray.Remove( aIndex );
-    
-    // Remove mailbox from widget settings
-    RArray<TUint32> keys;
-    GetMailboxNonZeroKeysL( keys );
-    const TInt iiMax( keys.Count() );
-    for ( TInt ii = 0; ii < iiMax; ii++ )
-        {
-        TInt value( 0 );
-        iCenRep->Get( keys[ii], value );
-        if( value == mailboxId.Id() )
-            {
-            iCenRep->Set( keys[ii], 0 );
-            }
-        }
-    }
-
-// ---------------------------------------------------------------------------
 // CMailCpsSettings::MaxRowCount
 // ---------------------------------------------------------------------------
 //
@@ -466,21 +442,17 @@
 void CMailCpsSettings::DissociateWidgetFromSettingL( const TDesC& aContentId )
     {
     FUNC_LOG;
-    TUint32 key(0);
-    TUint32 mailboxKey(0);
-
-    for (TInt i = 0; i < KMaxMailboxCount; i++)
+    for ( TInt i = 0; i < KMaxMailboxCount; i++ )
         {
         TBuf<KMaxDescLen> value;
-        TUint32 tempKey(KCMailWidgetContentIdBase+i);
-        iCenRep->Get( tempKey, value );
+        TUint32 key( KCMailWidgetContentIdBase + i );
+        iCenRep->Get( key, value );
         TInt result = value.Compare(aContentId);
         if (!result)
             {
-            key = tempKey;
-            mailboxKey = KCMailMailboxIdBase + i;
-            iCenRep->Reset(key);
-            iCenRep->Reset(mailboxKey);
+            iCenRep->Reset( key );
+            iCenRep->Reset( KCMailMailboxIdBase + i );
+            iCenRep->Reset( KCMailPluginIdBase + i );
             break;
             }
         }        
@@ -526,6 +498,30 @@
     }
 
 // ---------------------------------------------------------------------------
+// CMailCpsSettings::Associated
+// ---------------------------------------------------------------------------
+//
+TBool CMailCpsSettings::Associated( const TDesC& aContentId )
+    {
+    FUNC_LOG;    
+    TBool ret(EFalse);
+    
+    for (TInt i = 0; i < KMaxMailboxCount; i++)
+        {
+        TBuf<KMaxDescLen> value;
+        TUint32 key(KCMailWidgetContentIdBase+i);
+        iCenRep->Get( key, value );
+        TInt result = value.Compare(aContentId);
+        if (!result)
+            {
+            ret = ETrue;
+            break;
+            }
+        }
+    return ret;
+    }
+
+// ---------------------------------------------------------------------------
 // CMailCpsSettings::GetContentId
 // ---------------------------------------------------------------------------
 //
--- a/emailservices/emailserver/src/FsEmailGlobalDialogsAppUi.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/src/FsEmailGlobalDialogsAppUi.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -28,7 +28,7 @@
 // is hided from task list so it's not possible switch FSMailServer back to
 // foreground if user switches to Idle before dismissing the note.
 // '- 1' is needed for the VKB to work correctly
-const TInt KFsEmailDialogsWinPriorityActive = ECoeWinPriorityAlwaysAtFront - 1;
+const TInt KFsEmailDialogsWinPriorityActive = ECoeWinPriorityNormal;
 
 // To be used as FSMailServer window group priority when there is no displayable
 // content.
--- a/emailservices/emailstore/base_plugin/BWINS/basepluginU.DEF	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/BWINS/basepluginU.DEF	Wed Apr 14 15:42:15 2010 +0300
@@ -192,4 +192,5 @@
 	?Load2L@CResourceLoader@@QAEPAVHBufC16@@HH@Z @ 191 NONAME ; class HBufC16 * CResourceLoader::Load2L(int, int)
 	?Load2LC@CResourceLoader@@QAEPAVHBufC16@@H@Z @ 192 NONAME ; class HBufC16 * CResourceLoader::Load2LC(int)
 	?Load2L@CResourceLoader@@QAEPAVHBufC16@@HABVTDesC16@@@Z @ 193 NONAME ; class HBufC16 * CResourceLoader::Load2L(int, class TDesC16 const &)
+	?CalendarFileName@CBasePlugin@@MBEABVTDesC16@@XZ @ 194 NONAME ; class TDesC16 const & CBasePlugin::CalendarFileName(void) const
 
--- a/emailservices/emailstore/base_plugin/EABI/basepluginU.DEF	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/EABI/basepluginU.DEF	Wed Apr 14 15:42:15 2010 +0300
@@ -296,4 +296,5 @@
 	_ZN15CResourceLoader7Load2LCEi @ 295 NONAME
 	_ZN15CResourceLoader7Load2LCEiRK7TDesC16 @ 296 NONAME
 	_ZN15CResourceLoader7Load2LCEii @ 297 NONAME
+	_ZNK11CBasePlugin16CalendarFileNameEv @ 298 NONAME
 
--- a/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Wed Apr 14 15:42:15 2010 +0300
@@ -77,6 +77,7 @@
 LIBRARY     bafl.lib
 LIBRARY     efsrv.lib
 LIBRARY     gdi.lib
+LIBRARY     calinterimapi.lib
 
 LIBRARY     messagestoreclient.lib
 LIBRARY     fsfwcommonlib.lib
--- a/emailservices/emailstore/base_plugin/inc/BasePlugin.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/inc/BasePlugin.h	Wed Apr 14 15:42:15 2010 +0300
@@ -742,6 +742,8 @@
 	        TMsgStoreId aId,
 	        TMsgStoreId aParentId,
 	        TMsgStoreId aOtherId );
+	    
+	    IMPORT_C virtual const TDesC& CBasePlugin::CalendarFileName() const;
 
     public:
 
@@ -774,7 +776,7 @@
         TCacheLine iCacheLine;
 
     private:
-
+    protected:
         MDelayedOpsManager* iDelayedOpsManager;
 
         /**
--- a/emailservices/emailstore/base_plugin/src/BasePlugin.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/src/BasePlugin.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -30,6 +30,7 @@
 //Freestyle.
 #include "cfsmailcommon.h"
 #include "cfsmailmessage.h"
+#include "cmrcalendarinfo.h" 
 //</cmail>
 //Base plugin.
 #include "baseplugin.h"
@@ -40,6 +41,7 @@
 // Other
 #include <e32base.h>
 #include <utf.h>
+#include <calsession.h>
 
 //<cmail>
 #include "FreestyleEmailUiConstants.h"
@@ -258,6 +260,37 @@
     MMRInfoProcessor* infoProcessor = CBaseMrInfoProcessor::NewL( *this );
     result->SetMRInfoProcessorL( infoProcessor );
     
+    //JOJA-83VJ4L Plugins need to set the correct Calendar Database ID for MRUI to work
+    //get the calendar file name from the derived class
+    const TDesC& calFileName = CalendarFileName();
+    if ( calFileName != KNullDesC )
+        {
+        //the derived class does use its own calendar file, check if that file exists
+        //the file may not exist because cal sync was disabled, or the file was deleted from the calendar UI
+        CCalSession* calSession = CCalSession::NewL();
+        CleanupStack::PushL( calSession );
+        
+        TRAPD( error, calSession->OpenL( calFileName ) );
+        if ( error == KErrNone )
+            {
+            //calendar file exists, get its file id, and set it to cMail Celendar Info via the extention
+            TCalFileId fileId = KNullFileId; 
+            calSession->FileIdL( fileId );
+            
+            //get the extention api for the MR info, set the cal db id, and release the extention
+            CEmailExtension* extension = NULL;
+            TRAP( error, extension = result->ExtensionL( KMailboxExtMrCalInfo ) );
+            if ( error == KErrNone )
+                {
+                CMRCalendarInfo* calInfo = reinterpret_cast<CMRCalendarInfo*>( extension );
+                calInfo->SetCalendarDatabaseIdL( fileId ); // cannot actually leave
+                result->ReleaseExtension( calInfo );
+                }
+            }
+        
+        CleanupStack::PopAndDestroy( calSession );
+        }
+    
     CleanupStack::Pop( result );
     
     __LOG_EXIT
--- a/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -644,3 +644,8 @@
     {
     return *iDelayedOpsManager;
     }
+
+/*protected*/ EXPORT_C const TDesC& CBasePlugin::CalendarFileName() const
+    {
+    return KNullDesC();
+    }
--- a/emailservices/emailstore/base_plugin/src/baseplugintranslator.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailstore/base_plugin/src/baseplugintranslator.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -768,6 +768,10 @@
 	    TTime sentTime;
 	    sentTime.UniversalTime();
 	    aDst.AddOrUpdatePropertyL( KMsgStorePropertySent, sentTime );
+	    // same date needs to be set as received date , because of sorting
+	    // feature in message store, which enable sorting only according to
+	    // received date.
+	    aDst.AddOrUpdatePropertyL( KMsgStorePropertyReceivedAt, sentTime );
 	    aSrc.SetDate( sentTime );
     	}
     
--- a/emailuis/emailui/data/FreestyleEmailUi.rss	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss	Wed Apr 14 15:42:15 2010 +0300
@@ -34,6 +34,7 @@
 #include <unieditor.loc>
 #include <fsccallplugin.loc>
 #include <freestyleemailui.mbg>
+#include <aknsconstants.hrh>
 #define EMAILUI_ICON_FILE BITMAP_DIR"\\FreestyleEmailUi.mif"
 
 #ifndef qtn_cmail_options_moveto_folder
@@ -83,8 +84,9 @@
                         {
                         helptxt = qtn_msg_tb_tooltip_send;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_msg_send;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_msg_send_mask;
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_msg_send;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_msg_send_mask;
+                        extension = r_cmail_button_state_ext_tb_msg_send;
                         }
                     };
                 };
@@ -99,6 +101,8 @@
                 bmpFile = EMAILUI_ICON_FILE;
                 bmpId = EMbmFreestyleemailuiQgn_indi_tb_extension;
                 bmpMask = EMbmFreestyleemailuiQgn_indi_tb_extension_mask;
+                bmpSkinIdMajor = EAknsMajorGeneric;
+                bmpSkinIdMinor = EAknsMinorGenericQgnIndiTbExtension;
                 items =
                     {
                     TBAR_CTRL
@@ -116,6 +120,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_high_priority;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_high_priority_mask;
+                                    extension = r_cmail_button_state_ext_tb_high_priority;
                                     },
                                 AVKON_BUTTON_STATE
                                     {
@@ -123,6 +128,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_high_priority_selected;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_high_priority_selected_mask;
+                                    extension = r_cmail_button_state_ext_tb_high_priority_selected;
                                     }
                                 };
                             };
@@ -142,6 +148,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_low_priority;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_low_priority_mask;
+                                    extension = r_cmail_button_state_ext_tb_low_priority;
                                     },
                                 AVKON_BUTTON_STATE
                                     {
@@ -149,6 +156,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_low_priority_selected;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_low_priority_selected_mask;
+                                    extension = r_cmail_button_state_ext_tb_low_priority_selected;
                                     }
                                 };
                             };
@@ -168,6 +176,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_follow_up;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_follow_up_mask;
+                                    extension = r_cmail_button_state_ext_follow_up;
                                     },
                                 AVKON_BUTTON_STATE
                                     {
@@ -175,6 +184,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_follow_up_selected;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_follow_up_selected_mask;
+                                    extension = r_cmail_button_state_ext_tb_follow_up_selected;
                                     }
                                 };
                             };
@@ -196,6 +206,7 @@
                                     //bmpmask = EMbmFreestyleemailuiQgn_indi_tb_show_cc_mask;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_cc;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_cc_mask;
+                                    extension = r_cmail_button_state_ext_tb_show_cc;
                                     },
                                 AVKON_BUTTON_STATE
                                     {
@@ -203,6 +214,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_cc;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_cc_mask;
+                                    extension = r_cmail_button_state_ext_tb_hide_cc;
                                     }
                                 };
                             };
@@ -224,6 +236,7 @@
                                     //bmpmask = EMbmFreestyleemailuiQgn_indi_tb_show_bcc_mask;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc_mask;
+                                    extension = r_cmail_button_state_ext_tb_show_bcc;
                                     },
                                 AVKON_BUTTON_STATE
                                     {
@@ -231,6 +244,7 @@
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc;
                                     bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc_mask;
+                                    extension = r_cmail_button_state_ext_tb_hide_bcc;
                                     }
                                 };
                             };
@@ -248,6 +262,8 @@
                 bmpFile = EMAILUI_ICON_FILE;
                 bmpId = EMbmFreestyleemailuiQgn_indi_tb_expand_insert;
                 bmpMask = EMbmFreestyleemailuiQgn_indi_tb_expand_insert_mask;
+                bmpSkinIdMajor = EAknsMajorGeneric;
+                bmpSkinIdMinor = EAknsMinorGenericQgnIndiTbExpandInsert;
                 items =
                     {
                     TBAR_CTRL
@@ -264,8 +280,9 @@
                                     txt = qtn_msg_insert_tb_image;
                                     helptxt = qtn_msg_insert_tb_tooltip_image;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_image;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_image_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_mce_tb_image;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_mce_tb_image_mask;
+                                    extension = r_cmail_button_state_ext_mce_tb_image;
                                     }
                                 };
                             };
@@ -284,8 +301,9 @@
                                     txt = qtn_msg_insert_tb_video;
                                     helptxt = qtn_msg_insert_tb_tooltip_video;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_video;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_video_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_mce_tb_video;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_mce_tb_video_mask;
+                                    extension = r_cmail_button_state_ext_mce_tb_video;
                                     }
                                 };
                             };
@@ -304,8 +322,9 @@
                                     txt = qtn_msg_insert_tb_sound;
                                     helptxt = qtn_msg_insert_tb_tooltip_sound;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_audio;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_audio_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_mce_tb_audio;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_mce_tb_audio_mask;
+                                    extension = r_cmail_button_state_ext_mce_tb_audio;
                                     }
                                 };
                             };
@@ -344,8 +363,9 @@
                                     txt = qtn_msg_insert_tb_note;
                                     helptxt = qtn_fse_msg_insert_tb_tooltip_note_att;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_tb_note;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_note_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_note;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_note_mask;
+                                    extension = r_cmail_button_state_ext_tb_note;
                                     }
                                 };
                             };
@@ -386,8 +406,9 @@
                                     txt = qtn_msg_insert_tb_other;
                                     helptxt = qtn_msg_insert_tb_tooltip_other;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_other;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_other_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_mce_tb_other;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_mce_tb_other_mask;
+                                    extension = r_cmail_button_state_ext_mce_tb_other;
                                     }
                                 };
                             };
@@ -399,6 +420,113 @@
     }
 
 //------------------------------------------------------------------------------
+// Button state extensions for mail editor toolbar
+//------------------------------------------------------------------------------
+//
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_msg_send
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbMsgSend;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_high_priority
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbHighPriority;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_high_priority_selected
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbHighPrioritySelected;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_low_priority
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbLowPriority;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_low_priority_selected
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbLowPrioritySelected;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_follow_up
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbFollowUp;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_follow_up_selected
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbFollowUpSelected;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_show_cc
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbShowCc;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_hide_cc
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbHideCc;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_show_bcc
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbShowBcc;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_hide_bcc
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbHideBcc;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_add_recipient
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbAddRecipient;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_mce_tb_image
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMceTbImage;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_mce_tb_video
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMceTbVideo;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_mce_tb_audio
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMceTbAudio;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_note
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbNote;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_mce_tb_other
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiMceTbOther;
+    }
+
+//------------------------------------------------------------------------------
 // Folder list toolbar
 //------------------------------------------------------------------------------
 //
@@ -410,25 +538,6 @@
         TBAR_CTRL
             {
             type = EAknCtButton;
-            id = EFsEmailUiTbCmdSelect;
-            control = AVKON_BUTTON
-                {
-                flags = KAknButtonSizeFitText;
-                states =
-                    {
-                    AVKON_BUTTON_STATE
-                        {
-                        helptxt = qtn_ncs_softkey_select_text;
-                        bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_mark;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_mark_mask;                        
-                        }  
-                    };            
-                };
-            },
-        TBAR_CTRL
-            {
-            type = EAknCtButton;
             id = EFsEmailUiTbCmdExpandAll;
             control = AVKON_BUTTON
                 {
@@ -439,10 +548,19 @@
                         {
                         helptxt = qtn_fse_message_list_options_expand_all;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_expand_all;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_expand_all_mask;
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_expand_all;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_expand_all_mask;
+                        extension = r_cmail_button_state_ext_tb_expand_all;
                         }
-                    };            
+                    };
+                };
+            },
+        TBAR_CTRL
+            {
+            type = EAknCtButton;
+            control = AVKON_BUTTON
+                {
+                flags = KAknButtonPressedDownFrame;            
                 };
             },
         TBAR_CTRL
@@ -458,16 +576,33 @@
                         {
                         helptxt = qtn_fse_message_list_options_collapse_all;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_collapse_all;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_collapse_all_mask;
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_collapse_all;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_collapse_all_mask;
+                        extension = r_cmail_button_state_ext_tb_collapse_all;
                         }
-                    };            
+                    };
                 };
             }
         };
     }
 
 //------------------------------------------------------------------------------
+// Button state extensions for folder list toolbar
+//------------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_expand_all
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbExpandAll;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_collapse_all
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbCollapseAll;
+    }
+
+//------------------------------------------------------------------------------
 // Html message viewer toolbar with Reply all
 //------------------------------------------------------------------------------
 //
@@ -486,6 +621,8 @@
                 bmpFile = EMAILUI_ICON_FILE;
                 bmpId = EMbmFreestyleemailuiQgn_indi_tb_email_extend;
                 bmpMask = EMbmFreestyleemailuiQgn_indi_tb_email_extend_mask;
+                bmpSkinIdMajor = EAknsMajorGeneric;
+                bmpSkinIdMinor = EAknsMinorGenericQgnIndiTbEmailExtend;
                 items =
                     {
                     TBAR_CTRL
@@ -501,10 +638,11 @@
                                     {
                                     txt = qtn_fse_tb_ext_reply;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_reply;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;                        
-                                    }  
-                                };            
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_email_reply;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;
+                                    extension = r_cmail_button_state_ext_tb_email_reply;
+                                    }
+                                };
                             };
                         },
                     TBAR_CTRL
@@ -520,10 +658,11 @@
                                     {
                                     txt = qtn_fse_tb_ext_reply_all;
                                     bmpfile = EMAILUI_ICON_FILE;
-                                    bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_reply_all;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_reply_all_mask;                        
-                                    }  
-                                };            
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_email_reply_all;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_email_reply_all_mask;
+                                    extension = r_cmail_button_state_ext_tb_email_reply_all;
+                                    }
+                                };
                             };
                         }
                     }; // eof extension items
@@ -542,10 +681,11 @@
                         {
                         helptxt = qtn_fse_tb_forward;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_forward;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_email_forward;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;
+                        extension = r_cmail_button_state_ext_tb_email_forward;
+                        }
+                    };
                 };
             },
         TBAR_CTRL
@@ -561,16 +701,16 @@
                         {
                         helptxt = qtn_fse_tb_delete;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_delete;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_delete_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_delete;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_delete_mask;
+                        extension = r_cmail_button_state_ext_tb_delete;
+                        }
+                    };
                 };
             }
         };
     }
 
-
 //------------------------------------------------------------------------------
 // Html message viewer toolbar without Reply all
 //------------------------------------------------------------------------------
@@ -593,12 +733,13 @@
                         {
                         helptxt = qtn_fse_tb_reply;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_reply;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_email_reply;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;
+                        extension = r_cmail_button_state_ext_tb_email_reply;
+                        }
+                    };
                 };
-            },        
+            },
         TBAR_CTRL
             {
             type = EAknCtButton;
@@ -612,10 +753,11 @@
                         {
                         helptxt = qtn_fse_tb_forward;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_forward;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_email_forward;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;
+                        extension = r_cmail_button_state_ext_tb_email_forward;
+                        }
+                    };
                 };
             },
         TBAR_CTRL
@@ -631,16 +773,45 @@
                         {
                         helptxt = qtn_fse_tb_delete;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_delete;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_delete_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_indi_tb_delete;
+                        bmpmask = EMbmFreestyleemailuiQgn_indi_tb_delete_mask;
+                        extension = r_cmail_button_state_ext_tb_delete;
+                        }
+                    };
                 };
             }
         };
     }
 
 //------------------------------------------------------------------------------
+// Button state extensions for HTML message viewer toolbar
+//------------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_email_reply
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbEmailReply;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_email_reply_all
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbEmailReplyAll;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_email_forward
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbEmailForward;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_tb_delete
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnIndiTbDelete;
+    }
+
+//------------------------------------------------------------------------------
 // Attachment list toolbar
 //------------------------------------------------------------------------------
 //
@@ -662,10 +833,11 @@
                         {
                         helptxt = qtn_fse_tb_attachment_list_download_all;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all;
-                        bmpmask=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all;
+                        bmpmask = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_download_all_mask;
+                        extension = r_cmail_button_state_ext_attachment_download_all;
+                        }
+                    };
                 };
             },
         TBAR_CTRL
@@ -681,13 +853,14 @@
                         {
                         helptxt = qtn_fse_tb_attachment_list_cancel_download;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download;
-                        bmpmask=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download;
+                        bmpmask = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_cancel_download_mask;
+                        extension = r_cmail_button_state_ext_attachment_cancel_download;
+                        }
+                    };
                 };
             },
-            TBAR_CTRL
+        TBAR_CTRL
             {
             type = EAknCtButton;
             id = EFsEmailUiTbCmdSaveAll;
@@ -700,15 +873,42 @@
                         {
                         helptxt = qtn_fse_tb_attachment_list_save_all;
                         bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all;
-                        bmpmask=EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all_mask;                        
-                        }  
-                    };            
+                        bmpid = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all;
+                        bmpmask = EMbmFreestyleemailuiQgn_prop_cmail_action_attachment_save_all_mask;
+                        extension = r_cmail_button_state_ext_attachment_save_all;
+                        }
+                    };
                 };
             }
         };
     }
 
+//------------------------------------------------------------------------------
+// Button state extensions for message list toolbar
+//------------------------------------------------------------------------------
+//
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_attachment_download_all
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropCmailActionAttachmentDownloadAll;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_attachment_cancel_download
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropCmailActionAttachmentCancelDownload;
+    }
+
+RESOURCE AVKON_BUTTON_STATE_EXTENSION r_cmail_button_state_ext_attachment_save_all
+    {
+    bmbSkinIdMajor = EAknsMajorGeneric;
+    bmbSkinIdMinor = EAknsMinorGenericQgnPropCmailActionAttachmentSaveAll;
+    }
+
+//------------------------------------------------------------------------------
+// Localisable registration information
+//------------------------------------------------------------------------------
+//
 RESOURCE LOCALISABLE_APP_INFO r_freestyle_email_ui_loc_app_info
     {
     short_caption = qtn_fse_short_app_name;
@@ -1504,6 +1704,7 @@
 RESOURCE TBUF r_fse_wait_opening_text   { buf=qtn_gen_note_opening; }
 RESOURCE TBUF r_fse_wait_fetching_text          { buf=qtn_gen_note_fetching; }
 RESOURCE TBUF r_fse_wait_removing_text          { buf=qtn_gen_note_removing; }
+RESOURCE TBUF r_fse_wait_inserting_text         { buf=qtn_gen_note_inserting;}
 RESOURCE TBUF r_fse_wait_deleting_text          { buf=qtn_fse_wait_note_deleting; }
 RESOURCE TBUF r_fse_wait_cancelling_sync_text   { buf=qtn_fse_wait_note_canceling_synch; }
 RESOURCE TBUF r_fse_wait_sorting_text           { buf=qtn_fse_wait_note_sorting; }
@@ -2218,7 +2419,6 @@
                 listbox = AVKON_LIST_QUERY_LIST
                     {
                     };
-                heading = qtn_fse_editor_close_message_query_prompt;
                 };
             }
         };
@@ -2295,6 +2495,7 @@
 RESOURCE TBUF r_ncs_flag_clear { buf=qtn_fse_editor_list_flag_clear; }
 RESOURCE TBUF r_ncs_draft_save { buf=qtn_fse_editor_close_message_quey_save_to_drafts; }
 RESOURCE TBUF r_ncs_draft_delete { buf=qtn_fse_editor_close_message_query_delete_message; }
+RESOURCE TBUF r_ncs_draft_discard { buf=qtn_fse_editor_close_message_query_discard_message; }
 RESOURCE TBUF r_fse_editor_address_list_remote_lookup_search { buf=qtn_fse_editor_address_list_remote_lookup_search; }
 RESOURCE TBUF r_fse_editor_confirm_attachment_download { buf=qtn_fse_editor_confirm_attachment_download; }
 RESOURCE TBUF r_fse_editor_smart_tag { buf=qtn_fse_editor_smart_tag; }
--- a/emailuis/emailui/data/FreestyleEmailUiSettingsList.rssi	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/data/FreestyleEmailUiSettingsList.rssi	Wed Apr 14 15:42:15 2010 +0300
@@ -66,11 +66,11 @@
 	{
 	items =
 		{
-		MENU_ITEM
+/*		MENU_ITEM
 			{
 			command = EFsEmailUiCmdOpen;
 			txt = qtn_options_open;
-			},
+			},*/
 		MENU_ITEM
 			{
 			command = EFsEmailUiCmdSettingsAddAccount;
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Wed Apr 14 15:42:15 2010 +0300
@@ -25,6 +25,8 @@
 #include <brctlspecialloadobserver.h>
 #include <brctllinkresolver.h>
 
+#include <finditemengine.h>
+
 #include "FreestyleEmailUiAknStatusIndicator.h"
 #include "FreestyleEmailDownloadInformationMediator.h"
 #include "freestyleemailcenrepkeys.h"
@@ -323,6 +325,8 @@
     HBufC8* GetCharacterSetL( CFSMailMessagePart& aHtmlBodyPart );
     TBool IsMessageBodyURLL(const TDesC& aUrl);
 	void CreateHyperlinksFromUrlsL( RBuf& aSource );
+	TInt TotalLengthOfItems( CFindItemEngine& aItemEngine ) const;
+	
     //Returns ETrue of clicking on a link requires a browser to be launched
     TBool NeedToLaunchBrowserL( const TDesC& aUrl );
     //Launch the browser as a standalone app
--- a/emailuis/emailui/inc/FreestyleEmailUiLayoutHandler.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiLayoutHandler.h	Wed Apr 14 15:42:15 2010 +0300
@@ -24,10 +24,10 @@
 #include <e32hashtab.h>
 #include <alf/alfenv.h>
 #include <alf/alftextstyle.h>
-#include <AknLayout2ScalableDef.h>
-#include <AknUtils.h>
+#include <aknlayout2scalabledef.h>
+#include <aknutils.h>
 // INTERNAL INCLUDES
-#include "FreestyleEmailUiLayoutData.h"
+#include "freestyleemailuilayoutdata.h"
 
 // FORWARD DECLARATIONS
 class CFsTreeList;
--- a/emailuis/emailui/inc/FreestyleEmailUiSendAttachmentsListControl.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiSendAttachmentsListControl.h	Wed Apr 14 15:42:15 2010 +0300
@@ -24,6 +24,7 @@
 
 // LOCAL INCLUDES
 #include "FreestyleEmailUiAttachmentsListModel.h"
+#include "FreestyleEmailUiUtilities.h"
 #include "fsccontactactionmenudefines.h"
 
 // FORWARD DECLARATIONS
@@ -43,7 +44,7 @@
 */
 // <cmail>
 class CFreestyleEmailUiSendAttachmentsListControl 
-	: public CAlfControl, public MFsActionMenuPositionGiver, public MMGFetchVerifier
+	: public CAlfControl, public MFsActionMenuPositionGiver, public MMGFetchVerifier, public MFSEmailUiGenericTimerCallback
     {  
 // </cmail>
 public:
@@ -87,6 +88,11 @@
     */
     TBool OfferEventL( const TAlfEvent& aEvent );  
 
+    TBool IsAttachmentAddingLocked() const;
+    
+	// Fire timer callback
+	void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer );
+    
     /**
     * AppendAttachmentToListL
     * Adds new attachment to list and email body
@@ -235,6 +241,12 @@
 
     // Wait note for long running operations. Owns itself.
     CAknWaitDialog*                             iWaitNote;
+    
+    // adding attachment locked
+    TBool iAttachmentAddingLocked;
+    
+    // Timer to postpone the Info Dialog 
+    CFSEmailUiGenericTimer* iDialogTimer;
     };
 
 #endif /*FREESTYLEMAILUI_SENDATTACHMENTSLISTCONTROL_H_*/
--- a/emailuis/emailui/inc/ncsaddressinputfield.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/ncsaddressinputfield.h	Wed Apr 14 15:42:15 2010 +0300
@@ -29,6 +29,8 @@
 //</cmail>
 #include "ncscontrol.h"
 
+class CAknPhysics;
+
 //<cmail>  Temporary hardcoded layout values
 //Horizontal values
 const TInt KButtonXa = 5;
@@ -214,6 +216,8 @@
     TInt LayoutLineCount() const;
     // </cmail> Platform layout change
 
+    void EnableKineticScrollingL( CAknPhysics* aPhysics );
+    
 //<cmail>
 private:
     
@@ -283,6 +287,11 @@
     // for keeping buttons in view while scrolling
     TPoint iOriginalFieldPos;
     TPoint iOriginalButtonPos;
+
+    // panning related
+    CAknPhysics* iPhysics;
+    TBool iIsDraggingStarted;
+    TPoint iStartPosition;
     };
 	
 #endif // CNCSADDRESSINPUTFIELD_H
--- a/emailuis/emailui/inc/ncscomposeview.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/ncscomposeview.h	Wed Apr 14 15:42:15 2010 +0300
@@ -171,15 +171,22 @@
     /**
     * NewMessage
     * Returns pointer to current composer message
-    */    
+    */
     CFSMailMessage* NewMessage();
 
     /**
-    * CommitL
-    * Commits changes to message
+    * Commits changes to message. This method sets the field contents from
+    * the UI to the message object, but does not save the message unless
+    * explicitely requested.
     */
-    void CommitL( TBool aParseAddresses = ETrue, 
-                  TFieldToCommit aFieldToCommit = EAllFields );
+    void CommitL( TBool aParseAddresses = ETrue,
+        TFieldToCommit aFieldToCommit = EAllFields, TBool aSaveNow = EFalse );
+
+    /**
+     * Saves the message content, if it has been changed since the last save.
+     */
+    TInt SaveMessage();
+    void SaveMessageL();
 
     void DialogDismissedL( TInt aButtonId );
     
@@ -641,6 +648,12 @@
     
     // Popup menu for attachment list.
     CAknStylusPopUpMenu* iStylusPopUpMenu;
+
+    // Flag to indicate whether message text part has been modified.
+    TBool iMessageTextPartModified;
+
+    // Flag to indicate whether message has been modified.
+    TBool iMessageModified;
     };
 
 /**
--- a/emailuis/emailui/inc/ncsheadercontainer.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/ncsheadercontainer.h	Wed Apr 14 15:42:15 2010 +0300
@@ -34,6 +34,7 @@
 class CNcsEmailAddressObject;
 class CNcsPopupListBox;
 class CNcsSubjectField;
+class CAknPhysics;
 
 /**
 *  CNcsHeaderContainer
@@ -59,7 +60,7 @@
      * @return a pointer to the created instance of CNcsHeaderContainer.
      */
     static CNcsHeaderContainer* NewL( CCoeControl& aParent,
-        CFSMailBox& aMailBox, TInt aFlags = NULL );
+        CFSMailBox& aMailBox, TInt aFlags = NULL, CAknPhysics* aPhysics = NULL );
 
     /**
      * ~CNcsHeaderContainer
@@ -67,6 +68,8 @@
      */
     virtual ~CNcsHeaderContainer();
 
+    void EnableKineticScrollingL(CAknPhysics*  aPhysics);
+    
 private: // constructor/destructor
 
     /**
@@ -75,7 +78,7 @@
     * @param aParent Parent control.
     * @param aMailBox reference to current mailbox item
     */
-	CNcsHeaderContainer( CCoeControl& aParent, CFSMailBox& aMailBox );
+	CNcsHeaderContainer( CCoeControl& aParent, CFSMailBox& aMailBox, CAknPhysics* aPhysics );
 	
 	/**
 	* ConstructL
@@ -334,6 +337,8 @@
 
     void HandleDynamicVariantSwitchL();
 
+    void HandleSkinChangeL();
+
     // sets up iSwitchChangeMskOff falg 
     void SwitchChangeMskOff(TBool aTag);
     
@@ -348,7 +353,7 @@
      * 
      * @param aShow ETrue - shows, EFalse - hides cursor.
      */
-    void ShowCursor( TBool aShow );
+    void ShowCursor( TBool aShow, TDrawNow aDrawNow = ENoDrawNow );
 
     void DoScrollL();
 private: // Function members
@@ -442,6 +447,9 @@
     
     // Currently focused control
     CCoeControl* iFocused;
+
+    // panning related
+    CAknPhysics* iPhysics;
     };
 
 
--- a/emailuis/emailui/inc/ncspopuplistbox.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/ncspopuplistbox.h	Wed Apr 14 15:42:15 2010 +0300
@@ -27,7 +27,7 @@
 
 // FORWARD DECLARATION
 class CNcsEmailAddressObject;
-class CAknsBasicBackgroundControlContext;
+class CAknsFrameBackgroundControlContext;
 class CFSEmailUiContactHandler;
 class CFSMailBox;
 class CNcsHeaderContainer;
@@ -41,7 +41,7 @@
 */
 class CNcsPopupListBox : public CEikTextListBox, 
                          public MEikListBoxObserver,
-						 public MFSEmailUiContactHandlerObserver
+                         public MFSEmailUiContactHandlerObserver
     {
 public: // Constructors and destructor
 
@@ -52,12 +52,10 @@
                                    CNcsHeaderContainer& aHeaderContainer,
                                    TBool aRemoteLookupSupported );
 
-      
     /*
     * @param aMailBox reference to current mailbox item
     */
     void ConstructL( const CCoeControl* aParent );
-        
 
     /*
     * 
@@ -72,24 +70,25 @@
 public: // from CEikTextListBox
 
     TKeyResponse OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType );
-        
-    virtual TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
-        
+
+    TTypeUid::Ptr MopSupplyObject( TTypeUid aId );
+
     void SizeChanged();
+    void HandleResourceChange( TInt aType );
+    void HandlePointerEventL( const TPointerEvent& aPointerEvent );
 
 public: // from MEikListBoxObserver
 
     void HandleListBoxEventL( CEikListBox* aListBox, TListBoxEvent aEventType );
 
 public: // from MFSEmailUiContactHandlerObserver
-	
+
     void OperationCompleteL( TContactHandlerCmd aCmd, 
-    						const RPointerArray<CFSEmailUiClsItem>& aMatchingItems );
+        const RPointerArray<CFSEmailUiClsItem>& aMatchingItems );
     void OperationErrorL( TContactHandlerCmd aCmd, TInt aError );
- 
 
 public: // new methods for the header container
- 		
+
     /*
     * 
     * @param aText
@@ -143,7 +142,7 @@
 private: // to populate new list
     
     void SetListItemsFromArrayL();
- 		
+
     TInt RoundToItemHeight(const TInt aPopupHeight) const;
     
     void SetPopupHeight();
@@ -164,21 +163,26 @@
 
 private:
 
-    CNcsPopupListBox( CNcsHeaderContainer& aHeaderContainer, TBool aRemoteLookupSupported, 
-    				  CFSMailBox& aMailbox );
+    CNcsPopupListBox( CNcsHeaderContainer& aHeaderContainer,
+        TBool aRemoteLookupSupported, CFSMailBox& aMailbox );
 
     virtual void CreateItemDrawerL();
 
     void UpdateListL();
-    
+
+    void UpdateTextColors();
+
+    // From CCoeControl.
+    void Draw( const TRect& aRect ) const;
+
 private: // data
 
-	CNcsHeaderContainer&				iHeaderContainer;
-	
-    CAknsBasicBackgroundControlContext* iBaseBackroundContext;
-   
+    CNcsHeaderContainer&				iHeaderContainer;
+
+    CAknsFrameBackgroundControlContext* iBackgroundContext;
+
     RPointerArray<CFSEmailUiClsItem>	iMatchingItems;
-       
+
     CFSEmailUiContactHandler*			iContactHandler; // Owned
     CFSMailBox& 						iMailBox;
 
--- a/emailuis/emailui/inc/ncssubjectfield.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/inc/ncssubjectfield.h	Wed Apr 14 15:42:15 2010 +0300
@@ -31,7 +31,7 @@
 class CEikImage;
 class MNcsFieldSizeObserver;
 class CNcsHeaderContainer;
-
+class CAknPhysics;
 
 // CLASS DECLARATION
 /**
@@ -93,6 +93,8 @@
 
     void SetTextColorL( TLogicalRgb aColor );
 		
+    void EnableKineticScrollingL(CAknPhysics* aPhysics );
+    
 public: // from CoeControl
         /**
         * SetContainerWinowL
--- a/emailuis/emailui/loc/freestyleemailui.loc	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/loc/freestyleemailui.loc	Wed Apr 14 15:42:15 2010 +0300
@@ -1465,6 +1465,12 @@
 //
 #define qtn_fse_editor_close_message_query_delete_message "Delete message"
 
+// d:Discard item text in draft dialog
+// l:list_single_graphic_pane_t1_cp2
+// r:TB9.1
+//
+#define qtn_fse_editor_close_message_query_discard_message "Discard changes"
+
 // d:Upmost item in addressfield match popup list. For selecting Remote lookup server search
 // l:list_single_cmail_header_detail_pane_t1
 // r:TB9.1
--- a/emailuis/emailui/sendasmtm/inc/cfssendashelper.h	Wed Mar 31 21:08:33 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,179 +0,0 @@
-/*
-* 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"
-* 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:  Definition of the class CFsSendAsHelper.
-*
-*/
-
-
-#ifndef CFSSENDASHELPER_H
-#define CFSSENDASHELPER_H
-
-#include <e32base.h>
-#include <apmstd.h>
-
-#include <cmsvrecipientlist.h>
-//<cmail>
-#include "cfsmailcommon.h"
-//</cmail>
-// ---------------------------------------------------------------------------
-
-class CFSMailAddress;
-
-/**
- * This class is having functions which are used by Integration MTM to create
- * a message and to launch Freestyle UI editor.
- *
- * @since S60 3.1
- * @lib fssendashelper.lib
- */
-class CFsSendAsHelper : public CBase
-{
-public: // constructors and destructor
-    /**
-     * Constructs new object.
-     * @return created object.
-    */
-    IMPORT_C static CFsSendAsHelper* NewL();
-
-    /** 
-     * Destructor
-    */
-    IMPORT_C ~CFsSendAsHelper();
-
-public:    
-    /**
-     * Called from MTM when a file is selected to through sendas functionality.
-     * The file full path and mimetype are stored which will be later used to
-     * create mail and launch FS UI.
-     * @param aFileName Filename including full path
-     * @param aMimeType Mime type of the file that need to be attached
-     * @param aCharSet Charcaterset of the file
-    */
-    IMPORT_C void AddAttachmentL(const TDesC& aFileName,
-        const TDesC8& aMimeType, TUint aCharSet);    
-    /**
-     * Called from MTM when a file is selected to through sendas functionality.
-     * The file full path and mimetype are stored which will be later used to
-     * create mail and launch FS UI.
-     * @param aFile Handle to an attachment file. Ownership is transferred
-     * @param aMimeType Mime type of the file that need to be attached
-     * @param aCharSet Charcaterset of the file
-    */
-    IMPORT_C void AddAttachmentL( RFile& aFile,
-        const TDesC8& aMimeType, TUint aCharSet);    
-   
-    /**
-     * Called from MTM when a address is selected to send an e-mail.
-     * The Address and Alias of the address if present are stored 
-     * which will be later used to create mail and launch FS UI
-     * @param aAddress Mail address of the recipient
-     * @param aAlias Alias of the address, this can be NULL
-     * @param aType Type of recipient.
-    */
-    IMPORT_C void AddRecipientL(const TDesC& aAddress, const TDesC& aAlias, 
-        TMsvRecipientType aType);
-    
-    /**
-     * Called from MTM when a subject need to be set for the mail. The subject
-     * will be stored which will be later used to create mail and launch FS UI.
-     * @param aSubject Subject of the mail.
-    */
-    IMPORT_C void SetSubjectL(const TDesC& aSubject);
-
-    /**
-     * Called from MTM when certain text need to be made as body of the mail.
-     * Usually the case when notepad file is selected to send using sendas
-     * functionality. The contents of body will be stored which will be later 
-     * used to create mail while launching FS UI.
-     * @param aBody body part of the mail.
-    */
-    IMPORT_C void SetBodyL(const TDesC& aBody);
-
-    /**
-     * Called from MTM after either of setting subject, recipients,  
-     * attachments or/and body. The message will be created with the right
-     * data and will be stored to drafts of mail box. The messageid of the 
-     * createdmessage will be externalized which is used later to launch UI.
-     *
-     * @param aPluginId Plug-in Id
-     * @param aId Mailbox Id. 
-    */
-    IMPORT_C void StoreDataL( TUint aPluginId, TUint aId );
-
-    /**
-     * Called from MTM either to create empty mail or to create mail with some
-     * contents.
-     * @param aPluginId Plug-in Id
-     * @param aId Mailbox Id.
-     * @param aIsEmptyMail True if empty message need to be created.
-     * @param aIsSettings True if settings view need to be launched.
-    */
-    IMPORT_C void LaunchUiL(TUint aPluginId, TUint aId, 
-        TBool aIsEmptyMail = EFalse, TBool aIsSettings = EFalse );
-
-private: // constructors
-    /**
-     * Constructor
-     */
-    CFsSendAsHelper();
-
-    /**
-     * Second-phase constructor.
-     */
-    void ConstructL();
-
-    /*
-     * Displays mailbox not available note.
-     */
-    void DisplayMailboxNotAvailableNoteL();
-
-    /*
-     * Checks whether the mailbox is available or not
-     * @param aPluginId Plugin ID or the mailbox. 
-     * @return KErrNone if mailbox available, KErrNotSupported otherwise.
-     */
-    TInt IsMailboxAvailable( TInt aPluginId );
-private: // data
-    // Subject of the message
-    HBufC* iSubject;
-
-    // Body of the message    
-    HBufC* iBody;
-
-    // Filehandles that need to be attached.
-    RArray< RFile > iFiles;
-    
-    // Filenames that need to be attached
-    RPointerArray<HBufC> iFileNames;
-
-    // Mimetypes of the attached filehandles
-    RPointerArray<HBufC8> iMimeTypesFile;
-    // Mimetypes of the attached filenames
-    RPointerArray<HBufC8> iMimeTypesFileName;
-
-    // To recipients of the mail
-    RPointerArray<CFSMailAddress> iToAddresses;
-    // Cc recipients of the mail
-    RPointerArray<CFSMailAddress> iCcAddresses;  
-    // Bcc recipients of the mail
-    RPointerArray<CFSMailAddress> iBccAddresses;
-
-    //If Filehandles are passed to the framework (plugin)
-    TBool isPassed;
-    
-    // Message to be displayed when trying to use MfE or Ozone mailbox
-    // while in mass storage mode. Own.
-    HBufC* iMassStorageNote;
-};
-#endif  //CFSSENDASHELPER_H
--- a/emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -397,7 +397,14 @@
     	{
    		if ( iObserverArray[i].iObserver == aObserver && iObserverArray[i].iMessageId == aMessageId )
    			{
-            RemoveObserver(i);
+   		
+			TDownloadCount countObject( aMessageId );
+   		    TInt idx = iDownloadCountArray.Find( countObject, 
+   		                                         TIdentityRelation<TDownloadCount>(EqualMessageId) );    
+   		    if ( idx == KErrNotFound )
+   		        {
+				RemoveObserver(i);
+   		        }
    			}
     	}
 	}
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -1361,8 +1361,13 @@
                 {
                 iCurrentActiveView->HandleAppForegroundEventL( EFalse );
                 }
+            // in case the popupmenu is shown propagate event to it 
+            if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() )
+                {
+                iFolderListVisualiser->HandleAppForegroundEventL( EFalse );
+                }
+            }
             break;
-            }
         case KAknFullOrPartialForegroundGained:
             {
             if ( iCurrentActiveView && !iSettingsViewActive )
@@ -1374,17 +1379,21 @@
                     iPendingLayoutSwitch = EFalse;
                     }
                 }
-
-    		// Call status indicator's foreground event to resize the connection screen after the screensaver
-    		if ( iStatusIndicator )
+            // Call status indicator's foreground event to resize the connection screen after the screensaver
+            if ( iStatusIndicator )
                 {
                 iStatusIndicator->HandleForegroundEventL();
                 }
-    		}
-        	break;
+            // in case the popupmenu is shown propagate event to it 
+            if( iFolderListVisualiser && iFolderListVisualiser->IsPopupShown() )
+                {
+                iFolderListVisualiser->HandleAppForegroundEventL( ETrue );
+                }
+            }
+            break;
         default:
             break;
-    	}
+        }
 
     // Close menu
     if ( closeMenu && iCurrentActiveView != NULL )
--- a/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -499,8 +499,9 @@
 	{
     FUNC_LOG;
     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
-    cba->AddCommandSetToStackL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT);
+    cba->AddCommandSetToStackL( R_AVKON_SOFTKEYS_SELECT_CANCEL__SELECT );
     cba->UpdateCommandObserverL( cba->PositionById( EAknSoftkeySelect ), *this );
+    cba->MakeCommandVisible( EAknSoftkeySelect , EFalse );
     cba->UpdateCommandObserverL( cba->PositionById( EEikBidCancel ), *this );
     cba->DrawNow();
 	}
@@ -513,7 +514,7 @@
 	{
     FUNC_LOG;
     CEikButtonGroupContainer* cba = CEikButtonGroupContainer::Current();
-
+    cba->MakeCommandVisible( EAknSoftkeySelect , ETrue );
     if (cba->UpdatedCommandObserverExists(CEikButtonGroupContainer::ELeftSoftkeyPosition))
         {
         cba->RemoveCommandObserver( cba->PositionById( EAknSoftkeySelect ) );
@@ -523,10 +524,12 @@
         cba->RemoveCommandObserver( cba->PositionById( EEikBidCancel ) );
         }
     TInt pos = -1;
+   
     if ((pos = cba->PositionById( EAknSoftkeySelect )) >= 0)
         {
         cba->RemoveCommandFromStack( pos, EAknSoftkeySelect );
         }
+     
     if ((pos = cba->PositionById( EEikBidCancel )) >= 0)
         {
         cba->RemoveCommandFromStack( pos, EEikBidCancel );
@@ -871,9 +874,9 @@
     {
     switch( aCommand )
         {
-        case EFsEmailUiTbCmdSelect:
+        /*case EFsEmailUiTbCmdSelect:
             HandleCommandL( EFsEmailUiCmdSelect );
-            break;
+            break;*/
         case EFsEmailUiTbCmdCollapseAll:
             HandleCommandL( EFsEmailUiCmdActionsCollapseAll );
             break;
@@ -3001,8 +3004,7 @@
 void CFSEmailUiFolderListVisualiser::UpdateToolbarButtons()
     {
     FUNC_LOG;
-    Toolbar()->SetItemDimmed(
-        EFsEmailUiTbCmdSelect, ( iModel == NULL ) || ( iModel->Count() == 0 ), ETrue );
+    //Toolbar()->SetItemDimmed(EFsEmailUiTbCmdSelect, ( iModel == NULL ) || ( iModel->Count() == 0 ), ETrue );
     Toolbar()->SetItemDimmed( EFsEmailUiTbCmdExpandAll, AllNodesExpanded(), ETrue );
     Toolbar()->SetItemDimmed( EFsEmailUiTbCmdCollapseAll, AllNodesCollapsed(), ETrue );
     }
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -1373,7 +1373,6 @@
         TInt maxlength = bodyBuf.MaxSize();
         
         TInt position( 0 );
-        TText previous = 0;
         TBool EndOfString( EFalse );
         
         while ( !EndOfString )
@@ -1442,7 +1441,6 @@
                         i++;
                         break;
                     }
-                previous = ch;
                 }
             position += segment.Length();
             if ( ( bodyBuf.Length() - position ) <= 0 )
@@ -1504,252 +1502,69 @@
 void CFsEmailUiHtmlViewerContainer::CreateHyperlinksFromUrlsL( RBuf& aSource )
     {
     FUNC_LOG;
-    const TInt urlMaxLength = 2048;
-    _LIT( KHttp, "http://" );
-    _LIT( KHttps, "https://");
-    _LIT( KWww, "www."); 
-    
-    TBool eos( aSource.Size() <= 0 );
-    TInt position( 0 );
-    TInt carryOverInc( 0 );
-    TInt maxlength = aSource.Length();
-    while ( !eos )
+    const TInt searhCases( CFindItemEngine::EFindItemSearchURLBin );
+    CFindItemEngine* itemEngine = CFindItemEngine::NewL( aSource, CFindItemEngine::TFindItemSearchCase( searhCases ) );
+    CleanupStack::PushL ( itemEngine );
+    if ( itemEngine->ItemCount() > 0 )
         {
-        while ( carryOverInc >= aSource.MidTPtr( position ).Length() && aSource.Size() != 0 )
-            { // Skip segments of overlapping url string
-            carryOverInc -= aSource.MidTPtr( position ).Length();
-            position += aSource.MidTPtr( position ).Length();
-            }
+        _LIT( KHttp, "http://" );
+        _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" );
+        _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" );
         
-        TPtr16 segment( aSource.MidTPtr( position ) );
-        TLex16 lexSegment( segment );
-        lexSegment.Inc( carryOverInc );
-        carryOverInc = 0;
+        const TInt sourceLength( aSource.Length() );
+        // Allocate enough space for the final result
+        aSource.ReAllocL( sourceLength + TotalLengthOfItems( *itemEngine ) + KUrlFormatWithHttp().Length() * itemEngine->ItemCount() );
+        aSource.SetMax();
+        // Organize buffer so that original data is in the back of the aSource
+        aSource.RightTPtr( sourceLength ).Copy( aSource.Left( sourceLength ) );
+        // Set source to new original data's position
+        const TPtrC source( aSource.RightTPtr( sourceLength ) );
+        // Set target to aSource's beginning
+        TPtr target( aSource.MidTPtr( 0 ) );
+        // Reset length, we now have an empty buffer to fill
+        target.SetLength( 0 );
         
-        while (!lexSegment.Eos())
+        TInt currentSourcePosition( 0 );
+        CFindItemEngine::SFoundItem item;
+        for ( TBool available( itemEngine->Item( item ) ); available; available = itemEngine->NextItem( item ) )
             {
-            TPtrC nextToken( lexSegment.NextToken() );
-            TInt foundAt( KErrNotFound );
-            
-            // Find HTTP, HTTPS, or WWW link in CBufSeg segment of size 1024 bytes.
-            if ( ( ( foundAt = nextToken.FindC( KHttp ) ) != KErrNotFound ) ||
-                    (  ( foundAt = nextToken.FindC( KHttps ) ) != KErrNotFound ) ||
-                    ( ( foundAt = nextToken.FindC( KWww ) ) != KErrNotFound ) )
+            target.Append( source.Mid( currentSourcePosition, item.iStartPos - currentSourcePosition ) );
+            const TPtrC url( source.Mid( item.iStartPos, item.iLength ) );
+            TPtrC format( KUrlFormat() );
+            if ( url.FindF( KHttp() ) == KErrNotFound ) 
                 {
-                if ( !lexSegment.Eos() )
-                    { 
-                    if ( !foundAt )
-                        { // Token starts with http/https/www.x
-                        TPtrC url;
-                        TInt lineBreakPos( KErrNotFound );
-                        if ( ( lineBreakPos = nextToken.FindC( KHtmlLineBreak ) ) != KErrNotFound )
-                            { // Token contains html line break -> remove
-                            url.Set( nextToken.Left( lineBreakPos ) );
-                            }
-                        else
-                            {
-                            url.Set( nextToken );
-                            }
-                        
-                        if ( url.CompareC( KWww ) != KErrNone ) // if token=www., validate format 
-                            {                                   // www.x
-                            RBuf urlBuf;
-                            TBool wwwLink( EFalse );
-                            if ( url.Left( KWww().Length() ).CompareF( KWww ) == 0 )
-                                {
-                                wwwLink = ETrue;
-                                //Hyperlinks beginning with www. needs http:// prefix
-                                urlBuf.CreateL( KHtmlLinkTagWWW().Length() + url.Length() * 2
-                                        + KHtmlLinkEndTag().Length() + KHtmlLineBreak().Length() + KHttp().Length() );
-                                }                            
-                            else
-                                {
-                                urlBuf.CreateL( KHtmlLinkTag().Length() + url.Length() * 2
-                                        + KHtmlLinkEndTag().Length() + KHtmlLineBreak().Length() );                                
-                                }
-                            urlBuf.CleanupClosePushL();
-                            // Format html link
-                            if ( wwwLink )
-                                {
-                                urlBuf.AppendFormat( KHtmlLinkTagWWW, &KHttp, &url );
-                                }
-                            else
-                                {
-                                urlBuf.AppendFormat( KHtmlLinkTag, &url );
-                                }
-                            urlBuf.Append( url );
-                            urlBuf.Append( KHtmlLinkEndTag );
-                            if ( lineBreakPos != KErrNotFound )
-                                { // Add line break if removed earlier
-                                urlBuf.Append( KHtmlLineBreak );
-                                }
-                            //Test
-                            TInt nextTokenLength = nextToken.Length();
-                            TInt segOffset = lexSegment.Offset();
-                            TInt urlLength = urlBuf.Length();
-                            
-                            //Test
-                            TInt offset = lexSegment.Offset() - nextToken.Length();
-                            TLexMark tokenMark;
-                            // Move next character last token back
-                            lexSegment.Inc( - nextToken.Length() );
-                            lexSegment.Mark( tokenMark );
-                            aSource.Delete( offset + position, nextToken.Length() );
-                            aSource.ReAlloc( maxlength + urlBuf.Length() );
-                            aSource.Insert( offset + position, urlBuf );
-                            segment.Set( aSource.MidTPtr( position ) );
-                            lexSegment.Assign( segment );
-                            // Set next character to the position of inserted hyperlink
-                            lexSegment.UnGetToMark( tokenMark );
-                            
-                            // If Max segment length is reached, set carry over value to 
-                            // properly set next character in following CBufSeg segment
-                            if ( ( offset + urlBuf.Length() ) >= segment.Length() )
-                                {
-                                carryOverInc = offset + urlBuf.Length() - segment.Length();
-                                while ( !lexSegment.Eos() )
-                                    { // Set to segment's end
-                                    lexSegment.NextToken(); 
-                                    }
-                                }
-                            else
-                                {
-                                lexSegment.Inc( urlBuf.Length() );
-                                }
-                            
-                            CleanupStack::PopAndDestroy( &urlBuf );
-                            }
-                        }
-                    }
-                else
-                    // Next token is end of string, here we handle the last token of a segment
-                    {
-                    _LIT( KUrlEnd, "<" );
-                    
-                    TInt endOfUrlPos( KErrNotFound );
-                    TText ch = segment[ segment.Length() - 1];
-                    RBuf url;
-                    url.CreateL( urlMaxLength );
-                    url.CleanupClosePushL();
-                    
-                    // Find if hyperlink ends within this segment boundaries
-                    if ( ch == KSOH || ch == KCR || ch == KLF || ch == KHT || ch == KCharacterSpace )
-                        {
-                        endOfUrlPos = nextToken.Length() - 1;
-                        }
-                    else if ( ( endOfUrlPos = nextToken.Right( KHtmlLineBreak().Length() ).Find( KUrlEnd ) ) != KErrNotFound )
-                        {
-                        endOfUrlPos = nextToken.Length() - KHtmlLineBreak().Length() + endOfUrlPos;
-                        }
-                    else
-                        { // Handle hyperlink spread in multiple segments
-                        TInt nextPos = position;
-                        TPtrC nextSegment( aSource.MidTPtr( nextPos ) );
-                        TLex lexNextSegment( nextSegment );
-                        TPtrC nextNextToken( nextToken );
-                        TBool firstPass( ETrue );
-                        
-                        while ( endOfUrlPos == KErrNotFound || nextPos >= aSource.Length() )
-                            {
-                            if ( ( url.Length() + nextNextToken.Length() )  > urlMaxLength )
-                                { // URL exceeds limit of 2K, do nothing
-                                break;
-                                }
-                            
-                            url.Append( nextNextToken );
-                            if ( ( nextSegment.Length() == nextNextToken.Length() ) || firstPass )
-                                { // Token takes up the whole segment, or first pass( first segment 
-                                  // with last token where hyperlink does not end within segment's
-                                  // boundaries, move to next segment
-                                nextPos += nextSegment.Length();
-                                nextSegment.Set( aSource.MidTPtr( nextPos ) );
-                                if( nextSegment.Length() == 0 )
-                                    {      
-                                    break;
-                                    }
-                                lexNextSegment.Assign( nextSegment );
-                                nextNextToken.Set( lexNextSegment.NextToken() );
-                                if ( firstPass )
-                                    { 
-                                    firstPass =  EFalse;
-                                    }
-                                }
-                            else
-                                { // Last segment's token with hyperlink's end
-                                if ( ( endOfUrlPos = url.Find( KHtmlLineBreak ) ) != KErrNotFound )
-                                    { // Remove line break
-                                    url.Delete( endOfUrlPos, KHtmlLineBreak().Length() );
-                                    endOfUrlPos = nextNextToken.Length() - KHtmlLineBreak().Length();
-                                    }
-                                else
-                                    {
-                                    endOfUrlPos = nextNextToken.Length();
-                                    }  
-                                }
-                            }
- 
-                        if ( endOfUrlPos != KErrNotFound )
-                            { // Handle hyperlink that is within 2K limit
-                            RBuf urlBuf;
-                            TBool wwwLink( EFalse );
-
-                            if ( url.Left( KWww().Length() ).CompareF( KWww ) == 0 )
-                                {
-                                wwwLink = ETrue;
-                                urlBuf.CreateL( KHtmlLinkTagWWW().Length() + url.Length() * 2
-                                        + KHtmlLinkEndTag().Length() + KHtmlLineBreak().Length() + KHttp().Length() );
-                                }
-                            else
-                                {
-                                urlBuf.CreateL( KHtmlLinkTag().Length() + url.Length() * 2
-                                        + KHtmlLinkEndTag().Length() + KHtmlLineBreak().Length() );                                
-                                }
-
-                            urlBuf.CleanupClosePushL();
-                            // Format html link                            
-                            if ( wwwLink )
-                                {
-                                urlBuf.AppendFormat( KHtmlLinkTagWWW, &KHttp, &url );
-                                }
-                            else
-                                {
-                                urlBuf.AppendFormat( KHtmlLinkTag, &url );
-                                }
-                            
-                            urlBuf.Append( url );
-                            urlBuf.Append( KHtmlLinkEndTag );
-                            urlBuf.Append( KHtmlLineBreak );
-                            
-                            TInt offset = lexSegment.Offset() - nextToken.Length();
-                            // Remove hyperlink from the original message body
-                            aSource.Delete( offset + position, url.Length() );
-                            // Insert html formated hyperlink
-                            aSource.ReAlloc( maxlength + urlBuf.Length() );
-                            aSource.Insert( offset + position, urlBuf );
-                            segment.Set( aSource.MidTPtr( position ) );
-                            
-                            // Set carry on value to mark where new token should start in following segment
-                            carryOverInc = endOfUrlPos;
-                            position = nextPos;
-                            
-                            CleanupStack::PopAndDestroy( &urlBuf );
-                            }     
-                        }
-                    CleanupStack::PopAndDestroy( &url );
-                    }
+                format.Set( KUrlFormatWithHttp() );
                 }
-            }
-        position += segment.Length();
-        if ( ( aSource.Length() - position ) <= 0 )
+            HBufC* formatBuffer = HBufC::NewLC( format.Length() + url.Length() * 2 );
+            formatBuffer->Des().Format( format, &url, &url );            
+            target.Append( *formatBuffer );
+            CleanupStack::PopAndDestroy(); // formatBuffer
+            currentSourcePosition = item.iStartPos + item.iLength;
+            }        
+        // Append characters that are left in buffer
+        if ( currentSourcePosition < sourceLength )
             {
-            eos = ETrue;
+            target.Append( source.Mid( currentSourcePosition, sourceLength - currentSourcePosition ) );
             }
+        aSource.SetLength( target.Length() );
         }
-
-    
+    CleanupStack::PopAndDestroy(); // itemEngine
     }
 
 
+TInt CFsEmailUiHtmlViewerContainer::TotalLengthOfItems( CFindItemEngine& aItemEngine ) const
+    {
+    TInt totalLength( 0 );
+    CFindItemEngine::SFoundItem item;
+    aItemEngine.ResetPosition();
+    for ( TBool available( aItemEngine.Item( item ) ); available; available = aItemEngine.NextItem( item ) )
+        {
+        totalLength += item.iLength;
+        }
+    aItemEngine.ResetPosition();
+    return totalLength;
+    }
+
 // ---------------------------------------------------------------------------
 // Get Character set from CFSMailMessagePart
 // ---------------------------------------------------------------------------
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -1189,6 +1189,8 @@
 
     if ( reallyDelete )
         {
+        CancelFetchings();
+
         // Reset container content, so that plugins may really delete files
         if ( iContainer )
             {
@@ -1402,8 +1404,12 @@
             {
             case EFsEmailUiCmdActionsReply:
                 {
-                if ( iMessage && !iActivationData.iEmbeddedMessageMode )
+                if ( iMessage )
                     {
+                    if ( iActivationData.iEmbeddedMessageMode )
+                        {
+                        iCreateNewMsgFromEmbeddedMsg = ETrue;
+                        }
                     delete iNewMailTempAddress;
                     iNewMailTempAddress = NULL;
                     iNewMailTempAddress = CFSMailAddress::NewL();
@@ -2596,8 +2602,9 @@
         case EESMRCmdMailFlagMessage:
             ret = TFsEmailUiUtility::IsFollowUpSupported( *iMailBox );
             break;
+        //Changed to EFalse to fix defect EJZG-83CDRX
         case EESMRCmdMailMessageDetails:
-            ret = ETrue;
+            ret = EFalse;
             break;
         case EESMRCmdMailDelete:
             ret = ETrue;
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -87,7 +87,7 @@
 #include "FreestyleEmailUiHtmlViewerView.h"
 #include "FSDelayedLoader.h"
 #include "FSEmail.pan"
-#include "fsemailstatuspaneindicatorhandler.h"
+
 #include "ipsplgcommon.h"
 
 // CONST VALUES
@@ -1592,8 +1592,9 @@
 
     iCurrentClientRect = clientRect;
 	iThisViewActive = ETrue;
-	//emailindicator handling, we dont care if something goes wrong in the mailindicator update. User can still open the mailbox
-	TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( activationData.iMailBoxId.Id()));
+	
+	//emailindicator handling, is removed from 9.2
+	//TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( activationData.iMailBoxId.Id()));
 	    
     //Update mailbox widget index status in homescreen
     TFsEmailUiUtility::ToggleEmailIconL(EFalse, activationData.iMailBoxId );
@@ -3490,8 +3491,8 @@
     FUNC_LOG;
     if( iMailFolder )
         {
-        //emailindicator handling, we dont care if something goes wrong in the mailindicator update. User can still open the mailbox
-        TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( iMailFolder->GetMailBoxId().Id()));
+        //emailindicator handling, is removed  from 9.2
+        //TRAP_IGNORE(TFsEmailStatusPaneIndicatorHandler::StatusPaneMailIndicatorHandlingL( iMailFolder->GetMailBoxId().Id()));
         //Update mailbox widget index status in homescreen
         TFsEmailUiUtility::ToggleEmailIconL(EFalse, iMailFolder->GetMailBoxId() );
         }
@@ -5931,7 +5932,8 @@
             msgPtr.SaveMessageL();  // Save flag
 
             // Switch icon to correct one if mail list is visible
-            UpdateMsgIconAndBoldingL( aIndex );
+            TBool needRefresh = ( iAppUi.CurrentActiveView()->Id() == MailListId );
+            UpdateMsgIconAndBoldingL( aIndex, needRefresh);
 
             if ( iCurrentSortCriteria.iField == EFSMailSortByUnread )
                 {
@@ -6256,43 +6258,16 @@
 		if ( item && item->ModelItemType() == ETypeMailItem )
 			{
 			CFSMailMessage& messagePtr = item->MessagePtr();
-
-			TInt okToDelete(ETrue);
-			if ( iAppUi.GetCRHandler()->WarnBeforeDelete() )
-			    {
-	            TInt queryTextId(0);
-	            if ( messagePtr.IsFlagSet( EFSMsgFlag_CalendarMsg ))
-	                {
-	                queryTextId = R_FREESTYLE_EMAIL_DELETE_CALEVENT_NOTE;
-	                }
-	            else
-	                {
-	                queryTextId = R_FREESTYLE_EMAIL_DELETE_MAIL_NOTE;
-	                }
-	            HBufC* msgSubject = TFsEmailUiUtility::CreateSubjectTextLC( &messagePtr );
-
-	            okToDelete = TFsEmailUiUtility::ShowConfirmationQueryL( queryTextId, *msgSubject );
-
-	            CleanupStack::PopAndDestroy( msgSubject );
-			    }
-
-			if ( okToDelete )
- 				{
- 				// Delete message from framework, and perform internal housekeeping
- 				TFSMailMsgId msgId = messagePtr.GetMessageId();
- 				RArray<TFSMailMsgId> msgIds;
- 				CleanupClosePushL( msgIds );
- 				msgIds.Append( msgId );
-				TFSMailMsgId folderId = FolderId();
-				TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId();
-				iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
-                RemoveMsgItemsFromListIfFoundL( msgIds );
-                CleanupStack::PopAndDestroy( &msgIds );
-				}
-			else
-				{
-				UnmarkAllItemsL();
-				}
+            // Delete message from framework, and perform internal housekeeping
+            TFSMailMsgId msgId = messagePtr.GetMessageId();
+            RArray<TFSMailMsgId> msgIds;
+            CleanupClosePushL( msgIds );
+            msgIds.Append( msgId );
+            TFSMailMsgId folderId = FolderId();
+            TFSMailMsgId mailBox = iAppUi.GetActiveMailbox()->GetId();
+            iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
+            RemoveMsgItemsFromListIfFoundL( msgIds );
+            CleanupStack::PopAndDestroy( &msgIds );
 			}
 		}
 	}
--- a/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -395,7 +395,7 @@
 
 	// Update settings and set list mode according to settings
 	UpdateMailListSettingsL();
-
+	
 	if ( iMailBox )
 		{
 		delete iMailBox;
@@ -438,6 +438,9 @@
 			// Need to make sure that return to this view works even if following function leaves.
 			TRAP_IGNORE( CheckAndUpdateFocusedMessageL() );
 			}
+		
+	    // Set mailbox name to status pane
+		iAppUi.SetActiveMailboxNameToStatusPaneL();	
 		}
     CAknEnv::Static()->GetCurrentGlobalUiZoom( iCurrentZoomLevel );
 	// Set msk always empty when view is activated.
--- a/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListControl.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -62,6 +62,8 @@
 
 // CLASS IMPLEMENTATION
 
+TInt KGenericTimerDialogInterval = 1000; // Interval for iDialogTimer
+
 // ---------------------------------------------------------------------------
 // Two-phased constructor.
 // ---------------------------------------------------------------------------
@@ -119,6 +121,8 @@
     CAlfControl::ConstructL( aEnv );
 	iService = CFscContactActionService::NewL( iAppUi->GetVPbkManagerL() );
     iModel = CFSEmailUiSendAttachmentsListModel::NewL( iAppUi, Env(), this );
+    iAttachmentAddingLocked = EFalse;
+    iDialogTimer = CFSEmailUiGenericTimer::NewL( this );
     }
 
 // ---------------------------------------------------------------------------
@@ -128,6 +132,11 @@
 CFreestyleEmailUiSendAttachmentsListControl::~CFreestyleEmailUiSendAttachmentsListControl()
     {
     FUNC_LOG;
+	if(iDialogTimer)
+		{
+	    iDialogTimer->Cancel();
+	    delete iDialogTimer;
+		}
 	delete iService;
     }
 
@@ -324,6 +333,30 @@
 	return iModel;
 }
 
+
+// ---------------------------------------------------------------------------
+// IsAttachmentAddingLocked
+//
+// ---------------------------------------------------------------------------
+//
+TBool CFreestyleEmailUiSendAttachmentsListControl::IsAttachmentAddingLocked() const
+{
+    FUNC_LOG;
+	return iAttachmentAddingLocked;
+}
+
+
+// ---------------------------------------------------------------------------
+// TimerEventL
+// Timer that delays the dialog will open the dialog here
+// ---------------------------------------------------------------------------
+//
+void CFreestyleEmailUiSendAttachmentsListControl::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
+	{
+	TFsEmailUiUtility::ShowWaitNoteL( iWaitNote, R_FSE_WAIT_INSERTING_TEXT, EFalse,ETrue );
+	iDialogTimer->Cancel();
+	}
+
 // ---------------------------------------------------------------------------
 // AppendAttachmentToListL
 //
@@ -338,6 +371,11 @@
 	// <cmail>
 	TBool fetchOK = EFalse;
 	
+	if(iAttachmentAddingLocked)
+		{
+	    return ret;
+		}
+	
 	if (aType != MsgAttachmentUtils::EUnknown)
 	    {
         CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC();
@@ -373,8 +411,12 @@
 	    fetchOK = TFsEmailUiUtility::ShowSelectFileDialogL( filePath );
 	    }
         
+	iAttachmentAddingLocked = ETrue;
+	
 	if ( fetchOK && filePath.Length() > 0 ) // </cmail>
 		{
+	    iDialogTimer->Start(KGenericTimerDialogInterval);   
+	
         if ( !FileDrmProtectedL( filePath ) )
 			{
 			// add file as a email message part
@@ -425,6 +467,14 @@
 			ret = ETrue;
 			}
 		}
+
+	iDialogTimer->Cancel();
+	if(iWaitNote) 
+	  	{
+	    iWaitNote->ProcessFinishedL();
+	   	}
+	iAttachmentAddingLocked = EFalse;
+	
 	return ret;
 	}
 
--- a/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -64,7 +64,6 @@
 _LIT8( KPriorityHighImageName, "todo_high_add_img");
 _LIT8( KPriorityLowImageName, "todo_low_add_img");
 
-_LIT8( KAttachmentSizeUnit, "kb");
 _LIT8( KSpace8, " ");
 
 _LIT8( KHTMLImgTagId, "<image id=\"" );
@@ -973,7 +972,7 @@
 
     HBufC* sizeDesc = TFsEmailUiUtility::CreateSizeDescLC(aAttachment.ContentSize(), EFalse);
 
-    TBuf8<32> sizeText;
+    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 
@@ -985,7 +984,10 @@
     
     sizeText.Append( KSpace8 );
     sizeText.Append( _L8("(") );
-    sizeText.Append( sizeDesc->Des() );
+    HBufC8* sizeDesc8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( sizeDesc->Des() );
+    CleanupStack::PushL( sizeDesc8 );
+    sizeText.Append( sizeDesc8->Des() );
+    CleanupStack::PopAndDestroy( sizeDesc8 );
     CleanupStack::PopAndDestroy( sizeDesc );
     sizeText.Append( _L8(")") );
     
--- a/emailuis/emailui/src/ncsaddressinputfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncsaddressinputfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -32,6 +32,8 @@
 #include <sysutil.h>
 #include <AknUtils.h>
 #include <FreestyleEmailUi.rsg>
+#include <AknPhysics.h>
+
 #include "FreestyleEmailUiAppui.h"
 #include "FreestyleEmailUiLayoutData.h"
 #include "FreestyleEmailUiLayoutHandler.h"
@@ -53,10 +55,8 @@
 	MNcsAddressPopupList* aAddressPopupList,
 	CNcsHeaderContainer* aParentControl ):
 	MNcsControl( aSizeObserver ),
-    // <cmail>
 	iParentControl( aParentControl ),
 	iAddressPopupList( aAddressPopupList ),
-    // </cmail>
 	iFieldType( aFieldType )
     {
     FUNC_LOG;
@@ -352,7 +352,32 @@
         {
         iButton->HandlePointerEventL( aPointerEvent );
         }
-    iTextEditor->HandleTextChangedL();    
+    iTextEditor->HandleTextChangedL();
+    
+    switch( aPointerEvent.iType )
+    	{
+    	case TPointerEvent::EButton1Down:
+    		{
+            // Save start position so that it can be used in
+            // drag/scrolling calculations
+            iStartPosition = aPointerEvent.iPosition;
+            iIsDraggingStarted = EFalse;
+            break;
+    		}
+    		
+    	case TPointerEvent::EDrag:
+    		{
+            if ( !iIsDraggingStarted && iPhysics )
+                {
+                TInt drag( iStartPosition.iY - aPointerEvent.iPosition.iY );
+                if ( Abs( drag ) > iPhysics->DragThreshold() )
+                    {
+					iIsDraggingStarted = ETrue;
+                    }
+                }
+            break;
+    		}
+    	}
     }
 
 // -----------------------------------------------------------------------------
@@ -364,7 +389,7 @@
     {
     if( aEventType == EEventStateChanged )
         {
-        if( aControl == iButton )
+        if( aControl == iButton && !iIsDraggingStarted )
             {
             iParentControl->OpenPhonebookL();
             }
@@ -832,3 +857,9 @@
             }
         }
 	}
+
+void CNcsAddressInputField::EnableKineticScrollingL( CAknPhysics* aPhysics )
+    {
+	iPhysics = aPhysics;
+    iTextEditor->EnableKineticScrollingL( aPhysics );
+    }
--- a/emailuis/emailui/src/ncscomposeview.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeview.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -84,7 +84,8 @@
      iMailClient( aMailClient ), iOrigMessage( NULL ), iNewMessage( NULL ),
      iMsvSession( aMsvSession ), iEnv( aEnv ),
      iFakeSyncGoingOn(EFalse), iFetchDialogCancelled(EFalse),
-     iExecutingDoExitL( EFalse )
+     iExecutingDoExitL( EFalse ),
+     iMessageTextPartModified( EFalse ), iMessageModified( EFalse )
     {
     FUNC_LOG;
 
@@ -1007,6 +1008,7 @@
             	iNewMessage->ResetFlag( EFSMsgFlag_Low );
             	iNewMessage->SetFlag( EFSMsgFlag_Important );
             	iNewMessage->SaveMessageL();
+                iMessageModified = EFalse;
             	iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityHigh );
             	}
                 break;
@@ -1015,6 +1017,7 @@
             	iNewMessage->ResetFlag( EFSMsgFlag_Low );
             	iNewMessage->ResetFlag( EFSMsgFlag_Important );
             	iNewMessage->SaveMessageL();
+                iMessageModified = EFalse;
             	iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityNormal );
     	    	}
                 break;
@@ -1023,6 +1026,7 @@
             	iNewMessage->ResetFlag( EFSMsgFlag_Important );
             	iNewMessage->SetFlag( EFSMsgFlag_Low );
             	iNewMessage->SaveMessageL();
+                iMessageModified = EFalse;
             	iStatusPaneIndicators->SetPriorityFlag( EMsgPriorityLow );
     	    	}
                 break;
@@ -1145,7 +1149,7 @@
         User::Leave( KErrNotFound );
         }
 
-	CommitL();
+    CommitL( ETrue, EAllFields, ETrue );
 
     TRAPD(r, iMailBox->SendMessageL( *iNewMessage ) );
     if ( KErrNone != r )
@@ -1194,7 +1198,7 @@
         array->AppendL( *saveItem );
 		CleanupStack::PopAndDestroy( saveItem );
 
-    	HBufC* deleteItem = StringLoader::LoadLC( R_NCS_DRAFT_DELETE );
+    	HBufC* deleteItem = StringLoader::LoadLC( R_NCS_DRAFT_DISCARD );
         array->AppendL( *deleteItem );
 		CleanupStack::PopAndDestroy( deleteItem );
 
@@ -1339,14 +1343,28 @@
 	CFreestyleEmailUiSendAttachmentsListControl* attachmentControl;
 	attachmentControl = self->AttachmentsListControl();
 
-   	// show file dialog and get file name
-	TBool ok = EFalse;
-	TRAPD( error, ok = attachmentControl->AppendAttachmentToListL(
+    // show file dialog and get file name
+    TBool ok = EFalse;
+    TInt error = KErrNone;
+    if( ! self->Toolbar()->IsDimmed())
+        {
+	self->Toolbar()->SetDimmed(ETrue); 
+	}
+	
+    self->iContainer->SwitchChangeMskOff( ETrue );
+	TRAP( error, ok = attachmentControl->AppendAttachmentToListL(
                 self->iAttachmentAddType) );
+    self->iContainer->SwitchChangeMskOff( EFalse );
+    
 	if ( ok && error == KErrNone )
 	    {
-	    TRAPD( error, self->SetAttachmentLabelContentL() );
-	    return error;
+	    TRAP( error, self->SetAttachmentLabelContentL() );
+            }
+  	
+	if(! attachmentControl->IsAttachmentAddingLocked())
+	    {
+	    self->Toolbar()->SetDimmed(EFalse); 
+	    TRAP( error, self->UpdateToolbarL());
 	    }
 	return error;
     }
@@ -1521,6 +1539,7 @@
             {
             iNewMessage->SetContentType( KFSMailContentTypeMultipartMixed );
             iNewMessage->SaveMessageL();
+            iMessageModified = EFalse;
             }
         
         TFsEmailUiUtility::CreatePlainTextPartL( 
@@ -1598,6 +1617,7 @@
         iOrigMessage = NULL;
         iNewMessage->SetContentType( KFSMailContentTypeMultipartMixed );
         iNewMessage->SaveMessageL();
+        iMessageModified = EFalse;
         TFsEmailUiUtility::CreatePlainTextPartL( 
                 *iNewMessage, iNewMessageTextPart );
         InitFieldsL();
@@ -1627,6 +1647,7 @@
             }
         iNewMessage->SetContentType( KFSMailContentTypeMultipartMixed );
         iNewMessage->SaveMessageL();
+        iMessageModified = EFalse;
 
         TFsEmailUiUtility::CreatePlainTextPartL( 
                 *iNewMessage, iNewMessageTextPart );
@@ -2000,8 +2021,8 @@
 //
 // -----------------------------------------------------------------------------
 //
-void CNcsComposeView::CommitL( 
-        TBool aParseAddresses, TFieldToCommit aFieldToCommit )
+void CNcsComposeView::CommitL( TBool aParseAddresses,
+    TFieldToCommit aFieldToCommit, TBool aSaveNow )
     {
     FUNC_LOG;
     __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) );
@@ -2037,64 +2058,36 @@
         case ESubjectField:
             commitSubjectField = ETrue;
             break;
-	    default:
-	        break;
-	    }
-
-	if ( commitToField )
-		{
-	    // get addresses from UI to MSG object
-	    RPointerArray<CFSMailAddress> toAddresses;
-	    CleanupResetAndDestroyClosePushL( toAddresses );
-	    NcsUtility::ConvertAddressArrayL( 
-	            iContainer->GetToFieldAddressesL( aParseAddresses ), 
-	            toAddresses );
-	    iNewMessage->GetToRecipients().ResetAndDestroy();
-	    for ( TInt i = 0 ; i < toAddresses.Count() ; i++ )
-	    	{
-	    	iNewMessage->AppendToRecipient( toAddresses[i] );
-	        // Ownership of the message pointer was transferred from our array
-	    	// to iNewMessage
-	        toAddresses[i] = NULL;
-	    	}
-	    CleanupStack::PopAndDestroy( &toAddresses );
-		}
-
-	if ( commitCcField )
-		{
-	    RPointerArray<CFSMailAddress> ccAddresses;
-	    CleanupResetAndDestroyClosePushL( ccAddresses );
-	    NcsUtility::ConvertAddressArrayL( 
-	            iContainer->GetCcFieldAddressesL( aParseAddresses ), 
-	            ccAddresses );
-	    iNewMessage->GetCCRecipients().ResetAndDestroy();
-	    for ( TInt i = 0 ; i < ccAddresses.Count() ; i++ )
-	    	{
-	    	iNewMessage->AppendCCRecipient( ccAddresses[i] );
-	        // Ownership of the message pointer was transferred from 
-	    	// our array to iNewMessage
-	        ccAddresses[i] = NULL;
-	    	}
-	    CleanupStack::PopAndDestroy( &ccAddresses );
-		}
-
-	if ( commitBccField )
-		{
-	    RPointerArray<CFSMailAddress> bccAddresses;
-	    CleanupResetAndDestroyClosePushL( bccAddresses );
-	    NcsUtility::ConvertAddressArrayL( 
-	            iContainer->GetBccFieldAddressesL( aParseAddresses ), 
-	            bccAddresses );
-	    iNewMessage->GetBCCRecipients().ResetAndDestroy();
-	    for ( TInt i = 0; i < bccAddresses.Count() ; i++ )
-	    	{
-	    	iNewMessage->AppendBCCRecipient( bccAddresses[i] );
-	        // Ownership of the message pointer was transferred from 
-	    	// our array to iNewMessage
-	        bccAddresses[i] = NULL;
-	    	}
-	    CleanupStack::PopAndDestroy( &bccAddresses );
-		}
+        default:
+            break;
+        }
+
+    if ( commitToField )
+        {
+        RPointerArray<CFSMailAddress>& recipients = 
+            iNewMessage->GetToRecipients();
+        recipients.ResetAndDestroy();
+        NcsUtility::ConvertAddressArrayL(
+            iContainer->GetToFieldAddressesL( aParseAddresses ), recipients );
+        }
+
+    if ( commitCcField )
+        {
+        RPointerArray<CFSMailAddress>& recipients = 
+            iNewMessage->GetCCRecipients();
+        recipients.ResetAndDestroy();
+        NcsUtility::ConvertAddressArrayL( 
+            iContainer->GetCcFieldAddressesL( aParseAddresses ), recipients );
+        }
+
+    if ( commitBccField )
+        {
+        RPointerArray<CFSMailAddress>& recipients = 
+            iNewMessage->GetBCCRecipients();
+        recipients.ResetAndDestroy();
+        NcsUtility::ConvertAddressArrayL( 
+            iContainer->GetBccFieldAddressesL( aParseAddresses ), recipients );
+        }
 
 	if ( commitSubjectField )
 	    {
@@ -2116,24 +2109,42 @@
         // incorrect argument type in FW API, can be removed when API fixed
         iNewMessageTextPart->SetContent( bodyPtr );
         CleanupStack::PopAndDestroy( body );
-
-        TInt error = KErrNone;
-        if ( iNewMessageTextPart )
-            {
-            TRAP( error, iNewMessageTextPart->SaveL() );
-            }
+        iMessageTextPartModified = ETrue;
+        }
+
+    iMessageModified = ETrue;
+    RefreshToolbar();
+
+    if ( aSaveNow )
+        {
+        SaveMessageL();
         }
-
-	// Save message if at least one field committed
-    if ( iNewMessage || commitToField || commitCcField || commitBccField
-        || commitSubjectField || commitBodyField )
+    }
+
+TInt CNcsComposeView::SaveMessage()
+    {
+    FUNC_LOG;
+    TInt error = KErrNone;
+    TRAP( error, SaveMessageL() );
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// Saves the new message if it has been modifed since the last save.
+// -----------------------------------------------------------------------------
+void CNcsComposeView::SaveMessageL()
+    {
+    FUNC_LOG;
+    if ( iNewMessageTextPart && iMessageTextPartModified )
         {
-        TInt error = KErrNone;
-        if(iNewMessage) // Coverity error fix:
-            {
-            TRAP( error, iNewMessage->SaveMessageL() );
-            }
-        RefreshToolbar();
+        iNewMessageTextPart->SaveL();
+        iMessageTextPartModified = EFalse;
+        }
+
+    if ( iNewMessage && iMessageModified )
+        {
+        iNewMessage->SaveMessageL();
+        iMessageModified = EFalse;
         }
     }
 
@@ -2143,7 +2154,6 @@
 void CNcsComposeView::DoSafeExit( TExitMode aMode )
     {
     FUNC_LOG;
-
     if ( !iExecutingDoExitL )
         {
         iExecutingDoExitL = ETrue;
@@ -2660,11 +2670,11 @@
         {
         iNewMessage->SetContentType( KFSMailContentTypeMultipartMixed );
         iNewMessage->SaveMessageL();
-	    }
-	
-	TFsEmailUiUtility::CreatePlainTextPartL( *iNewMessage, iNewMessageTextPart );
-
-	}
+        iMessageModified = EFalse;
+        }
+
+    TFsEmailUiUtility::CreatePlainTextPartL( *iNewMessage, iNewMessageTextPart );
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsComposeView::GenerateForwardMessageL
@@ -2862,7 +2872,7 @@
     if ( iFirstStartCompleted && iNewMessage && iMailBox 
          && aActionCommand.Id() == KCmdEditorAutoSave )
         {
-        CommitL( EFalse );
+        CommitL( EFalse, EAllFields, ETrue );
         }
     }
 
@@ -2879,7 +2889,7 @@
         __ASSERT_DEBUG( iNewMessage, Panic( ENcsBasicUi ) );
 
         iFakeSyncGoingOn = ETrue;
-        TRAPD( error, CommitL( aParseAddresses ) );
+        TRAPD( error, CommitL( aParseAddresses, EAllFields, ETrue ) );
         iFakeSyncGoingOn = EFalse;
         User::LeaveIfError( error );
 
--- a/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -102,13 +102,18 @@
     SetMopParent( &iView );
     CreateWindowL();
 
+    if ( CAknPhysics::FeatureEnabled() )
+        {
+        iPhysics = CAknPhysics::NewL( *this, this );
+        }
+
     // Setup the control array
     InitComponentArrayL();
     CCoeControlArray& controls = Components();
     controls.SetControlsOwnedExternally( ETrue );
 
     // Create the header field
-    iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags );
+    iHeader = CNcsHeaderContainer::NewL( *this, iMailBox, aFlags, iPhysics );
     controls.AppendLC( iHeader );
     CleanupStack::Pop( iHeader );
 
@@ -118,6 +123,7 @@
     iMessageField->ConstructL( this, 0, 0 );
     iMessageField->SetAlignment( EAknEditorAlignBidi );
     iMessageField->SetAknEditorInputMode( EAknEditorTextInputMode );
+    iMessageField->EnableKineticScrollingL( iPhysics );
     controls.AppendLC( iMessageField );
     CleanupStack::Pop( iMessageField );
 
@@ -140,13 +146,16 @@
     // Listen edwin events and size events from smart quote field
     iReadOnlyQuoteField->AddEdwinObserverL( this );
     iReadOnlyQuoteField->SetEdwinSizeObserver( this );
+   iReadOnlyQuoteField->EnableKineticScrollingL( iPhysics );
 
     // Create the scroll bar
     iScrollBar = new( ELeave ) CAknDoubleSpanScrollBar( this );
-    iScrollBar->ConstructL( 
-            this, this, CEikScrollBar::EVertical, aRect.Height() );
-    iScrollBar->MakeVisible( ETrue );
+    iScrollBar->ConstructL( ETrue, this, this, CEikScrollBar::EVertical,
+        aRect.Height() );
+    iScrollBar->MakeVisible( EFalse );
     iScrollBar->SetModelL( &iScrollBarModel );
+    controls.AppendLC( iScrollBar );
+    CleanupStack::Pop( iScrollBar );
 
     iMessageField->SetupEditorL();
     iReadOnlyQuoteField->SetupEditorL();
@@ -158,17 +167,12 @@
 
     iLongTapDetector = CAknLongTapDetector::NewL( this );
 
-    UpdateScrollBarL();
-
     ActivateL();
+    DrawDeferred();
 
     // activate auto save functionality
     iAutoSaver.Enable( ETrue );
 
-    if ( CAknPhysics::FeatureEnabled() )
-        {
-        iPhysics = CAknPhysics::NewL( *this, this );
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -224,8 +228,8 @@
         {
         iFocused->SetFocus( ETrue, aDrawNow );
         }
-	
-	iView.HandleContainerChangeRequiringToolbarRefresh();
+
+    iView.HandleContainerChangeRequiringToolbarRefresh();
 
 	if ( aDrawNow )
 	    {
@@ -252,7 +256,7 @@
 void CNcsComposeViewContainer::HandlePointerEventL( 
         const TPointerEvent& aPointerEvent )
     {
-	FUNC_LOG;
+    FUNC_LOG;
 
     CCoeControl::HandlePointerEventL( aPointerEvent );
 
@@ -269,7 +273,7 @@
             // Save current and original position so that those can be used in
             // drag/scrolling calculations
             iPreviousPosition = iOriginalPosition = 
-                aPointerEvent.iParentPosition;
+                aPointerEvent.iPosition;
             iIsDragging = EFalse;
             iIsFlicking = EFalse;
 
@@ -289,9 +293,9 @@
 						{
 						iMessageField->ClearSelectionL();
 						}
-                    iMessageField->SetFocus( EFalse, EDrawNow );
+                    iMessageField->SetFocus( EFalse, ENoDrawNow );
                     iFocused = iHeader;
-                    iHeader->SetFocus( ETrue,EDrawNow );
+                    iHeader->SetFocus( ETrue,ENoDrawNow );
                     iHeader->MakeVisible( ETrue );
                     CommitL( EBodyField );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
@@ -299,8 +303,8 @@
                 else if ( iFocused == iReadOnlyQuoteField )
                     {
                     iFocused = iMessageField;
-                    iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
-                    iHeader->SetFocus( ETrue, EDrawNow );
+                    iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
+                    iHeader->SetFocus( ETrue, ENoDrawNow );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
                     }
                 }
@@ -310,16 +314,16 @@
                 if ( iFocused == iMessageField )
                     {
                     iFocused = iReadOnlyQuoteField;
-                    iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
-                    iMessageField->SetFocus( EFalse, EDrawNow );
+                    iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
+                    iMessageField->SetFocus( EFalse, ENoDrawNow );
                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
                     }
                 else if ( iFocused == iHeader )
                     {
                     iFocused = iReadOnlyQuoteField;
-                    iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
-                    iHeader->SetFocus( EFalse, EDrawNow );
+                    iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
+                    iHeader->SetFocus( EFalse, ENoDrawNow );
                     iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
                     }
@@ -330,20 +334,22 @@
                     {
                     //TRAP_IGNORE( DoUpdateSubjectL() );
 
-					iHeader->SetFocus( EFalse, EDrawNow );
-					iFocused = iMessageField;
-                    iMessageField->SetFocus( ETrue, EDrawNow );
+                    iHeader->SetFocus( EFalse, ENoDrawNow );
+                    iFocused = iMessageField;
+                    iMessageField->SetFocus( ETrue, ENoDrawNow );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
                     }
                 else if ( iFocused == iReadOnlyQuoteField )
                     {
                     iFocused = iMessageField;
-                    iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
-                    iMessageField->SetFocus( ETrue, EDrawNow );
+                    iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
+                    iMessageField->SetFocus( ETrue, ENoDrawNow );
                     iView.HandleContainerChangeRequiringToolbarRefresh();
                     }
                 else 
                     {
+					iMessageField->ClearSelectionL();
+
                     const TRect messageFieldRect( iMessageField->Rect() );
                     if ( !messageFieldRect.Contains( aPointerEvent.iPosition ) && 
                          aPointerEvent.iPosition.iY >= messageFieldRect.iTl.iY )
@@ -370,16 +376,28 @@
     	
     	case TPointerEvent::EDrag:
     		{
-    		// Get current pointer position
-    		TPoint position = aPointerEvent.iParentPosition;
+            if ( !iIsDragging )
+                {
+                TInt drag( iOriginalPosition.iY - aPointerEvent.iPosition.iY );
+                if ( Abs( drag ) > iPhysics->DragThreshold() )
+                    {
+					// If user started dragging, cancel hotspot actions
+					iIsDragging = ETrue;
+                    }
+                }
 
-    		// If user started dragging, cancel hotspot actions
-            iIsDragging = ETrue;
+            // Get current pointer position
+            TPoint position = aPointerEvent.iPosition;
+
 
            if( iPhysics )
-                {
-                TPoint delta( 0, iPreviousPosition.iY - position.iY );
-                iPhysics->RegisterPanningPosition( delta );
+               {
+			   if ( iIsDragging )
+				   {
+                    TPoint delta( 0, iPreviousPosition.iY - position.iY );
+                    if ( !iMessageField->SelectionLength() )
+                    		iPhysics->RegisterPanningPosition( delta );
+				   }
                 }
             else
                 {
@@ -418,11 +436,6 @@
     		}
     	}
     	
-    if( iFocused == iMessageField )
-    	{
-    	iMessageField->HandleTextChangedL();
-    	}
-
     if ( aPointerEvent.iType == TPointerEvent::EButton1Down &&
          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
         {
@@ -495,13 +508,15 @@
 
         if ( ret != EKeyWasConsumed )
             {
-        	DrawNow();
+            DrawDeferred();
             }
         }
 
     if ( ret == EKeyWasNotConsumed )
         {
-        ret = iFocused->OfferKeyEventL( aKeyEvent, aType );
+        if ( iFocused )
+            ret = iFocused->OfferKeyEventL( aKeyEvent, aType );
+
         if( aType == EEventKeyUp )
         	iView.HandleContainerChangeRequiringToolbarRefresh();
         
@@ -655,37 +670,38 @@
     if ( iFocused == iReadOnlyQuoteField && aKeyEvent.iCode == EKeyUpArrow )
         {
         iFocused = iMessageField;
-        iReadOnlyQuoteField->SetFocus( EFalse, EDrawNow );
-        iMessageField->SetFocus( ETrue, EDrawNow );
+        iReadOnlyQuoteField->SetFocus( EFalse, ENoDrawNow );
+        iMessageField->SetFocus( ETrue, ENoDrawNow );
         ret = EKeyWasConsumed;
         }
     else if ( iFocused == iMessageField )
-	    {
-	    if ( aKeyEvent.iCode == EKeyUpArrow )
-	        {
+        {
+        if ( aKeyEvent.iCode == EKeyUpArrow )
+            {
             iFocused = iHeader;
-    		iHeader->SetFocus( ETrue,EDrawNow );
-    		iMessageField->SetFocus( EFalse, EDrawNow );
-    		iHeader->MakeVisible( ETrue );
+            iHeader->SetFocus( ETrue, ENoDrawNow );
+            iMessageField->SetFocus( EFalse, ENoDrawNow );
+            iHeader->MakeVisible( ETrue );
+            iHeader->ShowCursor( ETrue );
             CommitL( EBodyField );
             ret = EKeyWasConsumed;
-	        }
-	    else if ( aKeyEvent.iCode == EKeyDownArrow && 
-	              iReadOnlyQuoteField->TextLength() )
-	        {
-	        // Focus move to read-only quote only if there is some text in it.
-	        iFocused = iReadOnlyQuoteField;
-	        iReadOnlyQuoteField->SetFocus( ETrue, EDrawNow );
-	        iMessageField->SetFocus( EFalse, EDrawNow );
-	        iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
-	        ret = EKeyWasConsumed;
-	        }
+            }
+        else if ( aKeyEvent.iCode == EKeyDownArrow && 
+                  iReadOnlyQuoteField->TextLength() )
+            {
+            // Focus move to read-only quote only if there is some text in it.
+            iFocused = iReadOnlyQuoteField;
+            iReadOnlyQuoteField->SetFocus( ETrue, ENoDrawNow );
+            iMessageField->SetFocus( EFalse, ENoDrawNow );
+            iReadOnlyQuoteField->SetCursorPosL( 0, EFalse );
+            ret = EKeyWasConsumed;
+            }
         }
-	else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow )
+    else if ( iFocused == iHeader && aKeyEvent.iCode == EKeyDownArrow )
         {
-		iFocused = iMessageField;
-		iHeader->SetFocus( EFalse, EDrawNow );
-		iMessageField->SetFocus( ETrue, EDrawNow );
+        iFocused = iMessageField;
+        iHeader->SetFocus( EFalse, ENoDrawNow );
+        iMessageField->SetFocus( ETrue, ENoDrawNow );
         iMessageField->SetCursorPosL( 0, EFalse );
         ret = EKeyWasConsumed;
         }
@@ -802,24 +818,21 @@
 // Draws the display
 // -----------------------------------------------------------------------------
 //
-void CNcsComposeViewContainer::Draw( const TRect& /*aRect*/ ) const
+void CNcsComposeViewContainer::Draw( const TRect& aRect ) const
     {
     FUNC_LOG;
 
-	if ( iBgContext )
-	    {
-    	CWindowGc& gc = SystemGc();
-
-    	MAknsSkinInstance* skin = AknsUtils::SkinInstance();
-
-    	if ( skin )
-    		{
-    		AknsDrawUtils::Background( skin, iBgContext, this, gc, Rect() );
-    		}
-	    }
+    if ( iBgContext )
+        {
+        CWindowGc& gc = SystemGc();
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+        if ( skin )
+            {
+            AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect );
+            }
+        }
     }
 
-
 // -----------------------------------------------------------------------------
 // CNcsComposeViewContainer::SetBodyContentL()
 // -----------------------------------------------------------------------------
@@ -1074,7 +1087,7 @@
 // -----------------------------------------------------------------------------
 //
 void CNcsComposeViewContainer::UpdateScrollBarL()
-	{
+    {
     FUNC_LOG;
 
     TRect headerRect = iHeader->Rect();
@@ -1093,8 +1106,8 @@
     iScrollBarModel.SetFocusPosition( visiblePosition );
 
     iScrollBar->SetModelL( &iScrollBarModel );
-    iScrollBar->DrawNow();
-	}
+    iScrollBar->MakeVisible( IsVisible() );
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsComposeViewContainer::SetFocusToMessageFieldL()
@@ -1108,12 +1121,11 @@
         {
         iHeader->SetFocus( EFalse, ENoDrawNow );
         iMessageField->SetCursorPosL( 0, EFalse );
-        iMessageField->SetFocus( ETrue, EDrawNow );
+        iMessageField->SetFocus( ETrue, ENoDrawNow );
         iFocused = iMessageField;
         UpdateScreenPositionL();
         DrawDeferred();
         }
-
     }
 
 // -----------------------------------------------------------------------------
@@ -1809,7 +1821,7 @@
     FUNC_LOG;
     if ( iHeader )
         {
-        iHeader->HandleDynamicVariantSwitchL();
+        iHeader->HandleSkinChangeL();
         }
 
     if ( iMessageField )
@@ -1914,9 +1926,6 @@
     FUNC_LOG;
 	TPoint headerPos( iHeader->Position() );
 	
-	aTargetPos = Max( 0, Min( aTargetPos, 
-	                          ContentTotalHeight() - Rect().Height()) );
-	
 	TInt moveY = -headerPos.iY - aTargetPos;
 	
 	if( moveY )
@@ -1938,7 +1947,7 @@
 		iSeparatorLineYPos += moveY;
 	
 		UpdateScrollBarL();
-		DrawNow();
+		DrawDeferred();
 		}
 	}
 
@@ -1953,12 +1962,9 @@
         TUint /*aFlags*/ )
     {
     FUNC_LOG;
-	if( iIsFlicking )
-		{
-		TInt scrollOffset = aNewPosition.iY - Rect().Size().iHeight / 2;
+	TInt scrollOffset = aNewPosition.iY - Rect().Size().iHeight / 2;
 
-		TRAP_IGNORE( ScrollL( scrollOffset ) );
-		}
+	TRAP_IGNORE( ScrollL( scrollOffset ) );
 	}
 
 // -----------------------------------------------------------------------------
--- a/emailuis/emailui/src/ncsheadercontainer.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncsheadercontainer.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -22,6 +22,7 @@
 #include <aknViewAppUi.h>
 #include <aknnotewrappers.h> //CAknInformationNote
 #include <FreestyleEmailUi.rsg>
+#include <aknphysics.h>
 
 #include "cfsmailbox.h"
 #include <FreestyleEmailUi.rsg>
@@ -57,11 +58,11 @@
 // ---------------------------------------------------------------------------
 //
 CNcsHeaderContainer* CNcsHeaderContainer::NewL( CCoeControl& aParent, 
-    CFSMailBox& aMailBox, TInt aFlags )
+    CFSMailBox& aMailBox, TInt aFlags, CAknPhysics* aPhysics )
     {
     FUNC_LOG;
     CNcsHeaderContainer* self = 
-        new ( ELeave ) CNcsHeaderContainer( aParent, aMailBox );
+        new ( ELeave ) CNcsHeaderContainer( aParent, aMailBox, aPhysics );
     CleanupStack::PushL( self );
     self->ConstructL( aFlags );
     CleanupStack::Pop( self );
@@ -74,11 +75,13 @@
 //
 CNcsHeaderContainer::CNcsHeaderContainer(
 	CCoeControl& aParent, 
-	CFSMailBox& aMailBox ): 
+	CFSMailBox& aMailBox,
+	CAknPhysics* aPhysics ): 
 	iParent( aParent ),
 	iFieldSizeObserver( static_cast< CNcsComposeViewContainer& >( aParent ) ),
 	iMailBox( aMailBox ),
-	iLongTapEventConsumed( EFalse )
+	iLongTapEventConsumed( EFalse ),
+    iPhysics( aPhysics )
 	{
     FUNC_LOG;
 	}
@@ -171,6 +174,11 @@
         KAknsIIDQsnBgAreaMain, Rect(), EFalse );
 
     iRALInProgress = EFalse;
+
+    iToField->EnableKineticScrollingL( iPhysics );
+    iCcField->EnableKineticScrollingL( iPhysics );
+    iBccField->EnableKineticScrollingL( iPhysics );
+    iSubjectField->EnableKineticScrollingL( iPhysics );
 	}
 
 // ---------------------------------------------------------------------------
@@ -235,7 +243,7 @@
 // CNcsHeaderContainer::ShowCursor
 // ---------------------------------------------------------------------------
 //
-void CNcsHeaderContainer::ShowCursor( TBool aShow )
+void CNcsHeaderContainer::ShowCursor( TBool aShow, TDrawNow aDrawNow )
     {
     CCoeControl* focused = FindFocused();
     if ( focused )
@@ -244,7 +252,7 @@
         }
     if ( iFocused ) 
         {
-        iFocused->SetFocus( aShow, EDrawNow );
+        iFocused->SetFocus( aShow, aDrawNow );
         }
     }
 
@@ -307,32 +315,36 @@
 void CNcsHeaderContainer::SetMskL()
     {
     FUNC_LOG;
+
+    // msk change disabled - probably some dialog/popup is visible
+    if( iSwitchChangeMskOff )
+        {
+        return;
+        }
+
     CCoeControl* focused = FindFocused();
     if ( focused == iToField || focused == iCcField || focused == iBccField )
         {
-        if( iSwitchChangeMskOff == EFalse )
-            {
-            ChangeMskCommandL( R_FSE_QTN_MSK_ADD );
-            }
+        ChangeMskCommandL( R_FSE_QTN_MSK_ADD );
         }
     else if ( focused == iAttachmentField ) 
         {
-            if ( GetAttachmentCount() > 1 )
-                {
+        if ( GetAttachmentCount() > 1 )
+            {
             ChangeMskCommandL( R_FSE_QTN_MSK_VIEWATTACHMENTS );
-                }
-            else if ( !HasRemoteAttachments() )
-                {
-            ChangeMskCommandL( R_FSE_QTN_MSK_VIEWATTACHMENT );                
-                }
-            else // message has single remote attachment => no MSK function
-                {
+            }
+        else if ( !HasRemoteAttachments() )
+            {
+            ChangeMskCommandL( R_FSE_QTN_MSK_VIEWATTACHMENT );
+            }
+        else // message has single remote attachment => no MSK function
+            {
             ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
             }
         }
     else if ( focused == iSubjectField )
         {
-        ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );       
+        ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
         }
     else 
         {
@@ -348,67 +360,75 @@
         const TPointerEvent& aPointerEvent )
     {
 	FUNC_LOG;
-	CCoeControl* clicked = 0;
-    for ( TInt i=0; i < Components().Count(); ++i )
-        {
-        TRect rc = Components().At( i ).iControl->Rect();
-        if ( rc.Contains( aPointerEvent.iPosition ) )
-            {
-            clicked = Components().At( i ).iControl;
-            }
-        }
-    if ( clicked )
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
         {
-        if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
-            {
-            CCoeControl* pOldCtrl = FindFocused();
-            CCoeControl* pNewCtrl= clicked;
-            
-            if ( pOldCtrl != pNewCtrl )
-                {
-                // Unfocus the control
-                if ( pOldCtrl )
-                    {
-                    pOldCtrl->SetFocus( EFalse, ENoDrawNow );
-                    }
-                pNewCtrl->SetFocus( ETrue, ENoDrawNow );
-                iFocused = pNewCtrl;
-                // Commit changes to previously focused field.
-                if ( pOldCtrl )
-                    {
-                    CommitFieldL( pOldCtrl );
-                    }
+		CCoeControl* clicked = 0;
+		for ( TInt i=0; i < Components().Count(); ++i )
+			{
+			TRect rc = Components().At( i ).iControl->Rect();
+			if ( rc.Contains( aPointerEvent.iPosition ) )
+				{
+				clicked = Components().At( i ).iControl;
+				}
+			}
+
+	    if ( clicked )
+	        {
+			CCoeControl* pOldCtrl = FindFocused();
+			CCoeControl* pNewCtrl= clicked;
+			
+			if ( pOldCtrl != pNewCtrl )
+				{
+				// Unfocus the control
+				if ( pOldCtrl )
+					{
+					pOldCtrl->SetFocus( EFalse, ENoDrawNow );
+					}
+				pNewCtrl->SetFocus( ETrue, ENoDrawNow );
+				iFocused = pNewCtrl;
+				// Commit changes to previously focused field.
+				if ( pOldCtrl )
+					{
+					CommitFieldL( pOldCtrl );
+					}
 
-                // If the attachments label has changed focus
-                if ( pOldCtrl == iAttachmentField || 
-                     pNewCtrl == iAttachmentField )
-                    {
-                    DrawAttachmentFocusNow();
-                    }
-                
-                CNcsComposeViewContainer* container = 
-                    static_cast<CNcsComposeViewContainer*>( &iParent );
-                container->UpdateScrollBarL();
-                }
-            
-            if( iLongTapEventConsumed )
-        		{
-        		iLongTapEventConsumed = EFalse;
-        		return;
-        		}        	
-            
-            if( pNewCtrl == iAttachmentField )
-            	{
+				// If the attachments label has changed focus
+				if ( pOldCtrl == iAttachmentField || 
+					 pNewCtrl == iAttachmentField )
+					{
+					DrawAttachmentFocusNow();
+					}
+				
+				CNcsComposeViewContainer* container = 
+					static_cast<CNcsComposeViewContainer*>( &iParent );
+				container->UpdateScrollBarL();
+				}
+			
+			if( iLongTapEventConsumed )
+				{
+				iLongTapEventConsumed = EFalse;
+				return;
+				}        
+
+			TBool physicsActionOngoing( EFalse );
+			if ( iPhysics && iPhysics->OngoingPhysicsAction() != CAknPhysics::EAknPhysicsActionNone )
+			{
+                physicsActionOngoing = ETrue;
+            }
+			
+			if( pNewCtrl == iAttachmentField && !physicsActionOngoing )
+				{
 				CNcsComposeViewContainer& parent = 
-                    static_cast<CNcsComposeViewContainer&>( iParent );
+					static_cast<CNcsComposeViewContainer&>( iParent );
 				parent.HandleAttachmentsOpenCommandL();
-            	}          
-            }
+				}          
+	        }
         }
-    for ( TInt i=0; i < Components().Count(); ++i )
-        {
-        Components().At( i ).iControl->HandlePointerEventL( aPointerEvent );
-        }
+
+    if ( aPointerEvent.iType != TPointerEvent::EDrag )
+    	{
+		CCoeControl::HandlePointerEventL( aPointerEvent );
+    	}
     }
 
 // -----------------------------------------------------------------------------
@@ -671,16 +691,16 @@
 		}
 	
 	CCoeControlArray::TCursor cur = Components().Find( aAnchor );
-	ASSERT( cur.IsValid() );
-
 	// figure out the new top position of the container
 	TInt top = aAnchor->Rect().iTl.iY;
-	while ( cur.Prev() )
+        if( cur.IsValid() )
 		{
-		CCoeControl* ctrl = cur.Control<CCoeControl>();
-		top -= ctrl->Rect().Height();
+	    while ( cur.Prev() )
+	    	{
+		    CCoeControl* ctrl = cur.Control<CCoeControl>();
+		    top -= ctrl->Rect().Height();
+		    }
 		}
-
 	// Then check we didn't move too much and composer still fills the whole
 	// visible area on the screen (i.e. don't scroll below the bottom of the
 	// body field)
@@ -1840,6 +1860,19 @@
     }
 
 // ---------------------------------------------------------------------------
+// CNcsHeaderContainer::HandleSkinChangeL
+// ---------------------------------------------------------------------------
+//
+void CNcsHeaderContainer::HandleSkinChangeL()
+    {
+    FUNC_LOG;
+    if ( iAacListBox )
+        {
+        iAacListBox->HandleResourceChange( KAknsMessageSkinChange );
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // CNcsHeaderContainer::LayoutLineCount
 // ---------------------------------------------------------------------------
 //
--- a/emailuis/emailui/src/ncspopuplistbox.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncspopuplistbox.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -19,11 +19,13 @@
 // INCLUDE FILES
 #include "emailtrace.h"
 #include <eikclbd.h>
-#include <AknsLayeredBackgroundControlContext.h>
+#include <AknsFrameBackgroundControlContext.h>
 #include <FreestyleEmailUi.rsg>						// R_FSE_EDITOR_ADDRESS_LIST_REMOTE_LOOKUP_SEARCH
 #include <StringLoader.h>						// StringLoader
 #include <CPbkContactEngine.h>
 #include <aknnotewrappers.h>					//For LanguageNotSupported errorNote
+#include <aknsdrawutils.h>
+#include <aknsutils.h>
 
 #include "ncspopuplistbox.h"
 #include "ncsemailaddressobject.h"					// CNcsEmailAddressObject
@@ -37,6 +39,9 @@
 #include "FSDelayedLoader.h"
 #include "FreestyleEmailUiCLSItem.h"
 
+const TInt KBackgroundFrameWidth = 4;
+const TInt KHighlightFrameWidth = 2;
+
 // ========================= MEMBER FUNCTIONS ==================================
 
 // -----------------------------------------------------------------------------
@@ -46,15 +51,15 @@
                                           CFSMailBox& aMailBox, 
                                           CNcsHeaderContainer& aHeaderContainer, 
                                           TBool aRemoteLookupSupported  )
-	{
+    {
     FUNC_LOG;
-	CNcsPopupListBox* self = 
-	    new (ELeave) CNcsPopupListBox( aHeaderContainer, aRemoteLookupSupported, aMailBox );
-	CleanupStack::PushL( self );
-	self->ConstructL( aParent );
-	CleanupStack::Pop( self );
-	return self;
-	}
+    CNcsPopupListBox* self =  new (ELeave) CNcsPopupListBox( aHeaderContainer,
+        aRemoteLookupSupported, aMailBox );
+    CleanupStack::PushL( self );
+    self->ConstructL( aParent );
+    CleanupStack::Pop( self );
+    return self;
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::CNcsPopupListBox
@@ -75,42 +80,40 @@
     {
     FUNC_LOG;
     CEikTextListBox::ConstructL( aParent, CEikListBox::EPopout );
-    CreateScrollBarFrameL();
+    // Create non-window-owning scrollbar to avoid flickering.
+    CEikScrollBarFrame* frame = CreateScrollBarFrameL( EFalse, EFalse, EFalse );
 
-	CEikTextListBox::SetBorder( TGulBorder::ESingleGray );
+    CEikTextListBox::SetBorder( TGulBorder::ENone );
 
-	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont );
-	CEikTextListBox::SetItemHeightL( font->HeightInPixels() + 8 );
+    const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont );
+    CEikTextListBox::SetItemHeightL( font->FontMaxHeight() + 12 );
 
-    iBaseBackroundContext = CAknsBasicBackgroundControlContext::NewL( 
-    	KAknsIIDQgnFsGrafEmailContent, 
-    	Rect(), 
-    	EFalse );
-	iContactHandler = CFsDelayedLoader::InstanceL()->GetContactHandlerL();
-	if ( !iContactHandler->IsLanguageSupportedL() )
-		{
-		iContactHandler = NULL;
-		}
-	
-	iAppUi =  static_cast<CFreestyleEmailUiAppUi*>(iEikonEnv->AppUi()); //<cmail>
-	
-    // <cmail>
+    iBackgroundContext = CAknsFrameBackgroundControlContext::NewL(
+        KAknsIIDQsnFrPopup, Rect(), Rect(), EFalse );
+    UpdateTextColors();
+
+    iContactHandler = CFsDelayedLoader::InstanceL()->GetContactHandlerL();
+    if ( !iContactHandler->IsLanguageSupportedL() )
+        {
+        iContactHandler = NULL;
+        }
+
+    iAppUi = static_cast<CFreestyleEmailUiAppUi*>( iEikonEnv->AppUi() );
     SetListBoxObserver( this );
-    // </cmail>
     }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::InitAndSearchL
 // -----------------------------------------------------------------------------
 void CNcsPopupListBox::InitAndSearchL( const TDesC& aText )
-	{
+    {
     FUNC_LOG;
- 	SetSearchTextL( aText );
- 	RPointerArray<CFSEmailUiClsItem> emptyArray;
- 	CleanupClosePushL( emptyArray );
-	OperationCompleteL( ESearchContacts, emptyArray );
-	CleanupStack::PopAndDestroy( &emptyArray );
-	}
+    SetSearchTextL( aText );
+    RPointerArray<CFSEmailUiClsItem> emptyArray;
+    CleanupClosePushL( emptyArray );
+    OperationCompleteL( ESearchContacts, emptyArray );
+    CleanupStack::PopAndDestroy( &emptyArray );
+    }
 
 // ---------------------------------------------------------------------------
 // CNcsPopupListBox::~CNcsPopupListBox
@@ -118,21 +121,20 @@
 CNcsPopupListBox::~CNcsPopupListBox()
     {
     FUNC_LOG;
-    delete iBaseBackroundContext;
-	delete iItemTextsArray;
-	delete iCurrentSearchText;
-	iMatchingItems.ResetAndDestroy();
-	}
+    delete iBackgroundContext;
+    delete iItemTextsArray;
+    delete iCurrentSearchText;
+    iMatchingItems.ResetAndDestroy();
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::CreateItemDrawerL
 // -----------------------------------------------------------------------------
 void CNcsPopupListBox::CreateItemDrawerL()
-	{
+    {
     FUNC_LOG;
-	CNcsListItemDrawer* drawer = new (ELeave) CNcsListItemDrawer( *this );
-	iItemDrawer = drawer;
-	}
+    iItemDrawer = new (ELeave) CNcsListItemDrawer( *this );
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::MopSupplyObject
@@ -142,7 +144,7 @@
     FUNC_LOG;
     if ( aId.iUid == MAknsControlContext::ETypeId )
         {
-        return MAknsControlContext::SupplyMopObject( aId, iBaseBackroundContext );
+        return MAknsControlContext::SupplyMopObject( aId, iBackgroundContext );
         }
     return CCoeControl::MopSupplyObject( aId );
     }
@@ -153,15 +155,59 @@
 void CNcsPopupListBox::SizeChanged()
     {
     FUNC_LOG;
-    CEikTextListBox::SizeChanged();
-    iBaseBackroundContext->SetRect( Rect() );
+    TRect outerRect = Rect();
+    TRect innerRect = outerRect;
+    innerRect.Shrink( KBackgroundFrameWidth, KBackgroundFrameWidth );
+    SetViewRectFromClientRect( innerRect );
+    TRAP_IGNORE( HandleViewRectSizeChangeL() );
+    iBackgroundContext->SetFrameRects( outerRect, innerRect );
+    }
+
+void CNcsPopupListBox::HandleResourceChange( TInt aType )
+    {
+    FUNC_LOG;
+    if ( aType == KAknsMessageSkinChange )
+        {
+        UpdateTextColors();
+        }
+    }
+
+void CNcsPopupListBox::HandlePointerEventL( const TPointerEvent& aPointerEvent )
+    {
+    // When scrollbar is non-window-owning, the pointer events should be passed
+    // to it through control hierachy, but the CEikTextListBox does not seem to 
+    // do that, so that is handled here.
+    CEikScrollBar* sb = iSBFrame->VerticalScrollBar();
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
+        {
+        if ( sb && sb->Rect().Contains( aPointerEvent.iPosition ) )
+            {
+            sb->ClaimPointerGrab( EFalse );
+            sb->HandlePointerEventL( aPointerEvent );
+            }
+        else
+            {
+            ClaimPointerGrab( EFalse );
+            }
+        }
+
+    CCoeControl* pointerRecipient = GrabbingComponent();
+    if ( sb && pointerRecipient == sb )
+        {
+        sb->HandlePointerEventL( aPointerEvent );
+        }
+    else
+        {
+        CEikTextListBox::HandlePointerEventL( aPointerEvent );
+        }
     }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::OfferKeyEventL
 // -----------------------------------------------------------------------------
 //    
-TKeyResponse CNcsPopupListBox::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType )
+TKeyResponse CNcsPopupListBox::OfferKeyEventL( const TKeyEvent& aKeyEvent,
+    TEventCode aType )
     {
     FUNC_LOG;
     TKeyResponse ret( EKeyWasNotConsumed );
@@ -206,12 +252,12 @@
     return ret;
     }
 
-// <cmail> Touch
 // ---------------------------------------------------------------------------
 // CNcsPopupListBox::HandleListBoxEventL
 // ---------------------------------------------------------------------------
 //      
-void CNcsPopupListBox::HandleListBoxEventL( CEikListBox* /*aListBox*/, TListBoxEvent aEventType )
+void CNcsPopupListBox::HandleListBoxEventL( CEikListBox* /*aListBox*/,
+    TListBoxEvent aEventType )
     {
     if ( aEventType == EEventItemClicked || 
     	 aEventType == EEventItemSingleClicked )
@@ -219,7 +265,6 @@
         iHeaderContainer.DoPopupSelectL();
         }
     }
-// </cmail>
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::OperationComplete
@@ -324,55 +369,54 @@
 // CNcsPopupListBox::SetPopupMaxRect
 // -----------------------------------------------------------------------------
 void CNcsPopupListBox::SetPopupMaxRect( const TRect& aPopupMaxRect )
-	{
+    {
     FUNC_LOG;
-	iPopupMaxRect = aPopupMaxRect;
-	SetPopupHeight();
-	TRAP_IGNORE( UpdateScrollBarsL() );
- 	TRAP_IGNORE( SetScrollBarVisibilityL() );
-	}
-	
+    iPopupMaxRect = aPopupMaxRect;
+    SetPopupHeight();
+    TRAP_IGNORE( UpdateScrollBarsL() );
+    TRAP_IGNORE( SetScrollBarVisibilityL() );
+    }
+
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::IsPopupEmpty
 // -----------------------------------------------------------------------------
 TBool CNcsPopupListBox::IsPopupEmpty() const
-	{
+    {
     FUNC_LOG;
-	if( Model()->NumberOfItems() > 0 )
-		return EFalse;
-	else
-		return ETrue;
-	}
+    if ( Model()->NumberOfItems() > 0 )
+        return EFalse;
+    else
+        return ETrue;
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::IsRemoteLookupItemSelected
 // -----------------------------------------------------------------------------
 TBool CNcsPopupListBox::IsRemoteLookupItemSelected() const
-	{
+    {
     FUNC_LOG;
-	if( CurrentItemIndex() == iRemoteLookupItemPos && iRemoteLookupSupported )
-		return ETrue;
-	else
-		return EFalse;
-	}
+    if ( CurrentItemIndex() == iRemoteLookupItemPos && iRemoteLookupSupported )
+        return ETrue;
+    else
+        return EFalse;
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::CurrentPopupClsItemsArray
 // -----------------------------------------------------------------------------
-
 const RPointerArray<CFSEmailUiClsItem>& CNcsPopupListBox::CurrentPopupClsItemsArray() const
-	{
-	return iMatchingItems;
-	}
+    {
+    return iMatchingItems;
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::RemoteLookupItemPos
 // -----------------------------------------------------------------------------
 TInt CNcsPopupListBox::RemoteLookupItemPos() const
-	{
+    {
     FUNC_LOG;
-	return iRemoteLookupItemPos;
-	}
+    return iRemoteLookupItemPos;
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsPopupListBox::LayoutHandler
@@ -380,9 +424,7 @@
 CFSEmailUiLayoutHandler& CNcsPopupListBox::LayoutHandler() const
     {
     FUNC_LOG;
-    CFreestyleEmailUiAppUi* appUi = 
-        static_cast<CFreestyleEmailUiAppUi*>( ControlEnv()->AppUi() );
-    return *appUi->LayoutHandler();
+    return *iAppUi->LayoutHandler();
     }
 
 // -----------------------------------------------------------------------------
@@ -436,15 +478,16 @@
 // CNcsPopupListBox::SetPopupHeight
 // -----------------------------------------------------------------------------
 void CNcsPopupListBox::SetPopupHeight()
-	{
+    {
     FUNC_LOG;
     // This is the total height in pixels needed to show all items
-    TInt minimumHeight = CalcHeightBasedOnNumOfItems( Model()->NumberOfItems());
+    TInt minimumHeight = 2 * KBackgroundFrameWidth +
+        CalcHeightBasedOnNumOfItems( Model()->NumberOfItems() );
     TRect newRect = iPopupMaxRect;
     TInt areaHeight = Parent()->Parent()->Rect().Height();
     TInt halfAreaHeight = areaHeight/2;
 
- 	// Get height of one line in Address field
+    // Get height of one line in Address field
     CNcsHeaderContainer* headerObj = static_cast<CNcsHeaderContainer* >(Parent());
     TInt toLineHeight = headerObj->GetToLineHeight(); // height of one line height
     if(toLineHeight == 0)
@@ -514,7 +557,8 @@
     FUNC_LOG;
 	if( iRemoteLookupSupported )
 		{
-		HBufC* rmluText = StringLoader::LoadLC( R_FSE_EDITOR_ADDRESS_LIST_REMOTE_LOOKUP_SEARCH, *iCurrentSearchText );
+		HBufC* rmluText = StringLoader::LoadLC( 
+		    R_FSE_EDITOR_ADDRESS_LIST_REMOTE_LOOKUP_SEARCH, *iCurrentSearchText );
 		
 		iItemTextsArray->InsertL( 0, *rmluText );
 		CleanupStack::PopAndDestroy( rmluText );
@@ -591,83 +635,80 @@
 // CNcsListItemDrawer::CNcsListItemDrawer
 // -----------------------------------------------------------------------------
 CNcsListItemDrawer::CNcsListItemDrawer( const CNcsPopupListBox& aListBox )
-:CListItemDrawer(), iListBox(aListBox)
-	{
+:CListItemDrawer(), iListBox( aListBox )
+    {
     FUNC_LOG;
-	// Store a GC for later use
-	iGc = &CCoeEnv::Static()->SystemGc();
-	SetGc(iGc);
-	}
+    // Store a GC for later use
+    iGc = &CCoeEnv::Static()->SystemGc();
+    SetGc(iGc);
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsListItemDrawer::DrawActualItem
 // -----------------------------------------------------------------------------
 void CNcsListItemDrawer::DrawActualItem(TInt aItemIndex,
-	const TRect& aActualItemRect, TBool aItemIsCurrent,
-	TBool /*aViewIsEmphasized*/, TBool /*aViewIsDimmed*/,
-	TBool /*aItemIsSelected*/) const
-	{
+    const TRect& aActualItemRect, TBool aItemIsCurrent,
+    TBool /*aViewIsEmphasized*/, TBool /*aViewIsDimmed*/,
+    TBool /*aItemIsSelected*/) const
+    {
     FUNC_LOG;
-	// <cmail>
-	iGc->Reset();
-	// </cmail>
-	
-	// Get reference to curren popup cls item list.
-	const RPointerArray<CFSEmailUiClsItem>& clsItemArray = 	iListBox.CurrentPopupClsItemsArray();
-	TInt rmluPosition = iListBox.RemoteLookupItemPos();
+    iGc->DiscardFont();
 
-	// Sets all the attributes, like font, text color and background color.
-	const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont );
-	iGc->UseFont(font);
+    // Get reference to curren popup cls item list.
+    const RPointerArray<CFSEmailUiClsItem>& clsItemArray =
+        iListBox.CurrentPopupClsItemsArray();
+    TInt rmluPosition = iListBox.RemoteLookupItemPos();
 
-	// We have to draw the item in layered fassion in order to do the skin
-	// First clear the backround by drawing a solid white rect.	
-	iGc->SetPenColor(iBackColor);
-	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
-	iGc->SetBrushColor(iBackColor);
-	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
-
-    // draw the background
-	TRect backgroundRect( aActualItemRect );
+    // Sets all the attributes, like font, text color and background color.
+    const CFont* font = AknLayoutUtils::FontFromId( EAknLogicalFontPrimarySmallFont );
+    iGc->UseFont( font );
+    iGc->SetPenStyle( CGraphicsContext::ESolidPen );
+    iGc->SetBrushStyle( CGraphicsContext::ENullBrush );
 
-    if ( !aItemIndex ) 
-        {
-        backgroundRect.iTl.iY = 0;
-        }
-    else if ( aItemIndex == iListBox.Model()->NumberOfItems() - 1 ) 
-        {
-        backgroundRect.iBr.iY = iListBox.Size().iHeight;
-        }
-    
-    iGc->DrawRect( backgroundRect );
-    
-
-    TRect textRect( aActualItemRect );
-    {
-    // temporary const_cast to get scroll width
-    CNcsPopupListBox& tmpListBox = const_cast<CNcsPopupListBox&>(iListBox);
-    textRect.Resize( -tmpListBox.ScrollBarFrame()->ScrollBarBreadth(CEikScrollBar::EVertical), 0 );
+    TRect itemRect = aActualItemRect;
+    { 
+    // temporary const_cast to get the scrollbar width
+    CNcsPopupListBox& tmpListBox = const_cast<CNcsPopupListBox&>( iListBox );
+    itemRect.Resize( -tmpListBox.ScrollBarFrame()->ScrollBarBreadth(
+        CEikScrollBar::EVertical ) + KBackgroundFrameWidth, 0 );
     }
 
+    TRect textRect = itemRect;
+    textRect.Shrink( KHighlightFrameWidth, KHighlightFrameWidth );
 
-	// Now draw the highlight
-	if( aItemIsCurrent ) 
-		{
-		TRgb highlightColor = iListBox.LayoutHandler().PcsPopupHighlightColor();
-		iGc->SetBrushColor(highlightColor);
-//	    AknsDrawUtils::DrawFrame( AknsUtils::SkinInstance(), *iGc,
-//	    	aActualItemRect, aActualItemRect,
-//	    	KNcsIIDHighlightBackground, KNcsIIDHighlightBackground );
-        iGc->DrawRect(textRect);
-		}
+    // Get skin instance.
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+    // Draw background using the control context from the list box.
+    MAknsControlContext* cc = AknsDrawUtils::ControlContext( &iListBox );
+    if ( cc )
+        {
+        AknsDrawUtils::Background( skin, cc, *iGc, itemRect );
+        }
+    else
+        {
+        iGc->Clear( itemRect );
+        }
 
-	iGc->SetPenColor(iTextColor);
-	iGc->SetPenStyle(CGraphicsContext::ESolidPen);
-	iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
-	TInt topToBaseline = ( textRect.Height() - font->HeightInPixels() ) / 2
-						+ font->AscentInPixels();
+    // Draw the highlight, when necessary.
+    if ( aItemIsCurrent ) 
+        {
+        AknsDrawUtils::DrawFrame( skin, *iGc, itemRect, textRect,
+            KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter );
+        }
 
-	TPtrC itemText = iListBox.Model()->ItemText( aItemIndex );
+    // Get text color.
+    TRgb textColor = TextColor();
+    if ( aItemIsCurrent )
+        {
+        textColor = HighlightedTextColor();
+        }
+
+    iGc->SetPenColor( textColor );
+    TInt topToBaseline = ( textRect.Height() - font->FontMaxHeight() ) / 2
+        + font->FontMaxAscent();
+
+    TPtrC itemText = iListBox.Model()->ItemText( aItemIndex );
 
 	// Construct bidirectional text object
 	// <cmail> Removed leave from non-leaving function.
@@ -820,5 +861,40 @@
         }
     }
 
+void CNcsPopupListBox::UpdateTextColors()
+    {
+    if ( iItemDrawer )
+        {
+        // Get skin instance.
+        MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+
+        // Get color for popup text from current skin.
+        TRgb textColor = KRgbBlack;
+        AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG20 );
+        iItemDrawer->SetTextColor( textColor );
+
+        // Get text color for highlighted list item from current skin.
+        AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors,
+            EAknsCIQsnTextColorsCG10 );
+        iItemDrawer->SetHighlightedTextColor( textColor );
+        }
+    }
+
+void CNcsPopupListBox::Draw( const TRect& aRect ) const
+    {
+    CWindowGc& gc = SystemGc();
+    MAknsSkinInstance* skin = AknsUtils::SkinInstance();
+    if ( iBackgroundContext )
+        {
+        AknsDrawUtils::Background( skin, iBackgroundContext, gc, aRect );
+        }
+    else
+        {
+        gc.Clear( aRect );
+        }
+    CEikListBox::Draw( aRect );
+    }
+
 // End of File
 
--- a/emailuis/emailui/src/ncssubjectfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/emailui/src/ncssubjectfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -597,3 +597,7 @@
         }
     }
 
+void CNcsSubjectField::EnableKineticScrollingL(CAknPhysics*  aPhysics)
+    {
+    iTextEditor->EnableKineticScrollingL(aPhysics);
+    }
--- a/emailuis/uicomponents/group/fs_generic.mmp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/uicomponents/group/fs_generic.mmp	Wed Apr 14 15:42:15 2010 +0300
@@ -141,5 +141,6 @@
 LIBRARY               aknphysics.lib
 LIBRARY               cmaillogger.lib
 LIBRARY 			  aknicon.lib
+LIBRARY               touchfeedback.lib
 
 DEFFILE               fs_generic_alf.def
--- a/emailuis/uicomponents/src/fscontrolbutton.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/uicomponents/src/fscontrolbutton.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -28,6 +28,8 @@
 
 #include <AknUtils.h>
 
+#include <touchfeedback.h> // for MTouchFeedback
+
 #include "fscontrolbutton.h"
 #include "fscontrolbuttonmodel.h"
 #include "fscontrolbuttonvisualiser.h"
@@ -665,6 +667,13 @@
                 if( HitTest( aEvent.PointerEvent().iParentPosition ) )
                     {
                     iTouchPressed = ETrue;
+					// added for tactile feedback
+					MTouchFeedback* feedback = MTouchFeedback::Instance();
+					if (feedback)
+						{
+						feedback->InstantFeedback(ETouchFeedbackBasic);
+						}
+					
                     GrabPointerEvents( ETrue );
                     result = iParent.HandleButtonEvent(
                         MFsControlButtonObserver::EEventButtonTouchPressed,
--- a/emailuis/widget/hsps/00/manifest.dat	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/widget/hsps/00/manifest.dat	Wed Apr 14 15:42:15 2010 +0300
@@ -34,6 +34,6 @@
     </localization>
 
     <!-- Instances of widget per one homescreen -->	
-    <multiinstance>5</multiinstance>
+    <multiinstance>6</multiinstance>
 	
 </package>
\ No newline at end of file
--- a/emailuis/widget/loc/emailwidget.loc	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailuis/widget/loc/emailwidget.loc	Wed Apr 14 15:42:15 2010 +0300
@@ -29,3 +29,9 @@
 // r: TB9.1
 #define qtn_hscr_ew_email_count "%0U (%1N)"
 
+//d: Notifies user that active homescreen is full
+//l: popup_note_window
+//w:
+//r: TB9.2
+//
+#define qtn_cmail_hs_widget_full_notification "Active homescreen is full. Mail widget should be added manually to homescreen."
--- a/ipsservices/ipssosplugin/src/ipsplgsmtpservice.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsmtpservice.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -554,7 +554,7 @@
       {
       
       //const TUid KCRUidEMailCharsets = {0x20018441};    // korea needs different default charset
-          const TInt KoreanMib = 36; // magic number to read from cen rep would be better
+          const TInt KoreanMib = 38; // magic number to read from cen rep would be better
             
 		  CCnvCharacterSetConverter* charConv = NULL;
 		  TRAPD( err, charConv = CCnvCharacterSetConverter::NewL() );
--- a/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Wed Mar 31 21:08:33 2010 +0300
+++ b/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Wed Apr 14 15:42:15 2010 +0300
@@ -62,7 +62,7 @@
         MENU_ITEM
             {
             command = EAknCmdHelp;
-            txt = qtn_clipb_litxt_help;
+            txt = qtn_options_help;
             },
         MENU_ITEM
             {
--- a/ipsservices/ipssossettings/inc/ipssetuifolderlistarray.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/ipsservices/ipssossettings/inc/ipssetuifolderlistarray.h	Wed Apr 14 15:42:15 2010 +0300
@@ -23,6 +23,27 @@
 #include <msvstd.h>     // TMsvId  
 #include <bamdesca.h>   // MDesCArray
 
+/**
+ * Help class to be used for transfering tree structure of folders 
+ * to list structure of visible items - inline class
+ */
+class TArrayFolderItem 
+    {
+private:
+    TMsvId iId;           // folder id
+    TMsvId iParent;       // parent folder or mailbox id for root
+    TInt   iIndentLevel;  // level of indentation
+public: 
+    TArrayFolderItem ( TMsvId aId, TInt32 aParent, TInt32 aIndentLevel );  
+    ~TArrayFolderItem(); 
+    TMsvId Id( void ); 
+    TInt32 Parent( void ); 
+    TInt32 IndentLevel( void );  
+    }; // TArrayFolderItem  
+
+//  CIpsSetUiFolderListArray does not have inline definitions
+#include "ipssetuifolderlistarray.inl" 
+
 class CMsvEntry;
 /**
  * Array class to be used by CIpsSetUiSubscriptionDialog
@@ -138,6 +159,14 @@
      */
     TBool DoContextHasChildFoldersL( TMsvId aId ) const;
 
+    /**
+     * RefreshFolderListArrayL - for recursive filling in the iArrayBuf 
+     * @param aIdFolder, id of folder to be checked for children
+     * @param aArrayIndex, id of the array index to be written to
+     * @param aIndentLevel, indent level for new item - increases with recursion
+     * @return void
+     */
+    void RefreshFolderListArrayL( TMsvId aIdFolder, TInt & aArrayIndex, TInt aIndentLevel );
 private:
 
 // data
@@ -168,8 +197,14 @@
      * Number of items.
      */
     TInt            iCount;
+
+    /**
+     * transform tree to list buffer
+     */
+    RPointerArray<TArrayFolderItem> iArrayBuf;  
+
     };
 
 #endif
 
-// End of File
\ No newline at end of file
+// End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ipsservices/ipssossettings/inc/ipssetuifolderlistarray.inl	Wed Apr 14 15:42:15 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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"
+* 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:  class TArrayFolderItem inline functions
+*
+*/
+
+
+inline TArrayFolderItem::TArrayFolderItem ( 
+        TMsvId aId, TInt32 aParent, TInt32 aIndentLevel ) : 
+        iId( aId ), iParent( aParent ), iIndentLevel( aIndentLevel ) 
+    {
+    FUNC_LOG;
+    };
+    
+inline TArrayFolderItem::~TArrayFolderItem()
+    {
+    FUNC_LOG;
+    };
+    
+inline TMsvId TArrayFolderItem::Id( void ) 
+    { 
+    return iId; 
+    }; 
+    
+inline TInt32 TArrayFolderItem::Parent( void ) 
+    { 
+    return iParent; 
+    }; 
+    
+inline TInt32 TArrayFolderItem::IndentLevel( void ) 
+    { 
+    return iIndentLevel; 
+    };
--- a/ipsservices/ipssossettings/src/ipssetuifolderlistarray.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuifolderlistarray.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -27,6 +27,11 @@
 
 #include "ipssetuifolderlistarray.h"
 
+// how the indentation is done 
+_LIT( KIndentString, ".." ); 
+const TInt KIndentStringLength = 2;  // KIndentString().Length();
+#define KMaxIndentLevel 3
+
 // ----------------------------------------------------------------------------
 // CIpsSetUiFolderListArray::NewL
 // ----------------------------------------------------------------------------
@@ -51,6 +56,7 @@
 CIpsSetUiFolderListArray::~CIpsSetUiFolderListArray()
     {
     FUNC_LOG;
+    iArrayBuf.ResetAndDestroy();
     delete iText;
     delete iEntry;
     }
@@ -83,18 +89,50 @@
 
 // ----------------------------------------------------------------------------
 // CIpsSetUiFolderListArray::MdcaPoint
+// list item contains: icon_index separator item_text
 // ----------------------------------------------------------------------------
 //
 TPtrC CIpsSetUiFolderListArray::MdcaPoint( TInt aIndex ) const
     {
     FUNC_LOG;
-    const TMsvEmailEntry emailEntry( (*iEntry)[aIndex] );
-
+    //    const TMsvEmailEntry emailEntry( (*iEntry)[aIndex] );
+    
+// firstly switch to correct directory to search for folders
+    TMsvId origFolder = iEntry->EntryId();
+    TArrayFolderItem * const pArrayItem = iArrayBuf[aIndex]; // not owning
+    TMsvId targetFolder = pArrayItem->Parent();
+    // if item has subitem it follows immediately
+    TBool itemHasChildFolders( ( aIndex < (iCount - 1) ) 
+          && (iArrayBuf[aIndex+1]->Parent() == pArrayItem->Id() ) );
+// return value init
     TPtr tempText = iText->Des();
     tempText.Zero();
 
+    TInt result( KErrNone );
+    if ( origFolder != targetFolder ) 
+        {
+        TRAP( result, iEntry->SetEntryL( targetFolder ) );
+        }
+    TMsvEmailEntry emailEntry;
+    if ( KErrNone == result )
+        {
+        TRAP( result, emailEntry = iEntry->ChildDataL( pArrayItem->Id() ) );
+        }
+
+    if ( KErrNone != result )    
+        {    // Handle error.
+            // item index dir or item
+            tempText.AppendNum( ( itemHasChildFolders 
+                ? EIpsSetUiFolderSubfoldersUnsubbed 
+                : EIpsSetUiFolderSingleUnsubbed ) );
+            tempText.Append( KColumnListSeparator );
+            // but name can't be find
+            return tempText;
+        }
+//    const TMsvEmailEntry emailEntry( curentEntry );
+
     TInt iconIndex = 0;
-    if ( ContextHasChildFolders( emailEntry.Id() ) )
+    if ( itemHasChildFolders )
         {
         iconIndex = ( emailEntry.LocalSubscription() ?
             EIpsSetUiFolderSubfoldersSubbed : EIpsSetUiFolderSubfoldersUnsubbed );
@@ -104,14 +142,27 @@
         iconIndex = ( emailEntry.LocalSubscription() ?
             EIpsSetUiFolderSingleSubbed : EIpsSetUiFolderSingleUnsubbed );
         }
+    
     tempText.AppendNum( iconIndex );
     tempText.Append( KColumnListSeparator );
-    tempText.Append(
-        emailEntry.iDetails.Left( KIpsSetUiMaxSettingsTextLength ) );
 
+    // add indentation text of subfolders 2,4 or 6 dots 
+    TInt i = ( ( pArrayItem->IndentLevel() >= KMaxIndentLevel ) 
+            ? KMaxIndentLevel : pArrayItem->IndentLevel() );
+    TInt siz ( KIpsSetUiMaxSettingsTextLength -  i * KIndentStringLength ); 
+    for ( ; i > 0; i-- ) 
+        {
+        tempText.Append(KIndentString);
+        }
+
+    // add item text
+    tempText.Append( emailEntry.iDetails.Left( siz ) );
+    
     return tempText;
+    
     }
 
+
 // ----------------------------------------------------------------------------
 // CIpsSetUiFolderListArray::MdcaCount
 // ----------------------------------------------------------------------------
@@ -129,7 +180,8 @@
 TMsvId CIpsSetUiFolderListArray::Id( TInt aIndex )
     {
     FUNC_LOG;
-    return (*iEntry)[aIndex].Id();
+//    return (*iEntry)[aIndex].Id();
+    return iArrayBuf[aIndex]->Id();
     }
 
 // ----------------------------------------------------------------------------
@@ -140,12 +192,6 @@
     {
     FUNC_LOG;
     iEntry->SetEntryL( aFolderId );
-
-    CMsvEntrySelection* sel = iEntry->ChildrenWithTypeL( KUidMsvFolderEntry );
-    iCount = sel->Count();
-    delete sel;
-    sel = NULL;
-
     }
 
 // ----------------------------------------------------------------------------
@@ -185,20 +231,9 @@
         KMsvGroupByType, EMsvSortByDetails, ETrue );
     CMsvEntry* entry = CMsvEntry::NewL(iSession, aId, selectionOrdering);
     CleanupStack::PushL( entry );
-    TInt index=entry->Count()-1;
-    while (index>=0 && (*entry)[index].iType!=KUidMsvFolderEntry)
-        {
-        index--;
-        }
-
+    TBool retval ( ( entry->Count() > 0 ) && ( KUidMsvFolderEntry == (*entry)[0].iType ) ); 
     CleanupStack::PopAndDestroy( entry );
-
-    if(index!=-1)
-        {
-        return ETrue;
-        }
-
-    return EFalse;
+    return retval;
     }
 
 // ----------------------------------------------------------------------------
@@ -239,7 +274,6 @@
             }
         }
 
-
     CleanupStack::Pop( sel );
     return sel;
     }
@@ -254,10 +288,12 @@
     return ( iEntry->Count() > 0 ? ETrue : EFalse );
     }
 
+
 // ----------------------------------------------------------------------------
 // CIpsSetUiFolderListArray::RefreshFolderListArrayL
+// original function 
 // ----------------------------------------------------------------------------
-//
+
 void CIpsSetUiFolderListArray::RefreshFolderListArrayL()
     {
     FUNC_LOG;
@@ -266,7 +302,8 @@
         delete iEntry;
         iEntry = NULL;
         }
-
+    iCount = 0;
+    
     iEntry = iSession.GetEntryL( iMailboxId );
     const TMsvSelectionOrdering originalOrdering=iEntry->SortType();
     TMsvSelectionOrdering newOrdering=originalOrdering;
@@ -275,10 +312,59 @@
     newOrdering.SetSorting( EMsvSortByDetails );
     iEntry->SetSortTypeL(newOrdering);
 
+    // code to fill in internal array
+    TInt arrayIndex(0);
+    TInt size = iArrayBuf.Count();
+    iArrayBuf.ResetAndDestroy();
+    if ( size > 8 )
+        {
+        iArrayBuf.ReserveL(size);
+        } 
+    RefreshFolderListArrayL(iMailboxId, arrayIndex, 0);
+    iArrayBuf.Compress();
+    iCount = iArrayBuf.Count();
+    
+    }
+
+// ----------------------------------------------------------------------------
+// CIpsSetUiFolderListArray::RefreshFolderListArrayL(
+//      TMsvId aIdFolder, TInt & aArrayIndex, TInt aIndentLevel)
+// recursion function to fill in / refresh iArrayBuf.
+// ----------------------------------------------------------------------------
+void CIpsSetUiFolderListArray::RefreshFolderListArrayL(
+                       TMsvId aIdFolder, TInt & aArrayIndex, TInt aIndentLevel)
+    {
+    TMsvId origFolder = iEntry->EntryId();
+    if ( origFolder != aIdFolder ) 
+        iEntry->SetEntryL( aIdFolder );
     CMsvEntrySelection* sel = iEntry->ChildrenWithTypeL( KUidMsvFolderEntry );
-    iCount = sel->Count();
-    delete sel;
-    sel = NULL;
+    CleanupStack::PushL( sel );
+    TInt count = sel->Count();
+    for (TInt i = 0; i < count; i++)
+        {
+        const TMsvEmailEntry emailEntry( (*iEntry)[i] );
+        TArrayFolderItem * item = new (ELeave) TArrayFolderItem( emailEntry.Id(), aIdFolder, aIndentLevel );
+        CleanupStack::PushL( item );
+        if ( iArrayBuf.Count() > aArrayIndex + 1 )
+            {
+            if ( iArrayBuf[aArrayIndex] ) 
+                {
+                delete iArrayBuf[aArrayIndex];
+                }
+            iArrayBuf[aArrayIndex] = item;
+            }
+        else
+            {
+            iArrayBuf.AppendL( item );
+            }
+//        iArrayBuf.Insert( item, aArrayIndex );
+        aArrayIndex++;
+        CleanupStack::Pop( item );
+        // recursion is here
+        RefreshFolderListArrayL(emailEntry.Id(), aArrayIndex, aIndentLevel + 1 );
+        }
+    CleanupStack::PopAndDestroy( sel );
+    iEntry->SetEntryL( origFolder );
     }
 
 // End of File
--- a/ipsservices/ipssossettings/src/ipssetuifoldersubscription.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuifoldersubscription.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -179,21 +179,7 @@
 void CIpsSetUiSubscriptionDialog::PreLayoutDynInitL()
     {
     FUNC_LOG;
-    // <cmail>
-    
-    /*TBool refreshed = EFalse;
-    CAknQueryDialog* confDialog = CAknQueryDialog::NewL();
-    if( confDialog->ExecuteLD( R_IPS_SET_CONNECT_FOR_UPDATE ) )
-        {
-        refreshed = ETrue;
-        CreateOperationL( EIpsSetUiRefreshFolderList );
-        }
-	
-    if( refreshed )
-        {
-        iFolderListArray->RefreshFolderListArrayL();
-        }*/
-    // </cmail>
+
     CEikColumnListBox* listBox =
         static_cast< CEikColumnListBox* >( Control( EIpsSetUiIdFolderListBox ) );
 
@@ -261,7 +247,12 @@
     {
     FUNC_LOG;
     TMsvId folderId = CurrentFolder();
-    if ( folderId == KErrNotFound )
+    TInt flags = static_cast<CEikColumnListBox*>( 
+            Control( EIpsSetUiIdFolderListBox ) )->ItemDrawer()->Flags(); 
+    TBool bSelectionVisible( (flags & CListItemDrawer::EPaintedSelection )
+          && !( flags & CListItemDrawer::EDisableHighlight ) );
+
+    if ( folderId == KErrNotFound || !bSelectionVisible )
         {
         if ( aResourceId == R_IPS_SET_SETTINGS_SUBSCRIBE_MENUPANE )
             {
@@ -325,19 +316,13 @@
 // ----------------------------------------------------------------------------
 //
 void CIpsSetUiSubscriptionDialog::HandleSessionEventL(TMsvSessionEvent aEvent,
-                    TAny* aArg1, TAny* /*aArg2*/, TAny* /*aArg3*/)
+                    TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
     {
     FUNC_LOG;
     if(aEvent!=EMsvEntriesChanged)
         return;
-
-    CMsvEntrySelection& sel=*static_cast<CMsvEntrySelection*>(aArg1);
-    if(sel.Find(CurrentFolder())!=KErrNotFound)
-        {
-        CEikColumnListBox* listBox = static_cast<CEikColumnListBox*>(
-                                            Control(EIpsSetUiIdFolderListBox));
-        listBox->DrawNow();
-        }
+    static_cast<CEikColumnListBox*>(
+        Control(EIpsSetUiIdFolderListBox))->DrawDeferred();
     }
 
 // ----------------------------------------------------------------------------
@@ -368,27 +353,9 @@
     		break;
 
     	case EIpsSetUiFolderOpenFolder:
-    		// open folder which has subfolders...
+    		// open folder which has subfolders.- no need to change the list now
     		iContextEntry->SetEntryL( CurrentFolder() );
-    		if ( ContextHasChildFolders() )
-    			{
-    			iOpenedFolderId = CurrentFolder();
-    			iFolderListArray->ChangEIpsSetUiFolderL( CurrentFolder() );
-    			if ( listBox->Model()->NumberOfItems() )
-    				{
-    				listBox->SetTopItemIndex( 0 );
-    				listBox->SetCurrentItemIndex( 0 );
-    				}
-    			if ( oldCount > listBox->Model()->NumberOfItems() )
-    				{
-    				listBox->HandleItemRemovalL();
-    				}
-    			else
-    				{
-    				listBox->HandleItemAdditionL();
-    				}
-    			}
-    		break;
+            break;
 
     	case EIpsSetUiRefreshFolderList:
     		// Always after successfull update go to root view,
@@ -497,13 +464,7 @@
 				Control( EIpsSetUiIdFolderListBox ) );
 		iContextEntry->SetEntryL( CurrentFolder() );
 
-		if ( listBox->Model()->NumberOfItems() &&
-			 ContextHasChildFolders() )
-			{
-			//if has childs, open folder
-			OkToExitL( EIpsSetUiFolderOpenFolder );
-			}
-		else
+        if ( listBox->Model()->NumberOfItems() )
 			{
 			//if not, change subs state of the folder
 			const TMsvEmailEntry emailEntry( iContextEntry->Entry() );
@@ -1077,7 +1038,6 @@
 TInt CIpsSetUiSubscriptionDialog::GetResourceForMiddlekey()
     {
     FUNC_LOG;
-//#ifdef MSK
     TInt resource = KErrNotFound;
         
         switch( CheckMSKState() )
@@ -1097,11 +1057,6 @@
             }
     
     return resource;
-/*
-#else
-    return KErrNotFound;
-#endif        
-*/    
     }
 
 //<cmail>
--- a/meetingrequest/mrgui/inc/cmrlistpane.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/inc/cmrlistpane.h	Wed Apr 14 15:42:15 2010 +0300
@@ -21,6 +21,8 @@
 // INCLUDES
 #include <coecntrl.h>
 #include <aknlongtapdetector.h>
+#include <touchlogicalfeedback.h>
+
 #include "mmrphysicsobserver.h"
 #include "mmrfieldcontainerobserver.h"
 
@@ -33,6 +35,7 @@
 class MMRScrollBarObserver;
 class CESMRField;
 class MESMRCalEntry;
+class MTouchFeedback;
 
 // CLASS DECLARATIONS
 NONSHARABLE_CLASS( CMRListPane ) : 
@@ -159,6 +162,7 @@
         
     private: // From MMRPhysicsObserver
         void PhysicsEmulationEnded();
+        void UpdateScrollBarDuringOngoingPhysics();
         
     private: // From MAknLongTapDetectorCallBack
         void HandleLongTapEventL(
@@ -178,6 +182,8 @@
         void UpdateClickedField( const TPointerEvent &aPointerEvent );
         TBool HiddenFocus();
         void ForwardReceivedPointerEventsToChildrenL();
+        void HandleTactileFeedback( const TTouchLogicalFeedback& aType );
+        TBool FeedbackScrollMarginExceeded( TInt aMargin );
         
     private: // Data
         /// Ref: Storage for list items.
@@ -204,6 +210,12 @@
         /// Own: Record if the long tapping event have been comsumed, if yes, 
         /// then do not handle signal pointer event anymore.
         TBool iLongTapEventConsumed;
+        /// Ref: Reference to tactile feedback
+        MTouchFeedback* iTactileFeedback;
+        /// Own: This records vertical scroll index for tactile feedback
+        TInt iPreviousVerticalScrollIndex;
+        /// Own: This records default field height for tactile feedback during scroll
+        TInt iDefaultFieldHeight;
     };
     
 #endif // CMRLISTPANE_H
--- a/meetingrequest/mrgui/inc/mmrphysicsobserver.h	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/inc/mmrphysicsobserver.h	Wed Apr 14 15:42:15 2010 +0300
@@ -37,6 +37,12 @@
      * scroll bar and focus.
      */
     virtual void PhysicsEmulationEnded() = 0;
+    
+    /**
+     * Method to be called when physics wants to notify scroll bar that 
+     * view position has changed, so that scroll bar can update itself
+     */
+    virtual void UpdateScrollBarDuringOngoingPhysics() = 0;
     };
 
 #endif // MMRPHYSICSOBSERVER_H
--- a/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuildercommon/src/cesmrrichtextviewer.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 *  Description : CEikRichTextEditor based Rich Text viewer
-*  Version     : %version: e002sa32#36 %
+*  Version     : %version: e002sa32#37 %
 *
 */
 
@@ -348,6 +348,7 @@
                         {
                         if ( link != GetSelectedLink() )
                             {
+                            iCntMenuHdlr->Reset();
                             iCntMenuHdlr->SetContactMenuObserver( this );
                             HighlightLinkL( *link );
                             DrawDeferred();
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmralarmfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmralarmfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -425,10 +425,10 @@
     if(aCommand == EESMRCmdOpenAlarmQuery ||
        aCommand == EAknCmdOpen )
         {
+		HandleTactileFeedbackL();
+		
         ExecuteMSKCommandL();
         isUsed = ETrue;
-        
-        HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrcheckbox.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrcheckbox.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -124,12 +124,12 @@
     // EAknCmdOpen is added for the Pointer events, see ListPane
     if( aCommand == EESMRCmdCheckEvent || aCommand == EAknCmdOpen )
         {
+    	HandleTactileFeedbackL();
+    
         HandleCheckEventL();
         SwitchMSKLabelL();
         SendFieldChangeEventL( EESMRFieldAllDayEvent );
         isUsed = ETrue;
-        
-        HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrlocationfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
  *  Description : ESMR location field implementation
- *  Version     : %version: e002sa33#52 %
+ *  Version     : %version: e002sa32#53 %
  *
  */
 
@@ -648,8 +648,8 @@
     if( iTitle->Rect().Contains( aPosition ) ||
             iFieldButton->Rect().Contains( aPosition ) )
         {
+		HandleTactileFeedbackL();
         NotifyEventL( EAknSoftkeyContextOptions );
-        HandleTactileFeedbackL();
         ret = ETrue;
         }
 
@@ -729,8 +729,8 @@
     if( iTitle->Rect().Contains( aPosition ) ||
             iFieldButton->Rect().Contains( aPosition ) )
         {
+		HandleTactileFeedbackL();
         NotifyEventL( EAknSoftkeyContextOptions );
-        HandleTactileFeedbackL();
         }
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrpriorityfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrpriorityfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -264,10 +264,10 @@
     if( aCommand == EESMRCmdOpenPriorityQuery ||
         aCommand == EAknCmdOpen )
         {
+    	HandleTactileFeedbackL();
+    	
         ExecutePriorityQueryL();
         isUsed = ETrue;
-        
-        HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrrecurencefield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrrecurencefield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -195,10 +195,10 @@
     if (aCommand == EESMRCmdOpenRecurrenceQuery ||
     	aCommand == EAknCmdOpen )
         {
+    	HandleTactileFeedbackL();
+    	
         ExecuteRecurrenceQueryL();
         isUsed = ETrue;
-        
-        HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsyncfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrsyncfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -176,10 +176,10 @@
     if(aCommand == EESMRCmdOpenSyncQuery ||
        aCommand == EAknCmdOpen )
         {
+    	HandleTactileFeedbackL();
+    	
         ExecuteSyncQueryL();
         isUsed = ETrue;
-        
-        HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cesmrviewerlocationfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -134,7 +134,7 @@
     		CMRImage::NewL( NMRBitmapManager::EMRBitmapLocationWaypoint, ETrue );
     		iWaypointIcon->SetParent( this );
     		}
-    	}    
+    	}
     }
 
 // ---------------------------------------------------------------------------
@@ -393,7 +393,7 @@
     // Move focus rect so that it's relative to field's position.
     bgRect.Move( -Position() );
     SetFocusRect( bgRect );
-    
+
     // Failures are ignored.
     TRAP_IGNORE(
     		// Try setting font
@@ -428,11 +428,6 @@
         {
         HandleTapEventL( aPosition );
         }
-    else
-        {
-        // Reset action menu after link selection
-        iRichTextViewer->ResetActionMenuL();
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -479,7 +474,7 @@
 		{
 		return;
 		}
-	
+
 	CESMRField::LockL();
 
 	delete iWaypointIcon;
@@ -487,7 +482,7 @@
 	iWaypointIcon = CMRImage::NewL( NMRBitmapManager::EMRBitmapLockField, ETrue );
 
 	iWaypointIcon->SetParent( this );
-	iWaypointIcon->SetObserver( this );	 
+	iWaypointIcon->SetObserver( this );
 	}
 
 // ---------------------------------------------------------------------------
@@ -524,7 +519,8 @@
                 // Clear viewer selection
                 iRichTextViewer->ClearSelectionL();
                 iRichTextViewer->DrawDeferred();
-        		
+                iRichTextViewer->ResetActionMenuL();
+
                 // Show context menu
                 HandleTactileFeedbackL();
                 NotifyEventL( EAknSoftkeyContextOptions );
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmralarmonofffield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmralarmonofffield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -237,11 +237,11 @@
     // EAknCmdOpen is added for the Pointer events, see ListPane
     if( aCommand == EESMRCmdAlarmOn || aCommand == EESMRCmdAlarmOff 
             || aCommand == EAknCmdOpen )
-        {    
+        {
+		HandleTactileFeedbackL();
+		
         SwitchMiddleSoftKeyL();
         isUsed = ETrue;
-        
-		HandleTactileFeedbackL();
         }
     return isUsed;
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrattachmentsfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrattachmentsfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -491,10 +491,6 @@
     else if ( aCommand == EESMREditorAddAttachment )
         {
         handled = AddAttachmentL();
-        if( handled )
-        	{
-			HandleTactileFeedbackL();
-        	}
         }
 
     else if ( IsValidAttachmentEditorCommand(aCommand) &&
@@ -851,11 +847,9 @@
         {
         if( Rect().Contains( aPosition ) )
             {
+			HandleTactileFeedbackL();
+			
             ret = AddAttachmentL();
-            if( ret )
-            	{
-				HandleTactileFeedbackL();
-            	}
             }
         }
     // Otherwise only the title and the fieldIcon will
@@ -865,11 +859,9 @@
         if( iTitle->Rect().Contains( aPosition ) ||
                 iFieldIcon->Rect().Contains( aPosition ) )
             {
-            ret = AddAttachmentL();
-            if( ret )
-            	{
-				HandleTactileFeedbackL();
-            	}
+			HandleTactileFeedbackL();
+			
+			ret = AddAttachmentL();
             }
         }
 
@@ -888,29 +880,20 @@
         {
         if( Rect().Contains( aPosition ) )
             {
-            if( AddAttachmentL() )
-            	{
-				HandleTactileFeedbackL();
-            	}
+			AddAttachmentL();
             }
         }
     else
         {
         if ( iRichTextViewer->Rect().Contains( aPosition ) )
             {
-            if( iRichTextViewer->LinkSelectedL() )
-            	{
-				HandleTactileFeedbackL();
-            	}
+			iRichTextViewer->LinkSelectedL();
             }
 
         if( iTitle->Rect().Contains( aPosition ) ||
                 iFieldIcon->Rect().Contains( aPosition ) )
             {
-            if( AddAttachmentL() )
-            	{
-				HandleTactileFeedbackL();
-            	}
+			AddAttachmentL();
             }
         }
     }
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrmulticalenfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -152,10 +152,10 @@
         		    	
 		else if( iTypeChangeEnabled )
             {
+			HandleTactileFeedbackL();
+		
 		    ExecuteTypeQueryL();
             isUsed = ETrue;
-            
-    		HandleTactileFeedbackL();
             }
         }
 
@@ -355,7 +355,19 @@
     
     // Move focus rect so that it's relative to field's position.
     viewerRect.Move( -Position() );
-    SetFocusRect( viewerRect );
+    
+    TAknLayoutRect bgLayoutRect = 
+        NMRLayoutManager::GetLayoutRect( 
+                rect, NMRLayoutManager::EMRLayoutTextEditorBg );
+    TRect bgRect( bgLayoutRect.Rect() );
+    
+    // Adjust background rect according to viewerRect 
+    bgRect.SetWidth( viewerRect.Width() );
+    
+    // Move focus rect so that it's relative to field's position.
+    bgRect.Move( -Position() );
+        
+    SetFocusRect( bgRect );
     }
 
 // ---------------------------------------------------------------------------
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrunifiededitorfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -410,7 +410,20 @@
 
     // Move focus rect so that it's relative to field's position.
     viewerRect.Move( -Position() );
-    SetFocusRect( viewerRect );
+
+    TAknLayoutRect bgLayoutRect = 
+        NMRLayoutManager::GetLayoutRect( 
+                rect, NMRLayoutManager::EMRLayoutTextEditorBg );
+    TRect bgRect( bgLayoutRect.Rect() );
+    
+    // Adjust background rect according to viewerRect 
+    bgRect.SetWidth( viewerRect.Width() );
+    
+    // Move focus rect so that it's relative to field's position.
+    bgRect.Move( -Position() );
+        
+    SetFocusRect( bgRect );
+    
         
     TAknTextComponentLayout editorLayout(
     		NMRLayoutManager::GetTextComponentLayout(
--- a/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderplugin/src/cmrviewerattachmentfield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -776,10 +776,7 @@
 
     if ( iRichTextViewer->Rect().Contains( aPosition ) )
         {
-        if( iRichTextViewer->LinkSelectedL() )
-        	{
-			HandleTactileFeedbackL();
-        	}
+        iRichTextViewer->LinkSelectedL();
         }
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrattendeefield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrattendeefield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -1077,10 +1077,10 @@
     if( iTitle->Rect().Contains( aPosition ) ||
             iFieldButton->Rect().Contains( aPosition ) )
         {
+    	HandleTactileFeedbackL();
+    	
         iContactHandler->GetAddressesFromPhonebookL( this );
         ret = ETrue;
-        
-		HandleTactileFeedbackL();
         }
 
     return ret;
@@ -1098,7 +1098,6 @@
             iFieldButton->Rect().Contains( aPosition ) )
         {
         NotifyEventL( EAknSoftkeyContextOptions );
-		HandleTactileFeedbackL();
         }
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponsefield.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -592,6 +592,7 @@
 
     if ( Rect().Contains( aPosition ) )
         {
+		HandleTactileFeedbackL();
         if ( iConflicted )
             {
             TRect conflictItemRect = iResponseItemArray[KConflictItemIndex]->Rect();
--- a/meetingrequest/mrgui/src/cmrlistpane.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/src/cmrlistpane.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -21,9 +21,11 @@
 #include "cesmrfield.h"
 #include "cmrfieldcontainer.h"
 #include "cmrlistpanephysics.h"
+#include "nmrlayoutmanager.h"
 
 #include <eikscrlb.h>
 #include <aknutils.h>
+#include <touchfeedback.h>
 
 //DEBUG
 #include "emailtrace.h"
@@ -54,7 +56,6 @@
 
     return index;
     }
-
 }
 
 //----- MEMBER FUNCTIONS ----
@@ -600,9 +601,12 @@
     
     if( !iPhysicsActionOngoing )
     	{    
-		// Offer pointer event to long tap detector
-		iLongtapDetector->PointerEventL( aPointerEvent );
-	
+		// Offer pointer event to long tap detector if event occures within fields
+		if( iFieldContainer->Rect().Contains( aPointerEvent.iPosition ) )
+			{
+			iLongtapDetector->PointerEventL( aPointerEvent );
+			}
+
 		SetFocusAfterPointerEventL( aPointerEvent );
 		
         // If longtap event has been handled, then do not handle signal event anymore.
@@ -650,6 +654,55 @@
     }
 
 // ---------------------------------------------------------------------------
+// CMRListPane::UpdateScrollBarDuringOngoingPhysics
+// ---------------------------------------------------------------------------
+//
+void CMRListPane::UpdateScrollBarDuringOngoingPhysics()
+    {
+    FUNC_LOG;
+    TInt verticalScrollIndex( iPhysics->VerticalScrollIndex() );
+    iScrollModel.SetFocusPosition( verticalScrollIndex );
+
+	iScroll.SetModel( &iScrollModel );
+
+	// Update the new thumb position to view's
+	// iScrollBarThumbPosition member.
+	iScrollBarObserver.ScrollBarPositionChanged( 
+			iScroll.ThumbPosition() );
+	
+	iScroll.DrawDeferred();
+	
+	if( FeedbackScrollMarginExceeded( 
+			Abs( verticalScrollIndex - iPreviousVerticalScrollIndex ) ) )
+		{
+		HandleTactileFeedback( ETouchFeedbackSlider );
+
+		iPreviousVerticalScrollIndex = verticalScrollIndex;
+		}
+    }
+	
+// ---------------------------------------------------------------------------
+// CESMRField::HandleTactileFeedback
+// ---------------------------------------------------------------------------
+//
+void CMRListPane::HandleTactileFeedback( 
+		const TTouchLogicalFeedback& aType )
+	{
+	FUNC_LOG;
+
+	if( !iTactileFeedback )
+		{
+		// Aquire tactile feedback pointer from TLS
+		iTactileFeedback = MTouchFeedback::Instance();
+		}
+	
+	if ( iTactileFeedback && iTactileFeedback->FeedbackEnabledForThisApp() )
+		{
+		iTactileFeedback->InstantFeedback( aType );
+		}
+    }
+
+// ---------------------------------------------------------------------------
 // CMRListPane::SetFocusAfterPointerEventL
 // ---------------------------------------------------------------------------
 //
@@ -742,4 +795,34 @@
     return hiddenFocus;
     }
 
+// ---------------------------------------------------------------------------
+// CMRListPane::FeedbackScrollMarginExceeded
+// ---------------------------------------------------------------------------
+//
+TBool CMRListPane::FeedbackScrollMarginExceeded( TInt aMargin )
+    {
+	/*
+	 * This compares given margin to default one row
+	 * field height, and returns ETrue if margin is exceeded.
+	 * Otherwise EFalse.
+	 */
+	TBool ret( EFalse );
+	
+	if( !iDefaultFieldHeight )
+		{
+		TAknLayoutRect fieldLayoutRect( 
+			NMRLayoutManager::GetFieldLayoutRect( 
+					iFieldContainer->Rect(), 1 ) );
+		
+		iDefaultFieldHeight = fieldLayoutRect.Rect().Height();
+		}
+
+	if( aMargin > iDefaultFieldHeight )
+		{
+		ret = ETrue;
+		}
+	
+    return ret;
+    }
+
 // End of file
--- a/meetingrequest/mrgui/src/cmrlistpanephysics.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/meetingrequest/mrgui/src/cmrlistpanephysics.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -242,7 +242,10 @@
     if ( aDrawNow )
         {
         iParent.DrawDeferred();
-        }        
+        }
+    
+    // Vertical scroll index has changed, we need to update scroll bar also
+    iPhysicsObserver.UpdateScrollBarDuringOngoingPhysics();
     }
 
 // ---------------------------------------------------------------------------