Revision: 201009 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 15 Mar 2010 12:39:10 +0200
branchRCL_3
changeset 11 0396474f30f5
parent 10 f5907b1a1053
child 12 4ce476e64c59
Revision: 201009 Kit: 201010
email_plat/email_client_api/inc/memailaddress.h
emailservices/emailclientapi/inc/emailtextcontent.h
emailservices/emailclientapi/src/emailclientapiimpl.cpp
emailservices/emailclientapi/src/emailmailbox.cpp
emailservices/emailclientapi/src/emailmessage.cpp
emailservices/emailclientapi/src/emailmultipart.cpp
emailservices/emailclientapi/src/emailtextcontent.cpp
emailservices/emailframework/commonlib/group/FSFWCommonLib.mmp
emailservices/emailframework/commonlib/inc/CFSMailCommon.h
emailservices/emailframework/commonlib/src/CFSMailBox.cpp
emailservices/emailframework/commonlib/src/CFSMailRequestHandler.cpp
emailservices/emailframework/data/fsmailbrandmanager.rss
emailservices/emailframework/inc/CFSClientAPIRequestHandler.h
emailservices/emailframework/src/CFSClientAPI.cpp
emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp
emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp
emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp
emailservices/emailserver/group/fsmailserver.mmp
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/group/bld.inf
emailservices/emailstore/base_plugin/inc/BasePlugin.h
emailservices/emailstore/base_plugin/inc/basepluginresourceloader.h
emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp
emailservices/emailstore/base_plugin/src/basepluginresourceloader.cpp
emailservices/emailstore/message_store/client/api/MsgStoreTypes.h
emailservices/emailstore/message_store/server/inc/ContainerStoreContentManager.h
emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp
emailservices/emailstore/message_store/server/src/MessageStoreServer.cpp
emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp
emailservices/emailstore/tsrc/message_store_test/group/t_msgstore.mmp
emailservices/emailstore/tsrc/message_store_test/group/t_msgstore_nrm.mmp
emailservices/emailstore/tsrc/message_store_test/src/ObserverTests.cpp
emailservices/psmruadapter/group/PsMruAdapter.mmp
emailservices/psmruadapter/src/CPsMruAdapter.cpp
emailuis/emailui/data/FreestyleEmailUi.rss
emailuis/emailui/data/html/email.js
emailuis/emailui/data/iconlist.txt
emailuis/emailui/group/FreestyleEmailUi.mmp
emailuis/emailui/inc/FreestyleEmailDownloadInformationMediator.h
emailuis/emailui/inc/FreestyleEmailUi.hrh
emailuis/emailui/inc/FreestyleEmailUiAppui.h
emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h
emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h
emailuis/emailui/inc/FreestyleEmailUiUtilities.h
emailuis/emailui/inc/ncscomposeview.h
emailuis/emailui/loc/freestyleemailui.loc
emailuis/emailui/sendasmtm/fsmtms/client/src/cfsclientmtm.cpp
emailuis/emailui/sendasmtm/fsmtms/uidata/src/cfsuidatamtm.cpp
emailuis/emailui/sendasmtm/sendashelper/src/cfssendashelper.cpp
emailuis/emailui/sis/commonemail.pkg
emailuis/emailui/sis/commonemail_loc.pkg
emailuis/emailui/sis/commonemail_udeb.pkg
emailuis/emailui/sis/commonemail_udeb_loc.pkg
emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp
emailuis/emailui/src/FreestyleEmailUiAppui.cpp
emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp
emailuis/emailui/src/FreestyleEmailUiAttachmentsListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
emailuis/emailui/src/FreestyleEmailUiLayoutHandler.cpp
emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListModel.cpp
emailuis/emailui/src/FreestyleEmailUiUtilities.cpp
emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp
emailuis/emailui/src/OverlayControl.cpp
emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp
emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp
emailuis/emailui/src/ncscomposeview.cpp
emailuis/emailui/src/ncscomposeviewcontainer.cpp
emailuis/emailui/src/ncseditor.cpp
emailuis/emailui/src/ncsheadercontainer.cpp
emailuis/emailui/src/ncsutility.cpp
emailuis/uicomponents/src/fstextparser.cpp
emailuis/uicomponents/src/fstextviewervisualizerdata.cpp
emailuis/uicomponents/src/fstreeiterator.cpp
emailuis/widget/emailwidgetsettings/src/emailwidgetsettingslistview.cpp
emailuis/widget/rom/emailwidget_resources.iby
ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp
ipsservices/ipssosplugin/inc/ipsplgconnectandrefreshfolderlist.h
ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp
ipsservices/ipssosplugin/src/ipsplgimap4moveremoteop.cpp
ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp
ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp
ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp
ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp
ipsservices/ipssossettings/src/ipssetview.cpp
meetingrequest/mrcommon/group/esmrcommon.mmp
--- a/email_plat/email_client_api/inc/memailaddress.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/email_plat/email_client_api/inc/memailaddress.h	Mon Mar 15 12:39:10 2010 +0200
@@ -49,7 +49,7 @@
     
     /**
      * Sets email address
-     * @param address e.g 'john@domain.com'
+     * @param email address 
      */
     virtual void SetAddressL( const TDesC& aAddress ) = 0;
     
--- a/emailservices/emailclientapi/inc/emailtextcontent.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/inc/emailtextcontent.h	Mon Mar 15 12:39:10 2010 +0200
@@ -103,6 +103,8 @@
 public: // for internal usage
     void SetOwner( const TDataOwner aOwner );
     
+    static const TDesC& CheckParameterFormatL( const TDesC& aParam );
+    
 private:
     CEmailTextContent( const TDataOwner aOwner );
     
--- a/emailservices/emailclientapi/src/emailclientapiimpl.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/src/emailclientapiimpl.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -37,7 +37,7 @@
 #include "emailmailboxcache.h"
 #include "FreestyleEmailUiConstants.h"
 #include "emailclientapi.hrh"
-#include "FreestyleEmailCenRepKeys.h"
+#include "freestyleemailcenrepkeys.h"
 #include "FreestyleEmailUiConstants.h"
 // ---------------------------------------------------------------------------
 // CEmailClientApi::MailboxL
@@ -143,7 +143,7 @@
     if ( aPolicy == EShowLastUnseenMailbox)
         {
         CRepository* emailRepository = CRepository::NewL( KFreestyleEmailCenRep );
-		CleanupStack::PushL(emailRepository);
+        CleanupStack::PushL(emailRepository);
         TInt numberOfMailboxes(0);
         TInt inboxId(0);
         TInt pluginId(0);
--- a/emailservices/emailclientapi/src/emailmailbox.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/src/emailmailbox.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -349,6 +349,7 @@
 void CEmailMailbox::EditNewMessageL()
     {
     TEditorLaunchParams editorLaunchData;
+    editorLaunchData.iExtra = NULL;
     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMailboxId);
     editorLaunchData.iActivatedExternally = ETrue;
 
--- a/emailservices/emailclientapi/src/emailmessage.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/src/emailmessage.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -825,6 +825,7 @@
 void CEmailMessage::ReplyToMessageL( const TBool aReplyToAll )
     {
     TEditorLaunchParams editorLaunchData;
+    editorLaunchData.iExtra = NULL;
     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
@@ -844,6 +845,7 @@
 void CEmailMessage::ForwardMessageL()
     {
     TEditorLaunchParams editorLaunchData;
+    editorLaunchData.iExtra = NULL;
     editorLaunchData.iMailboxId = FsMsgId(iPluginData, iMessageId.iFolderId.iMailboxId);
     editorLaunchData.iFolderId = FsMsgId(iPluginData, iMessageId.iFolderId);
     editorLaunchData.iMsgId = FsMsgId(iPluginData, iMessageId);
--- a/emailservices/emailclientapi/src/emailmultipart.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/src/emailmultipart.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -105,21 +105,24 @@
     CFSMailMessagePart* copy = iEmailMsgContent->Part().ChildPartL(partId);
     
     const TDesC& contentType = copy->GetContentType();
+    const TDesC& compareString = CEmailTextContent::CheckParameterFormatL( contentType );
+
     TMessageContentId msgContentId = TMessageContentId( 
             copy->GetPartId().Id(),
             Id().iMessageId.iId,
             Id().iMessageId.iFolderId.iId,
             Id().iMessageId.iFolderId.iMailboxId ); 
-    if (!contentType.Compare(KFSMailContentTypeTextPlain) || 
-        !contentType.Compare(KFSMailContentTypeTextHtml))
+   
+    if (!compareString.Compare(KFSMailContentTypeTextPlain) || 
+        !compareString.Compare(KFSMailContentTypeTextHtml))
         {                                
         content = CEmailTextContent::NewL( iEmailMsgContent->PluginData(), msgContentId, copy, EClientOwns );
         }
-    else if (!contentType.Compare(KFSMailContentTypeMultipartMixed) ||
-             !contentType.Compare(KFSMailContentTypeMultipartAlternative) ||
-             !contentType.Compare(KFSMailContentTypeMultipartDigest) ||
-             !contentType.Compare(KFSMailContentTypeMultipartRelated) ||
-             !contentType.Compare(KFSMailContentTypeMultipartParallel))
+    else if (!compareString.Compare(KFSMailContentTypeMultipartMixed) ||
+             !compareString.Compare(KFSMailContentTypeMultipartAlternative) ||
+             !compareString.Compare(KFSMailContentTypeMultipartDigest) ||
+             !compareString.Compare(KFSMailContentTypeMultipartRelated) ||
+             !compareString.Compare(KFSMailContentTypeMultipartParallel))
         {
         content = CEmailMultipart::NewL( iEmailMsgContent->PluginData(), msgContentId, copy, EClientOwns );
         }
@@ -174,7 +177,7 @@
     iChildPartCount = iChildParts.Count();
     CleanupStack::Pop();
     
-    /* ToDo: Construct multipart  */
+
     
     return;
     }
--- a/emailservices/emailclientapi/src/emailtextcontent.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailclientapi/src/emailtextcontent.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -48,12 +48,14 @@
         CFSMailMessagePart* aPart )
     {
     iEmailMsgContent = CEmailMessageContent::NewL( aPluginData, aMsgContentId, aPart );
-    if (!aPart->GetContentType().Compare(KFSMailContentTypeTextHtml))
+
+    if (!CheckParameterFormatL( aPart->GetContentType() ).Compare(KFSMailContentTypeTextHtml))
         {
         iTextType = EHtmlText;        
         }
     }
 
+
 // -----------------------------------------------------------------------------
 // 
 // -----------------------------------------------------------------------------
@@ -316,6 +318,47 @@
 // 
 // -----------------------------------------------------------------------------
 //
+const TDesC& CEmailTextContent::CheckParameterFormatL( const TDesC& aParam )
+    {    
+    _LIT( KSeparator, ";" );
+    _LIT( KSlash, "/" );
+    // Check for a type separator in the string
+    TInt endPos = aParam.Find( KSeparator );
+    // Construct the compare string
+    TPtrC extractString( aParam.Left( endPos ) );
+    HBufC* compareBuf = extractString.AllocLC();
+    TPtr compareString = compareBuf->Des();
+    TInt slashPos = aParam.Find( KSlash );
+    TInt stringLen = compareString.Length();
+         
+    const TDesC& leftPart = extractString.Left( slashPos );
+    HBufC* leftPartBuf = leftPart.AllocLC();
+    TPtr leftPartString = leftPartBuf->Des();
+    leftPartString.Trim();
+         
+    const TDesC& rightPart = extractString.Right( stringLen - ( slashPos + 1 ) );
+    HBufC* rightPartBuf = rightPart.AllocLC();
+    TPtr rightPartString = rightPartBuf->Des();
+    rightPartString.Trim();
+         
+    compareString.Delete( 0, endPos );
+    compareString.Append( leftPartString );
+    compareString.Append( KSlash );
+    compareString.Append( rightPartString );
+    compareString.LowerCase();   
+    CleanupStack::PopAndDestroy( rightPartBuf );
+    CleanupStack::PopAndDestroy( leftPartBuf );
+    
+    const TDesC& retParam = compareString;
+    CleanupStack::PopAndDestroy( compareBuf );
+    
+    return retParam;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
 void CEmailTextContent::SetOwner( const TDataOwner aOwner )
     {
     iOwner = aOwner;
--- a/emailservices/emailframework/commonlib/group/FSFWCommonLib.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/commonlib/group/FSFWCommonLib.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -63,6 +63,4 @@
 LIBRARY       eikcore.lib
 LIBRARY       avkon.lib
 
-#ifdef TRACE_INTO_FILE
 LIBRARY       flogger.lib
-#endif // TRACE_INTO_FILE
--- a/emailservices/emailframework/commonlib/inc/CFSMailCommon.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/commonlib/inc/CFSMailCommon.h	Mon Mar 15 12:39:10 2010 +0200
@@ -480,6 +480,12 @@
         // aParam2: TDesC* aCustomMessage or NULL (optional)
         // aParam3: MFSMailExceptionEventCallback* aCallback or NULL (optional)
         TFSEventException,
+        
+        // Mail deleted from viewer
+        // aParam1: RArray<TFSMailId>* aEntries
+        // aParam2: TFSMailId* aParentFolder
+        // aParam3: NULL
+        TFSEventMailDeletedFromViewer,
         };
         
 /**
--- a/emailservices/emailframework/commonlib/src/CFSMailBox.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/commonlib/src/CFSMailBox.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -132,6 +132,7 @@
     {
     FUNC_LOG;
     TFSProgress progress;
+    progress.iError = EFalse;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         progress = plugin->GetLastSyncStatusL( GetId() );       
@@ -148,6 +149,7 @@
     FUNC_LOG;
 
     TFSPendingRequest request;
+    request.iRequestId = 0;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
         // init asynchronous request
@@ -173,6 +175,7 @@
     FUNC_LOG;
 
     TFSPendingRequest request;
+    request.iRequestId = 0;
     MFSMailRequestObserver* observer = NULL;
     if(CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid(GetId()))
         {
--- a/emailservices/emailframework/commonlib/src/CFSMailRequestHandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/commonlib/src/CFSMailRequestHandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -56,6 +56,9 @@
         // close file server connection
         iFs.Close();        
         }
+    
+    // clear TLS
+    Dll::FreeTls();
     }
 
 // -----------------------------------------------------------------------------
--- a/emailservices/emailframework/data/fsmailbrandmanager.rss	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/data/fsmailbrandmanager.rss	Mon Mar 15 12:39:10 2010 +0200
@@ -359,7 +359,7 @@
                     },
                     
                     BRAND {
-                        // Definition of AT&T Yahoo! Mail brand   
+                        // Definition of ... Yahoo! Mail brand   
                         graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
 
                         brand_id_match_strings =
@@ -425,7 +425,7 @@
                             },
 
                             BRAND {
-                                // Definition of Rogers Yahoo! Mail brand   
+                                // Definition of ... Yahoo! Mail brand   
                                 graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
 
                                 brand_id_match_strings =
--- a/emailservices/emailframework/inc/CFSClientAPIRequestHandler.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/inc/CFSClientAPIRequestHandler.h	Mon Mar 15 12:39:10 2010 +0200
@@ -36,17 +36,16 @@
 	{
 
 public:
-  
+	
     /**
-     * destructor.
-     */
-     ~CFSClientAPIRequestHandler();
-
+    * To prevent deleting handler when is still needed
+    */
+    void ReleaseInstance();
+	
     /**
-     * two based constructor
-     *
-     */
-     static CFSClientAPIRequestHandler* NewL( MEmailClientPluginManager* aPluginManager);
+    * Returns instance of request handler
+    */
+    static CFSClientAPIRequestHandler* GetInstanceL( MEmailClientPluginManager* aPluginManager );
 	
     /**
      * returns plugin pointer related to plugin id
@@ -64,13 +63,26 @@
   	 CFSClientAPIRequestHandler(  MEmailClientPluginManager* aPluginManager );
   	 
     /**
-     * two based constructor
+     * two phased constructor
      */
      void ConstructL( );
 
+private: // methods
+     
+    /**
+    * destructor.
+    */
+    ~CFSClientAPIRequestHandler();
+	
+    /**
+    * two phased constructor
+    *
+    */
+    static CFSClientAPIRequestHandler* NewL( MEmailClientPluginManager* aPluginManager);
 
 private: // data
 
+    TInt iInstanceCounter;
     MEmailClientPluginManager* iPluginManager;
     };
 
--- a/emailservices/emailframework/src/CFSClientAPI.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/src/CFSClientAPI.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -33,7 +33,7 @@
 CFSClientAPI::~CFSClientAPI()
     {
     FUNC_LOG;
-    delete iAPIRequestHandler;
+    iAPIRequestHandler->ReleaseInstance();
     }
 
 // -----------------------------------------------------------------------------
@@ -55,6 +55,6 @@
 void CFSClientAPI::ConstructL(MEmailClientPluginManager* aPluginManager)
     {
     FUNC_LOG;
-    iAPIRequestHandler = CFSClientAPIRequestHandler::NewL(aPluginManager);
+    iAPIRequestHandler = CFSClientAPIRequestHandler::GetInstanceL( aPluginManager );
     }
 
--- a/emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailframework/src/CFSClientAPIRequestHandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -26,24 +26,53 @@
 // CFSMailRequestHandler::CFSMailRequestHandler
 // -----------------------------------------------------------------------------
 CFSClientAPIRequestHandler::CFSClientAPIRequestHandler(  
-    MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager)
+    MEmailClientPluginManager* aPluginManager ) : iPluginManager(aPluginManager), iInstanceCounter( 1 )
 {
     FUNC_LOG;
-
-	// store pointer to TLS
-	TInt err = Dll::SetTls(static_cast<TAny*>(this));
 }
 
 // -----------------------------------------------------------------------------
 // CFSMailRequestHandler::~CFSMailRequestHandler
 // -----------------------------------------------------------------------------
-
 CFSClientAPIRequestHandler::~CFSClientAPIRequestHandler()
     {
     FUNC_LOG;
     }
 
 // -----------------------------------------------------------------------------
+// CFSMailRequestHandler::GetInstanceL
+// -----------------------------------------------------------------------------
+CFSClientAPIRequestHandler* CFSClientAPIRequestHandler::GetInstanceL( MEmailClientPluginManager* aPluginManager )
+    {
+    CFSClientAPIRequestHandler *requestHandler = static_cast<CFSClientAPIRequestHandler*>( Dll::Tls() );
+    if ( requestHandler == NULL )
+        {
+        requestHandler = CFSClientAPIRequestHandler::NewL( aPluginManager );
+        }
+    else
+        {
+        requestHandler->iInstanceCounter++;
+        }
+	
+    return requestHandler;
+    }
+
+// -----------------------------------------------------------------------------
+// CFSMailRequestHandler::ReleaseInstance
+// -----------------------------------------------------------------------------
+void CFSClientAPIRequestHandler::ReleaseInstance()
+    {
+    if( iInstanceCounter > 1 )
+        {
+        iInstanceCounter--;
+        }
+    else
+        {
+        delete this;
+        }
+    }
+
+// -----------------------------------------------------------------------------
 // CFSMailRequestHandler::NewL
 // -----------------------------------------------------------------------------
 CFSClientAPIRequestHandler* CFSClientAPIRequestHandler::NewL( 
--- a/emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/cmailhandlerplugin/group/cmailhandlerplugin.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -102,7 +102,4 @@
 LIBRARY                         egul.lib
 LIBRARY                         apparc.lib
 LIBRARY                         cmaillogger.lib
-
-#ifdef TRACE_INTO_FILE
 LIBRARY                         flogger.lib
-#endif // TRACE_INTO_FILE
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -880,11 +880,14 @@
                                  {
                                  iInstIdList.AppendL( contentid.AllocL() );
                                  }
-                             TInt widgetInstance = FindWidgetInstanceId(cid->Des());
-                             PublishSetupWizardL(widgetInstance);
-                             iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des());
-                             // Widget visible on the homescreen. Publishing allowed.
-                             iAllowedToPublish[widgetInstance] = ETrue;
+                             TInt widgetInstance = FindWidgetInstanceId(cid->Des()); 
+                             if(widgetInstance>=0)// coverity fix, index can be negativ, allowed 0, since it is valid index
+                                 {
+                                 PublishSetupWizardL(widgetInstance);
+                                 iMailCpsHandler->UpdateMailboxesL(widgetInstance, cid->Des());
+                                 // Widget visible on the homescreen. Publishing allowed.
+                                 iAllowedToPublish[widgetInstance] = ETrue;
+                                 }
                              CleanupStack::PopAndDestroy( cid );
                              }
                          else if (trigger.Compare(KPluginStartup16) == 0)
@@ -1012,7 +1015,7 @@
     {
     FUNC_LOG;
     // Clean up all published data
-    if( !iMsgInterface ) GetMessagingInterfaceL();
+    if( iMsgInterface == NULL) GetMessagingInterfaceL(); // Coverity fix, it does not like !iMsgInterface comparison
     CLiwGenericParamList* inParam = &(iServiceHandler->InParamListL());
     CLiwGenericParamList* outParam = &(iServiceHandler->OutParamListL());
 
--- a/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -33,12 +33,13 @@
 
 _LIT( KDefaultEmailTone, "z:\\data\\sounds\\digital\\Message 1.aac");
 _LIT8( KEmailBeepSequence, "\x2\x4a\x3a\x51\x9\x95\x95\xc0\x4\x0\xb\x1c\x41\x8d\x51\xa8\x0\x0" );
+_LIT( KProfileSilentTone, "Z:\\resource\\No_Sound.wav" );
 
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
-void CFSMailSoundHandler::DriveStateChangedL( TBool /*aState*/ )
+void CFSMailSoundHandler::DriveStateChangedL(TBool /*aState*/)
     {
     //causes a reload of soundpayer
     iState->ProfileChanged();
@@ -56,8 +57,8 @@
         new( ELeave ) CFSMailSoundHandler( aOwner );
     CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;	
+    CleanupStack::Pop(self);
+    return self;
     }
 
 // ---------------------------------------------------------------------------
@@ -68,8 +69,8 @@
     {
     FUNC_LOG;
 
-    SetObserving( ETrue );
-    
+    SetObserving(ETrue);
+
     iProfileEngine = CreateProfileEngineL();
     iHandler = CProfileChangeNotifyHandler::NewL( this );
     iMsgToneSubscriber = CPSSubscriber::NewL(
@@ -78,16 +79,15 @@
 
     // After sound state initialization iState is valid pointer until
     // CEmailSoundState::Uninitialize is called in the destructor.
-    CEmailSoundState::InitializeL( this );
+    CEmailSoundState::InitializeL(this);
     }
 
 // ---------------------------------------------------------------------------
 // 
 // ---------------------------------------------------------------------------
 //
-CFSMailSoundHandler::CFSMailSoundHandler(
-    MFSNotificationHandlerMgr& aOwner ) :
-    CFSNotificationHandlerBase( aOwner )
+CFSMailSoundHandler::CFSMailSoundHandler( MFSNotificationHandlerMgr& aOwner )
+: CFSNotificationHandlerBase(aOwner)
     {
     FUNC_LOG;
     }
@@ -98,8 +98,8 @@
 //
 CFSMailSoundHandler::~CFSMailSoundHandler()
     {
-    FUNC_LOG;         
-    if ( iProfileEngine )
+    FUNC_LOG;
+    if (iProfileEngine)
         {
         iProfileEngine->Release();
         iProfileEngine = NULL;
@@ -108,7 +108,7 @@
     ReleaseAudioPlayer();
     delete iDriveObserver;
     delete iMsgToneSubscriber;
-    CEmailSoundState::Uninitialize( iState );
+    CEmailSoundState::Uninitialize(iState);
     }
 
 // ---------------------------------------------------------------------------
@@ -116,12 +116,8 @@
 // Home Screen status.
 // ---------------------------------------------------------------------------
 //
-void CFSMailSoundHandler::HandleEventL(
-    TFSMailEvent aEvent,
-    TFSMailMsgId aMailbox,
-    TAny* aParam1,
-    TAny* aParam2,
-    TAny* aParam3 )
+void CFSMailSoundHandler::HandleEventL(TFSMailEvent aEvent,
+        TFSMailMsgId aMailbox, TAny* aParam1, TAny* aParam2, TAny* aParam3)
     {
     FUNC_LOG;
     // assumption: base class handles event only if it is TFSEventNewMail
@@ -136,21 +132,22 @@
 // 
 // ---------------------------------------------------------------------------
 //
-void CFSMailSoundHandler::SetState( CEmailSoundState* aNewState )
+void CFSMailSoundHandler::SetState(CEmailSoundState* aNewState)
     {
     FUNC_LOG;
     INFO_1( "email sound state => %d", (TInt) aNewState )
     iState = aNewState;
 #ifdef __HANDLER_TEST 
     // for module testing
-    if ( iTesterReqStatus ) {  
+    if ( iTesterReqStatus )
+        {
         TRequestStatus*& status = iTesterReqStatus;
         User::RequestComplete( status, KErrNone );
         iTesterReqStatus = NULL;
         }
 #endif    
     }
-    
+
 // ---------------------------------------------------------------------------
 // Returns audio player utility
 // ---------------------------------------------------------------------------
@@ -165,9 +162,10 @@
 // play from Audio player.
 // ---------------------------------------------------------------------------
 //
-void CFSMailSoundHandler::HandleActiveProfileEventL( TProfileEvent /*aPE*/, TInt /*aId*/ ) 
+void CFSMailSoundHandler::HandleActiveProfileEventL(TProfileEvent /*aPE*/,
+        TInt /*aId*/ )
     {
-    FUNC_LOG;                                                    
+    FUNC_LOG;
     // iState should never be null
     __ASSERT_ALWAYS( iState, Panic ( ECmailHandlerPluginPanicNullState ) );
     iState->ProfileChanged();
@@ -188,7 +186,7 @@
     if ( aError )
         {
         delete iAudioPlayer;
-        iAudioPlayer = NULL;        
+        iAudioPlayer = NULL;
         iState->AudioInitFailed();
         }
     else
@@ -202,7 +200,7 @@
 // Audio player.
 // ---------------------------------------------------------------------------
 //
-void CFSMailSoundHandler::MapcPlayComplete( TInt /*aError*/ ) 
+void CFSMailSoundHandler::MapcPlayComplete(TInt /*aError*/)
     {
     FUNC_LOG;
     // iState should never be null
@@ -222,23 +220,22 @@
     FUNC_LOG;
     delete iAudioPlayer;
     iAudioPlayer = NULL;
-    
+
     MProfile* profile = iProfileEngine->ActiveProfileL();
-    CleanupReleasePushL( *profile );
+    CleanupReleasePushL(*profile);
 
-    TBool vibraEnabled = profile->ProfileTones().ToneSettings().iEmailVibratingAlert;
-
+    TBool vibraEnabled = profile->ProfileTones().ToneSettings().iVibratingAlert;
+    TBool mailVibraEnabled = vibraEnabled & profile->ProfileTones().ToneSettings().iEmailVibratingAlert;
 
     TInt preference = KAudioPrefNewSpecialMessage;
-    if ( !vibraEnabled )
+    if ( !mailVibraEnabled )
         {
-        preference = EMdaPriorityPreferenceTimeAndQuality;
+        preference = EMdaPriorityPreferenceQuality;
         }
 
-    if ( IsBeepOnceSetL( *profile ) )
+    if (IsBeepOnceSetL(*profile))
         {
-        
-        
+
         // create audio player based on hard coded sequence
         // (Platform does not offer any "play platform-wide beep" service)
         iAudioPlayer = CMdaAudioPlayerUtility::NewDesPlayerReadOnlyL(
@@ -252,8 +249,17 @@
         // Otherwise loading tone from file
         TFileName fileToPlay = profile->ProfileExtraTones().EmailAlertTone();
         
+        if ( (fileToPlay.Compare(KProfileSilentTone) == 0) &&
+                (!vibraEnabled) )
+            {
+            // Play the silent tone with KAudioPrefNewSpecialMessage
+            // in order to avoid the distortion
+			// KAudioPrefNewSpecialMessage does not play vibra if KProfileSilentTone is played
+            preference = KAudioPrefNewSpecialMessage;
+            }
         RFs fs;
         TInt err = fs.Connect();
+		CleanupClosePushL( fs );
             
         if ( err == KErrNone )
             {
@@ -276,7 +282,7 @@
                 fileToPlay.Append( KDefaultEmailTone );
                 }
             
-            fs.Close();
+		    CleanupStack::PopAndDestroy( &fs );
             }
         
         iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( 
@@ -285,7 +291,7 @@
                 KAudioPriorityRecvMsg, 
                 static_cast<TMdaPriorityPreference>( preference ) );
         }
-    CleanupStack::PopAndDestroy( profile );  // profile
+    CleanupStack::PopAndDestroy( profile );
     }
 
 // ---------------------------------------------------------------------------
@@ -337,21 +343,21 @@
 // IsBeepOnceSetL
 // ---------------------------------------------------------------------------
 //
-TBool CFSMailSoundHandler::IsBeepOnceSetL( const MProfile& aProfile ) const
+TBool CFSMailSoundHandler::IsBeepOnceSetL(const MProfile& aProfile) const
     {
     FUNC_LOG;
     // default to false
     TBool ret = EFalse;
-    
+
     // get tone settings    
     const TProfileToneSettings& toneSettings = aProfile.ProfileTones().ToneSettings();
     
     // if beep-once is set, set return value to ETrue
-    if( toneSettings.iRingingType == EProfileRingingTypeBeepOnce )
+    if (toneSettings.iRingingType == EProfileRingingTypeBeepOnce)
         {
         ret = ETrue;
-        }    
-    
+        }
+
     return ret;
     }
 
@@ -362,8 +368,8 @@
 void CFSMailSoundHandler::HandlePropertyChangedL( const TUid& aCategory, TInt aKey )
     {
     FUNC_LOG;
-    TInt state( 0 );
-    
+    TInt state(0);
+
     //
     // Handling the event of user pressing a key while "msg received" -tone is playing
     //
@@ -371,7 +377,7 @@
         {
         RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsMessageToneQuit, state );
         INFO_1("KCoreAppUIsMessageToneQuit == %d" , state );
-        if ( state == ECoreAppUIsStopTonePlaying )
+        if (state == ECoreAppUIsStopTonePlaying)
             {
             iState->StopTone();
             iMsgToneSubscriber->Cancel();
--- a/emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/cmailhandlerplugin/src/fsnotificationhandlerbaseimpl.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -25,8 +25,8 @@
 #include "fsnotificationhandlerbase.h"
 #include "cmailhandlerpluginpanic.h"
 #include "commonemailcrkeys.h"
-#include "FreestyleEmailCenRepKeys.h"
-#include "FreestyleEmailuiConstants.h"
+#include "freestyleemailcenrepkeys.h"
+#include "FreestyleEmailUiConstants.h"
 
 
 // ======== MEMBER FUNCTIONS ========
@@ -178,28 +178,28 @@
     {
     FUNC_LOG;
     if ( aEvent != TFSEventMailboxDeleted )
-    	{
-    	CFSMailBox* mailBox( MailClient().GetMailBoxByUidL( aMailbox ) );
-    	if ( mailBox == NULL )
-    		{
-    		User::Leave( KErrArgument );
-    		}
+        {
+        CFSMailBox* mailBox( MailClient().GetMailBoxByUidL( aMailbox ) );
+        if ( mailBox == NULL )
+            {
+            User::Leave( KErrArgument );
+            }
 
-    	if ( mailBox->HasCapability( EFSMBoxCapaNewEmailNotifications ) )
-    		{
-    		delete mailBox;
-    		return EFalse;
-    		}
-    	else
-    		{
-    		delete mailBox;
-    		return ETrue;
-    		}
-    	}
+        if ( mailBox->HasCapability( EFSMBoxCapaNewEmailNotifications ) )
+            {
+            delete mailBox;
+            return EFalse;
+            }
+        else
+            {
+            delete mailBox;
+            return ETrue;
+            }
+        }
     else
-    	{
-    	return ETrue;
-    	}
+        {
+        return ETrue;
+        }
     }
 
 void CFSNotificationHandlerBase::HandleEventL(
--- a/emailservices/emailserver/group/fsmailserver.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/group/fsmailserver.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -100,7 +100,4 @@
 LIBRARY liwservicehandler.lib
 LIBRARY cmaillogger.lib
 
-
-#ifdef TRACE_INTO_FILE
 LIBRARY flogger.lib
-#endif // TRACE_INTO_FILE
--- a/emailservices/emailserver/src/FsEmailGlobalDialogsAppUi.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailserver/src/FsEmailGlobalDialogsAppUi.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -97,7 +97,7 @@
             
             if ( iForeground && topmost && iForegroundNotTopmost )
                 {
-                // This hack ensures the screen is refreshed when going back
+                // This ensures the screen is refreshed when going back
                 // from the VKB window
                 SendToBackground();
                 BringToForeground();
--- a/emailservices/emailstore/base_plugin/BWINS/basepluginU.DEF	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/BWINS/basepluginU.DEF	Mon Mar 15 12:39:10 2010 +0200
@@ -181,4 +181,9 @@
 	?UnregisterRequestObserver@CBasePlugin@@UAEXH@Z @ 180 NONAME ; void CBasePlugin::UnregisterRequestObserver(int)
 	?UnsubscribeMailboxEvents@CBasePlugin@@UAEXABVTFSMailMsgId@@AAVMFSMailEventObserver@@@Z @ 181 NONAME ; void CBasePlugin::UnsubscribeMailboxEvents(class TFSMailMsgId const &, class MFSMailEventObserver &)
 	?WizardDataAvailableL@CBasePlugin@@UAEHXZ @ 182 NONAME ; int CBasePlugin::WizardDataAvailableL(void)
+	?LoadLC@CResourceLoader@@QAEPAVHBufC16@@H@Z @ 183 NONAME ; class HBufC16 * CResourceLoader::LoadLC(int)
+	?Fs@CResourceLoader@@QAEAAVRFs@@XZ @ 184 NONAME ; class RFs & CResourceLoader::Fs(void)
+	?NewL@CResourceLoader@@SAPAV1@ABVTDesC16@@@Z @ 185 NONAME ; class CResourceLoader * CResourceLoader::NewL(class TDesC16 const &)
+	??1CResourceLoader@@UAE@XZ @ 186 NONAME ; CResourceLoader::~CResourceLoader(void)
+	?CreateResourceReaderLC@CResourceLoader@@QBEPAVHBufC8@@AAVTResourceReader@@H@Z @ 187 NONAME ; class HBufC8 * CResourceLoader::CreateResourceReaderLC(class TResourceReader &, int) const
 
--- a/emailservices/emailstore/base_plugin/EABI/basepluginU.DEF	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/EABI/basepluginU.DEF	Mon Mar 15 12:39:10 2010 +0200
@@ -281,4 +281,13 @@
 	_ZThn4_NK21CBaseMrRecurrenceRule19RecurrenceStartTimeEv @ 280 NONAME
 	_ZThn4_NK21CBaseMrRecurrenceRule20RecurrentDaysofMonthEv @ 281 NONAME
 	_ZThn4_NK21CBaseMrRecurrenceRule4TypeEv @ 282 NONAME
+	_ZN15CResourceLoader2FsEv @ 283 NONAME
+	_ZN15CResourceLoader4NewLERK7TDesC16 @ 284 NONAME
+	_ZN15CResourceLoader6LoadLCEi @ 285 NONAME
+	_ZN15CResourceLoaderD0Ev @ 286 NONAME
+	_ZN15CResourceLoaderD1Ev @ 287 NONAME
+	_ZN15CResourceLoaderD2Ev @ 288 NONAME
+	_ZNK15CResourceLoader22CreateResourceReaderLCER15TResourceReaderi @ 289 NONAME
+	_ZTI15CResourceLoader @ 290 NONAME
+	_ZTV15CResourceLoader @ 291 NONAME
 
--- a/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -61,6 +61,8 @@
 SOURCE BaseMrInfoObject.cpp
 SOURCE basepluginfetch.cpp
 SOURCE baseplugindelayedops.cpp
+SOURCE basepluginresourceloader.cpp
+
 
 // *************************************
 // OTHER STUFF
@@ -73,6 +75,7 @@
 LIBRARY     ecom.lib
 LIBRARY     charconv.lib
 LIBRARY     bafl.lib
+LIBRARY     efsrv.lib
 
 LIBRARY     messagestoreclient.lib
 LIBRARY     fsfwcommonlib.lib
--- a/emailservices/emailstore/base_plugin/group/bld.inf	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/group/bld.inf	Mon Mar 15 12:39:10 2010 +0200
@@ -28,6 +28,7 @@
 ../inc/basemrinfoobject.h        |../../../../inc/basemrinfoobject.h
 ../inc/baseplugincommonutils.h   |../../../../inc/baseplugincommonutils.h
 ../inc/baseplugindelayedops.h    |../../../../inc/baseplugindelayedops.h
+../inc/basepluginresourceloader.h |../../../../inc/basepluginresourceloader.h
 
 PRJ_MMPFILES
 ./BasePlugin.mmp
\ No newline at end of file
--- a/emailservices/emailstore/base_plugin/inc/BasePlugin.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/inc/BasePlugin.h	Mon Mar 15 12:39:10 2010 +0200
@@ -814,7 +814,9 @@
 
         virtual ~CMailboxInfo()
             {
-            iMailBox->RemoveObserverL( iBasePlugin );
+            if ( iMailBox )
+                iMailBox->RemoveObserverL( iBasePlugin );
+
             iObservers.Close();
 
             delete iMailBoxName;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailservices/emailstore/base_plugin/inc/basepluginresourceloader.h	Mon Mar 15 12:39:10 2010 +0200
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Library to handle resource loading when 
+*              CCoeEnv is not available.
+*/
+
+#ifndef __BASEPLUGINRESOURCELOADER_H__
+#define __BASEPLUGINRESOURCELOADER_H__
+
+//  INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <barsc.h>
+
+/**
+ * Library to handle resource loading when CCoeEnv is not available.
+ */
+class CResourceLoader : public CBase
+    {
+public:
+
+    /**
+     * A constructor.
+     * @param aName a resource name
+     * @return created object.
+     */
+    IMPORT_C static CResourceLoader* NewL( const TDesC& aName );
+
+    /**
+     * Destructor
+     */
+    virtual ~CResourceLoader();
+
+    /**
+    * @return reference to opened file session
+    */
+    IMPORT_C RFs& Fs();
+    
+    /**
+     * @param aResourceId a resource key
+     * @return resource value from resource, instance ownership is transferred
+     */
+    IMPORT_C HBufC* LoadLC(TInt aResourceId );
+
+    /**
+     * @param aReader a reader
+     * @param aResourceId a resource key
+     * @return pointer to resource buffer placed on leave stack
+     */
+    IMPORT_C HBufC8* CreateResourceReaderLC( TResourceReader& aReader,TInt aResourceId ) const;
+    
+private:
+
+    /**
+    * A constructor
+    */
+    CResourceLoader();
+
+    /**
+    * A 2nd phase constructor
+    * @param aName a HTML macro, e.g. lt
+    */
+    void ConstructL( const TDesC& aName );
+
+private:
+
+    RFs iFs;
+    RResourceFile iResFile;
+    };
+
+
+#endif  // __BASEPLUGINRESOURCELOADER_H__
--- a/emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/base_plugin/src/basepluginnotifications.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -126,23 +126,32 @@
     {
     switch ( aEvent )
         {
-        // A backup or restore is in progress.  The message store is unavailable.
-        case EMsgStoreBackupOrRestoreInProgress:
-        // The message store has been wiped, including the password.
-        case EMsgStoreDatabaseWiped:
-        // The message store has transitioned from an authenticated state to an unauthenticated state.
-        case EMsgStoreNotAuthenticated:
+        // The message store is unavailable.  This may be due to 
+        // a backup or restore being in progress, a Pointsec lock being issued,
+        // the disk drive being unavailable, etc.
+        case EMsgStoreUnavailable:
             {
-            NotifyGlobalEventL( TFSMailboxUnavailable );
+            // since the store is unavailabe we are unable to get 
+            // list of mailboxes, setting plugin id only
+            TFSMailMsgId id;
+            id.SetPluginId( TUid::Uid( GetPluginId() ) );
+            NotifyGlobalEventL( TFSMailboxUnavailable, id );
             }
         break;
 
-        // The backup or restore completed.  The message store is available again.   
-        case EMsgStoreBackupOrRestoreCompleted:
-        // The message store has transitioned from an unauthenticated state to an authenticated state.
-        case EMsgStoreAuthenticated:
+        // The message store is available again.
+        case EMsgStoreAvailable:
             {
-            NotifyGlobalEventL( TFSMailboxAvailable );
+            RArray<TFSMailMsgId> mailboxes;
+            CleanupClosePushL( mailboxes );
+            ListMailBoxesL( mailboxes );
+
+            for ( TInt i( 0 ); i < mailboxes.Count(); i++ )
+                {
+                NotifyGlobalEventL( TFSMailboxAvailable, mailboxes[i] );
+                }
+
+            CleanupStack::PopAndDestroy( &mailboxes );
             }
         break;
 
@@ -151,6 +160,7 @@
         // which many message store operations have occurred.
         case EObserverEventQueueOverflow:
         //don't see anything meaningful to do here.
+        default:
         break;
         };
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailservices/emailstore/base_plugin/src/basepluginresourceloader.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Library to handle resource loading when 
+*              CCoeEnv is not available.
+*
+*/
+
+
+#include <barsread.h>
+#include <bautils.h>
+#include "basepluginresourceloader.h"
+
+EXPORT_C CResourceLoader* CResourceLoader::NewL( const TDesC& aName )
+    {
+    CResourceLoader* temp = new( ELeave ) CResourceLoader();
+    CleanupStack::PushL( temp );
+    temp->ConstructL( aName );
+    CleanupStack::Pop( temp );
+    return temp;
+    }
+
+CResourceLoader::CResourceLoader()
+    {
+    }
+
+void CResourceLoader::ConstructL( const TDesC& aFilename )
+    {
+    User::LeaveIfError( iFs.Connect() );
+    TFileName aFile(aFilename);
+    BaflUtils::NearestLanguageFile( iFs, aFile );
+    iResFile.OpenL( iFs, aFile );
+    iResFile.ConfirmSignatureL();
+    }
+
+EXPORT_C CResourceLoader::~CResourceLoader()
+    {
+    iResFile.Close();
+    iFs.Close();
+    }
+
+EXPORT_C RFs& CResourceLoader::Fs() 
+    {
+    return iFs;
+    }
+
+EXPORT_C HBufC* CResourceLoader::LoadLC(TInt aResourceId)
+    {
+    TResourceReader reader;
+    HBufC8* readBuffer = CreateResourceReaderLC( reader, aResourceId );
+    TPtrC textdata = reader.ReadTPtrC();
+    
+    HBufC16* textBuffer = HBufC16::NewL( textdata.Length() );
+    *textBuffer = textdata;
+    CleanupStack::PopAndDestroy(readBuffer);
+    CleanupStack::PushL( textBuffer );
+    return textBuffer;
+    }
+
+EXPORT_C HBufC8* CResourceLoader::CreateResourceReaderLC(TResourceReader& aReader,TInt aResourceId) const
+    {
+    HBufC8* readBuffer = iResFile.AllocReadLC( aResourceId );
+    aReader.SetBuffer( readBuffer );
+    return readBuffer;
+    }
+        
--- a/emailservices/emailstore/message_store/client/api/MsgStoreTypes.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/message_store/client/api/MsgStoreTypes.h	Mon Mar 15 12:39:10 2010 +0200
@@ -71,18 +71,23 @@
 /** Defines the system events of which observers receive notification. */
 enum TMsgStoreSystemEvent
 	{
-	// A backup or restore is in progress.  The message store is unavailable.
-	EMsgStoreBackupOrRestoreInProgress = KMsgStoreSystemEventMin,
-	
-	// The backup or restore completed.  The message store is available again.
-	EMsgStoreBackupOrRestoreCompleted,
+    // Available and Unavailable events have been added which include the
+    // status of backup/restore and Pointsec.  It is recommended that these
+    // new events be used to determine Msg Store availability.
+    // Backup/restore events and Pointsec events left for backwards compatibility.
+    
+    // A backup or restore is in progress.
+    EMsgStoreBackupOrRestoreInProgress = KMsgStoreSystemEventMin,
+    
+    // The backup or restore completed.
+    EMsgStoreBackupOrRestoreCompleted,
     
     // PointSec has locked the file system, all operations are suspendded
     EMsgStorePointSecLockStarted,
     
     // PointSec has unlocked the file system, all operations are resumed
     EMsgStorePointSecLockEnded,
-	
+    
 	// The message store has been wiped, including the password.
 	EMsgStoreDatabaseWiped,
 
@@ -95,7 +100,15 @@
 	// The observer event queue has overflowed and has been reset, so events have been lost.  This
 	// shouldn't happen unless the client thread has been starved for an extended period of time, during
 	// which many message store operations have occurred.
-	EObserverEventQueueOverflow
+	EObserverEventQueueOverflow,
+	
+    // The message store is unavailable.  This may be due to 
+    // a backup or restore being in progress, a Pointsec lock being issued,
+    // the disk drive being unavailable, etc.
+    EMsgStoreUnavailable,
+    
+    // All lock conditions have cleared and the message store is available again.
+    EMsgStoreAvailable
 	
 	}; // end enum TMsgStoreSystemEvent
 	
--- a/emailservices/emailstore/message_store/server/inc/ContainerStoreContentManager.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/message_store/server/inc/ContainerStoreContentManager.h	Mon Mar 15 12:39:10 2010 +0200
@@ -110,7 +110,7 @@
          * manager.
          * @param aContentPath path and file name of an existing content file
          */
-        TInt TransferContentFile(
+        void TransferContentFileL(
             TContainerId aId, 
             const TDesC& aContentPath );
         
--- a/emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/message_store/server/src/ContainerStoreContentManager.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -564,19 +564,18 @@
 /**
  *
  */
-TInt CContainerStoreContentManager::TransferContentFile(
+void CContainerStoreContentManager::TransferContentFileL(
     TContainerId aId, 
     const TDesC& aContentPath )
     {
-    __LOG_ENTER( "TransferContentFile" )
+    __LOG_ENTER( "TransferContentFileL" )
     
     TFileName contentFilename;  
     ContentFilename( aId, contentFilename );
     
-    TInt err = iFs.Rename( aContentPath, contentFilename ); 
+    User::LeaveIfError( iFs.Replace( aContentPath, contentFilename ) );
     
     __LOG_EXIT
-    return err;
     }
 
             
--- a/emailservices/emailstore/message_store/server/src/MessageStoreServer.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/message_store/server/src/MessageStoreServer.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -62,7 +62,7 @@
 _LIT( KUpgradeDetectionFile, "c:\\System\\EsIms\\canary.txt" );
 
 
-//const TChar KColon(':');
+
 
 // SID list
 // This is the list of secure Ids that are allowed to use the message store.  This list must be terminated
@@ -380,14 +380,30 @@
 // Cancel the shutdown timer if it was running
 // ==========================================================================
 void CMessageStoreServer::AddSession( CMessageStoreSession* aSession )
-  {
-  __LOG_ENTER( "AddSession" )
-  iSessions.Append( aSession );
+    {
+    __LOG_ENTER( "AddSession" )
+    iSessions.Append( aSession );
+
+    // notify new session of current state
+    TMsgStoreEvent event;
+    event.iType        = EMsgStoreAvailable;
+    event.iId          = KMsgStoreInvalidId;
+    event.iParentId    = KMsgStoreInvalidId;
+    event.iOtherId     = KMsgStoreInvalidId;
+    event.iFlags       = KMsgStoreFlagsNotFound;
 
-  // A sesssion was added, so the shutdown timer can be stopped.
-//  iShutdown->Stop();
-  __LOG_EXIT
-  } // end AddSession
+    if ( iLockedByBackupRestore || iLockedByPointSec ) 
+        {
+        event.iType = EMsgStoreUnavailable;
+        }
+
+    aSession->SendEventToObserver( event );
+
+    // A sesssion was added, so the shutdown timer can be stopped.
+    //  iShutdown->Stop();
+
+    __LOG_EXIT
+    } // end AddSession
 
 // ==========================================================================
 // FUNCTION: DropSession
@@ -430,6 +446,8 @@
 // ==========================================================================
 void CMessageStoreServer::CreateContainerStoreL()
     {
+    __LOG_ENTER( "CreateContainerStoreL" )
+
     TDriveNumber drive( EDriveC );
     iMessageStore = CContainerStore::NewL( KDbFilename,
                                            drive,
@@ -438,6 +456,7 @@
                                            Priority() - 1);  // lower than server
 
 
+    __LOG_EXIT
     } // end CreateContainerStoreL
 
 
@@ -882,11 +901,11 @@
 void CMessageStoreServer::BackupOrRestoreInProgress( TBool /*aIsARestore*/ )
 {
     __LOG_ENTER( "BackupOrRestoreInProgress" );
-    
-    SendSystemLockMessage( EMsgStoreBackupOrRestoreInProgress );
-    
-    if ( !iLockedByPointSec )
+
+    if ( !iLockedByBackupRestore )
         {
+        iLockedByBackupRestore = ETrue;
+        SendSystemLockMessage( EMsgStoreBackupOrRestoreInProgress );
         LockSystem();
         }
 
@@ -900,10 +919,10 @@
     {
     __LOG_ENTER( "BackupOrRestoreCompleted" );
   
-    SendSystemLockMessage( EMsgStoreBackupOrRestoreCompleted );
-      
-    if ( !iLockedByPointSec )
+    if ( iLockedByBackupRestore )
         {
+        iLockedByBackupRestore = EFalse;
+        SendSystemLockMessage( EMsgStoreBackupOrRestoreCompleted );
         TRAP_IGNORE( UnlockSystemL() );
         }
     
@@ -920,10 +939,7 @@
         {
         iLockedByPointSec = ETrue;
         SendSystemLockMessage( EMsgStorePointSecLockStarted );
-        if ( !iLockedByBackupRestore )
-            {
-            LockSystem();
-            }
+        LockSystem();
         }
     __LOG_EXIT
     }
@@ -938,10 +954,7 @@
         {
         iLockedByPointSec = EFalse;
         SendSystemLockMessage( EMsgStorePointSecLockEnded );
-        if ( !iLockedByBackupRestore )
-            {
-            TRAP_IGNORE( UnlockSystemL() );
-            }
+        TRAP_IGNORE( UnlockSystemL() );
         }
     __LOG_EXIT
     }
@@ -953,13 +966,18 @@
     {
     __LOG_ENTER( "LockSystem" );
     
-    for( TInt i = 0; i < iSessions.Count(); i++ )
+    if ( iMessageStore )
         {
-        iSessions[i]->ContainerStoreUnavailable();
-        } // end if
-
-    delete iMessageStore;
-    iMessageStore = NULL;
+        SendSystemLockMessage( EMsgStoreUnavailable );
+        
+        for( TInt i = 0; i < iSessions.Count(); i++ )
+            {
+            iSessions[i]->ContainerStoreUnavailable();
+            } // end if
+    
+        delete iMessageStore;
+        iMessageStore = NULL;
+        }
     
     __LOG_EXIT
     }
@@ -970,32 +988,37 @@
 void CMessageStoreServer::UnlockSystemL()
     {
     __LOG_ENTER( "UnlockSystemL" );
-    
-    TRAPD( result,
-            CreateContainerStoreL(); CreatePredefinedFoldersIfNeededL(); );
 
-    if( result != 0 )
+    if  ( ( !iLockedByBackupRestore ) 
+       && ( !iLockedByPointSec ) )
         {
-        __LOG_WRITE_ERROR( "failed to recreate message store after system lock" )
+        TRAPD( result,
+                CreateContainerStoreL(); CreatePredefinedFoldersIfNeededL(); );
+
+        if( result != KErrNone )
+            {
+            __LOG_WRITE_ERROR( "failed to recreate message store after system lock" )
 
-        // The server is in a very bad state.  Shut down the server immediately.
-        iShutdown->ShutDownNow();
-        }
-   else if  ( ( !iLockedByBackupRestore ) 
-           && ( !iLockedByPointSec ) )
-        {
-
-        for( TInt i = 0; i < iSessions.Count(); i++ )
+            // The server is in a very bad state.  Shut down the server immediately.
+            iShutdown->ShutDownNow();
+            }
+       else if  ( ( !iLockedByBackupRestore ) 
+               && ( !iLockedByPointSec ) )
             {
-            iSessions[i]->ContainerStoreAvailable();
+            SendSystemLockMessage( EMsgStoreAvailable );
+
+            for( TInt i = 0; i < iSessions.Count(); i++ )
+                {
+                iSessions[i]->ContainerStoreAvailable();
+                } // end if
+
+            if( iWipeAfterBackupRestore )
+                {
+                iWipeAfterBackupRestore = EFalse;
+                WipeEverythingL();
+                } // end if
+
             } // end if
-        
-        if( iWipeAfterBackupRestore )
-            {
-            iWipeAfterBackupRestore = EFalse;
-            WipeEverythingL();
-            } // end if
-
         } // end if
     
     __LOG_EXIT
--- a/emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/message_store/server/src/bufferedmessagecreator.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -509,7 +509,7 @@
         
         if ( BaflUtils::FileExists( rfs, filePath ) )
             {
-            aStore.ContentManager().TransferContentFile(
+            aStore.ContentManager().TransferContentFileL(
                 part.iParams.iId, filePath );
             }
         }
--- a/emailservices/emailstore/tsrc/message_store_test/group/t_msgstore.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/tsrc/message_store_test/group/t_msgstore.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -35,7 +35,8 @@
 USERINCLUDE     ../../../message_store/common/inc 
 USERINCLUDE     ../../../message_store/server/inc 
 
-OS_LAYER_SYSTEMINCLUDE	
+OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE   ../../../../../inc
 
 SOURCEPATH      ../src
--- a/emailservices/emailstore/tsrc/message_store_test/group/t_msgstore_nrm.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/tsrc/message_store_test/group/t_msgstore_nrm.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -36,6 +36,7 @@
 USERINCLUDE     ../../../message_store/server/inc 
 
 OS_LAYER_SYSTEMINCLUDE
+MW_LAYER_SYSTEMINCLUDE
 SYSTEMINCLUDE   ../../../../../inc
     
 SOURCEPATH      ../src
--- a/emailservices/emailstore/tsrc/message_store_test/src/ObserverTests.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/emailstore/tsrc/message_store_test/src/ObserverTests.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -98,12 +98,28 @@
 
     StartRecordingObserverEvents();         
 
+    TObserverEvent         event;
+    RArray<TObserverEvent> expectedEvents;
+
+    iLog->Log( _L("Case %d: Add observer events"), iCaseId++ );
+    
     session1->AddObserverL( this );
     session2->AddObserverL( this );
     
-    TObserverEvent         event;
-    RArray<TObserverEvent> expectedEvents;
+    // one per each session         
+    event.iMailBoxId   = -1;
+    event.iOperation   = EMsgStoreAvailable;
+    event.iType        = -1;
+    event.iFlags       = KMsgStoreFlagsNotFound;
+    event.iId          = -1;
+    event.iParentId    = -1;
+    event.iOtherId     = -1;    
+    
+    expectedEvents.AppendL( event );
+    expectedEvents.AppendL( event );
 
+    VerifyRecordedObserverEventsL( ETrue, expectedEvents );         
+    
     iLog->Log( _L("Case %d: Create Account events"), iCaseId++ );
     
     CMsgStoreAccount* account1 = CMsgStoreAccount::NewLC( KOwner1, KAccount1 ); //+3
@@ -600,6 +616,12 @@
     expectedEvents.AppendL( event );
     expectedEvents.AppendL( event );
 
+    // one per each session         
+    event.iOperation   = EMsgStoreUnavailable;
+    
+    expectedEvents.AppendL( event );
+    expectedEvents.AppendL( event );
+
     VerifyRecordedObserverEventsL( EFalse, expectedEvents );            
     
     
@@ -610,7 +632,13 @@
     expectedEvents.AppendL( event );
     expectedEvents.AppendL( event );
 
-    VerifyRecordedObserverEventsL( EFalse, expectedEvents );            
+    // one per each session         
+    event.iOperation   = EMsgStoreAvailable;
+    
+    expectedEvents.AppendL( event );
+    expectedEvents.AppendL( event );
+
+   VerifyRecordedObserverEventsL( EFalse, expectedEvents );            
         
     iLog->Log( _L("Case %d: PointSec system lock events"), iCaseId++ );
 
@@ -628,6 +656,12 @@
     expectedEvents.AppendL( event );
     expectedEvents.AppendL( event );
 
+    // one per each session         
+    event.iOperation   = EMsgStoreUnavailable;
+    
+    expectedEvents.AppendL( event );
+    expectedEvents.AppendL( event );
+
     VerifyRecordedObserverEventsL( EFalse, expectedEvents );            
     
     TriggerPointSecEventL( EFalse );
@@ -637,6 +671,12 @@
     expectedEvents.AppendL( event );
     expectedEvents.AppendL( event );
 
+    // one per each session         
+    event.iOperation   = EMsgStoreAvailable;
+    
+    expectedEvents.AppendL( event );
+    expectedEvents.AppendL( event );
+
     VerifyRecordedObserverEventsL( EFalse, expectedEvents );            
         
     
--- a/emailservices/psmruadapter/group/PsMruAdapter.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/psmruadapter/group/PsMruAdapter.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -36,7 +36,7 @@
 
 SOURCEPATH      ../src
 SOURCE          proxy.cpp
-SOURCE 			CPsMruAdapter.cpp
+SOURCE          CPsMruAdapter.cpp
 
 USERINCLUDE     ../inc
 
@@ -45,7 +45,8 @@
 
 LIBRARY     euser.lib
 LIBRARY     eCom.lib
-LIBRARY	    PcsUtils.lib
-LIBRARY		FSMailFramework.lib
-LIBRARY		FSFWCommonLib.lib
-LIBRARY cmaillogger.lib
+LIBRARY     PcsUtils.lib
+LIBRARY     FSMailFramework.lib
+LIBRARY     FSFWCommonLib.lib
+LIBRARY     cmaillogger.lib
+LIBRARY     flogger.lib
--- a/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -302,7 +302,7 @@
         // Update datastore contents, first reset
         iDataStoreObserver->RemoveAll( aDataStoreURI );
 
-        TInt trap_err; // for trap macro
+        TInt trap_err=KErrNone; // for trap macro
         if ( mruList )
             {
             // trap the error to enable returning status back
--- a/emailuis/emailui/data/FreestyleEmailUi.rss	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss	Mon Mar 15 12:39:10 2010 +0200
@@ -84,30 +84,160 @@
                         helptxt = qtn_msg_tb_tooltip_send;
                         bmpfile = EMAILUI_ICON_FILE;
                         bmpid=EMbmFreestyleemailuiQgn_indi_tb_msg_send;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_msg_send_mask;                        
-                        }  
-                    };            
+                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_msg_send_mask;
+                        }
+                    };
                 };
             },
         TBAR_CTRL
             {
-            type = EAknCtButton;
-            id = EFsEmailUiTbCmdAddRecipient;
-            control = AVKON_BUTTON
+            type = EAknCtToolbarExtension;
+            id = EFsEmailUiTbCmdExpandActions;
+            control = AVKON_TOOLBAR_EXTENSION
                 {
-                flags = KAknButtonSizeFitText;
-                states =
+                helptxt = qtn_mail_tb_tooltip_actions;
+                bmpFile = EMAILUI_ICON_FILE;
+                bmpId = EMbmFreestyleemailuiQgn_indi_tb_extension;
+                bmpMask = EMbmFreestyleemailuiQgn_indi_tb_extension_mask;
+                items =
                     {
-                    AVKON_BUTTON_STATE
+                    TBAR_CTRL
+                        {
+                        type = EAknCtButton;
+                        id = EFsEmailUiTbCmdHighPriority;
+                        control = AVKON_BUTTON
+                            {
+                            flags = KAknButtonRequestExitOnButtonUpEvent;
+                            states =
+                                {
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_priority_high;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_high_priority;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_high_priority_mask;
+                                    },
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_priority_high;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_high_priority_selected;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_high_priority_selected_mask;
+                                    }
+                                };
+                            };
+                        },
+                    TBAR_CTRL
+                        {
+                        type = EAknCtButton;
+                        id = EFsEmailUiTbCmdLowPriority;
+                        control = AVKON_BUTTON
+                            {
+                            flags = KAknButtonRequestExitOnButtonUpEvent;
+                            states =
+                                {
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_priority_low;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_low_priority;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_low_priority_mask;
+                                    },
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_priority_low;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_low_priority_selected;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_low_priority_selected_mask;
+                                    }
+                                };
+                            };
+                        },
+                    TBAR_CTRL
                         {
-                        helptxt = qtn_msg_tb_tooltip_add_recipient;
-                        bmpfile = EMAILUI_ICON_FILE;
-                        bmpid=EMbmFreestyleemailuiQgn_indi_tb_add_recipient;
-                        bmpmask=EMbmFreestyleemailuiQgn_indi_tb_add_recipient_mask;                        
-                        }  
-                    };            
-                };
-            },  
+                        type = EAknCtButton;
+                        id = EFsEmailUiTbCmdFollowUp;
+                        control = AVKON_BUTTON
+                            {
+                            flags = KAknButtonRequestExitOnButtonUpEvent;
+                            states =
+                                {
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_follow_up;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_follow_up;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_follow_up_mask;
+                                    },
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_follow_up;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_follow_up_selected;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_follow_up_selected_mask;
+                                    }
+                                };
+                            };
+                        },
+                    TBAR_CTRL
+                        {
+                        type = EAknCtButton;
+                        id = EFsEmailUiTbCmdCcField;
+                        control = AVKON_BUTTON
+                            {
+                            flags = KAknButtonRequestExitOnButtonUpEvent;
+                            states =
+                                {
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_show_cc;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    //bmpid = EMbmFreestyleemailuiQgn_indi_tb_show_cc;
+                                    //bmpmask = EMbmFreestyleemailuiQgn_indi_tb_show_cc_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_cc;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_cc_mask;
+                                    },
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_hide_cc;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_cc;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_cc_mask;
+                                    }
+                                };
+                            };
+                        },
+                    TBAR_CTRL
+                        {
+                        type = EAknCtButton;
+                        id = EFsEmailUiTbCmdBccField;
+                        control = AVKON_BUTTON
+                            {
+                            flags = KAknButtonRequestExitOnButtonUpEvent;
+                            states =
+                                {
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_show_bcc;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    //bmpid = EMbmFreestyleemailuiQgn_indi_tb_show_bcc;
+                                    //bmpmask = EMbmFreestyleemailuiQgn_indi_tb_show_bcc_mask;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc_mask;
+                                    },
+                                AVKON_BUTTON_STATE
+                                    {
+                                    txt = qtn_mail_tb_ext_hide_bcc;
+                                    bmpfile = EMAILUI_ICON_FILE;
+                                    bmpid = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc;
+                                    bmpmask = EMbmFreestyleemailuiQgn_indi_tb_hide_bcc_mask;
+                                    }
+                                };
+                            };
+                        }
+                    }; // end of extension items
+                }; // end of AVKON_TOOLBAR_EXTENSION
+            },
         TBAR_CTRL
             {
             type = EAknCtToolbarExtension;
@@ -135,9 +265,9 @@
                                     helptxt = qtn_msg_insert_tb_tooltip_image;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_image;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_image_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_image_mask;
+                                    }
+                                };
                             };
                         },
                     TBAR_CTRL
@@ -155,11 +285,11 @@
                                     helptxt = qtn_msg_insert_tb_tooltip_video;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_video;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_video_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_video_mask;
+                                    }
+                                };
                             };
-                        },                                    
+                        },
                     TBAR_CTRL
                         {
                         type = EAknCtButton;
@@ -175,9 +305,9 @@
                                     helptxt = qtn_msg_insert_tb_tooltip_sound;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_audio;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_audio_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_audio_mask;
+                                    }
+                                };
                             };
                         },
                     /*TBAR_CTRL
@@ -195,9 +325,9 @@
                                     helptxt = "Insert template";
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_tb_template;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_template_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_template_mask;
+                                    }
+                                };
                             };
                         },*/
                     TBAR_CTRL
@@ -215,9 +345,9 @@
                                     helptxt = qtn_fse_msg_insert_tb_tooltip_note_att;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_tb_note;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_note_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_tb_note_mask;
+                                    }
+                                };
                             };
                         },  
 #ifdef EMAIL_PRESENTATION_SUPPORT
@@ -236,9 +366,9 @@
                                     helptxt = qtn_msg_insert_tb_tooltip_presentation;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_pres;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_pres_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_pres_mask;
+                                    }
+                                };
                             };
                         },
 #endif //EMAIL_PRESENTATION_SUPPORT
@@ -257,14 +387,14 @@
                                     helptxt = qtn_msg_insert_tb_tooltip_other;
                                     bmpfile = EMAILUI_ICON_FILE;
                                     bmpid=EMbmFreestyleemailuiQgn_indi_mce_tb_other;
-                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_other_mask;                        
-                                    }  
-                                };            
+                                    bmpmask=EMbmFreestyleemailuiQgn_indi_mce_tb_other_mask;
+                                    }
+                                };
                             };
                         }
                     }; // eof extension items
                 }; // eof AVKON_TOOLBAR_EXTENSION control
-           }
+            }
         };
     }
 
@@ -410,7 +540,7 @@
                     {
                     AVKON_BUTTON_STATE
                         {
-                        helptxt = qtn_fse_tb_ext_reply;
+                        helptxt = qtn_fse_tb_reply;
                         bmpfile = EMAILUI_ICON_FILE;
                         bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_reply;
                         bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;                        
@@ -513,7 +643,7 @@
                     {
                     AVKON_BUTTON_STATE
                         {
-                        helptxt = qtn_fse_tb_ext_forward;
+                        helptxt = qtn_fse_tb_forward;
                         bmpfile = EMAILUI_ICON_FILE;
                         bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_forward;
                         bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;                        
@@ -564,7 +694,7 @@
                     {
                     AVKON_BUTTON_STATE
                         {
-                        helptxt = qtn_fse_tb_ext_reply;
+                        helptxt = qtn_fse_tb_reply;
                         bmpfile = EMAILUI_ICON_FILE;
                         bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_reply;
                         bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_reply_mask;                        
@@ -583,7 +713,7 @@
                     {
                     AVKON_BUTTON_STATE
                         {
-                        helptxt = qtn_fse_tb_ext_forward;
+                        helptxt = qtn_fse_tb_forward;
                         bmpfile = EMAILUI_ICON_FILE;
                         bmpid=EMbmFreestyleemailuiQgn_indi_tb_email_forward;
                         bmpmask=EMbmFreestyleemailuiQgn_indi_tb_email_forward_mask;                        
--- a/emailuis/emailui/data/html/email.js	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/data/html/email.js	Mon Mar 15 12:39:10 2010 +0200
@@ -1,9 +1,6 @@
 // Original image sources are stored in this array
 var originalImageSources = new Array();
 
-// Cid identifier string, if the image name begins with cid: it's shown
-var cid = new String("cid:");
-
 // Number of images hidden (or replaced with our placeholder image)
 var hiddenCount = 0;
 
@@ -17,7 +14,7 @@
         for (i = 0; i < doc.images.length; i++) {
         	var image = doc.images[i];
             originalImageSources.push(image.src);
-            if (image.src.length > 0 && image.src.indexOf(cid) == -1) {
+            if (image.src.length > 0) {
                 doc.images[i].src = "../hidden.png";
                 hiddenCount++;
             }
--- a/emailuis/emailui/data/iconlist.txt	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/data/iconlist.txt	Mon Mar 15 12:39:10 2010 +0200
@@ -184,3 +184,14 @@
 -c16,8 qgn_indi_tb_expand_all.svg
 -c16,8 qgn_indi_cmail_arrow_previous.svg
 -c16,8 qgn_indi_cmail_arrow_next.svg
+-c16,8 qgn_indi_tb_low_priority.svg
+-c16,8 qgn_indi_tb_low_priority_selected.svg
+-c16,8 qgn_indi_tb_high_priority.svg
+-c16,8 qgn_indi_tb_high_priority_selected.svg
+-c16,8 qgn_indi_tb_follow_up.svg
+-c16,8 qgn_indi_tb_follow_up_selected.svg
+-c16,8 qgn_indi_tb_show_cc.svg
+-c16,8 qgn_indi_tb_hide_cc.svg
+-c16,8 qgn_indi_tb_show_bcc.svg
+-c16,8 qgn_indi_tb_hide_bcc.svg
+-c16,8 qgn_indi_tb_extension.svg
--- a/emailuis/emailui/group/FreestyleEmailUi.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/group/FreestyleEmailUi.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -124,6 +124,7 @@
 APP_LAYER_SYSTEMINCLUDE
 USERINCLUDE     ../../inc
 USERINCLUDE     ../../../inc
+USERINCLUDE     ../../../ipsservices/inc
 
 // 9.11.2009: Temporary flagging SYMBIAN_ENABLE_SPLIT_HEADERS
 // Can be removed when header structure change is complete
--- a/emailuis/emailui/inc/FreestyleEmailDownloadInformationMediator.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailDownloadInformationMediator.h	Mon Mar 15 12:39:10 2010 +0200
@@ -262,7 +262,8 @@
 	* @param    aCompletedCount How many attachments were succesfully downloaded.
 	*/
 	void LaunchDownloadCompleteNoteL( const TPartData& aPart, TInt aCompletedCount );
-
+	void OpenAttachmentL( const TPartData& aPart, const TInt aCompletedCount );
+	
 	/**
 	* Notify all the registered observers about a download event.
 	*/
--- a/emailuis/emailui/inc/FreestyleEmailUi.hrh	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUi.hrh	Mon Mar 15 12:39:10 2010 +0200
@@ -292,9 +292,14 @@
 	EFsEmailUiCmdZoom150Percent,
 	
     // <cmail> Toolbar
-	EFsEmailUiTbCmdSend,
-	EFsEmailUiTbCmdAddRecipient,
-	EFsEmailUiTbCmdExpandInsert,
+    EFsEmailUiTbCmdSend,
+    EFsEmailUiTbCmdExpandActions,
+    EFsEmailUiTbCmdCcField,
+    EFsEmailUiTbCmdBccField,
+    EFsEmailUiTbCmdLowPriority,
+    EFsEmailUiTbCmdHighPriority,
+    EFsEmailUiTbCmdFollowUp,
+    EFsEmailUiTbCmdExpandInsert,
     EFsEmailUiTbCmdInsertImage,
     EFsEmailUiTbCmdInsertVideo,
     EFsEmailUiTbCmdInsertAudio,
--- a/emailuis/emailui/inc/FreestyleEmailUiAppui.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiAppui.h	Mon Mar 15 12:39:10 2010 +0200
@@ -500,6 +500,9 @@
     // if email editor started from embedded app.
     TBool EditorStartedFromEmbeddedApp() const;
 
+    // returns last seen pointer position
+    const TPoint& LastSeenPointerPosition() const;
+    
 public: //from MFSMailEventObserver
     /**
      * Framework event message.
@@ -838,6 +841,8 @@
     
     // Flag for judging if email editor started from embedded app.
     TBool iEditorStartedFromEmbeddedApp;
+    
+    TPoint iLastPointerPosition;
     };
 
 
--- a/emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h	Mon Mar 15 12:39:10 2010 +0200
@@ -167,6 +167,8 @@
 	void CancelAllDownloadsL();
     // check if model contains any attachment of message type
     TBool IsThereAnyMessageAttachments() const;
+    // check if model contains any attachment of non-message type
+    TBool IsThereAnyNonMessageAttachments() const;
 
 private:
 	CFSEmailUiAttachmentsListModel( CFreestyleEmailUiAppUi& aAppUi, MFSEmailUiAttachmentsStatusObserver& aObserver );
--- a/emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h	Mon Mar 15 12:39:10 2010 +0200
@@ -323,6 +323,8 @@
                                      TBool aAllowRefresh,
                                      TUint aUnreadCnt = 0);
 
+    TDesC* CFSEmailUiFolderListVisualiser::GetItemDisplayNameLC( TDesC& aItemData, TUint aUnreadCnt );
+    
 	void CreatePlainItemLC2( const TDesC* aItemDataBuff,
                              CFsTreePlainOneLineItemData* &aItemData,
                              CFsTreePlainOneLineItemVisualizer* &aItemVisualizer,
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Mon Mar 15 12:39:10 2010 +0200
@@ -27,7 +27,7 @@
 
 #include "FreestyleEmailUiAknStatusIndicator.h"
 #include "FreestyleEmailDownloadInformationMediator.h"
-#include "FreestyleEmailCenRepKeys.h"
+#include "freestyleemailcenrepkeys.h"
 #include "OverlayControl.h"
 
 class CFSMailMessage;
@@ -257,6 +257,9 @@
     void HideDownloadStatus();
     void DisplayStatusIndicatorL(TInt aDuration = KStatusIndicatorDefaultDuration);
     
+    // Inform that maillist model has updated
+    void MailListModelUpdatedL();
+    
 private: // from CEUiHtmlViewerSettings::MObserver
 
     /**
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Mon Mar 15 12:39:10 2010 +0200
@@ -212,12 +212,13 @@
     void LoadContentFromFileL( RFile& aFile );
     void LoadContentFromUrlL( const TDesC& aUrl );
     void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage, TBool aResetScrollPosition =ETrue );
-    void DeleteMailL();
+    void DeleteMailL(TBool aSilentDelete = EFalse);
     void HideContainer();
     void ShowContainerL();
     void DynInitZoomMenuL( CEikMenuPane* aMenuPane );
     TInt ZoomLevelIndexL();
     void SetZoomLevelIndexL( TInt aIndex );
+    void RestoreZoomLevelL();
     void SaveEmailAsContactL(
         const TDesC& aEmailAddress );
     //new functions for support of HTML viewer
--- a/emailuis/emailui/inc/FreestyleEmailUiUtilities.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/FreestyleEmailUiUtilities.h	Mon Mar 15 12:39:10 2010 +0200
@@ -112,6 +112,8 @@
     static void ShowGlobalErrorNoteL( TInt aResourceStringId );
     static void ShowGlobalInfoNoteL( TInt aResourceStringId );
     static void ShowDiscreetInfoNoteL( TInt aResourceStringId );
+    static void ShowDiscreetInfoNoteL( const TDesC& aNoteText );    
+     
     /**
     * Creates and shows a local wait note. Caller must pass a member variable pointer
     * which will hold the created wait note instance. This must NOT be an automatic variable.
@@ -298,6 +300,10 @@
     // Checks if FSMailServer is running. If not, then launches it.
     static void EnsureFsMailServerIsRunning( RWsSession& aWsSession );
     
+    //
+    static void SetDownloadSave( TBool aValue );    
+    //
+    static void SetSaveSelect( TBool aValue );      
 private:
     static TFSEmailUiTextures GetReadMsgIcon( CFSMailMessage* aMsgPtr );
     static TFSEmailUiTextures GetUnreadMsgIcon( CFSMailMessage* aMsgPtr );
@@ -325,6 +331,8 @@
 private: // static data
     static CAknGlobalNote* iGlobalWaitNote;
     static CAknWaitDialog* iOpeningWaitNote;
+    static TBool iSaveSelect;
+    static TBool iDownloadSave;
     
     // <cmail>
     // A separate MR viewer instance for checking the MR method type.
--- a/emailuis/emailui/inc/ncscomposeview.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/inc/ncscomposeview.h	Mon Mar 15 12:39:10 2010 +0200
@@ -52,6 +52,7 @@
 class CAknWaitDialog;
 class CActiveHelper;
 class CAknStylusPopUpMenu;
+class CAknToolbarExtension;
 
 
 const TInt KErrNcsComposeViewNotReady = KErrNotReady - 1000;
@@ -204,6 +205,11 @@
             const TDesC8& aCustomMessage );  
 
     /**
+     * From MAknToolbarObserver.
+     */
+    void DynInitToolbarL( TInt aResourceId, CAknToolbar* aToolbar );
+
+    /**
      *  @see CFsEmailUiViewBase::OfferToolbarEventL
      */
     void OfferToolbarEventL( TInt aCommand );
@@ -471,8 +477,11 @@
     void DoFirstStartL();
     
     static TInt AsyncExit( TAny* aSelfPtr );
-    
-    //void AsyncExitL(); //<cmail> made public
+
+    // Gets button from toolbar extension.
+    CAknButton* Button( TInt aCmdId, 
+        CAknToolbarExtension* aExtension = NULL );
+
 private:   // Constructors and destructor
 
     /**
--- a/emailuis/emailui/loc/freestyleemailui.loc	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/loc/freestyleemailui.loc	Mon Mar 15 12:39:10 2010 +0200
@@ -2517,23 +2517,35 @@
 #define qtn_fse_tb_actions "Actions"
 
 // d:Extended toolbar button reply, creates a reply to email message sender
-// l:popup_preview_text_window_t1
+// l:cell_tb_ext_pane_t1
 // r:TB9.2
 //
 #define qtn_fse_tb_ext_reply "Reply"
 
 // d:Extended toolbar button reply, creates a reply to email message sender and other recipients
-// l:popup_preview_text_window_t1
+// l:cell_tb_ext_pane_t1
 // r:TB9.2
 //
 #define qtn_fse_tb_ext_reply_all "Reply to all"
 
 // d:Extended toolbar button forward, creates a forward email message to the sender
-// l:popup_preview_text_window_t1
+// l:cell_tb_ext_pane_t1
 // r:TB9.2
 //
 #define qtn_fse_tb_ext_forward "Forward"
 
+// d:Toolbar button reply, creates a reply to email message sender
+// l:popup_preview_text_window_t1
+// r:TB9.2
+//
+#define qtn_fse_tb_reply "Reply"
+
+// d:Toolbar button forward, creates a forward email message to the sender
+// l:popup_preview_text_window_t1
+// r:TB9.2
+//
+#define qtn_fse_tb_forward "Forward"
+
 // d:Toolbar button for add attachment in editor, opens extended toolbar for attachment selection
 // l:popup_preview_text_window_t1
 // r:TB9.2
@@ -2810,3 +2822,51 @@
 //
 #define qtn_mail_option_alternative_no                       "No"
 
+// d:Tooltip text for opening actions toolbar extension
+// l:popup_preview_text_window_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_tooltip_actions "Actions"
+
+// d:Toolbar extension command for setting low priority flag in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_priority_low "Low"
+
+// d:Toolbar extension command for setting high priority flag in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_priority_high "High"
+
+// d:Toolbar extension command for setting follow up flag in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_follow_up "Follow up"
+
+// d:Toolbar extension command for showing cc field in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_show_cc "Show Cc field"
+
+// d:Toolbar extension command for hiding cc field in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_hide_cc "Hide Cc field"
+
+// d:Toolbar extension command for showin bcc field in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_show_bcc "Show Bcc field"
+
+// d:Toolbar extension command for hiding bcc field in editor
+// l:cell_tb_ext_pane_t1
+// r:TB9.2
+//
+#define qtn_mail_tb_ext_hide_bcc "Hide Bcc field"
+
--- a/emailuis/emailui/sendasmtm/fsmtms/client/src/cfsclientmtm.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sendasmtm/fsmtms/client/src/cfsclientmtm.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -812,7 +812,7 @@
 
 	if ( iEmailAttachedInEmail )
 		{
-		TMsvId accountId;
+		TMsvId accountId(0); // used as not found
 
 		// Get S60 mailboxes
 		CMsvEntry* root = CMsvEntry::NewL( Session(), KMsvRootIndexEntryId,
@@ -882,7 +882,7 @@
 
 	if ( iEmailAttachedInEmail )
 		{
-		TMsvId accountId;
+		TMsvId accountId(0); //0 is used as notfound later on
 
 		// Get S60 mailboxes
 		CMsvEntry* root = CMsvEntry::NewL( Session(), KMsvRootIndexEntryId,
--- a/emailuis/emailui/sendasmtm/fsmtms/uidata/src/cfsuidatamtm.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sendasmtm/fsmtms/uidata/src/cfsuidatamtm.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -158,7 +158,7 @@
         array->SetReserveL( 2 ); // AppendLs will not LEAVE
         
         CGulIcon* brandedIcon( NULL );
-        TInt err;
+        TInt err(KErrNone);
 
         if ( i < mailboxes.Count() ) // Do not execute for the last round
             {
--- a/emailuis/emailui/sendasmtm/sendashelper/src/cfssendashelper.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sendasmtm/sendashelper/src/cfssendashelper.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -414,6 +414,7 @@
     	CESMailSettingsPlugin::TSubViewActivationData pluginData;
     	pluginData.iAccount = TFSMailMsgId( aPluginId, aId );
     	pluginData.iLaunchedOutsideFSEmail = ETrue;
+    	pluginData.iSubviewId=0;
     	const TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> pkgOut( pluginData );
     	coeAppUi->ActivateViewL( TVwsViewId( KFSEmailUiUid, SettingsViewId ),
     	            TUid::Uid(KMailSettingsOpenPluginSettings), pkgOut );
@@ -444,6 +445,7 @@
 
         TUid editorCommand = TUid::Uid( KEditorCmdOpen );
         TEditorLaunchParams params;
+        params.iExtra=NULL;
         params.iActivatedExternally = ETrue;    
         params.iMailboxId = TFSMailMsgId( aPluginId, aId );
         
--- a/emailuis/emailui/sis/commonemail.pkg	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sis/commonemail.pkg	Mon Mar 15 12:39:10 2010 +0200
@@ -241,7 +241,7 @@
 ; Non-localized files:
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"      - "c:\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\manifest.dat"                 - "c:\private\200159c0\install\emailwidget\hsps\00\manifest.dat"
-"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"           - "c:\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"
+"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"          - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"
 ; Localized files (need to be clarified how these really work):
 "\epoc32\data\Z\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"                   - "c:\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd" - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd"
--- a/emailuis/emailui/sis/commonemail_loc.pkg	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sis/commonemail_loc.pkg	Mon Mar 15 12:39:10 2010 +0200
@@ -254,7 +254,7 @@
 ; Non-localized files:
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"      - "c:\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\manifest.dat"                 - "c:\private\200159c0\install\emailwidget\hsps\00\manifest.dat"
-"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"           - "c:\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"
+"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"          - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"
 ; Localized files (need to be clarified how these really work):
 "\epoc32\data\Z\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"                   - "c:\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd" - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd"
--- a/emailuis/emailui/sis/commonemail_udeb.pkg	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sis/commonemail_udeb.pkg	Mon Mar 15 12:39:10 2010 +0200
@@ -229,7 +229,7 @@
 ; Non-localized files:
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"      - "c:\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\manifest.dat"                 - "c:\private\200159c0\install\emailwidget\hsps\00\manifest.dat"
-"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"           - "c:\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"
+"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"          - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"
 ; Localized files (need to be clarified how these really work):
 "\epoc32\data\Z\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"                   - "c:\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd" - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd"
--- a/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Mon Mar 15 12:39:10 2010 +0200
@@ -242,7 +242,7 @@
 ; Non-localized files:
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"      - "c:\private\200159c0\install\emailwidget\hsps\00\widgetconfiguration.xml"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\manifest.dat"                 - "c:\private\200159c0\install\emailwidget\hsps\00\manifest.dat"
-"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"           - "c:\private\200159c0\install\emailwidget\hsps\00\qgn_menu_cmail.svg"
+"\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"          - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif"
 ; Localized files (need to be clarified how these really work):
 "\epoc32\data\Z\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"                   - "c:\private\200159c0\install\emailwidget\xuikon\00\EW.o0000"
 "\epoc32\data\Z\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd" - "c:\private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd"
--- a/emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailDownloadInformationMediator.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -241,13 +241,13 @@
                  countObject.iDownloadsCompletedCount == countObject.iDownloadsStartedCount &&
                  countObject.iSaveRequestedCount > 0 )
                  {
+                 TFsEmailUiUtility::SetDownloadSave( ETrue );
                  TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( countObject.iSaveRequestedCount );
                  }        
             // Show "Download completed" if necessary
             else if ( CompletionNotesInUseL() && completedDownloadsToNotify )
                 {
-                LaunchDownloadCompleteNoteL( download.iPartData,
-                    completedDownloadsToNotify );
+                OpenAttachmentL( download.iPartData, completedDownloadsToNotify );            
                 }
             else if ( download.iNotifyComplete &&
                       countObject.iSaveRequestedCount == 0 )
@@ -450,6 +450,7 @@
 	FUNC_LOG;
 	// now there is at least one download started 
 	iDownloadsStarted = ETrue;
+	TFsEmailUiUtility::SetSaveSelect( ETrue );  
 	// fetch message part
 	CFSMailMessage* mailMessage = iMailClient.GetMessageByUidL( aPart.iMailBoxId, aPart.iFolderId, aPart.iMessageId, EFSMsgDataEnvelope );
 	CleanupStack::PushL( mailMessage );
@@ -628,6 +629,19 @@
 	return cenRepHandler->DownloadNotifications();
 	}
 
+void CFSEmailDownloadInfoMediator::OpenAttachmentL( const TPartData& aPart, 
+        const TInt aCompletedCount )
+    {
+    iPopupLaunchData = aPart;
+    if (aCompletedCount > 1)
+        {
+        iPopupLaunchData.iMessagePartId.SetNullId();    
+        }
+    TRequestStatus* status = &iStatus;
+    User::RequestComplete(status, KErrNone);
+    SetActive();
+    }
+
 void CFSEmailDownloadInfoMediator::LaunchDownloadCompleteNoteL(
         const TPartData& aPart, TInt aCompletedCount )
     {
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -1325,6 +1325,12 @@
         return;
         }
 
+    if (aEvent.Type() == EEventPointer)
+        {
+        TAdvancedPointerEvent* pointerEvent(aEvent.Pointer());
+        iLastPointerPosition = pointerEvent->iParentPosition;
+        }
+    
 	TInt key = aEvent.Key()->iScanCode;
     // <cmail>
     // to disable voice commands during creating new mail message
@@ -2173,7 +2179,6 @@
                         {
                         TIMESTAMP( "Starting sync" );
                         //If syncs were started by user, show the synchoronisation indicator
-                        TIMESTAMP( "Sync error" );
                         if(iManualMailBoxSyncAll)
                             {
                             ManualMailBoxSyncAll(EFalse);
@@ -2184,6 +2189,7 @@
                         {
                         // error occured during "Connect" or "Send and receive" operation
                         // check if user needs to be notified
+                        TIMESTAMP( "Sync error" );
                         if ( iManualMailBoxSync )
                             {
                             // since error id is not provided by plugin, lets popup general note
@@ -2249,6 +2255,7 @@
 	   	 	gridContentsChanged = ETrue;
 			break;
         case TFSEventMailDeleted:
+        case TFSEventMailDeletedFromViewer:
             {
             RArray<TFSMailMsgId>* entries = reinterpret_cast<RArray<TFSMailMsgId>*>(aParam1);
             for (TInt i = entries->Count() - 1; i >= 0; i--)
@@ -2296,8 +2303,9 @@
     	iAttachmentListVisualiser->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 );
     	}
     // Handle mail deleted event in Html view list, as the mails might become obsolete
-    else if ( iHtmlViewerView && (aEvent == TFSEventMailDeleted || aEvent == TFSEventNewMail) &&
-    	 iCurrentActiveView->Id() == HtmlViewerId)
+    else if ( iHtmlViewerView && (aEvent == TFSEventMailDeleted || 
+                                  aEvent == TFSEventMailDeletedFromViewer || 
+                                  aEvent == TFSEventNewMail) && iCurrentActiveView->Id() == HtmlViewerId)
     	{
     	iHtmlViewerView->HandleMailBoxEventL( aEvent, aMailbox, aParam1, aParam2, aParam3 );
     	}
@@ -2896,6 +2904,14 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFreestyleEmailUiAppUi::LastSeenPointerPosition
+// -----------------------------------------------------------------------------
+const TPoint& CFreestyleEmailUiAppUi::LastSeenPointerPosition() const
+    {
+    return iLastPointerPosition;
+    }
+
+// -----------------------------------------------------------------------------
 //
 // -----------------------------------------------------------------------------
 void CFreestyleEmailUiAppUi::ConstructNaviPaneL()
--- a/emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -465,6 +465,18 @@
     return msgFound;
     }
 
+TBool CFSEmailUiAttachmentsListModel::IsThereAnyNonMessageAttachments() const
+    {
+    FUNC_LOG;
+    TBool msgFound = EFalse;
+    TInt attCount = iAttachments.Count();
+    for ( TInt i = 0 ; i < attCount && !msgFound ; i++ )
+        {
+        msgFound = !IsMessage( iAttachments[i] );
+        }
+    return msgFound;
+    }
+
 void CFSEmailUiAttachmentsListModel::UpdateListL( CFSMailMessage* aEmbeddedMessage )
 	{
     FUNC_LOG;
@@ -593,10 +605,15 @@
 	TBool retVal = EFalse;
 	TInt attCount = iAttachments.Count();
     TInt savedCount( 0 );
+    const CFSMailBox* mailbox( iAppUi.GetActiveMailbox() );
 	for ( TInt i = 0; i < attCount; i++ )
 		{
-		TBool downloadStarted = SaveAttachmentL( iAttachments[i], aFileName, savedCount );
-		retVal = downloadStarted || retVal;
+        if ( !IsMessage( iAttachments[i] ) || 
+                ( mailbox && mailbox->HasCapability( EFSMboxCapaSupportsSavingOfEmbeddedMessages ) ) )
+            {
+            TBool downloadStarted = SaveAttachmentL( iAttachments[i], aFileName, savedCount );
+            retVal = downloadStarted || retVal;
+            }
 		}
 	if ( savedCount )
 	    {
--- a/emailuis/emailui/src/FreestyleEmailUiAttachmentsListVisualiser.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiAttachmentsListVisualiser.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -1558,7 +1558,7 @@
     TPartData partData = iModel->GetMessageL( nullId );
 
     if ( iFirstStartCompleted && aMailbox == partData.iMailBoxId && 
-    	 aEvent == TFSEventMailDeleted && aParam1 && iModel ) // Safety, in list events that only concern active mailbox are handled 
+    	 (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 && iModel ) // Safety, in list events that only concern active mailbox are handled 
         {
 		RArray<TFSMailMsgId>* removedEntries = static_cast< RArray<TFSMailMsgId>* >(aParam1);
 		for ( TInt i=0 ; i < removedEntries->Count() ; i++ )
--- a/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -132,9 +132,6 @@
 const TReal KFSHeaderTextBackgroundOpacity = 0.3f;
 const TAlfTimedValue KFSVisible( 1 );
 const TAlfTimedValue KFSInvisible( 0 );
-// Considering that there are 99999 unread emails + ( + ) + SPACE size should be 5+1+1+1 =8
-static const TInt KFmtUnRdCntMaxLength( 8 );
-_LIT(KFormatUnreadCnt, " (%d)");
 
 // ---------------------------------------------------------------------------
 // NewL
@@ -2204,10 +2201,10 @@
 	{
     FUNC_LOG;
 	CFsSeparatorData* data = CFsSeparatorData::NewL();
-
+	CleanupStack::PushL(data);
 	CFsSeparatorVisualizer* visualizer( NULL );
     visualizer = CFsSeparatorVisualizer::NewL(*iTreeList->TreeControl());
-
+    CleanupStack::Pop(data);
     // We use the default size of the separator, but we need to save it
     // here to have it available later when calculating the list height
     iListSeparatorHeight = visualizer->Size().iHeight;
@@ -2258,12 +2255,7 @@
     CFsTreePlainOneLineNodeData* plainItemData;
     CFsTreePlainOneLineNodeVisualizer* plainNodeVisualizer;
 
-    HBufC* itemDispName = HBufC::NewLC(aItemData->Length() + KFmtUnRdCntMaxLength);
-    itemDispName->Des().Copy(*aItemData);
-    if( aUnreadCnt > 0 )
-        {
-        itemDispName->Des().AppendFormat(KFormatUnreadCnt, aUnreadCnt);
-        }
+    TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt );
 	CreatePlainNodeLC2( itemDispName, plainItemData, plainNodeVisualizer, aIcon );
 
 	// We assume that node can never be the last item to be drawn, there will
@@ -2314,12 +2306,7 @@
     CFsTreePlainOneLineItemData* plainItemData;
     CFsTreePlainOneLineItemVisualizer* plainItemVisualizer;
 
-    HBufC* itemDispName = HBufC::NewLC(aItemData->Length() + KFmtUnRdCntMaxLength);
-    itemDispName->Des().Copy(*aItemData);
-    if( aUnreadCnt > 0 )
-        {
-        itemDispName->Des().AppendFormat(KFormatUnreadCnt, aUnreadCnt);
-        }
+    TDesC* itemDispName = GetItemDisplayNameLC( *aItemData, aUnreadCnt );
     CreatePlainItemLC2( itemDispName, plainItemData, plainItemVisualizer, aIcon );
 
 
@@ -2335,6 +2322,34 @@
 	}
 
 // ---------------------------------------------------------------------------
+// Get the display name for a folder
+// ---------------------------------------------------------------------------
+TDesC* CFSEmailUiFolderListVisualiser::GetItemDisplayNameLC( TDesC& aItemData, TUint aUnreadCnt )
+    {
+    TDesC* itemDispName = NULL;
+    if( aUnreadCnt > 0 )
+        {
+        CDesCArray* descArray = new (ELeave) CDesCArrayFlat( 1 );
+        CleanupStack::PushL( descArray );
+        descArray->AppendL( aItemData );
+        CArrayFix<TInt>* intArray = new (ELeave) CArrayFixFlat<TInt>( 1 );
+        CleanupStack::PushL( intArray );
+        intArray->AppendL( aUnreadCnt );
+        itemDispName = StringLoader::LoadL(
+                R_FREESTYLE_EMAIL_UI_FOLDER_LIST_FOLDER_WITH_UNREAD,
+                *descArray, *intArray );
+        CleanupStack::PopAndDestroy( intArray );
+        CleanupStack::PopAndDestroy( descArray );
+        CleanupStack::PushL( itemDispName );
+        }
+    else
+        {
+        itemDispName = aItemData.AllocLC();
+        }
+    return itemDispName;
+	}
+
+// ---------------------------------------------------------------------------
 // Create plain leaf item
 // ---------------------------------------------------------------------------
 //
@@ -2850,7 +2865,14 @@
                 // Keep the right edge position unchanged
                 if( landscape )
                     {
-                    aRect.Move( oldButtonRect.iBr.iX - aRect.iBr.iX, 0 );
+					if ( !AknLayoutUtils::LayoutMirrored() )
+						{
+					    aRect.Move( oldButtonRect.iBr.iX - aRect.iBr.iX, 0 );
+						}
+					else
+						{
+					    aRect.Move( ( aRect.Width() - aRect.iBr.iX ) + iCtrlButtonRect.Width(), 0 );
+						}
                     }
                 }
             }
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -357,7 +357,8 @@
                               TBrCtlDefs::ECapabilityDisplayScrollBar |
                               TBrCtlDefs::ECapabilityClientNotifyURL |
                               TBrCtlDefs::ECapabilityLoadHttpFw |
-                              TBrCtlDefs::ECapabilityCursorNavigation;
+                              TBrCtlDefs::ECapabilityCursorNavigation |
+                              TBrCtlDefs::ECapabilityPinchZoom;
 
     // Set browsercontrol to whole screen
     TRect rect( TPoint(), Size() );
@@ -514,7 +515,7 @@
 // ---------------------------------------------------------------------------
 //
 void CFsEmailUiHtmlViewerContainer::LoadContentFromMailMessageL(
-    CFSMailMessage* aMailMessage, TBool aResetScrollPos )
+        CFSMailMessage* aMailMessage, TBool aResetScrollPos )
     {
     FUNC_LOG;
     ASSERT( aMailMessage );
@@ -803,7 +804,7 @@
             {
             iAppUi.DownloadInfoMediator()->StopObserving( this );
             }
-
+               
         if ( iMessage && linkContent )
             {
             CFSMailMessagePart* part = iMessage->ChildPartL( aPart.iMessagePartId );
@@ -817,10 +818,10 @@
             CleanupStack::PopAndDestroy( &contentFile );
             CleanupStack::PopAndDestroy( part );
             }
+        
         if ( iMessage )
             {
-            LoadContentFromMailMessageL( iMessage );
-            
+            LoadContentFromMailMessageL( iMessage, EFalse );            
             UpdateOverlayButtons( ETrue );
             }
         }
@@ -1495,13 +1496,13 @@
     _LIT8( KHttps, "https://");
     _LIT8( KWww, "www."); 
     
-    TBool eos( EFalse );
+    TBool eos( aSource.Size() <= 0 );
     TInt position( 0 );
     TInt carryOverInc( 0 );
     
     while ( !eos )
         {
-        while ( carryOverInc >= aSource.Ptr( position ).Length() )
+        while ( carryOverInc >= aSource.Ptr( position ).Length() && aSource.Size() != 0 )
             { // Skip segments of overlapping url string
             carryOverInc -= aSource.Ptr( position ).Length();
             position += aSource.Ptr( position ).Length();
@@ -2219,3 +2220,9 @@
     iStatusIndicator->ShowIndicatorL( image, imageMask, statusText, aDuration );
     }
 
+void CFsEmailUiHtmlViewerContainer::MailListModelUpdatedL()
+    {
+    FUNC_LOG;
+    UpdateOverlayButtons( IsVisible() );    
+    }
+
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -605,14 +605,14 @@
                     }                              
                 else
                     {
+                    // Attachment list model is not created when opening mrViewer, so attachment options menu is
+                    // not working with MR messages
                     iAttachmentsListModel = CFSEmailUiAttachmentsListModel::NewL( iAppUi, *this );
-                    TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId);
+                    TPartData msgPartData( iActivationData.iMailBoxId, iActivationData.iFolderId, iActivationData.iMessageId );
                     iAttachmentsListModel->UpdateListL( msgPartData );
-                       
                     CheckMessageBodyL( *iMessage, msgBodyStructurePresent, msgBodyContentPresent );
                     LoadContentFromMailMessageL( iMessage, ETrue );
-                    }
-                
+                    }                
                 }
             else
                 {
@@ -935,7 +935,7 @@
     if( Layout_Meta_Data::IsLandscapeOrientation() )
         {
         // landscape must use different layout
-        res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
+		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
         }
 
     if( StatusPane()->CurrentLayoutResId() != res )
@@ -1221,7 +1221,7 @@
         }
     }
 
-void CFsEmailUiHtmlViewerView::DeleteMailL()
+void CFsEmailUiHtmlViewerView::DeleteMailL(TBool aSilentDelete)
     {
     FUNC_LOG;
 
@@ -1233,7 +1233,7 @@
     TInt reallyDelete( ETrue );
 
     if ( iAppUi.GetCRHandler()->WarnBeforeDelete() && 
-         !iMessage->IsFlagSet( EFSMsgFlag_CalendarMsg ) )
+         !aSilentDelete )
         {
         reallyDelete = TFsEmailUiUtility::ShowConfirmationQueryL(
                            R_FREESTYLE_EMAIL_UI_DELETE_MESSAGE_CONFIRMATION );
@@ -1269,7 +1269,9 @@
         CleanupStack::PopAndDestroy( &msgIds );
 
         // Notify appui of deleted mail item
-        SendEventToAppUiL( TFSEventMailDeleted ); 
+        SendEventToAppUiL( TFSEventMailDeletedFromViewer ); 
+        
+       
         
         if ( iAppUi.CurrentActiveView()->Id() == HtmlViewerId )
             {   
@@ -1283,11 +1285,10 @@
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
                 NavigateBackL();
                 }
-
-			
 			}
-        //inform user that mail is deleted  
-        TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
+        //inform user that mail is deleted
+        if (!aSilentDelete)
+        	TFsEmailUiUtility::ShowDiscreetInfoNoteL( R_FREESTYLE_EMAIL_MAIL_DELETED );
         }
     }
 
@@ -1301,13 +1302,11 @@
     {
     FUNC_LOG;
     if ( /*iFirstStartCompleted &&*/ iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() &&
-                                     aEvent == TFSEventMailDeleted && aParam1 ) // Safety, in list events that only concern active mailbox are handled
+                                     (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && aParam1 ) // Safety, in list events that only concern active mailbox are handled
         {
         TFSMailMsgId curMsgId = iMessage->GetMessageId();       
         RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
-        // <cmail> break-keyword should be used only in switch-clauses
         TBool cont = ETrue;
-
         for ( TInt i = 0 ; i < removedEntries->Count() && cont; i++ )
             {
             if ( ( curMsgId == ( *removedEntries )[i] ) &&
@@ -1315,16 +1314,23 @@
                 {                
                 cont = EFalse;
                 ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
-                HandleCommandL( EAknSoftkeyBack );
+                if(aEvent == TFSEventMailDeleted)
+                    {   //Delete event came from server; close the viewer.
+                	HandleCommandL( EAknSoftkeyBack );
+                	// The message we are viewing was deleted => stop here
+                	return;
+                    }
                 }            
             } 
         }
      
-    if (iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && aEvent == TFSEventNewMail)
+    if (iContainer && iMessage && aMailbox.Id() == iAppUi.GetActiveMailboxId().Id() && 
+            ( aEvent == TFSEventNewMail || 
+              aEvent == TFSEventMailDeleted || 
+              aEvent == TFSEventMailChanged ) )
         {
-        UpdateEmailHeaderIndicators();
+        iContainer->MailListModelUpdatedL();
         }
-    // </cmail>
     }
 
 void CFsEmailUiHtmlViewerView::DynInitZoomMenuL( CEikMenuPane* aMenuPane )
@@ -1408,6 +1414,16 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
+// -----------------------------------------------------------------------------
+//
+void CFsEmailUiHtmlViewerView::RestoreZoomLevelL()
+    {
+    FUNC_LOG;
+    SetZoomLevelIndexL( ZoomLevelIndexL() );
+    }
+
+// -----------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::HandleEmailAddressCommandL()
 // -----------------------------------------------------------------------------
 //
@@ -1638,6 +1654,7 @@
 
 void CFsEmailUiHtmlViewerView::DownloadAttachmentL( const TAttachmentData& aAttachment )
     {
+    iAppUi.DownloadInfoMediator()->AddObserver( this, aAttachment.partData.iMessageId );
     iAttachmentsListModel->StartDownloadL(aAttachment);
     }
 
@@ -1786,6 +1803,12 @@
         
         iContainer->ShowAttachmentDownloadStatusL( aEvent.iProgressStatus, *attachment );
         }
+    
+    if (aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestComplete || 
+            aEvent.iProgressStatus == TFSProgress::EFSStatus_RequestCancelled)
+        {
+        iAppUi.DownloadInfoMediator()->StopObserving( this, aPart.iMessageId );
+        }
     }
 
 void CFsEmailUiHtmlViewerView::RequestResponseL( const TFSProgress& aEvent, const TPartData& aPart )
@@ -1967,6 +1990,8 @@
 
             iAppUi.MoveToNextMsgL( currentMsgId, nextMsgId );
             // Next message is displayed in this view through doactivate, because view is re-activate by mail list
+
+            RestoreZoomLevelL();
             }
         }
     }
@@ -2000,7 +2025,7 @@
         TFSMailMsgId prevMsgId;
         TFSMailMsgId prevMsgFolderId;
         if ( iAppUi.IsPreviousMsgAvailable( currentMsgId, prevMsgId, prevMsgFolderId ) )
-            {
+            {          
             if (iContainer)
                 {
                 iContainer->PrepareForMessageNavigation();
@@ -2014,6 +2039,8 @@
 
             iAppUi.MoveToPreviousMsgL( currentMsgId, prevMsgId );
             // Previous message is displayed in this view through doactivate, because view is re-activate by mail list
+
+            RestoreZoomLevelL();
             }
         }
     }
@@ -2657,7 +2684,7 @@
             if ( iMessage )
                 {
                 iDeletedMessageFromMrui = iMessage->GetMessageId(); //<cmail>
-                DeleteMailL();
+                DeleteMailL(ETrue);
                 iOpResult.iResultCode = KErrNone; //???? what to pass here
                 }
 
--- a/emailuis/emailui/src/FreestyleEmailUiLayoutHandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiLayoutHandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -26,6 +26,7 @@
 #include <aknlayoutscalable_apps.cdl.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 #include <layoutmetadata.cdl.h>
+#include <fslayoutmanager.h>
 
 // For generic treelist layout data setting
 #include "fstreelist.h"
@@ -472,10 +473,18 @@
     if( landscape )
         {
         TSize menuSize = rect.Size();
-
-        // position left from the button
-        rect.SetRect( TPoint( buttonRect.iTl.iX - menuSize.iWidth, 
+        if ( !CFsLayoutManager::IsMirrored() )
+           {
+        	// position left from the button
+            rect.SetRect( TPoint( buttonRect.iTl.iX - menuSize.iWidth, 
                 buttonRect.Center().iY - menuSize.iHeight / 2 ), menuSize );
+           }
+        else
+           {
+           // position right from the button
+           rect.SetRect( TPoint( buttonRect.Width(), 
+                       buttonRect.Center().iY - menuSize.iHeight / 2 ), menuSize );
+           }
         }
     else
         {
@@ -1941,7 +1950,7 @@
     listRect.LayoutRect( mainPaneRect, 
                         AknLayoutScalable_Apps::main_sp_fs_listscroll_pane_te_cp01( var ));
     TRect rect = listRect.Rect();
-
+  
     // if control bar is required, reserve space on top of the listbox  
     if( aControlsOnTop && landscape )
         {
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -89,6 +89,7 @@
 #include "FSDelayedLoader.h"
 #include "FSEmail.pan"
 #include "fsemailstatuspaneindicatorhandler.h"
+#include "ipsplgcommon.h"
 
 // CONST VALUES
 const TInt KControlBarTransitionTime = 250;
@@ -1635,7 +1636,7 @@
     if( Layout_Meta_Data::IsLandscapeOrientation() )
         {
         // landscape must use different layout
-        res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
+		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
         }
 
 	if ( StatusPane()->CurrentLayoutResId() != res )
@@ -1726,6 +1727,12 @@
             // Sync/cancel sync
 	    CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox();
 	    TBool supportsSync = activeMailbox->HasCapability( EFSMBoxCapaSupportsSync );
+        TFSMailBoxStatus onlineStatus = activeMailbox->GetMailBoxStatus();
+         if ( onlineStatus == EFSMailBoxOnline && 
+		      KIpsPlgImap4PluginUid == activeMailbox->GetId().PluginId() )
+        	{
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
+        	}
 
             // flag to hide or show SyncButton
             TBool hideSync = GetLatestSyncState();
@@ -1735,7 +1742,6 @@
         if ( !supportsSync )
         {
 				// POP3 behaviour
-				TFSMailBoxStatus onlineStatus = activeMailbox->GetMailBoxStatus();
 				if( onlineStatus == EFSMailBoxOnline || iMailListModelUpdater->IsUpdating() )
 				  {
 					aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, EFalse );
@@ -3157,7 +3163,7 @@
         TFsEmailUiUtility::ToggleEmailIconL(EFalse, iMailFolder->GetMailBoxId() );
         }
     
-	if ( iFirstStartCompleted ) // Safety
+	if ( aForeground && iFirstStartCompleted ) // Safety
 	    {
 	    // Update mail list settings and date formats, is done every time
 	    // the user might have changed these in settings, so the list needs to refresh
@@ -3793,21 +3799,6 @@
 			TFSMailMsgId folderID;
 			folderID.SetNullId(); // Selection is popped up with NULL
 			MoveMsgsToFolderL( folderID );
-
-			TBool supportsSync = iAppUi.GetActiveMailbox()->HasCapability( EFSMBoxCapaSupportsSync );
-			if ( supportsSync )
-			    {
-			    //If synchronizing is ongoing and a new sync is started we ignore it
-			    if(!GetLatestSyncState())
-			        {
-			        iAppUi.SyncActiveMailBoxL();
-
-			        // Sync the mailbox
-			        ManualMailBoxSync(ETrue);
-
-                    iAppUi.ManualMailBoxSync( ETrue );
-			        }
-			    }
 			}
 			break;
        	case EFsEmailUiCmdActionsMoveToDrafts:
@@ -3990,7 +3981,14 @@
                 iMoveToFolderOngoing = ETrue;
                 TFolderListActivationData folderListData;
                 folderListData.iCallback = this;
-                folderListData.iSourceFolderType = iMailFolder->GetFolderType();
+                if(iMailFolder) // Coverity error fix , assuming that inbox is best bet for safe data. 
+                    {
+                    folderListData.iSourceFolderType = iMailFolder->GetFolderType();
+                    }
+                else
+                    {
+                    folderListData.iSourceFolderType = EFSInbox;
+                    }
                 const TPckgBuf<TFolderListActivationData> pkgOut( folderListData );
                 if ( targetEntries.Count() == 1 )
                     {
@@ -4229,6 +4227,12 @@
 void CFSEmailUiMailListVisualiser::SetMskL()
     {
     FUNC_LOG;
+    // If there is no keyboard present, than Msk buttom must not be shown
+    if ( iAppUi.ShortcutBinding().KeyBoardType() == 
+                                    CFSEmailUiShortcutBinding::ENoKeyboard )
+        {
+        return;
+        }
     // Get the mail list count
     TInt listCount(0);
     if ( iMailList )
@@ -4238,7 +4242,7 @@
 
     if ( iFocusedControl == EControlBarComponent )
         {
-        ChangeMskCommandL( R_FSE_QTN_MSK_CHANGE );
+        ChangeMskCommandL( R_FSE_QTN_MSK_CHANGE ); // change - switch focus on
         }
     else  if ( iFocusedControl == EMailListComponent )
         {
@@ -4252,17 +4256,17 @@
                 // Nodes may not be marked
                 if ( iMailList->IsNode( iMailList->FocusedItem() ) )
                     {
-                    ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY );
+                    ChangeMskCommandL( R_FSE_QTN_MSK_EMPTY ); // nothing
                     }
                 else
                     {
                     if ( iMailList->IsMarked( iMailList->FocusedItem() ) )
                         {
-                        ChangeMskCommandL( R_FSE_QTN_MSK_UNMARK );
+                        ChangeMskCommandL( R_FSE_QTN_MSK_UNMARK ); // unmark item
                         }
                     else
                         {
-                        ChangeMskCommandL( R_FSE_QTN_MSK_MARK );
+                        ChangeMskCommandL( R_FSE_QTN_MSK_MARK ); // mark item
                         }
                     }
                 }
@@ -4276,11 +4280,11 @@
                         {
                         if ( iMailFolder && iMailFolder->GetFolderType() == EFSOutbox )
                             {
-                            ChangeMskCommandL( R_FSE_QTN_MSK_OPEN_BLOCKED );
+                            ChangeMskCommandL( R_FSE_QTN_MSK_OPEN_BLOCKED ); // blocked email opening 
                             }
                         else
                             {
-                            ChangeMskCommandL( R_FSE_QTN_MSK_OPEN );
+                            ChangeMskCommandL( R_FSE_QTN_MSK_OPEN ); // open email
                             }
                         }
                     }
@@ -4292,11 +4296,11 @@
                         {
                         if ( iMailList->IsExpanded( iMailList->FocusedItem() ) )
                             {
-                            ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE );
+                            ChangeMskCommandL( R_FSE_QTN_MSK_COLLAPSE ); // collapse folder
                             }
                         else
                             {
-                            ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND );
+                            ChangeMskCommandL( R_FSE_QTN_MSK_EXPAND ); // expand folder
                             }
                         }
                     }
@@ -5512,11 +5516,8 @@
                 }
             msgPtr.SaveMessageL();  // Save flag
 
-            if ( !iMailOpened )
-                {
-                // Switch icon to correct one if mail list is visible
-                UpdateMsgIconAndBoldingL( aIndex );
-                }
+            // Switch icon to correct one if mail list is visible
+            // UpdateMsgIconAndBoldingL( aIndex );
 
             if ( iCurrentSortCriteria.iField == EFSMailSortByUnread )
                 {
@@ -7024,7 +7025,7 @@
 				SetMailboxNameToStatusPaneL();
 				}
 			}
-	 	else if ( aEvent == TFSEventMailDeleted && iMailFolder ) // <cmail> Added iMailFolder null safety check </cmail>
+	 	else if ( (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) && iMailFolder ) // <cmail> Added iMailFolder null safety check </cmail>
 			{
 			// Change mail item icon or read status
 			RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>(aParam1);
@@ -7111,7 +7112,7 @@
 			}
 		else if ( aEvent == TFSEventMailChanged && iMailFolder ) // Added iMailFolder null safety check
 			{
-			if ( !iMailOpened ) // do not handle mail changed while viewer/editor is open. This may cause flickering
+			//if ( !iMailOpened ) // do not handle mail changed while viewer/editor is open. This may cause flickering
 			    {
     			// Change mail item icon or read status
     			RArray<TFSMailMsgId>* entries = static_cast<RArray<TFSMailMsgId>*>( aParam1 );
@@ -7632,7 +7633,7 @@
 void CFSEmailUiMailListVisualiser::CreateExtensionL()
     {
     CFSMailBox* box = iAppUi.GetActiveMailbox();
-    CEmailExtension* ext;
+    CEmailExtension* ext=NULL;
     if (box)
         {
         ext = box->ExtensionL( KEmailMailboxStateExtensionUid );
--- a/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -621,49 +621,53 @@
 	if (aResourceId == R_FSEMAILUI_SEARCHLIST_SUBMENU_ACTIONS)
 	    {
         CFSEmailUiMailListModelItem* item = dynamic_cast<CFSEmailUiMailListModelItem*>(iModel->Item(HighlightedIndex()));
-        CFSMailMessage* messagePtr = &item->MessagePtr();
-        TInt menuIndex( 0 );
-
-        //Get # of recipients
-        TInt numRecipients(0);
-        if ( messagePtr )
+        if(item) // Coverity error fix Item could have been NULL
             {
-            numRecipients =TFsEmailUiUtility::CountRecepients( messagePtr );
-            if ( numRecipients == 1 )
+            CFSMailMessage* messagePtr = &item->MessagePtr();
+            TInt menuIndex( 0 );
+    
+            //Get # of recipients
+            TInt numRecipients(0);
+            if ( messagePtr )
                 {
-                //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
-                //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI.
-                if ( messagePtr->GetToRecipients().Count() )
+                numRecipients =TFsEmailUiUtility::CountRecepients( messagePtr );
+                if ( numRecipients == 1 )
                     {
-                    if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetToRecipients()[0]->GetEmailAddress()) )
+                    //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
+                    //email is a distribution list and we need to inc num of Recipients so that "Reply ALL" option appears in UI.
+                    if ( messagePtr->GetToRecipients().Count() )
                         {
-                        numRecipients++;
-                        }
-                    }
-                    if ( messagePtr->GetCCRecipients().Count() )
-                        {
-                        if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetCCRecipients()[0]->GetEmailAddress()) )
+                        if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetToRecipients()[0]->GetEmailAddress()) )
                             {
                             numRecipients++;
                             }
                         }
-                    if ( messagePtr->GetBCCRecipients().Count() )
-                        {
-                        if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetBCCRecipients()[0]->GetEmailAddress()) )
+                        if ( messagePtr->GetCCRecipients().Count() )
                             {
-                            numRecipients++;
+                            if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetCCRecipients()[0]->GetEmailAddress()) )
+                                {
+                                numRecipients++;
+                                }
                             }
-                        }
+                        if ( messagePtr->GetBCCRecipients().Count() )
+                            {
+                            if ( iAppUi.GetActiveMailbox()->OwnMailAddress().GetEmailAddress().Compare(messagePtr->GetBCCRecipients()[0]->GetEmailAddress()) )
+                                {
+                                numRecipients++;
+                                }
+                            }
+                    }
+    
                 }
 
-            }
-        if ( numRecipients > 1 )
-            {
-            aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, EFalse );
-            }
-        else if ( aMenuPane->MenuItemExists( EFsEmailUiCmdActionsReplyAll, menuIndex ) )
-            {
-            aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue );
+            if ( numRecipients > 1 )
+                {
+                aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, EFalse );
+                }
+            else if ( aMenuPane->MenuItemExists( EFsEmailUiCmdActionsReplyAll, menuIndex ) )
+                {
+                aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsReplyAll, ETrue );
+                }
             }
 	    }
 
@@ -815,7 +819,7 @@
     if( Layout_Meta_Data::IsLandscapeOrientation() )
         {
         // landscape must use different layout
-        res = R_AVKON_STATUS_PANE_LAYOUT_IDLE_FLAT;
+		res = R_AVKON_STATUS_PANE_LAYOUT_USUAL_EXT;
         }
 
     if ( StatusPane()->CurrentLayoutResId() !=  res )
@@ -1897,7 +1901,7 @@
         CFSMailBox* activeMailbox = iAppUi.GetActiveMailbox();
         if ( activeMailbox && aMailbox.Id() == activeMailbox->GetId().Id() ) // Safety, in list events that only concern active mailbox are handled
             {
-            if ( iModel && iModel->Count() && aEvent == TFSEventMailDeleted )
+            if ( iModel && iModel->Count() && (aEvent == TFSEventMailDeleted || aEvent == TFSEventMailDeletedFromViewer) )
                 {
                 RArray<TFSMailMsgId>* removedEntries = static_cast<RArray<TFSMailMsgId>*>(aParam1);
                 if ( removedEntries && removedEntries->Count() )
--- a/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListModel.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiSendAttachmentsListModel.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -418,14 +418,15 @@
 	{
     FUNC_LOG;
 	// empty the list
-	if ( iAttachmentsList )
+	if ( !iAttachmentsList ) 
 		{
-		iAttachmentsList->RemoveAllL();
-        iAttachmentsList->SetFocusedL(ETrue);
+        // Coverity error fix. iAttachmentsList was used also later without null checks
+        return;
 		}
-
-	iAttachmentsList->HideListL();
 	
+    iAttachmentsList->RemoveAllL();
+    iAttachmentsList->SetFocusedL(ETrue);
+    iAttachmentsList->HideListL();
 	TRect screenRect;
     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, screenRect );
     iListLayout->SetSize( screenRect.Size() );
--- a/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -158,6 +158,8 @@
 
 // Define static members
 CAknGlobalNote* TFsEmailUiUtility::iGlobalWaitNote = NULL;
+TBool TFsEmailUiUtility::iSaveSelect = ETrue;
+TBool TFsEmailUiUtility::iDownloadSave = EFalse;
 // <cmail>
 CESMRIcalViewer* TFsEmailUiUtility::iMrViewer = NULL;
 TFsEmailUiUtility::CMrViewerEmptyCallback* TFsEmailUiUtility::iMrViewerCallback = NULL;
@@ -520,6 +522,17 @@
 void TFsEmailUiUtility::ShowDiscreetInfoNoteL( TInt aResourceStringId )
     {
     FUNC_LOG;   
+    HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
+    ShowDiscreetInfoNoteL( *noteText );
+    CleanupStack::PopAndDestroy( noteText );
+    }
+
+// -----------------------------------------------------------------------------
+// TFsEmailUiUtility::ShowDiscreetInfoNoteL
+// -----------------------------------------------------------------------------
+void TFsEmailUiUtility::ShowDiscreetInfoNoteL( const TDesC& aNoteText )
+    {
+    FUNC_LOG;   
     //create a host of dummy parameters in order to change the popup duration flag...
     const TDesC& dummyText = KNullDesC;
     CGulIcon* dummyIcon = NULL;
@@ -532,8 +545,7 @@
     TInt flags = 0;
     flags |= KAknDiscreetPopupDurationLong;
     
-    HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
-    CAknDiscreetPopup::ShowLocalPopupL(*noteText, 
+    CAknDiscreetPopup::ShowLocalPopupL( aNoteText, 
                                         dummyText, 
                                         dummyIcon, 
                                         dummySkinId,
@@ -541,7 +553,6 @@
                                         dummyBitmapId, 
                                         dummyMaskId, 
                                         flags);
-    CleanupStack::PopAndDestroy( noteText );
     }
 
 // -----------------------------------------------------------------------------
@@ -682,6 +693,7 @@
 			}
 		}
 	CleanupStack::PopAndDestroy( realFilePath );
+	TFsEmailUiUtility::SetSaveSelect( ret );
 	return ret;
 	}
 
@@ -692,22 +704,35 @@
 void TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( TInt aCount )
     {
     FUNC_LOG;
-    CAknGlobalNote* globalNote = CAknGlobalNote::NewLC();
-    if ( aCount == 1 )
-        {
-        HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_ONE_ATTACHMENT_SAVED );
-        globalNote->ShowNoteL( EAknGlobalInformationNote, *noteText );
-        CleanupStack::PopAndDestroy( noteText );
+    if ( !iDownloadSave || iSaveSelect ) 
+        { 
+	    if ( aCount == 1 )
+	        {
+	        HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_ONE_ATTACHMENT_SAVED );
+	        ShowDiscreetInfoNoteL( *noteText );
+	        CleanupStack::PopAndDestroy( noteText );
+	        }
+	    else if ( aCount > 1 )
+	        {
+	        HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MULTIPLE_ATTACHMENT_SAVED, aCount );
+	        ShowDiscreetInfoNoteL( *noteText );
+	        CleanupStack::PopAndDestroy( noteText );
+	        }
         }
-    else if ( aCount > 1 )
-        {
-        HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_MULTIPLE_ATTACHMENT_SAVED, aCount );
-        globalNote->ShowNoteL( EAknGlobalInformationNote, *noteText );
-        CleanupStack::PopAndDestroy( noteText );
-        }
-    CleanupStack::PopAndDestroy( globalNote );
+    TFsEmailUiUtility::SetSaveSelect( ETrue ); 
+    TFsEmailUiUtility::SetDownloadSave( EFalse ); 
     }
 
+void TFsEmailUiUtility::SetDownloadSave( TBool aValue )
+    {
+    FUNC_LOG;
+    iDownloadSave = aValue;
+    }
+void TFsEmailUiUtility::SetSaveSelect( TBool aValue )
+    {
+    FUNC_LOG;
+    iSaveSelect = aValue;
+    }
 // -----------------------------------------------------------------------------
 // TFsEmailUiUtility::OpenFileL
 // -----------------------------------------------------------------------------
--- a/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -259,9 +259,9 @@
     if (!iAutoLoadImages)
         {
         _LIT8(KDescription, "");
-        _LIT8(KButton, "Display images");
+        //_LIT8(KButton, "Display images");
         HBufC8* description = KDescription().AllocLC(); //HeadingTextLC(R_FREESTYLE_EMAIL_UI_IMAGES_ARE_NOT_DISPLAYED);
-        HBufC8* button = KButton().AllocLC(); //HeadingTextLC(R_FREESTYLE_EMAIL_UI_DISPLAY_IMAGES);
+        HBufC8* button = HeadingTextLC(R_FREESTYLE_EMAIL_UI_DISPLAY_IMAGES); // KButton().AllocLC();
         HBufC8* formatBuffer = NULL;
         if (iMirrorLayout)
             {
@@ -474,7 +474,8 @@
             case CFindItemEngine::EFindItemSearchURLBin:
                 {
                 HBufC8* url8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *valueBuf );
-                FreestyleMessageHeaderURLFactory::CreateEmailSubjectUrlL(*valueBuf);
+                CFreestyleMessageHeaderURL *fsurl = FreestyleMessageHeaderURLFactory::CreateEmailSubjectUrlL(*valueBuf);
+                delete fsurl;
                 CleanupStack::PushL( url8 );
                 StartHyperlinkL(*url8);
                 iWriteStream.WriteL(*url8);
--- a/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -291,6 +291,8 @@
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, ETrue );   
 
+    const TBool isMessage( iAttachmentsListModel->IsMessage( aAttachment ) );
+    
     if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
         {        
         iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, EFalse );  
@@ -302,37 +304,44 @@
         // block saving of embedded messages if needed.
         if ( iView.IsEmbeddedMsgView() )
             {
-            if ( iView.IsEmbeddedMsgSavingAllowed() || !iAttachmentsListModel->IsMessage( aAttachment ) )
+            if ( iView.IsEmbeddedMsgSavingAllowed() || !isMessage )
                 {
                 iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, EFalse );    
                 }              
             }
         else
             {
-            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, EFalse );
+            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, isMessage && !iView.IsEmbeddedMsgSavingAllowed() );
             }
         
         if ( iAttachmentsListModel->GetModel().Count() > 1 )
             {
-            // In embedded message mode, save all needs to be blocked if there
-            // are any message type attachments. This is due to limitations of Activesync plugin.
-            if( !(iView.IsEmbeddedMsgView() && iAttachmentsListModel->IsThereAnyMessageAttachments()) )
+            // Save all cannot be shown if there is one message attachment and saving is not supported
+            if ( !( iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() ) )
                 {
-                iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, EFalse );    
-                }            
+                // In embedded message mode, save all needs to be blocked if there
+                // are any message type attachments. This is due to limitations of Activesync plugin.
+                if( !(iView.IsEmbeddedMsgView() && iAttachmentsListModel->IsThereAnyMessageAttachments()) )
+                    {
+                    iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, EFalse );    
+                    }
+                }
             }         
         }
     else
         {
         iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, EFalse ); 
+        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, isMessage ); 
         if ( iAttachmentsListModel->GetModel().Count() > 1 )
             {
-            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, EFalse );
+            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll,
+                    iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() );
             }         
         }
-    iAttachmentStylusPopup->SetPosition( iAppUi.ClientRect().Center(), 
-                                         CAknStylusPopUpMenu::EPositionTypeRightBottom );
+   
+    
+    iAttachmentStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(), 
+                                         CAknStylusPopUpMenu::EPositionTypeLeftTop );
     iAttachmentStylusPopup->ShowMenu();
     }
 
--- a/emailuis/emailui/src/OverlayControl.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/OverlayControl.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -70,19 +70,22 @@
 
 void COverlayControl::HandlePointerEventL( const TPointerEvent& aPointerEvent )
     {
-    if (aPointerEvent.iType == TPointerEvent::EButton1Down)
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Down )
         {      
         // Give feedback to user (vibration)     
-        iTouchFeedBack->InstantFeedback(this, ETouchFeedbackBasic);  
+        iTouchFeedBack->InstantFeedback( this, ETouchFeedbackBasic );
+        SetPointerCapture( ETrue );        
         }
-    
     CCoeControl::HandlePointerEventL( aPointerEvent );
-    
-    if( iObserver )
+    if ( aPointerEvent.iType == TPointerEvent::EButton1Up )
         {
-        // Do not let leaves disturb the system
-        TRAP_IGNORE(
-            iObserver->HandleOverlayPointerEventL( this, aPointerEvent ));
+        if ( Rect().Contains( aPointerEvent.iPosition ) && iObserver )
+            {
+            // Do not let leaves disturb the system - send event only if the poimter 
+            // was pressed on this control
+            TRAP_IGNORE( iObserver->HandleOverlayPointerEventL( this, aPointerEvent ) );
+            }
+        SetPointerCapture( EFalse );        
         }
      }
 
--- a/emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -148,7 +148,7 @@
     	{
     	// Either no mailbox with the given ID exist or it is not allowed to
     	// be deleted.
-    	// TODO Display an error message?
+    	// Display an error message?
     	CleanupStack::PopAndDestroy(); // mailboxes
     	return;
     	}
--- a/emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -22,9 +22,9 @@
 #include "emailtrace.h"
 
 #include "cfsmailclient.h"
-#include "freestyleemailuiappui.h"
-#include "freestyleemailuiutilities.h"
-#include "freestyleemailuiconstants.h"
+#include "FreestyleEmailUiAppui.h"
+#include "FreestyleEmailUiUtilities.h"
+#include "FreestyleEmailUiConstants.h"
 #include "fsemailstatuspaneindicatorhandler.h"
 #include "commonemailcrkeys.h"
 #include "freestyleemailcenrepkeys.h"
--- a/emailuis/emailui/src/ncscomposeview.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/ncscomposeview.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -105,7 +105,7 @@
     FUNC_LOG;
 
     CNcsComposeView* self = 
-        CNcsComposeView::NewLC( aMailClient, aEnv, 	aAppUi,
+        CNcsComposeView::NewLC( aMailClient, aEnv, aAppUi,
                                 aControlGroup, aMsvSession );
     CleanupStack::Pop( self );
 
@@ -160,7 +160,7 @@
     CAlfControlGroup& attListControlGroup = 
         iEnv.NewControlGroupL( KSendAttachmentManagerDisplayGroup );
     CFSEmailUiSendAttachmentsListVisualiser* sendAttachmentVisualiser =
-		CFSEmailUiSendAttachmentsListVisualiser::NewLC(
+        CFSEmailUiSendAttachmentsListVisualiser::NewLC(
             iEnv, &iAppUi, attListControlGroup );
     iAppUi.AddViewL( sendAttachmentVisualiser );
     CleanupStack::Pop( sendAttachmentVisualiser );
@@ -433,6 +433,91 @@
     TIMESTAMP( "Editor launched" );
     }
 
+// -----------------------------------------------------------------------------
+// Initialises toolbar items.
+// -----------------------------------------------------------------------------
+//
+void CNcsComposeView::DynInitToolbarL( TInt aResourceId,
+    CAknToolbar* aToolbar )
+    {
+    FUNC_LOG;
+    if ( aResourceId == EFsEmailUiTbCmdExpandActions && aToolbar )
+        {
+        CAknToolbarExtension* ext = aToolbar->ToolbarExtension();
+        if ( iContainer )
+            {
+            // Set correct state for show/hide cc field button.
+            CAknButton* ccButton = Button( EFsEmailUiTbCmdCcField, ext );
+            if ( ccButton )
+                {
+                TInt index = iContainer->IsCcFieldVisible() ? 1 : 0;
+                ccButton->SetCurrentState( index, EFalse );
+
+                // Command is dimmed, if there is content in the field.
+                ccButton->SetDimmed( iContainer->GetCcFieldLength() > 0 );
+                }
+
+            // Set correct state for show/hide bcc field button.
+            CAknButton* bccButton = Button( EFsEmailUiTbCmdBccField, ext );
+            if ( bccButton )
+                {
+                TInt index = iContainer->IsBccFieldVisible() ? 1 : 0;
+                bccButton->SetCurrentState( index, EFalse );
+
+                // Command is dimmed, if there is content in the field.
+                bccButton->SetDimmed( iContainer->GetBccFieldLength() > 0 );
+                }
+            }
+        else
+            {
+            ext->HideItemL( EFsEmailUiTbCmdCcField, ETrue );
+            ext->HideItemL( EFsEmailUiTbCmdBccField, ETrue );
+            }
+
+        if ( iNewMessage )
+            {
+            // Set correct state for low priority button.
+            TBool lowPriority = iNewMessage->IsFlagSet( EFSMsgFlag_Low );
+            CAknButton* lowPriorityButton = static_cast<CAknButton*>(
+                ext->ControlOrNull( EFsEmailUiTbCmdLowPriority ) );
+            if ( lowPriorityButton )
+                {
+                TInt index = lowPriority ? 1 : 0;
+                lowPriorityButton->SetCurrentState( index, EFalse ); 
+                }
+
+            // Set correct state for high priority button.
+            TBool highPriority = iNewMessage->IsFlagSet( EFSMsgFlag_Important );
+            CAknButton* highPriorityButton = static_cast<CAknButton*>(
+                ext->ControlOrNull( EFsEmailUiTbCmdHighPriority ) );
+            if ( highPriorityButton )
+                {
+                TInt index = highPriority ? 1 : 0;
+                highPriorityButton->SetCurrentState( index, EFalse );
+                }
+
+            // Set correct state for follow up button.
+            TBool followUp = iNewMessage->IsFlagSet( EFSMsgFlag_FollowUp );
+            CAknButton* followUpButton = static_cast<CAknButton*>(
+                ext->ControlOrNull( EFsEmailUiTbCmdFollowUp ) );
+            if ( followUpButton )
+                {
+                TInt index = followUp ? 1 : 0;
+                followUpButton->SetCurrentState( index, EFalse );
+
+                // Hide follow up button, if follow up is not supported.
+                ext->HideItemL( EFsEmailUiTbCmdFollowUp,
+                    !TFsEmailUiUtility::IsFollowUpSupported( *iMailBox ) );
+                }
+            }
+        else
+            {
+            ext->HideItemL( EFsEmailUiTbCmdLowPriority, ETrue );
+            ext->HideItemL( EFsEmailUiTbCmdHighPriority, ETrue );
+            ext->HideItemL( EFsEmailUiTbCmdFollowUp, ETrue );
+            }
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CNcsComposeView::OfferToolbarEventL
@@ -440,7 +525,7 @@
 void CNcsComposeView::OfferToolbarEventL( TInt aCommand )
     {
     FUNC_LOG;
-    bool attachmentAddition = EFalse;
+    TBool attachmentAddition = EFalse;
     switch ( aCommand )
         {
         case EFsEmailUiTbCmdSend:
@@ -453,12 +538,104 @@
                 HandleCommandL( ENcsCmdSend );
                 }
             break;
-        case EFsEmailUiTbCmdAddRecipient:
-            if ( iContainer )
+        case EFsEmailUiTbCmdCcField:
+            {
+            CAknButton* ccFieldButton = Button( EFsEmailUiTbCmdCcField );
+            if ( ccFieldButton )
                 {
-                iContainer->AppendAddressesL();
+                if ( ccFieldButton->StateIndex() )
+                    {
+                    HandleCommandL( ENcsCmdShowCc );
+                    }
+                else
+                    {
+                    HandleCommandL( ENcsCmdHideCc );
+                    }
+                }
+            break;
+            }
+        case EFsEmailUiTbCmdBccField:
+            {
+            CAknButton* bccFieldButton = Button( EFsEmailUiTbCmdBccField );
+            if ( bccFieldButton )
+                {
+                if ( bccFieldButton->StateIndex()  )
+                    {
+                    HandleCommandL( ENcsCmdShowBcc );
+                    }
+                else
+                    {
+                    HandleCommandL( ENcsCmdHideBcc );
+                    }
                 }
             break;
+            }
+        case EFsEmailUiTbCmdLowPriority:
+            {
+            CAknButton* lowPriorityButton = Button( EFsEmailUiTbCmdLowPriority );
+            if ( lowPriorityButton )
+                {
+                if ( lowPriorityButton->StateIndex() )
+                    {
+                    CAknButton* highPriorityButton = Button( 
+                        EFsEmailUiTbCmdHighPriority );
+                    if ( highPriorityButton )
+                        {
+                        highPriorityButton->SetCurrentState( 0, ETrue );
+                        }
+                    HandleCommandL( ENcsCmdPriorityLow );
+                    }
+                else
+                    {
+                    HandleCommandL( ENcsCmdPriorityNormal );
+                    }
+                }
+            break;
+            }
+        case EFsEmailUiTbCmdHighPriority:
+            {
+            CAknButton* highPriorityButton = Button( EFsEmailUiTbCmdHighPriority );
+            if ( highPriorityButton )
+                {
+                if ( highPriorityButton->StateIndex() )
+                    {
+                    CAknButton* lowPriorityButton = Button( 
+                        EFsEmailUiTbCmdLowPriority );
+                    if ( lowPriorityButton )
+                        {
+                        lowPriorityButton->SetCurrentState( 0, ETrue );
+                        }
+                    HandleCommandL( ENcsCmdPriorityHigh );
+                    }
+                else
+                    {
+                    HandleCommandL( ENcsCmdPriorityNormal );
+                    }
+                }
+            break;
+            }
+        case EFsEmailUiTbCmdFollowUp:
+            {
+            CAknButton* button = Button( EFsEmailUiTbCmdFollowUp );
+            if ( button && iNewMessage )
+                {
+                if ( button->StateIndex() )
+                    {
+                    iNewMessage->SetFlag( EFSMsgFlag_FollowUp );
+                    iNewMessage->ResetFlag( EFSMsgFlag_FollowUpComplete );
+                    iStatusPaneIndicators->SetFollowUpFlag( 
+                        CCustomStatuspaneIndicators::EFollowUp );
+                    }
+                else
+                    {
+                    iNewMessage->ResetFlag( EFSMsgFlag_FollowUp 
+                        | EFSMsgFlag_FollowUpComplete );
+                    iStatusPaneIndicators->SetFollowUpFlag( 
+                        CCustomStatuspaneIndicators::EFollowUpNone );
+                    }
+                }
+            break;
+            }
         case EFsEmailUiTbCmdInsertAudio:
             iAttachmentAddType = MsgAttachmentUtils::EAudio;
             attachmentAddition = ETrue;
@@ -535,10 +712,10 @@
         // DimAllOptions if remotesearch is in progress, 
         // because it takes you into a different view
         TBool dimAllOptions = iContainer->IsRemoteSearchInprogress();
+        SetToolbarItemDimmed( EFsEmailUiTbCmdExpandActions, dimAllOptions );
         SetToolbarItemDimmed( EFsEmailUiTbCmdExpandInsert, dimAllOptions );
-        SetToolbarItemDimmed( EFsEmailUiTbCmdSend,
-                iContainer->AreAddressFieldsEmpty() );
-        SetToolbarItemDimmed( EFsEmailUiTbCmdAddRecipient, dimAllOptions );
+        SetToolbarItemDimmed( EFsEmailUiTbCmdSend, dimAllOptions 
+            || iContainer->AreAddressFieldsEmpty() );
         }
     }
 
@@ -1945,7 +2122,10 @@
         || commitSubjectField || commitBodyField )
         {
         TInt error = KErrNone;
-        TRAP( error, iNewMessage->SaveMessageL() );
+        if(iNewMessage) // Coverity error fix:
+            {
+            TRAP( error, iNewMessage->SaveMessageL() );
+            }
         RefreshToolbar();
         }
     }
@@ -2954,6 +3134,36 @@
     }
 
 // ---------------------------------------------------------------------------
+// Returns the speficied button from the toolbar extension, or NULL, 
+// if the button is not found.
+// ---------------------------------------------------------------------------
+//
+CAknButton* CNcsComposeView::Button( TInt aCmdId, 
+    CAknToolbarExtension* aExtension )
+    {
+    CAknButton* button = NULL;
+
+    // Get toolbar extension.
+    CAknToolbarExtension* extension = aExtension;
+    if ( !aExtension )
+        {
+        CAknToolbar* toolbar = Toolbar();
+        if ( toolbar )
+            {
+            extension = toolbar->ToolbarExtension();
+            }
+        }
+
+    // Get specified button from the extension.
+    if ( extension )
+        {
+        button = static_cast<CAknButton*>( extension->ControlOrNull( aCmdId ) );
+        }
+
+    return button;
+    }
+
+// ---------------------------------------------------------------------------
 // CActiveHelper::NewL()
 // ---------------------------------------------------------------------------
 //
--- a/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -844,6 +844,7 @@
     // Activating the field will set the control to the end of the text
     iMessageField->ActivateL();
     iMessageField->SetCursorPosL( 0, EFalse );
+	iMessageField->FormatAllTextNowL();
 
     inputStream.Open( aReadOnlyQuote.Ptr(), aReadOnlyQuote.Size() );
     CleanupClosePushL( inputStream );
@@ -1793,6 +1794,8 @@
         {
         iHeader->HandleDynamicVariantSwitchL();
         }
+    // force recalculation of the position of every component
+    UpdateFieldPosition( NULL );
     UpdateScrollBarL();
     }
 
--- a/emailuis/emailui/src/ncseditor.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/ncseditor.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -71,6 +71,7 @@
             CEikEdwin::ENoAutoSelection | CEikEdwin::EInclusiveSizeFixed |
             CEikEdwin::ENoHorizScrolling | CEikRichTextEditor::EPasteAsPlainText );
 
+    EnableKineticScrollingL( ETrue );
     iGlobalCharFormat = CCharFormatLayer::NewL();
     iGlobalCharFormat->SetBase( GlobalText()->GlobalCharFormatLayer() );
     GlobalText()->SetGlobalCharFormat( iGlobalCharFormat );
--- a/emailuis/emailui/src/ncsheadercontainer.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/ncsheadercontainer.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -1094,10 +1094,14 @@
 	
 	MNcsControl* ncsCtrl = dynamic_cast<MNcsControl*>( coe );
 	// This will give the the position relative to the top of the control
-	TInt pos = ncsCtrl->CursorPosition();
-	// add the location of the top of the control relative to the top
-	// of the header.
-	pos += coe->Rect().iTl.iY - Rect().iTl.iY;
+	TInt pos(0); // Coverity error fix ncsCtrl could be NULL
+	if(ncsCtrl)
+	    {
+        pos = ncsCtrl->CursorPosition();
+        // add the location of the top of the control relative to the top
+        // of the header.
+        pos += coe->Rect().iTl.iY - Rect().iTl.iY;
+	    }
 	return pos;
 	}
 
--- a/emailuis/emailui/src/ncsutility.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/emailui/src/ncsutility.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -34,11 +34,11 @@
 #include <eikimage.h>
 #include <fbs.h>
 #include <flogger.h>
-#include <aknenv.h>	// CAknEnv
+#include <aknenv.h> // CAknEnv
 
-#include "CFSMailBox.h"
-#include "CFSMailClient.h"
-#include "CFSMailAddress.h"
+#include "cfsmailbox.h"
+#include "cfsmailclient.h"
+#include "cfsmailaddress.h"
 
 #include <aknlayoutscalable_apps.cdl.h>
 #include <layoutmetadata.cdl.h>
@@ -66,23 +66,23 @@
 //
 void NcsUtility::CompleteRelativePathL( 
         const TDesC& aRelativePath, TPtr& aAbsolutePath )
-	{
+    {
     FUNC_LOG;
 
-	// + 2 is for drive letter and ":"
-	if( aAbsolutePath.MaxLength() < aRelativePath.Length() + 2 )
-		{
-		User::Leave( KErrArgument );
-		}
+    // + 2 is for drive letter and ":"
+    if( aAbsolutePath.MaxLength() < aRelativePath.Length() + 2 )
+        {
+        User::Leave( KErrArgument );
+        }
 
-	TFileName path;
-  	path.Copy( aRelativePath );
-	TInt err = CompleteWithAppPath( path );
-	User::LeaveIfError( err );
+    TFileName path;
+    path.Copy( aRelativePath );
+    TInt err = CompleteWithAppPath( path );
+    User::LeaveIfError( err );
 
-	aAbsolutePath.Copy( path );
+    aAbsolutePath.Copy( path );
 
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::GenerateFromLineToMessageBodyL()
@@ -91,14 +91,14 @@
 //
 HBufC* NcsUtility::GenerateFromLineToMessageBodyL( 
         const RPointerArray<CNcsEmailAddressObject>& aFromArray )
-	{
+    {
     FUNC_LOG;
 
     HBufC* buf = DoGenerateAddressLineToMessageBodyL( 
             R_NCS_ENGINE_EMAIL_FROM, aFromArray );
 
-	return buf;
-	}
+    return buf;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::GenerateSentLineToMessageBodyL()
@@ -106,31 +106,31 @@
 // -----------------------------------------------------------------------------
 //
 HBufC* NcsUtility::GenerateSentLineToMessageBodyL( CFSMailMessage& aMessage )
-	{
+    {
     FUNC_LOG;
 
-	HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &aMessage );
-	HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &aMessage );
-	HBufC* sent = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_SENT );
+    HBufC* dateText = TFsEmailUiUtility::DateTextFromMsgLC( &aMessage );
+    HBufC* timeText = TFsEmailUiUtility::TimeTextFromMsgLC( &aMessage );
+    HBufC* sent = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_SENT );
 
-	HBufC* buf = HBufC::NewL( sent->Length() +
+    HBufC* buf = HBufC::NewL( sent->Length() +
                               KSpace().Length() +
-	                          dateText->Length() +
-	                          KSentLineDateAndTimeSeparatorText().Length() +
-	                          timeText->Length() );
-	TPtr ptr = buf->Des();
-	ptr.Append( *sent );
-	ptr.Append( KSpace );
-	ptr.Append( *dateText );
-	ptr.Append( KSentLineDateAndTimeSeparatorText );
-	ptr.Append( *timeText );
+                              dateText->Length() +
+                              KSentLineDateAndTimeSeparatorText().Length() +
+                              timeText->Length() );
+    TPtr ptr = buf->Des();
+    ptr.Append( *sent );
+    ptr.Append( KSpace );
+    ptr.Append( *dateText );
+    ptr.Append( KSentLineDateAndTimeSeparatorText );
+    ptr.Append( *timeText );
 
-	CleanupStack::PopAndDestroy( sent );
-	CleanupStack::PopAndDestroy( timeText );
-	CleanupStack::PopAndDestroy( dateText );
+    CleanupStack::PopAndDestroy( sent );
+    CleanupStack::PopAndDestroy( timeText );
+    CleanupStack::PopAndDestroy( dateText );
 
-	return buf;
-	}
+    return buf;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::GenerateAddressLineToMessageBodyL()
@@ -138,11 +138,11 @@
 // -----------------------------------------------------------------------------
 //
 HBufC* NcsUtility::GenerateAddressLineToMessageBodyL(
-	RPointerArray<CNcsEmailAddressObject>& aToArray, TRecipientType aType )
-	{
+    RPointerArray<CNcsEmailAddressObject>& aToArray, TRecipientType aType )
+    {
     FUNC_LOG;
 
-	// figure out the recipient type dependent text
+    // figure out the recipient type dependent text
     TInt labelResource = R_NCS_ENGINE_EMAIL_TO;
     if ( aType == ERecipientTypeCc )
         {
@@ -152,7 +152,7 @@
     HBufC* buf = DoGenerateAddressLineToMessageBodyL( labelResource, aToArray );
 
     return buf;
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::DoGenerateAddressLineToMessageBodyL()
@@ -228,22 +228,22 @@
 // -----------------------------------------------------------------------------
 //
 HBufC* NcsUtility::GenerateSubjectLineToMessageBodyL( const TDesC& aSubject )
-	{
+    {
     FUNC_LOG;
 
-	// load "Subject:" string
-	HBufC* subjectLabel = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_SUBJECT );
+    // load "Subject:" string
+    HBufC* subjectLabel = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_SUBJECT );
 
-	// allocate buffer for the text
-	HBufC* buf = HBufC::NewL( subjectLabel->Length() + aSubject.Length() );
+    // allocate buffer for the text
+    HBufC* buf = HBufC::NewL( subjectLabel->Length() + aSubject.Length() );
     TPtr ptr = buf->Des();
     ptr.Append( *subjectLabel );
     ptr.Append( aSubject );
 
     CleanupStack::PopAndDestroy( subjectLabel );
 
-	return buf;
-	}
+    return buf;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::CreateNcsAddressL()
@@ -252,27 +252,27 @@
 //
 CNcsEmailAddressObject* NcsUtility::CreateNcsAddressL( 
         const CFSMailAddress& aFsAddress )
-	{
+    {
     FUNC_LOG;
 
-	CNcsEmailAddressObject* address = CNcsEmailAddressObject::NewL( ETrue );
-	CleanupStack::PushL( address );
-	// temporary ugly code because email API can return references to null
-	TDesC& a = aFsAddress.GetEmailAddress();
-	if ( &a )
-		{
-		address->SetEmailAddressL( a );
-		}
-	TDesC& name = aFsAddress.GetDisplayName();
-	if ( &name )
-		{
-		address->SetDisplayNameL( name );
-		}
+    CNcsEmailAddressObject* address = CNcsEmailAddressObject::NewL( ETrue );
+    CleanupStack::PushL( address );
+    // temporary ugly code because email API can return references to null
+    TDesC& a = aFsAddress.GetEmailAddress();
+    if ( &a )
+        {
+        address->SetEmailAddressL( a );
+        }
+    TDesC& name = aFsAddress.GetDisplayName();
+    if ( &name )
+        {
+        address->SetDisplayNameL( name );
+        }
 
-	CleanupStack::Pop( address );
+    CleanupStack::Pop( address );
 
-	return address;
-	}
+    return address;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::CreateFsAddressL()
@@ -281,15 +281,15 @@
 //
 CFSMailAddress* NcsUtility::CreateFsAddressL( 
         const CNcsEmailAddressObject& aNcsAddress )
-	{
+    {
     FUNC_LOG;
 
-	CFSMailAddress* address = CFSMailAddress::NewL();
-	address->SetEmailAddress( aNcsAddress.EmailAddress() );
-	address->SetDisplayName( aNcsAddress.DisplayName() );
+    CFSMailAddress* address = CFSMailAddress::NewL();
+    address->SetEmailAddress( aNcsAddress.EmailAddress() );
+    address->SetDisplayName( aNcsAddress.DisplayName() );
 
-	return address;
-	}
+    return address;
+    }
 
 
 // -----------------------------------------------------------------------------
@@ -299,61 +299,61 @@
 //
 HBufC* NcsUtility::FormatSubjectLineL( 
         const TDesC& aNewSubjectLine, const TDesC& aPrefix )
-	{
-	FUNC_LOG;
-	   
-	    HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
-	    HBufC* prefix = aPrefix.AllocLC();
-	    TPtr formattedSubjectLinePtr = formattedSubjectLine->Des();
-	    TPtr prefixPtr = prefix->Des();
-	    prefixPtr.Trim();
-	    
-	    TInt subjectLineLength = formattedSubjectLinePtr.Length();
-	    TInt length = subjectLineLength;
-	    TInt prefixLength = prefixPtr.Length();
-	    HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX );
-	    TPtr fwdPrt = fwdPrefix->Des();
-	    TInt fwdLength = fwdPrt.Length();
-	    fwdPrt.Trim();
-	    
-	      for(TInt index = formattedSubjectLinePtr.FindC( prefixPtr ); index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( prefixPtr ))
-	        {
-	            formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
-	            length = formattedSubjectLinePtr.Length() - index - prefixLength;
-	        }
-	       formattedSubjectLinePtr.Trim();
-	       
-	       for(TInt index = formattedSubjectLinePtr.FindC( fwdPrt) ; index != KErrNotFound  ; index = formattedSubjectLinePtr.FindC( fwdPrt ))
-	          {
-	               formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
-	               length = formattedSubjectLinePtr.Length() - index - fwdLength;
-	          }
+    {
+    FUNC_LOG;
+       
+        HBufC* formattedSubjectLine = aNewSubjectLine.AllocLC();
+        HBufC* prefix = aPrefix.AllocLC();
+        TPtr formattedSubjectLinePtr = formattedSubjectLine->Des();
+        TPtr prefixPtr = prefix->Des();
+        prefixPtr.Trim();
+        
+        TInt subjectLineLength = formattedSubjectLinePtr.Length();
+        TInt length = subjectLineLength;
+        TInt prefixLength = prefixPtr.Length();
+        HBufC* fwdPrefix = StringLoader::LoadLC( R_NCS_ENGINE_EMAIL_FORWARD_PREFIX );
+        TPtr fwdPrt = fwdPrefix->Des();
+        TInt fwdLength = fwdPrt.Length();
+        fwdPrt.Trim();
+        
+          for(TInt index = formattedSubjectLinePtr.FindC( prefixPtr ); index != KErrNotFound ; index = formattedSubjectLinePtr.FindC( prefixPtr ))
+            {
+                formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
+                length = formattedSubjectLinePtr.Length() - index - prefixLength;
+            }
+           formattedSubjectLinePtr.Trim();
+           
+           for(TInt index = formattedSubjectLinePtr.FindC( fwdPrt) ; index != KErrNotFound  ; index = formattedSubjectLinePtr.FindC( fwdPrt ))
+              {
+                   formattedSubjectLinePtr = formattedSubjectLinePtr.RightTPtr( length );
+                   length = formattedSubjectLinePtr.Length() - index - fwdLength;
+              }
 
-	       formattedSubjectLinePtr.Trim();
-	    
-	    
-	    HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length()  );
-	    TPtr ptr = finalSubject->Des();
-	    if ( AknLayoutUtils::LayoutMirrored() )
-	        {
-	        ptr.Append( formattedSubjectLinePtr );
-	        ptr.Append( KSpace );
-	        ptr.Append( prefixPtr );        
-	        
-	        }
-	    else
-	        {
-	        ptr.Append( prefixPtr );
-	        ptr.Append( KSpace );
-	        ptr.Append( formattedSubjectLinePtr );
-	    
-	        }
-	    CleanupStack::PopAndDestroy( fwdPrefix );
-	    CleanupStack::PopAndDestroy( prefix );
-	    CleanupStack::PopAndDestroy( formattedSubjectLine );
+           formattedSubjectLinePtr.Trim();
+        
+        
+        HBufC* finalSubject = HBufC::NewL( formattedSubjectLinePtr.Length() + prefixPtr.Length() + KSpace().Length()  );
+        TPtr ptr = finalSubject->Des();
+        if ( AknLayoutUtils::LayoutMirrored() )
+            {
+            ptr.Append( formattedSubjectLinePtr );
+            ptr.Append( KSpace );
+            ptr.Append( prefixPtr );        
+            
+            }
+        else
+            {
+            ptr.Append( prefixPtr );
+            ptr.Append( KSpace );
+            ptr.Append( formattedSubjectLinePtr );
+        
+            }
+        CleanupStack::PopAndDestroy( fwdPrefix );
+        CleanupStack::PopAndDestroy( prefix );
+        CleanupStack::PopAndDestroy( formattedSubjectLine );
 
-	    return finalSubject;
-	}
+        return finalSubject;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::ConvertAddressArrayL()
@@ -363,19 +363,19 @@
 void NcsUtility::ConvertAddressArrayL( 
         const RPointerArray<CFSMailAddress>& aSrc, 
         RPointerArray<CNcsEmailAddressObject>& aDst )
-	{
+    {
     FUNC_LOG;
 
- 	for ( TInt i=0; i<aSrc.Count(); i++ )
- 		{
-		CNcsEmailAddressObject* ncsRecipient = 
+    for ( TInt i=0; i<aSrc.Count(); i++ )
+        {
+        CNcsEmailAddressObject* ncsRecipient = 
             NcsUtility::CreateNcsAddressL( *aSrc[i] );
-		CleanupStack::PushL( ncsRecipient );
-		aDst.AppendL( ncsRecipient );
-		CleanupStack::Pop( ncsRecipient );
- 		}
+        CleanupStack::PushL( ncsRecipient );
+        aDst.AppendL( ncsRecipient );
+        CleanupStack::Pop( ncsRecipient );
+        }
 
-	}
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::ConvertAddressArrayL()
@@ -385,19 +385,19 @@
 void NcsUtility::ConvertAddressArrayL( 
         const RPointerArray<CNcsEmailAddressObject>& aSrc, 
         RPointerArray<CFSMailAddress>& aDst )
-	{
+    {
     FUNC_LOG;
 
- 	for ( TInt i=0; i<aSrc.Count(); i++ )
- 		{
-		CFSMailAddress* fsRecipient = 
+    for ( TInt i=0; i<aSrc.Count(); i++ )
+        {
+        CFSMailAddress* fsRecipient = 
             NcsUtility::CreateFsAddressL( *aSrc[i] );
-		CleanupStack::PushL( fsRecipient );
-		aDst.AppendL( fsRecipient );
-		CleanupStack::Pop( fsRecipient );
- 		}
+        CleanupStack::PushL( fsRecipient );
+        aDst.AppendL( fsRecipient );
+        CleanupStack::Pop( fsRecipient );
+        }
 
-	}
+    }
 
 
 
@@ -413,15 +413,15 @@
     {
     FUNC_LOG;
 
-	HBufC* buf = HBufC::NewLC( KMaxFileName );
-	TPtr ptr = buf->Des();
-	NcsUtility::CompleteRelativePathL( aMifRelativeFileName, ptr );
+    HBufC* buf = HBufC::NewLC( KMaxFileName );
+    TPtr ptr = buf->Des();
+    NcsUtility::CompleteRelativePathL( aMifRelativeFileName, ptr );
 
     AknIconUtils::CreateIconL( aImage,
                                aMask,
                                ptr,
-	                           aImgId,
-	                           aMaskId );
+                               aImgId,
+                               aMaskId );
 
     TSize size;
     AknIconUtils::GetContentDimensions( aImage, size );
@@ -431,7 +431,7 @@
     aIcon->SetNewBitmaps( aImage, aMask );
     aIcon->SetPictureOwnedExternally( ETrue );
 
-	CleanupStack::PopAndDestroy( buf );
+    CleanupStack::PopAndDestroy( buf );
 
     }
 
@@ -463,29 +463,29 @@
 TBool NcsUtility::IsEqualAddressArray( 
         const RPointerArray<CFSMailAddress>& aAddresses1,
         const RPointerArray<CFSMailAddress>& aAddresses2 )
-	{
+    {
     FUNC_LOG;
 
-	if ( aAddresses1.Count() != aAddresses2.Count() )
-		{
-		return EFalse;
-		}
+    if ( aAddresses1.Count() != aAddresses2.Count() )
+        {
+        return EFalse;
+        }
     for ( TInt i=0; i<aAddresses1.Count(); i++ )
-    	{
-    	if ( aAddresses1[i]->GetEmailAddress().Compare( 
-    	        aAddresses2[i]->GetEmailAddress() ) != 0 )
-    		{
-    		return EFalse;
-    		}
-    	if ( aAddresses1[i]->GetDisplayName().Compare( 
-    	        aAddresses2[i]->GetDisplayName() ) != 0 )
-    		{
-    		return EFalse;
-    		}
-    	}
+        {
+        if ( aAddresses1[i]->GetEmailAddress().Compare( 
+                aAddresses2[i]->GetEmailAddress() ) != 0 )
+            {
+            return EFalse;
+            }
+        if ( aAddresses1[i]->GetDisplayName().Compare( 
+                aAddresses2[i]->GetDisplayName() ) != 0 )
+            {
+            return EFalse;
+            }
+        }
 
     return ETrue;
-	}
+    }
 
 
 // -----------------------------------------------------------------------------
@@ -493,102 +493,102 @@
 // -----------------------------------------------------------------------------
 //
 TNcsMeasures NcsUtility::Measures()
-	{
+    {
     FUNC_LOG;
 
-	TNcsMeasures ms;
+    TNcsMeasures ms;
 
-	TAknUiZoom zoomLevel = EAknUiZoomNormal;
-	CAknEnv::Static()->GetCurrentGlobalUiZoom( zoomLevel );
-	switch ( zoomLevel )
-		{
-		case EAknUiZoomNormal: case EAknUiZoomAutomatic:
-			{
-			ms.iAifHeight = KAifHeight;
-			ms.iAifLabelMarginVertical = KAifLabelMarginVertical;
-			ms.iAifEditorMarginVertical = KAifEditorMarginVertical;
-			ms.iAifEditorHeight = KAifEditorHeight;
-			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottom;
-			ms.iAttachmentExtraHeightBottom = KAttachmentExtraHeightBottom;
-			ms.iIconMarginPriorityVertical = KIconMarginPriorityVertical;
-			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVertical;
+    TAknUiZoom zoomLevel = EAknUiZoomNormal;
+    CAknEnv::Static()->GetCurrentGlobalUiZoom( zoomLevel );
+    switch ( zoomLevel )
+        {
+        case EAknUiZoomNormal: case EAknUiZoomAutomatic:
+            {
+            ms.iAifHeight = KAifHeight;
+            ms.iAifLabelMarginVertical = KAifLabelMarginVertical;
+            ms.iAifEditorMarginVertical = KAifEditorMarginVertical;
+            ms.iAifEditorHeight = KAifEditorHeight;
+            ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottom;
+            ms.iAttachmentExtraHeightBottom = KAttachmentExtraHeightBottom;
+            ms.iIconMarginPriorityVertical = KIconMarginPriorityVertical;
+            ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVertical;
             ms.iIconMarginAttachmentVertical = KIconMarginAttachmentVertical;
-			ms.iLabelFontHeightPx = KLabelFontHeightPx;
-			ms.iEditorFontHeightPx = KEditorFontHeightPx;
-			}
+            ms.iLabelFontHeightPx = KLabelFontHeightPx;
+            ms.iEditorFontHeightPx = KEditorFontHeightPx;
+            }
             break;
-		case EAknUiZoomSmall: case EAknUiZoomVerySmall:
-			{
-			ms.iAifHeight = KAifHeightSmall;
-			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalSmall;
-			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalSmall;
-			ms.iAifEditorHeight = KAifEditorHeightSmall;
-			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomSmall;
-			ms.iAttachmentExtraHeightBottom = 
+        case EAknUiZoomSmall: case EAknUiZoomVerySmall:
+            {
+            ms.iAifHeight = KAifHeightSmall;
+            ms.iAifLabelMarginVertical = KAifLabelMarginVerticalSmall;
+            ms.iAifEditorMarginVertical = KAifEditorMarginVerticalSmall;
+            ms.iAifEditorHeight = KAifEditorHeightSmall;
+            ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomSmall;
+            ms.iAttachmentExtraHeightBottom = 
                 KAttachmentExtraHeightBottomSmall;
-			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalSmall;
-			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalSmall;
+            ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalSmall;
+            ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalSmall;
             ms.iIconMarginAttachmentVertical = 
                 KIconMarginAttachmentVerticalSmall;
-			ms.iLabelFontHeightPx = KLabelFontHeightPxSmall;
-			ms.iEditorFontHeightPx = KEditorFontHeightPxSmall;
-			}
+            ms.iLabelFontHeightPx = KLabelFontHeightPxSmall;
+            ms.iEditorFontHeightPx = KEditorFontHeightPxSmall;
+            }
             break;
-		case EAknUiZoomLarge: case EAknUiZoomVeryLarge:
-			{
-			ms.iAifHeight = KAifHeightLarge;
-			ms.iAifLabelMarginVertical = KAifLabelMarginVerticalLarge;
-			ms.iAifEditorMarginVertical = KAifEditorMarginVerticalLarge;
-			ms.iAifEditorHeight = KAifEditorHeightLarge;
-			ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomLarge;
-			ms.iAttachmentExtraHeightBottom = 
+        case EAknUiZoomLarge: case EAknUiZoomVeryLarge:
+            {
+            ms.iAifHeight = KAifHeightLarge;
+            ms.iAifLabelMarginVertical = KAifLabelMarginVerticalLarge;
+            ms.iAifEditorMarginVertical = KAifEditorMarginVerticalLarge;
+            ms.iAifEditorHeight = KAifEditorHeightLarge;
+            ms.iSubjectExtraHeightBottom = KSubjectExtraHeightBottomLarge;
+            ms.iAttachmentExtraHeightBottom = 
                 KAttachmentExtraHeightBottomLarge;
-			ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalLarge;
-			ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalLarge;
+            ms.iIconMarginPriorityVertical = KIconMarginPriorityVerticalLarge;
+            ms.iIconMarginFollowUpVertical = KIconMarginFollowUpVerticalLarge;
             ms.iIconMarginAttachmentVertical = 
                 KIconMarginAttachmentVerticalLarge;
-			ms.iLabelFontHeightPx = KLabelFontHeightPxLarge;
-			ms.iEditorFontHeightPx = KEditorFontHeightPxLarge;
-			}
+            ms.iLabelFontHeightPx = KLabelFontHeightPxLarge;
+            ms.iEditorFontHeightPx = KEditorFontHeightPxLarge;
+            }
             break;
-		}
+        }
 
-	return ms;
-	}
+    return ms;
+    }
 
 // -----------------------------------------------------------------------------
 // NcsUtility::GetNearestFontL
 // -----------------------------------------------------------------------------
 //
 CFont* NcsUtility::GetNearestFontL( TInt aLogicalFontId, TInt aHeightPixels )
-	{
+    {
     FUNC_LOG;
 
-	// Base the font on logical font passed to us
-	const CFont* logicalFont = AknLayoutUtils::FontFromId( aLogicalFontId );
-	// Note: This font is owned by the application's system font array (where
-	// it is likely already to have been created) and does not need to be
-	// released. It can just go out of scope.
+    // Base the font on logical font passed to us
+    const CFont* logicalFont = AknLayoutUtils::FontFromId( aLogicalFontId );
+    // Note: This font is owned by the application's system font array (where
+    // it is likely already to have been created) and does not need to be
+    // released. It can just go out of scope.
 
-	// Extract font information
-	TFontSpec fontSpec = logicalFont->FontSpecInTwips();
+    // Extract font information
+    TFontSpec fontSpec = logicalFont->FontSpecInTwips();
 
-	// Desired height, weight, and posture
-	CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() );
-	fontSpec.iHeight = screenDev.VerticalPixelsToTwips( aHeightPixels );
-	fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightNormal );
-	fontSpec.iFontStyle.SetPosture( EPostureUpright );
+    // Desired height, weight, and posture
+    CWsScreenDevice& screenDev = *( CEikonEnv::Static()->ScreenDevice() );
+    fontSpec.iHeight = screenDev.VerticalPixelsToTwips( aHeightPixels );
+    fontSpec.iFontStyle.SetStrokeWeight( EStrokeWeightNormal );
+    fontSpec.iFontStyle.SetPosture( EPostureUpright );
 
-	// Obtain new font
-	CFont* font;
+    // Obtain new font
+    CFont* font;
 
-	TInt err = screenDev.GetNearestFontInTwips( font, fontSpec );
-	User::LeaveIfError( err );
+    TInt err = screenDev.GetNearestFontInTwips( font, fontSpec );
+    User::LeaveIfError( err );
 
-	return font;
-	// Font is now usable. Must be released before application
-	// exit using CWsScreenDevice::ReleaseFont()
-	}
+    return font;
+    // Font is now usable. Must be released before application
+    // exit using CWsScreenDevice::ReleaseFont()
+    }
 
 // <cmail> Platform layout change
 // -----------------------------------------------------------------------------
@@ -739,9 +739,9 @@
 // -----------------------------------------------------------------------------
 //
 TInt NcsUtility::DeleteMessage( CFSMailClient& aMailClient,
-		const TFSMailMsgId& aMailBoxId,
-		const TFSMailMsgId& aFolderId,
-		const TFSMailMsgId& aMsgId )
+        const TFSMailMsgId& aMailBoxId,
+        const TFSMailMsgId& aFolderId,
+        const TFSMailMsgId& aMsgId )
     {
     FUNC_LOG;
     RArray<TFSMailMsgId> msgIds;
@@ -761,7 +761,7 @@
 //
 TRect NcsUtility::HeaderCaptionPaneRect( const TRect& aParent )
     {
-	FUNC_LOG;
+    FUNC_LOG;
     TAknLayoutRect headerCaptionPaneRect;
     headerCaptionPaneRect.LayoutRect( aParent, AknLayoutScalable_Apps::list_single_cmail_header_caption_pane() );
     return headerCaptionPaneRect.Rect();
--- a/emailuis/uicomponents/src/fstextparser.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/uicomponents/src/fstextparser.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -717,7 +717,7 @@
                         info.iFirstFieldPos - iPosition));
             textObject = static_cast<MFsRichTextObject*>
                 (CFsRichTextText::NewL(iGNOSomeText, 0));
-            
+            CleanupStack::PushL(textObject);
             TInt styleId = iTextStyleManager->GetStyleIDL(iGNOCharFormat);
             ((CFsRichTextText*)textObject)->SetStyleId(styleId);
             
@@ -728,7 +728,8 @@
                 iGNOCharFormat.iFontPresentation.iTextColor );
             
             iLastPosition = iPosition;
-            iPosition += iGNOSomeText.Length();      
+            iPosition += iGNOSomeText.Length();
+            CleanupStack::Pop(textObject);
             }
         else
             {
@@ -766,6 +767,7 @@
                                   
                 CFsRichTextText* smileyTextObject = 
                     CFsRichTextText::NewL(iGNOSomeText, 0);
+                CleanupStack::PushL(smileyTextObject); 
                 smileyTextObject->SetTextColor(
                         iGNOCharFormat.iFontPresentation.iTextColor );
                 
@@ -797,7 +799,7 @@
                 
                 CFsRichTextPicture* smileyPictureObject = 
                     CFsRichTextPicture::NewL();
-                
+                CleanupStack::PushL(smileyPictureObject);
                 if(iIsSetSizeOfSmiley)      
                     {
                     texturesize = iSizeOfSmiley;
@@ -819,7 +821,9 @@
                 textObject = CFsRichTextSmiley::NewL(
                         smileyTextObject, 
                         smileyPictureObject);
-                        
+                
+                CleanupStack::Pop(smileyPictureObject);
+                CleanupStack::Pop(smileyTextObject);
                 textObject->SetBeginOfObject(iPosition);
                 textObject->SetEndOfObject(iPosition + iGNOSomeText.Length() - 1);
                 
@@ -844,7 +848,7 @@
         	{
         	textObject = static_cast<MFsRichTextObject*>
                     (CFsRichTextText::NewL(iGNOSomeText, 0));
-            
+            CleanupStack::PushL(textObject); 
         	TInt styleId = iTextStyleManager->GetStyleIDL(iGNOCharFormat);
         	((CFsRichTextText*)textObject)->SetStyleId(styleId);
             
@@ -887,6 +891,8 @@
 	            
 	        iLastPosition = iPosition;
 	        iPosition += iGNOSomeText.Length();
+	        
+	        CleanupStack::Pop(textObject);
 	        }     
         }
     
--- a/emailuis/uicomponents/src/fstextviewervisualizerdata.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/uicomponents/src/fstextviewervisualizerdata.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -709,7 +709,7 @@
         }
 
     CAlfVisual* visual = NULL;
-
+    CFsTexture *texture = NULL;
     if ( aVisual->iIsText )
         {
         visual = CAlfTextVisual::AddNewL( *iControl, aVisual->iLayout );
@@ -1018,30 +1018,32 @@
         {
         retVal = iVisArray[0];
         }
-
-    for ( TInt i = 0; i < iVisArray.Count(); ++i )
+    
+    if(retVal) // Coverity error fix, retVal could be NULL and used
         {
-        if ( iVisArray[i]->iRect.iTl.iY >= iScreenOffset )
+        for ( TInt i = 0; i < iVisArray.Count(); ++i )
             {
-            if ( iVisArray[i]->iRect.iTl.iY < retVal->iRect.iTl.iY )
+            if ( iVisArray[i]->iRect.iTl.iY >= iScreenOffset )
                 {
-                retVal = iVisArray[i];
-                }
-            else if ( iVisArray[i]->iRect.iTl.iY 
-                    == retVal->iRect.iTl.iY )
-                {
-                if ( iVisArray[i]->iRect.iTl.iX < retVal->iRect.iTl.iX )
+                if ( iVisArray[i]->iRect.iTl.iY < retVal->iRect.iTl.iY )
+                    {
+                    retVal = iVisArray[i];
+                    }
+                else if ( iVisArray[i]->iRect.iTl.iY 
+                        == retVal->iRect.iTl.iY )
+                    {
+                    if ( iVisArray[i]->iRect.iTl.iX < retVal->iRect.iTl.iX )
+                        {
+                        retVal = iVisArray[i];
+                        }
+                    }
+                else if ( retVal->iRect.iTl.iY < iScreenOffset )
                     {
                     retVal = iVisArray[i];
                     }
                 }
-            else if ( retVal->iRect.iTl.iY < iScreenOffset )
-                {
-                retVal = iVisArray[i];
-                }
             }
         }
-    
     return retVal;
     }
 
@@ -1057,29 +1059,30 @@
         {
         retVal = iVisArray[0];
         }
-
-    for ( TInt i = 0; i < iVisArray.Count(); ++i )
+    if(retVal) // Coverity error fix, retval could be null and used
         {
-        if ( iVisArray[i]->iRect.iBr.iY <= iScreenOffset + iScreenHeight )
+        for ( TInt i = 0; i < iVisArray.Count(); ++i )
             {
-            if ( iVisArray[i]->iRect.iBr.iY > retVal->iRect.iBr.iY )
+            if ( iVisArray[i]->iRect.iBr.iY <= iScreenOffset + iScreenHeight )
                 {
-                retVal = iVisArray[i];
-                }
-            else if ( iVisArray[i]->iRect.iBr.iY 
-                    == retVal->iRect.iBr.iY )
-                {
-                if ( iVisArray[i]->iRect.iBr.iX > retVal->iRect.iBr.iX )
+                if ( iVisArray[i]->iRect.iBr.iY > retVal->iRect.iBr.iY )
                     {
                     retVal = iVisArray[i];
                     }
-                }
-            else 
-                {
+                else if ( iVisArray[i]->iRect.iBr.iY 
+                        == retVal->iRect.iBr.iY )
+                    {
+                    if ( iVisArray[i]->iRect.iBr.iX > retVal->iRect.iBr.iX )
+                        {
+                        retVal = iVisArray[i];
+                        }
+                    }
+                else 
+                    {
+                    }
                 }
             }
         }
-
     return retVal;
     }
 
--- a/emailuis/uicomponents/src/fstreeiterator.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/uicomponents/src/fstreeiterator.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -284,7 +284,7 @@
                     next = item;
                     }
                 }
-            else
+            else if(node) // coverity error fix
                 {
                 item = node;
                 node = item->Parent();
--- a/emailuis/widget/emailwidgetsettings/src/emailwidgetsettingslistview.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/widget/emailwidgetsettings/src/emailwidgetsettingslistview.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -119,12 +119,8 @@
 // CEmailWidgetSettingsListView::HandleForegroundEventL
 // ---------------------------------------------------------------------------
 //
-void CEmailWidgetSettingsListView::HandleForegroundEventL(TBool aForeground)
+void CEmailWidgetSettingsListView::HandleForegroundEventL(TBool /*aForeground*/)
     {
-    if (!aForeground)
-        {
-        AppUi()->HandleCommandL(EAknSoftkeyCancel); //Exit app
-        }
     }
 
 // ---------------------------------------------------------------------------
--- a/emailuis/widget/rom/emailwidget_resources.iby	Fri Mar 12 15:41:14 2010 +0200
+++ b/emailuis/widget/rom/emailwidget_resources.iby	Mon Mar 15 12:39:10 2010 +0200
@@ -22,18 +22,23 @@
 #ifndef FF_CMAIL_INTEGRATION
 #ifdef FF_EMAIL_FRAMEWORK
 
-// Enabled by DTD-localization tools, language specific
-
-// Following export is used only for fully localised widget
-//data=ZPRIVATE\200159c0\install\emailwidget\xuikon\00\EW.o0000 \private\200159c0\install\emailwidget\xuikon\00\EW.o0000
-
-// For partially localised widget add exports here for those languages which require different css file
-// ( add exports behind language specific flags )
-// ...
 
 data=ZPRIVATE\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd \private\200159c0\install\emailwidget\hsps\00\emailwidgetconfiguration.dtd
 data=ZPRIVATE\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif \private\200159c0\install\emailwidget\hsps\00\emailwidgeticon.mif
 
+#if defined (__LOCALES_37_IBY__)
+data=ZPRIVATE\200159c0\install\emailwidget\xuikon\37\EW.o0037 \private\200159c0\install\emailwidget\xuikon\37\EW.o0037
+#endif
+#if defined  (__LOCALES_50_IBY__)
+data=ZPRIVATE\200159c0\install\emailwidget\xuikon\50\EW.o0050 \private\200159c0\install\emailwidget\xuikon\50\EW.o0050
+#endif
+#if defined  (__LOCALES_57_IBY__)
+data=ZPRIVATE\200159c0\install\emailwidget\xuikon\57\EW.o0057 \private\200159c0\install\emailwidget\xuikon\57\EW.o0057
+#endif
+#if defined  (__LOCALES_94_IBY__)
+data=ZPRIVATE\200159c0\install\emailwidget\xuikon\94\EW.o0094 \private\200159c0\install\emailwidget\xuikon\94\EW.o0094
+#endif
+
 #endif //FF_EMAIL_FRAMEWORK
 #endif //FF_CMAIL_INTEGRATION
 
--- a/ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosaoplugin/src/IpsSosAOMboxLogic.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -742,6 +742,7 @@
     TAOInfo info;
     info.iLastSuccessfulUpdate = now;
     info.iUpdateSuccessfulWithCurSettings = ETrue;
+    info.iLastUpdateFailed=EFalse;
     iExtendedSettings->SetLastUpdateInfo( info );
     // clear flag
     iExtendedSettings->SetEmnReceivedButNotSyncedFlag( EFalse );
--- a/ipsservices/ipssosplugin/inc/ipsplgconnectandrefreshfolderlist.h	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/inc/ipsplgconnectandrefreshfolderlist.h	Mon Mar 15 12:39:10 2010 +0200
@@ -127,16 +127,11 @@
 
     //data
 private:
-    
+
     TInt                                iState;
-    TFSMailMsgId 						iMailboxId;
-    CMsvSession&						iSession;
-    TMsvId								iService;
-    CMsvOperation* 						iOperation;
     CIpsPlgTimerOperation*				iTimer;
     CMsvEntrySelection*					iMsvEntry;
     TPckgBuf<TImap4CompoundProgress>    iProgressBuf;
-    TRequestStatus						iObserverRequestStatus;
     CAknWaitNoteWrapper*                iAsyncWaitNote;
     };
 
--- a/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -75,15 +75,11 @@
             0, // FSRequestId
             EFalse), // SignallingAllowed
     iState( EIdle ),
-    iMailboxId( aMailboxId ),
-    iSession( aSession ),
-    iService( aService ),
-    iOperation( NULL ),
     iTimer( NULL ),
-    iMsvEntry( NULL ),
-    iObserverRequestStatus( aObserverRequestStatus )
+    iMsvEntry( NULL )
     {
     FUNC_LOG;
+    iService = aService;
     }
 
 // ----------------------------------------------------------------------------
@@ -96,7 +92,6 @@
     iMsvEntry = aMsvEntry.CopyL();    
     iState = EStartConnect;
     DoRunL();
-    
     }
 
 // ----------------------------------------------------------------------------
@@ -106,7 +101,6 @@
     FUNC_LOG;
     Cancel();
     delete iMsvEntry;
-    delete iOperation;
     }
 
 // ---------------------------------------------------------------------------
@@ -224,11 +218,11 @@
             delete iOperation;
             iOperation = NULL;
             iOperation = CIpsPlgDisconnectOp::NewL( 
-                            iSession, 
+            		        iMsvSession, 
                             iStatus, 
                             iService, 
                             *iTimer,
-                            iMailboxId, 
+                            iFSMailboxId, 
                             *observer, 
                             NULL );
             iState = EDisconnecting;
@@ -268,7 +262,7 @@
     // Get the TMsvEntry for the mailbox, which we use to get its name.
     TMsvId serviceId;
     TMsvEntry mailboxServiceEntry;
-    User::LeaveIfError( iSession.GetEntry( iMailboxId.Id(), serviceId, mailboxServiceEntry ) );
+    User::LeaveIfError( iMsvSession.GetEntry( iFSMailboxId.Id(), serviceId, mailboxServiceEntry ) );
 
     // Load/construct the strings for the dialog.
     HBufC* headerText( NULL );
--- a/ipsservices/ipssosplugin/src/ipsplgimap4moveremoteop.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4moveremoteop.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -139,6 +139,7 @@
         }        
     TImap4SyncProgress progg;
     progg.iErrorCode = KErrNone;
+    progg.iFoldersNotFound = 0;
     TPckgBuf<TImap4SyncProgress> param(progg);
     iSyncProgress.Copy(param);
     return iSyncProgress;  
--- a/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -248,6 +248,7 @@
         return *iFetchErrorProgress;
         }        
     TImap4SyncProgress progg;
+    progg.iFoldersNotFound = 0;
     progg.iErrorCode = KErrNone;
     TPckgBuf<TImap4SyncProgress> param(progg);
     iSyncProgress.Copy(param);
--- a/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -1251,7 +1251,11 @@
 
         CleanupStack::Pop( result );
         }
-    SetFetchStateL( aEntry, aMessageId.Id(), EFalse, *result );
+    if(result) // coverity error fix: result might be null
+        {
+        SetFetchStateL( aEntry, aMessageId.Id(), EFalse, *result );
+        }
+
     CleanupStack::PopAndDestroy( buf );
     return result;
     }
--- a/ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgpop3fetchoperation.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -76,6 +76,7 @@
     else
         {
         TPop3Progress progg;
+        progg.iTotalSize = 0;
         progg.iErrorCode = KErrNone;
         TPckgBuf<TPop3Progress> param(progg);
         iProgressBuf.Copy(param);
--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -1360,36 +1360,43 @@
 void CIpsPlgSosBasePlugin::CopyMessagePartFileL(
     const TFSMailMsgId& /* aMailBoxId */,
     const TFSMailMsgId& /* aParentFolderId */,
-    const TFSMailMsgId& aMessageId,
+    const TFSMailMsgId& /*aMessageId*/,
     const TFSMailMsgId& aMessagePartId,
     const TDesC& aFilePath)
 	{
     FUNC_LOG;
-    CMsvEntry* cEntry( NULL );
-    CImEmailMessage* message( NULL );
-
-    CFileMan* fileMgr = CFileMan::NewL( iSession->FileSession() );
-    CleanupStack::PushL( fileMgr );
-
-    // We trust that the message ID really refers to a message
-    GetMessageEntryL( aMessageId.Id(), cEntry, message );
-
-    // Without this e.g. alternative body iCal parts are not found
-    message->GetAttachmentsListL( aMessageId.Id(),
-        CImEmailMessage::EAllAttachments,
-        CImEmailMessage::EThisMessageAndEmbeddedMessages );
-    MMsvAttachmentManager& attachmentMgr( message->AttachmentManager() );
-    // It is assumed that the attachment ID is same as the corresponding
-    // entry ID
-    RFile attachmentFile = attachmentMgr.GetAttachmentFileL(
-        (TMsvAttachmentId) aMessagePartId.Id() );
-
-    // Overwrites the target file if such exists
-    // There is no other way to report errors than leave
-    User::LeaveIfError( fileMgr->Copy( attachmentFile, aFilePath ) );
-
-    attachmentFile.Close();
-    CleanupStack::PopAndDestroy( fileMgr );
+    CMsvEntry* cEntry = iSession->GetEntryL( aMessagePartId.Id() );
+    CleanupStack::PushL( cEntry );
+    CMsvStore* store = NULL;
+    TBool hasStore = cEntry->HasStoreL();
+    if ( hasStore )
+        {
+        store = cEntry->ReadStoreL();
+        }
+    if ( !store || !hasStore )
+        {
+        User::Leave( KErrNotFound );
+        }
+    CleanupStack::PushL( store );
+    MMsvAttachmentManager& attachmentMgr = store->AttachmentManagerL();
+    // It is assumed that the attachment file is always in the index 0
+    if ( attachmentMgr.AttachmentCount() )
+        {
+        RFile attachmentFile =
+            attachmentMgr.GetAttachmentFileL( 0 );
+        CleanupClosePushL( attachmentFile );
+        CFileMan* fileMgr = CFileMan::NewL( iSession->FileSession() );
+        CleanupStack::PushL( fileMgr );
+        User::LeaveIfError( fileMgr->Copy( attachmentFile, aFilePath ) );
+        CleanupStack::PopAndDestroy( fileMgr );
+        CleanupStack::PopAndDestroy(); // attachmentFile.Close()
+        }
+    else
+        {
+        User::Leave( KErrNotFound );
+        }
+    CleanupStack::PopAndDestroy( store );
+    CleanupStack::PopAndDestroy( cEntry );
 	}
 
 // ----------------------------------------------------------------------------
@@ -1617,6 +1624,7 @@
 	{
     FUNC_LOG;
 	TFSProgress status;
+	status.iError = KErrNone;
 	status.iProgressStatus = TFSProgress::EFSStatus_RequestComplete;
 	for ( TInt i = 0; i < iOperations.Count(); i++ )
         {
--- a/ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgsyncstatehandler.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -307,6 +307,7 @@
     TAOInfo info;
     info.iLastSuccessfulUpdate = now;
     info.iUpdateSuccessfulWithCurSettings = ETrue;
+    info.iLastUpdateFailed = EFalse;
     extendedSettings->SetLastUpdateInfo( info );
     // clear flag
     extendedSettings->SetEmnReceivedButNotSyncedFlag( EFalse );
--- a/ipsservices/ipssossettings/src/ipssetview.cpp	Fri Mar 12 15:41:14 2010 +0200
+++ b/ipsservices/ipssossettings/src/ipssetview.cpp	Mon Mar 15 12:39:10 2010 +0200
@@ -165,6 +165,7 @@
     CIpsSetView* self = static_cast<CIpsSetView*>( aSelfPtr );
 
     TSubViewActivationData subView;
+    subView.iSubviewId = 0;
     TPckgBuf<CESMailSettingsPlugin::TSubViewActivationData> subViewData( subView ); //<cmail>
     subViewData.Copy( *self->iCustomMessage );
     subView = subViewData();
--- a/meetingrequest/mrcommon/group/esmrcommon.mmp	Fri Mar 12 15:41:14 2010 +0200
+++ b/meetingrequest/mrcommon/group/esmrcommon.mmp	Mon Mar 15 12:39:10 2010 +0200
@@ -53,11 +53,9 @@
 LIBRARY                 featmgr.lib
 LIBRARY                 centralrepository.lib
 LIBRARY                 PlatformEnv.lib
-LIBRARY cmaillogger.lib
+LIBRARY                 cmaillogger.lib
 
-#ifdef TRACE_INTO_FILE
 LIBRARY                 flogger.lib
-#endif // TRACE_INTO_FILE
 
 // end of file