Revision: 201031 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 09:38:05 +0300
branchRCL_3
changeset 23 dcf0eedfc1a3
parent 22 d620048b4810
child 24 d189ee25cf9d
Revision: 201031 Kit: 201033
emailservices/emailframework/group/FSMailFramework.mmp
emailservices/emailframework/inc/CFSMailPluginManager.h
emailservices/emailframework/inc/emailversionnumbers.hrh
emailservices/emailframework/src/CFSMailClient.cpp
emailservices/emailframework/src/CFSMailPluginManager.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp
emailservices/emailserver/group/bld.inf
emailservices/emailserver/inc/fsemailserverpskeys.h
emailservices/emailstore/base_plugin/group/BasePlugin.mmp
emailservices/emailstore/base_plugin/src/basepluginmisc.cpp
emailservices/emailstore/message_store/MsgStoreRfsPlugin/group/RfsMsgStorePlugin.mmp
emailservices/emailstore/message_store/server/group/MessageStoreServer.mmp
emailservices/emailstore/preinstall/group/EmailStorePreInstall.mmp
emailservices/emailstore/preinstall/inc/ProcessTimer.h
emailuis/emailui/conf/freestyleemailui.confml
emailuis/emailui/conf/freestyleemailui_2001E277.crml
emailuis/emailui/data/FreestyleEmailUi.rss
emailuis/emailui/inc/FreestyleEmailCenRepKeys.h
emailuis/emailui/inc/FreestyleEmailUiAppui.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h
emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h
emailuis/emailui/inc/FreestyleEmailUiShortcutBinding.h
emailuis/emailui/inc/FreestyleMessageHeaderURLEventHandler.h
emailuis/emailui/inc/ncscomposeview.h
emailuis/emailui/loc/freestyleemailui.loc
emailuis/emailui/src/FreestyleEmailUi.cpp
emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp
emailuis/emailui/src/FreestyleEmailUiAppui.cpp
emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp
emailuis/emailui/src/FreestyleEmailUiShortcutBinding.cpp
emailuis/emailui/src/FreestyleEmailUiViewBase.cpp
emailuis/emailui/src/FreestyleEmailUiWizardObserver.cpp
emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp
emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp
emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp
emailuis/emailui/src/ncsaddressinputfield.cpp
emailuis/emailui/src/ncscomposeview.cpp
emailuis/emailui/src/ncscomposeviewcontainer.cpp
emailuis/emailui/src/ncseditor.cpp
emailuis/emailui/src/ncssubjectfield.cpp
emailuis/uicomponents/src/fstextparser.cpp
emailuis/uicomponents/src/fstreenode.cpp
emailuis/uicomponents/src/fstreeplainonelinenodevisualizer.cpp
emailuis/uicomponents/src/fstreevisualizerbase.cpp
help/data/xhtml.zip
ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp
ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp
ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp
ipsservices/ipssossettings/data/ipssetuimailsettings.ra
ipsservices/ipssossettings/group/ipssossettings.mmp
ipsservices/ipssossettings/src/ipssetuinotes.cpp
ipsservices/ipssossettings/tsrc/IpsSosTestApp/group/ipssostestapp.mmp
--- a/emailservices/emailframework/group/FSMailFramework.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailframework/group/FSMailFramework.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -33,7 +33,6 @@
 
 USERINCLUDE ../../../inc
 APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   /epoc32/include/variant
 
 
 USERINCLUDE     ../inc
--- a/emailservices/emailframework/inc/CFSMailPluginManager.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailframework/inc/CFSMailPluginManager.h	Thu Aug 19 09:38:05 2010 +0300
@@ -108,7 +108,13 @@
      */  
 	 void ListImplementationsL( RPointerArray<CFSMailPlugin>& aImplementations,
 	                            RPointerArray<CImplementationInformation>& aInfo );
-									 
+	
+     /**
+      * recheck existing plugins
+      *
+      */                 								 
+     void CFSMailPluginManager::RecheckPlugins( );
+     
 protected:
 
     /**
--- a/emailservices/emailframework/inc/emailversionnumbers.hrh	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailframework/inc/emailversionnumbers.hrh	Thu Aug 19 09:38:05 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2009 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"
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description : Common email version number definitions
-* Version     : %version: 10.1.7 %
+* Version     : %version: 10.1.7.1.1 %
 *
 */
 
@@ -25,14 +25,14 @@
  *  version number both major and minor version are stored in separate 32 bit
  *  location.
  */
-#define KEmailBinaryVersionNumber 10.9
+#define KEmailBinaryVersionNumber 10.11
 
 /** ECom version number to be used in Cmail related ECom registeration
  *  resource files.
  *  NOTE: Version number in ECom registeration resource file is saved as one
  *  byte, so 255 is the maximum version number.
  */
-#define KEmailEcomVersionNumber 9
+#define KEmailEcomVersionNumber 11
 
 /** Binary paging setting (paged/non-paged)
  */
--- a/emailservices/emailframework/src/CFSMailClient.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailframework/src/CFSMailClient.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -118,19 +118,28 @@
 // CFSMailClient::GetMailBoxByUidL
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailBox* CFSMailClient::GetMailBoxByUidL(const TFSMailMsgId aMailBoxId)
-{
+    {
     FUNC_LOG;
 	// select plugin
 	CFSMailBox* mailBox = NULL;
 	CFSMailPlugin* plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId);
 	if(plugin)
-	{
+	    {
 		// get mailbox from plugin
 		mailBox = plugin->GetMailBoxByUidL(aMailBoxId);
-	}
-
+	    }
+	else
+	    {
+        iFWImplementation->GetPluginManager().RecheckPlugins();
+        plugin = iFWImplementation->GetPluginManager().GetPluginByUid(aMailBoxId);
+        if(plugin)
+            {
+            // get mailbox from plugin
+            mailBox = plugin->GetMailBoxByUidL(aMailBoxId);
+            }
+	    }
 	return mailBox;
-}
+    }
 
 // -----------------------------------------------------------------------------
 // CFSMailClient::GetMailBoxByUidLC
@@ -242,6 +251,8 @@
 	CFSMailBox *mailBox = NULL;	
     // </cmail>	
 	
+	iFWImplementation->GetPluginManager().RecheckPlugins();
+	
 	if(aPlugin.IsNullId())
 	{
 		for(TInt i=0;i<iFWImplementation->GetPluginManager().GetPluginCount();i++)
--- a/emailservices/emailframework/src/CFSMailPluginManager.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailframework/src/CFSMailPluginManager.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -139,5 +139,42 @@
 	return iPluginList.Count();
 	}
 	
+// -----------------------------------------------------------------------------
+// CFSMailPluginManager::RecheckPlugins
+// -----------------------------------------------------------------------------
 
-
+void CFSMailPluginManager::RecheckPlugins( )
+    {
+    FUNC_LOG;
+    
+    CFSMailPlugin* plugin = NULL;
+    
+    TInt tempCount = iPluginInfo.Count();
+    
+    for ( TInt i = 0; i < tempCount; i++ )
+        {
+        TUid id = iPluginInfo[i]->ImplementationUid();
+        TBool found = false;
+        
+        // check if plugin is already in plugin list
+        for ( TInt j = 0; j < iPluginList.Count(); j++)
+            {
+            
+            if ( iPluginList[j]->iPluginId == id )
+                {
+                found = true;
+                break;
+                }
+            }
+        // if plugin is not found try to create it and add it to plugin list.
+        if ( !found )
+            {
+            TRAPD(err,plugin = CFSMailPlugin::NewL( id ));
+            CFSMailPlugin::Close();
+            if ( err == KErrNone && plugin != NULL )
+                {
+                AddPluginL(id,plugin);
+                }
+            }
+        }
+    }
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -43,6 +43,8 @@
 #include "cmailpluginproxy.h"
 #include "cmailhandlerpluginpanic.h"
 
+#include "fsemailserverpskeys.h"
+
 using namespace EmailInterface;
 
 // ---------------------------------------------------------
@@ -98,6 +100,18 @@
     InitializeExternalAccountsL();
 
     iSettings->StartObservingL( this );
+
+    TInt err = RProperty::Define( KPSUidEmailServerCategory, 
+                                  KIntMailboxCount, 
+                                  RProperty::EInt );
+    if ( err != KErrAlreadyExists && err != KErrNone )
+        {
+        User::LeaveIfError( err );
+        }
+    
+    // set mailbox initial count 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }
 
 // ---------------------------------------------------------
@@ -470,7 +484,7 @@
                 // Use localisation format when displaying also unread messages
 
                 // Arrays must be used when loc string contains indexed parameters
-                CDesCArrayFlat* strings = new CDesCArrayFlat( 1 );
+                CDesCArrayFlat* strings = new( ELeave) CDesCArrayFlat( 1 );
                 CleanupStack::PushL( strings );
                 strings->AppendL( accountName ); // replace "%0U" with mailbox name
 
@@ -852,8 +866,8 @@
 void CMailCpsHandler::HandleEventL(
     TFSMailEvent aEvent,
     TFSMailMsgId aMailbox,
-    TAny* aParam1,
-    TAny* aParam2,
+    TAny* /*aParam1*/,
+    TAny* /*aParam2*/,
     TAny* /*aParam3*/ )
     {
     FUNC_LOG;
@@ -886,6 +900,7 @@
             }
         case TFSEventNewMail:
             {
+            iSettings->ToggleWidgetNewMailIconL( ETrue, aMailbox );
             SetUpdateNeeded( aMailbox );
             UpdateFullL();
             break;
@@ -930,6 +945,10 @@
         {
         iLiwIf->AddWidgetToHomescreenL( aMailbox );
         }
+
+    // update total mailbox count. 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }
 
 // ---------------------------------------------------------
@@ -979,6 +998,9 @@
             break;
             }
         }
+    // update total mailbox count. 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }
 
 
--- a/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/emailsoundhandler.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -231,7 +231,7 @@
     TInt preference = KAudioPrefNewSpecialMessage;
     if ( !mailVibraEnabled )
         {
-        preference = EMdaPriorityPreferenceQuality;
+        preference = KAudioPrefNewEmail; // Used in TB.92 only! In 10.X adaptation will manage vibra setting itself.
         }
 
     if (IsBeepOnceSetL(*profile))
@@ -255,12 +255,12 @@
             {
             // Play the silent tone with KAudioPrefNewSpecialMessage
             // in order to avoid the distortion
-			// KAudioPrefNewSpecialMessage does not play vibra if KProfileSilentTone is played
+            // KAudioPrefNewSpecialMessage does not play vibra if KProfileSilentTone is played
             preference = KAudioPrefNewSpecialMessage;
             }
         RFs fs;
         TInt err = fs.Connect();
-		CleanupClosePushL( fs );
+        CleanupClosePushL( fs );
             
         if ( err == KErrNone )
             {
@@ -283,7 +283,7 @@
                 fileToPlay.Append( KDefaultEmailTone );
                 }
             
-		    CleanupStack::PopAndDestroy( &fs );
+            CleanupStack::PopAndDestroy( &fs );
             }
         
         iAudioPlayer = CMdaAudioPlayerUtility::NewFilePlayerL( 
--- a/emailservices/emailserver/group/bld.inf	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailserver/group/bld.inf	Thu Aug 19 09:38:05 2010 +0300
@@ -29,9 +29,10 @@
 PRJ_EXPORTS
 
 ../inc/fsmailserverconst.hrh |../../../inc/fsmailserverconst.hrh
-../inc/fsmailserverconst.h |../../../inc/fsmailserverconst.h// <cmail>
+../inc/fsmailserverconst.h |../../../inc/fsmailserverconst.h
+../inc/fsemailserverpskeys.h |../../../inc/fsemailserverpskeys.h
 
-../cmailhandlerplugin/inc/cmailwidgetcenrepkeys.h |../../../inc/cmailwidgetcenrepkeys.h// </cmail>
+../cmailhandlerplugin/inc/cmailwidgetcenrepkeys.h |../../../inc/cmailwidgetcenrepkeys.h
 ../rom/fsmailserver.iby                 CORE_APP_LAYER_IBY_EXPORT_PATH(fsmailserver.iby)
 ../rom/fsmailserverresources.iby        LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(fsmailserverresources.iby)
 ../loc/fsmailserver.loc                 APP_LAYER_LOC_EXPORT_PATH(fsmailserver.loc)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailservices/emailserver/inc/fsemailserverpskeys.h	Thu Aug 19 09:38:05 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* 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:  Domain Publish & Subscribe keys for emailserver
+ *
+ *
+*/
+
+
+#ifndef FSEMAILSERVERPSKEYS_H
+#define FSEMAILSERVERPSKEYS_H
+
+const TUid KPSUidEmailServerCategory = { 0x2001F40A }; // see KFSMailServerUid
+
+/**
+ * Keeps amount of mailboxes that is registered in Email application
+ */
+const TUint KIntMailboxCount = 0x00000001;
+
+
+#endif // FSEMAILSERVERPSKEYS_H
--- a/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/base_plugin/group/BasePlugin.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -46,7 +46,6 @@
 USERINCLUDE ../inc
 
 USERINCLUDE ../../../../inc
-SYSTEMINCLUDE /epoc32/include/ecom
 
 APP_LAYER_SYSTEMINCLUDE
 
--- a/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/base_plugin/src/basepluginmisc.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -204,6 +204,9 @@
     criteria.AddResultPropertyL( KMsgStorePropertySize );
     criteria.AddResultPropertyL( KMsgStorePropertyFrom );
     criteria.AddResultPropertyL( KMsgStorePropertySubject );
+    criteria.AddResultPropertyL( KMsgStorePropertyTo );
+    criteria.AddResultPropertyL( KMsgStorePropertyCc );
+    criteria.AddResultPropertyL( KMsgStorePropertyBcc );
 
     /**@ figure the lifecycle mgmnt of the handler.*/
     CSearchHandler* searchHandler = new (ELeave) CSearchHandler( aSearchObserver, *this, aMailBoxId );
--- a/emailservices/emailstore/message_store/MsgStoreRfsPlugin/group/RfsMsgStorePlugin.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/message_store/MsgStoreRfsPlugin/group/RfsMsgStorePlugin.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -30,8 +30,7 @@
 
 VERSION       KRfsMsgStoreMMPVersionNumber
 
-MW_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   /epoc32/include/ecom
+APP_LAYER_SYSTEMINCLUDE
 
 USERINCLUDE  ../inc
 USERINCLUDE  ../data
@@ -55,7 +54,7 @@
 LIBRARY    ecom.lib
 LIBRARY    efsrv.lib
 LIBRARY    platformenv.lib
-LIBRARY	   bafl.lib
+LIBRARY    bafl.lib
 LIBRARY    estor.lib
 
 // END FILE RfsMsgStorePlugin.mmp
--- a/emailservices/emailstore/message_store/server/group/MessageStoreServer.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/message_store/server/group/MessageStoreServer.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -38,10 +38,6 @@
 //MACRO DEBUG_LOG_OPTION_INFO
 
 // COMMENT OUT THESE 4 LINES TO BYPASS THE CRYPTO API
-//SYSTEMINCLUDE /epoc32/include/libc
-//USERINCLUDE   /epoc32/include/certicom
-//USERINCLUDE   /epoc32/include/CryptoApi
-//LIBRARY       cryptoapi.lib
 
 USERINCLUDE   ../inc
 USERINCLUDE   ../../client/api
@@ -86,7 +82,7 @@
 LIBRARY euser.lib 
 LIBRARY estor.lib
 LIBRARY efsrv.lib
-LIBRARY	bafl.lib
+LIBRARY bafl.lib
 LIBRARY edbms.lib
 LIBRARY sysutil.lib
 LIBRARY charconv.lib
--- a/emailservices/emailstore/preinstall/group/EmailStorePreInstall.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/preinstall/group/EmailStorePreInstall.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -41,16 +41,17 @@
 MACRO DEBUG_LOG_OPTION_ERRORS
 MACRO DEBUG_LOG_OPTION_INFO
 
-SOURCEPATH		../src
+SOURCEPATH      ../src
 SOURCE          EmailStorePreInstall.cpp ProcessTimer.cpp
 
 USERINCLUDE     ../inc
 USERINCLUDE     ../../inc
+USERINCLUDE     ../../../../inc   
+
 
 APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   ../../../../inc   
 
-LIBRARY   		euser.lib 
+LIBRARY         euser.lib 
 LIBRARY         efsrv.lib
 LIBRARY         ws32.lib
 LIBRARY         apparc.lib      //TApaAppInfo
--- a/emailservices/emailstore/preinstall/inc/ProcessTimer.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailstore/preinstall/inc/ProcessTimer.h	Thu Aug 19 09:38:05 2010 +0300
@@ -18,7 +18,8 @@
 #define PROCESSTIMER_H_
 
 #include <e32base.h>
-#include <debuglogmacros.h>
+
+#include "debuglogmacros.h"
 
 /**
  * Timeout observer interface.
Binary file emailuis/emailui/conf/freestyleemailui.confml has changed
Binary file emailuis/emailui/conf/freestyleemailui_2001E277.crml has changed
--- a/emailuis/emailui/data/FreestyleEmailUi.rss	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss	Thu Aug 19 09:38:05 2010 +0300
@@ -1580,6 +1580,7 @@
           MENU_ITEM { command = EFsEmailUiCmdActionsForward; txt = qtn_fse_message_list_options_forward; },
           MENU_ITEM { command = EFsEmailUiCmdMailActions; txt = qtn_cmail_message_list_options_actions; cascade=r_fsemailui_maillist_submenu_mail_actions;},
           MENU_ITEM { command = EFsEmailUiCmdSync; txt = qtn_cmail_message_list_options_send_receive; },
+          MENU_ITEM { command = EFsEmailUiCmdCancelSync; txt = qtn_fse_launcher_options_cancel_sync; }, 
           MENU_ITEM { command = EFsEmailUiCmdMarkingMode; txt = qtn_fse_message_list_options_mark; },
           MENU_ITEM { command = EFsEmailUiCmdSettings; txt = qtn_fse_message_list_options_settings; },
           MENU_ITEM { command = EFsEmailUiCmdHelp; txt = qtn_options_help; },
--- a/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h	Thu Aug 19 09:38:05 2010 +0300
@@ -90,6 +90,9 @@
 // Values: 1 = hide, 0 = show.
 const TUint32 KEmailHideFS205UIFeature          = {0x0000FFFF};
 const TUint32 KEmailHideFSHiLightUIFeature          = {0x0000FFFF};
+// PS2 variation
+// one centrep key for every feature, 0 means disabled
+const TUint32 KEmailFeatureSplitScreen                  = {0x00001001};
 
 //
 // TP Wizard repository in the central repository
--- a/emailuis/emailui/inc/FreestyleEmailUiAppui.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiAppui.h	Thu Aug 19 09:38:05 2010 +0300
@@ -493,6 +493,9 @@
 
     // returns last seen pointer position
     const TPoint& LastSeenPointerPosition() const;
+    
+    // returns last seen ws event type
+    TInt LastSeenWsEventType();
 
     // Runs fake sync animation (needed for better user experience as
     // otherwise in some connection/sync states pressing "send & receive"
@@ -678,6 +681,7 @@
 
 	// Html viewer view
 	CFsEmailUiHtmlViewerView* iHtmlViewerView;
+	TUid iHtmlViewerViewId;  
 
 	// Message details view
 	CFSEmailUiMsgDetailsVisualiser* iMsgDetailsVisualiser;
@@ -835,6 +839,7 @@
     TBool iEditorStartedFromEmbeddedApp;
 
     TPoint iLastPointerPosition;
+    TInt iLastWsEventType; // EEventPointer or EEventKey    
     };
 
 
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerContainer.h	Thu Aug 19 09:38:05 2010 +0300
@@ -197,14 +197,12 @@
     void LoadContentFromFileL( RFile& aFile );
     void LoadContentFromUrlL( const TDesC& aUrl );
     void LoadContentFromMailMessageL( CFSMailMessage* aMailMessage, TBool aResetScrollPos=ETrue );
-    void ResetContent(const TBool aDisconnect = EFalse);
+    void ResetContent( TBool aDisconnect = EFalse, TBool aClearFlags = ETrue );
     void CancelFetch();
     void ClearCacheAndLoadEmptyContent();
-    // <cmail>
     void PrepareForExit();
     void PrepareForMessageNavigation();
-    // </cmail>
-    
+
 // from base class CCoeControl
 
     CCoeControl* ComponentControl( TInt aIndex ) const;
@@ -303,7 +301,7 @@
     void ConvertToHtmlFileL( CFSMailMessagePart& aTextBodyPart, const TDesC& aHtmlFileName );
 
     // Reads given file content to buffer and return pointer to it
-    HBufC8* ReadContentFromFileLC( RFile& aFile, CFSMailMessagePart& aHtmlBodyPart );
+    HBufC8* ReadContentFromFileLC( RFile& aFile, CFSMailMessagePart& aBodyPart );
     // Writes buffer to given file
     void WriteContentToFileL( const TDesC8& aContent, const TDesC& aFileName, CFSMailMessagePart& aHtmlBodyPart );
 
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Thu Aug 19 09:38:05 2010 +0300
@@ -71,7 +71,6 @@
     */
     TUid Id() const;
 
-    void HandleStatusPaneSizeChange();
 
     void HandleViewRectChange();
 
--- a/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h	Thu Aug 19 09:38:05 2010 +0300
@@ -294,6 +294,17 @@
 	        // Focus to the beginning.
 	        EFocusChangeNeeded
 	        };
+	    
+	    // states for sorting timer
+	    enum TSortState
+	    	{
+	    	ESortNone,
+	    	ESortRequested,
+	    	ESortStarted,
+	    	ESortPostponed,
+	    	ESortCompleted,
+	    	ESortStartError
+	    	};
 public:
 	static CFSEmailUiMailListVisualiser* NewL(CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aMailListControlGroup);
 	static CFSEmailUiMailListVisualiser* NewLC(CAlfEnv& aEnv, CFreestyleEmailUiAppUi* aAppUi, CAlfControlGroup& aMailListControlGroup);
@@ -936,9 +947,15 @@
 	TPoint iMarkingModeTextPos;
 	TSize iMarkingModeTextSize;
 	TRect iMarkingModeTextRect;
+	// sorting info dialog
     CAknWaitDialog* iSortWaitNote;
+    //sorting timer
+    CFSEmailUiGenericTimer* iSortTimer;
+    TSortState iSortState; //states of the sorting timer
+    TInt iSortTryCount;   // number of tries that it will make to retry start sorting
     // timer generates events for inserting new mails into mail list
     CFSEmailUiGenericTimer* iNewMailTimer;
+    
     // array keeps IDs of new mails which should be added into mail list 
     RArray<TFSMailMsgId> iNewMailIds;
 
--- a/emailuis/emailui/inc/FreestyleEmailUiShortcutBinding.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiShortcutBinding.h	Thu Aug 19 09:38:05 2010 +0300
@@ -30,6 +30,8 @@
 class CEikMenuPane;
 class CPtiEngine;
 class CPtiKeyMappings;
+class CPtiQwertyKeyMappings;
+class CPtiHalfQwertyKeyMappings;
 
 
 // CLASS DECLARATION
@@ -160,8 +162,8 @@
 	
     RProperty iKbLayoutProperty;
 
-    CPtiKeyMappings* iQwertyMappings; // owned by iPtiEngine
-    CPtiKeyMappings* iHalfQwertyMappings; // owned by iPtiEngine
+    CPtiQwertyKeyMappings* iQwertyMappings; // owned by iPtiEngine
+    CPtiHalfQwertyKeyMappings* iHalfQwertyMappings; // owned by iPtiEngine
     };
     
 #endif // __FS_EMAIL_UI_SHORTCUT_BINDING_H
--- a/emailuis/emailui/inc/FreestyleMessageHeaderURLEventHandler.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleMessageHeaderURLEventHandler.h	Thu Aug 19 09:38:05 2010 +0300
@@ -70,10 +70,13 @@
 private:
     const TAttachmentData& FindAttachmentL( const CFreestyleMessageHeaderURL& aAttachmentUrl );
     void LaunchAttachmentMenuL( const TAttachmentData& aAttachment );
+    TBool LaunchAttachmentMenuHWKeyL( const TAttachmentData& aAttachment );
     void HandAttachmentActionMenuCommandL( TActionMenuCustomItemId aSelectedActionMenuItem,
                                            const TAttachmentData& aAttachment );    
     void LaunchEmailAddressMenuL( );
+    TBool LaunchEmailAddressMenuHWKeyL();
     void LaunchWebAddressMenuL( );
+    TBool LaunchWebAddressMenuHWKeyL( );    
     
 private:
     CFreestyleMessageHeaderURL*     iMessageHeaderURL;
@@ -90,4 +93,49 @@
     CFSHtmlReloadAO*                iHTMLReloadAO; 
     };
 
+
+/******************************************************************************
+ * class TPopupMenuItem
+ ******************************************************************************/
+
+NONSHARABLE_CLASS (TPopupMenuItem) 
+    {
+public:        
+    TInt iCommandId;
+    TBuf<KMaxName> iText;
+    TBool iDimmed;
+    TInt iListIndex;
+    };
+
+
+/******************************************************************************
+ * class CFreestylePopupMenu
+ ******************************************************************************/
+
+NONSHARABLE_CLASS  (CFreestylePopupMenu) : public CBase 
+    {
+public:
+    static CFreestylePopupMenu* NewL( TInt aResourceId ); 
+    ~CFreestylePopupMenu();
+    
+private:
+    CFreestylePopupMenu( TInt aResourceId );
+    void ConstructL();
+    
+public:
+    TInt LaunchPopupMenuL();  // returns command id or KErrCancel
+    void SetDimmed( TInt aCommandId, TBool aDimmed );
+    
+private:
+    TInt CommandIdFromListIndex( TInt aListIndex );
+    void ConstructFromResourceL( TResourceReader& aReader );
+    void StrCopy( TDes& aTarget, const TDesC& aSource );
+    
+private:
+    TInt iResourceId;
+    
+    RArray<TPopupMenuItem> iItemList;
+    };
+
+
 #endif //__CFREESTYLE_MESSAGE_HEADER_EVENTHANDLER_URL_H__
--- a/emailuis/emailui/inc/ncscomposeview.h	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/inc/ncscomposeview.h	Thu Aug 19 09:38:05 2010 +0300
@@ -158,6 +158,10 @@
     */
     void HandleDynamicVariantSwitchL( 
             CFsEmailUiViewBase::TDynamicSwitchType aType );
+    /**  
+    * to hide or show CAlfVisuals ( used for activation or deactivation )
+    */             
+    virtual void FadeOut( TBool aDirectionOut );
         
 public: // from MAlfActionObserver
     	
@@ -522,6 +526,7 @@
     // Gets button from toolbar extension.
     CAknButton* Button( TInt aCmdId, 
         CAknToolbarExtension* aExtension = NULL );
+    TBool WLANConnectionActive();
 
 private:   // Constructors and destructor
 
--- a/emailuis/emailui/loc/freestyleemailui.loc	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/loc/freestyleemailui.loc	Thu Aug 19 09:38:05 2010 +0300
@@ -49,7 +49,7 @@
 // l:cell_cmail_l_pane_t1
 // r:TB9.1
 //
-#define qtn_fse_launcher_directory	"Directory"
+#define qtn_fse_launcher_directory  "Contact search"
 
 // d:About item in launcher grid
 // l:cell_cmail_l_pane_t1
@@ -2880,4 +2880,4 @@
 // l:cell_tb_ext_pane_t1/opt1
 // r:TB9.2
 //
-#define qtn_mail_viewer_additional_info "--- Message too long ---"
+#define qtn_mail_viewer_additional_info "--- Message limited to %N kB ---"
--- a/emailuis/emailui/src/FreestyleEmailUi.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUi.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -24,7 +24,7 @@
 #include <u32std.h>
 #include <MemoryManager.h>
 
-#define __USE_FAST_ALLOCATOR
+//#define __USE_FAST_ALLOCATOR
 
 CApaDocument* CFreestyleEmailUiApplication::CreateDocumentL()
     {
--- a/emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAknStatusIndicator.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -185,7 +185,7 @@
     if ( iAnimate && ( iHideTimeout == KMaxTInt || iHideTimeout-- > 0 ) )
         {
         StartTimer( KAnimationDelayMs );
-        iAngle -= 360 / (KAnimationFps * KSecondsPerFullRotation);
+        iAngle += 360 / (KAnimationFps * KSecondsPerFullRotation);
         ScaleImage();
         DrawDeferred();
         }
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -90,6 +90,10 @@
 //</cmail>
 #include <layoutmetadata.cdl.h>         // for Layout_Meta_Data
 
+#include <AknPriv.hrh>
+#include "freestyleemailcenrepkeys.h"
+#include <centralrepository.h>
+
 // INTERNAL INCLUDE FILES
 #include "FreestyleEmailUiContactHandler.h"
 #include "FreestyleEmailUiAppui.h"
@@ -371,6 +375,7 @@
     {
     FUNC_LOG;
     iEnv = &aEnv;
+    iHtmlViewerViewId = TUid::Null();
     TIMESTAMP( "Application starting" );
     }
 
@@ -543,6 +548,7 @@
     iHtmlViewerControlGroup = &iEnv->NewControlGroupL( KHtmlViewerDisplayGroup );
     iHtmlViewerView = CFsEmailUiHtmlViewerView::NewL( *iEnv, *this, *iHtmlViewerControlGroup );
     AddViewL( iHtmlViewerView );
+    iHtmlViewerViewId = iHtmlViewerView->Id(); 
 
 	// Create mail list
     iMailListVisualiser = CFSEmailUiMailListVisualiser::NewL(*iEnv, this, *iMailListControlGroup );
@@ -736,6 +742,8 @@
 
  	TFsEmailUiUtility::DeleteStaticData();
 
+	// Cannot rely on framework to delete HTMLVierView as it de-registers from CFSEmailDownloadInfoMediator
+	RemoveView(iHtmlViewerViewId);
     // destroys the Download Information mediator
     // Destruction must be done here as other Tls data depends on it.
     CFSEmailDownloadInfoMediator::Destroy();
@@ -853,7 +861,12 @@
             {
             // Activate grid view if the view history stack is empty. This happens only
             // if something has gone wrong.
+            // Note that the grid view may need to be re-drawn, e.g. if the
+            // current orientation is different from the last time it was
+            // displayed.  This is because it will not have received dynamic
+            // variant switch notifications while it was not in the history.
             iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
+            iMainUiGridVisualiser->SetRefreshNeeded();
             }
         else
             {
@@ -881,6 +894,10 @@
     // Do nothing if the externally activated view was already active
     if ( iCurrentActiveView->Id() != aViewId )
         {
+        // this function removes setting view from view stack so 
+        // it cannot be active any more
+        iSettingsViewActive = EFalse;
+        
         iPreviousActiveView = iCurrentActiveView;
 
         // Check if the view is in the history stack. In that case, we don't
@@ -947,7 +964,12 @@
         {
         // Activate grid view if the view history stack is empty. This happens only
         // if something has gone wrong.
+        // Note that the grid view may need to be re-drawn, e.g. if the
+        // current orientation is different from the last time it was
+        // displayed.  This is because it will not have received dynamic
+        // variant switch notifications while it was not in the history.
         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
+        iMainUiGridVisualiser->SetRefreshNeeded();
         }
     else
         {
@@ -1046,9 +1068,14 @@
         }
 
     // Return to grid in case the desired view was not found
-    if ( iCurrentActiveView->Id() != aViewId )
+    if ( iCurrentActiveView->Id() != aViewId && iCurrentActiveView->Id() != AppGridId )
         {
+        // For some reason the launcher grid wasn't at the bottom of the
+        // stack.  Activate it now, but also tell it to refresh itself in
+        // case it wasn't in the stack at all and missed (e.g.) an
+        // orientation change notification.
         iCurrentActiveView = static_cast<CFsEmailUiViewBase*>( View(AppGridId) );
+        iMainUiGridVisualiser->SetRefreshNeeded();
         }
 
     if ( aCustomMessageId != TUid::Null() || aCustomMessage.Length() )
@@ -1318,8 +1345,13 @@
         {
         TAdvancedPointerEvent* pointerEvent(aEvent.Pointer());
         iLastPointerPosition = pointerEvent->iParentPosition;
+        iLastWsEventType = EEventPointer;
         }
 
+    if (aEvent.Type() == EEventKey)
+        {
+        iLastWsEventType = EEventKey;
+        }
 	TInt key = aEvent.Key()->iScanCode;
     // <cmail>
     // to disable voice commands during creating new mail message
@@ -1465,6 +1497,15 @@
     // </cmail>
     CAknAppUi::HandleResourceChangeL( aType );
 
+    if ( aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled ) 
+        { 
+        StatusPane()->MakeVisible( aType == KAknSplitInputDisabled );       
+        if ( iCurrentActiveView != NULL )
+            {
+            iCurrentActiveView->HandleStatusPaneSizeChange(); 
+            } 
+        }
+
     // Refresh mode is changed to manual to avoid any flickering during
     // resource change handling in list views. Trap any leaves so that we set
     // the automatic refresh mode back on even in case of error.
@@ -1494,7 +1535,8 @@
     //    CAlfEnv::Static()->NotifySkinChangedL();
     //    }
 
-    if ( aType == KEikDynamicLayoutVariantSwitch )
+    if( aType == KEikDynamicLayoutVariantSwitch
+        || aType == KAknSplitInputEnabled || aType == KAknSplitInputDisabled )
     	{
         // Changing layout for status pane (just in case it is not switched
         // correctly), fix for HMNN-82BAGR error
@@ -1521,7 +1563,7 @@
         {
 
 	  	TRect screenRect;
-	 	AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EMainPane, screenRect );
+        screenRect = ClientRect();
   		StatusPane()->DrawNow();
         if(iEnv)
             {
@@ -1539,6 +1581,8 @@
             case KAknsMessageSkinChange:
                 type = CFsEmailUiViewBase::ESkinChanged;
                 break;
+            case KAknSplitInputEnabled:  // fall though
+            case KAknSplitInputDisabled: // fall though
             case KEikDynamicLayoutVariantSwitch:
                 type = CFsEmailUiViewBase::EScreenLayoutChanged;
                 break;
@@ -2978,6 +3022,12 @@
     }
 
 // -----------------------------------------------------------------------------
+// CFreestyleEmailUiAppUi::LastSeenWsEventType
+// -----------------------------------------------------------------------------
+TInt CFreestyleEmailUiAppUi::LastSeenWsEventType()
+    {
+    return iLastWsEventType;
+    }
 // CFreestyleEmailUiAppUi::RunFakeSyncAnimL
 // -----------------------------------------------------------------------------
 void CFreestyleEmailUiAppUi::RunFakeSyncAnimL()
@@ -3098,7 +3148,7 @@
                     (CAknTitlePane*)StatusPane()->ControlL( titlePaneUid ) );
 
                 TSize iconSize = LayoutHandler()->statusPaneIconSize();
-                iConnectionStatusIconAngle -= KConnectionStatusIconRotationAmount;
+                iConnectionStatusIconAngle += KConnectionStatusIconRotationAmount;
                 AknIconUtils::SetSizeAndRotation(iConnectionIconBitmap, iconSize, EAspectRatioNotPreserved, iConnectionStatusIconAngle);
                 titlePane->DrawNow();
                 iConnectionStatusIconAnimTimer->Start(KConnectionStatusIconRotationInterval);
--- a/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -2655,11 +2655,11 @@
 	 	
 		if(!Layout_Meta_Data::IsLandscapeOrientation())
 			{
-			iScreenRect.SetRect( 0, 0, iScreenRect.Width(),iScreenRect.Height() + noToolbar.Height()  );
+			iScreenRect.SetRect( 0, 0, iScreenRect.Width(), iScreenRect.Height() );
 			}
 		else
 			{
-			iScreenRect.SetRect( 0, 0, noToolbar.Width(),iScreenRect.Height());
+			iScreenRect.SetRect( 0, 0, noToolbar.Width(), iScreenRect.Height() );
 			}
         }
 	else
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -176,9 +176,9 @@
 CEUiHtmlViewerSettings* CEUiHtmlViewerSettings::NewL( MObserver& aObserver )
     {
     CEUiHtmlViewerSettings* self = new (ELeave) CEUiHtmlViewerSettings(aObserver);
-    CleanupStack::PushL(self);
+    CleanupStack::PushL( self );
     self->ConstructL();
-    CleanupStack::Pop(); // self
+    CleanupStack::Pop( self );
     return self;
     }
 
@@ -216,11 +216,12 @@
 //
 void CEUiHtmlViewerSettings::AddKeyListenerL( TUint32 aKey )
     {
-    CEUiHtmlViewerSettingsKeyListener* listener = new (ELeave) CEUiHtmlViewerSettingsKeyListener(*this, aKey);
-    CleanupStack::PushL(listener);
-    iKeyListeners.AppendL(listener);
-    CleanupStack::Pop(); // listener
-    UpdateValue(aKey);
+    CEUiHtmlViewerSettingsKeyListener* listener = 
+        new (ELeave) CEUiHtmlViewerSettingsKeyListener( *this, aKey );
+    CleanupStack::PushL( listener );
+    iKeyListeners.AppendL( listener );
+    CleanupStack::Pop( listener );
+    UpdateValue( aKey );
     }
 
 // ---------------------------------------------------------------------------
@@ -446,8 +447,9 @@
 
     if ( iBrCtlInterface )
         {
-        delete iBrCtlInterface;
-        iBrCtlInterface = NULL;
+       	SetZoomLevelL(100);
+		iBrCtlInterface->SetBrowserSettingL( TBrCtlDefs::ESettingsAutoLoadImages, iViewerSettings->AutoLoadImages() );
+       	return;
         }
 
     TUint brCtlCapabilities = TBrCtlDefs::ECapabilityClientResolveEmbeddedURL |
@@ -502,9 +504,6 @@
 #endif 
 
     
-    SetRect( iView.ContainerRect() );
-    CreateBrowserControlInterfaceL();
-
     iEventHandler = CFreestyleMessageHeaderURLEventHandler::NewL( iAppUi, iView );
 
     TRect nextButtonRect = OverlayButtonRect( EFalse );
@@ -522,6 +521,9 @@
     iTouchFeedBack = MTouchFeedback::Instance();
     iTouchFeedBack->EnableFeedbackForControl(this, ETrue);
 
+    CreateBrowserControlInterfaceL();
+    SetRect( iView.ContainerRect() );
+
     ActivateL();
     }
 
@@ -699,7 +701,8 @@
 // Reset content
 // ---------------------------------------------------------------------------
 //
-void CFsEmailUiHtmlViewerContainer::ResetContent(const TBool aDisconnect)
+void CFsEmailUiHtmlViewerContainer::ResetContent( TBool aDisconnect,
+    TBool aClearFlags )
     {
     FUNC_LOG;
     if ( iBrCtlInterface )
@@ -718,7 +721,10 @@
     iLinkContents.Reset();
     iMessageParts.Reset();
     iMessage = NULL;
-    iFlags.ClearAll();
+    if ( aClearFlags )
+        {
+        iFlags.ClearAll();
+        }
     iScrollPosition = 0;
     }
 
@@ -1171,49 +1177,65 @@
     aTextBodyPart.GetContentToBufferL( contentPtr, 0 );
     //When we found EFSMsgFlag_BodyTruncated was set, add "--Message too long--" in the end of plain html view
     if ( limit < contentsize )
-    	{
-		 HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO );
-		 TInt pos = limit - addingText->Length();
-		 contentPtr.Replace(pos,addingText->Length(),*addingText);
-         CleanupStack::PopAndDestroy( addingText );
+        {
+        // Disable this is PS1 until we have translations available             
+//		 HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO , limit/KKilo );
+//		 TInt pos = contentPtr.Length() - addingText->Length();
+//		 contentPtr.Replace(pos,addingText->Length(),*addingText);
+//         CleanupStack::PopAndDestroy( addingText );
          aTextBodyPart.SetFlag(EFSMsgFlag_BodyTruncated);
-    	}
+        }
     
     ConvertToHTML( *content, targetFileName, aTextBodyPart );
     CleanupStack::PopAndDestroy( content );
-
     }
 
 // ---------------------------------------------------------------------------
 // Reads given file content to buffer and return pointer to it
 // ---------------------------------------------------------------------------
 //
-HBufC8* CFsEmailUiHtmlViewerContainer::ReadContentFromFileLC( RFile& aFile, CFSMailMessagePart& aHtmlBodyPart )
+HBufC8* CFsEmailUiHtmlViewerContainer::ReadContentFromFileLC( RFile& aFile, 
+   CFSMailMessagePart& aBodyPart )
     {
     FUNC_LOG;
     TInt fileSize = 0;
-    
-    TInt limit(0);
-    TInt err = iViewerSettings->Repository().Get( KFreestyleMaxBodySize , limit );
-    limit *= KKilo; // cenrep value is in kB, 0 means unlimited
-
     User::LeaveIfError( aFile.Size( fileSize ) );
-    if ( limit == 0 || err )
+ 
+    HBufC* contentType = aBodyPart.GetContentType().AllocLC();
+    TInt length = contentType->Locate(';');
+    if( length >= 0 )
         {
-        limit = KMaxTInt;
+        contentType->Des().SetLength( length );
         }
-
-    TInt size = Min( limit, fileSize ); // read no more than limit bytes..
-
+    TBool body = KFSMailContentTypeTextPlain().CompareF( contentType->Des() ) == 0 ||
+                 KFSMailContentTypeTextHtml().CompareF( contentType->Des() ) == 0; 
+    CleanupStack::PopAndDestroy( contentType );
     
-    if ( size < fileSize )
+    if ( body )
         {
-        aHtmlBodyPart.SetFlag( EFSMsgFlag_BodyTruncated );
+        // limit message size if not done already by plugins
+        TInt limit(0);
+        TInt err = iViewerSettings->Repository().Get( KFreestyleMaxBodySize , limit );
+        limit *= KKilo; // cenrep value is in kB, 0 means unlimited
+ 
+        if ( limit == 0 || err )
+           {
+           limit = KMaxTInt;
+           }
+        fileSize = Min( limit, fileSize ); // read no more than limit bytes..
+     
+        TInt contentSize = aBodyPart.ContentSize();
+        TInt fetchedSize = aBodyPart.FetchedContentSize();
+        
+        if ( ( limit!=KMaxTInt && fileSize < contentSize ) 
+          || ( fetchedSize < contentSize ) ) 
+            {
+            aBodyPart.SetFlag( EFSMsgFlag_BodyTruncated );
+            }
         }
-    
-    HBufC8* buffer = HBufC8::NewLC( size );
+    HBufC8* buffer = HBufC8::NewLC( fileSize );
     TPtr8 ptr = buffer->Des();
-    User::LeaveIfError( aFile.Read( ptr, size ) );
+    User::LeaveIfError( aFile.Read( ptr, fileSize ) );
     return buffer;
     }
 
@@ -1296,15 +1318,24 @@
 
         // Write the original content
         User::LeaveIfError( targetFile.Write( buffer ) );
-		//When we found EFSMsgFlag_BodyTruncated was set, add "--Message too long--" in the end of html view
-        if( aHtmlBodyPart.GetFlags()&EFSMsgFlag_BodyTruncated )
+        if( aHtmlBodyPart.GetFlags() & EFSMsgFlag_BodyTruncated )
         	{
-			HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO );
-			HBufC8* addingText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *addingText );       
-			CleanupStack::PopAndDestroy( addingText );
-			CleanupStack::PushL( addingText8 );
-			User::LeaveIfError( targetFile.Write( *addingText8 ) );
-			CleanupStack::PopAndDestroy( addingText8 );
+            //When we found EFSMsgFlag_BodyTruncated was set, add "--- Message limited to %N kB ---" in the end of html view
+             TInt limit(0);
+             TInt err = iViewerSettings->Repository().Get( KFreestyleMaxBodySize , limit );
+             limit *= KKilo; // cenrep value is in kB, 0 means unlimited
+             if ( limit == 0 || err )
+                 {
+                 limit = KMaxTInt;
+                 }
+
+// Disable this is PS1 until we have translations available             
+//          HBufC* addingText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_VIEW_ADDITIONAL_INFO, limit/KKilo );
+//			HBufC8* addingText8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L( *addingText );       
+//			CleanupStack::PopAndDestroy( addingText );
+//			CleanupStack::PushL( addingText8 );
+//			User::LeaveIfError( targetFile.Write( *addingText8 ) );
+//			CleanupStack::PopAndDestroy( addingText8 );
         	}
         // Write ending metadata if needed
         if ( modificationNeeded || (aHtmlBodyPart.GetFlags()&EFSMsgFlag_BodyTruncated) )
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -72,7 +72,8 @@
     CAlfControlGroup& aControlGroup )
     {
     FUNC_LOG;
-    CFsEmailUiHtmlViewerView* self = new ( ELeave ) CFsEmailUiHtmlViewerView( aEnv, aAppUi, aControlGroup );
+    CFsEmailUiHtmlViewerView* self = new ( ELeave ) CFsEmailUiHtmlViewerView(
+        aEnv, aAppUi, aControlGroup );
     CleanupStack::PushL( self );
     self->ConstructL();
     CleanupStack::Pop( self );
@@ -1042,12 +1043,6 @@
         }
     }
 
-void CFsEmailUiHtmlViewerView::HandleStatusPaneSizeChange()
-    {
-    CFsEmailUiViewBase::HandleStatusPaneSizeChange();
-
-	HandleViewRectChange();
-    }
 
 void CFsEmailUiHtmlViewerView::HandleViewRectChange()
     {
@@ -2190,30 +2185,29 @@
                 }
             }
         }
-    if(iContainer)
+
+    if ( iContainer )
         {
         iContainer->HideDownloadStatus();
         }
+
     if ( reloadContent )
         {
-
-        if (  iContainer )
+        if ( iContainer )
             {
-            iContainer->ResetContent();
-            if( iMessage )
+            iContainer->ResetContent( EFalse, EFalse );
+            if ( iMessage )
                 {
-                LoadContentFromMailMessageL( iMessage , EFalse);
+                LoadContentFromMailMessageL( iMessage , EFalse );
                 SetMskL();
                 }
             }
         }
 
-
-    if(iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed)
+    if ( iAsyncProcessComplete && iWaitDialog && iDialogNotDismissed )
         {
         iWaitDialog->ProcessFinishedL(); // deletes the dialog
         }
-
     }
 
 // -----------------------------------------------------------------------------
@@ -2975,13 +2969,27 @@
     TUid uid;
     TDataType dataType( _L8( "text/html" ) );
     session.AppForDataType( dataType, uid );
-
-    // Runs the default application using the dataType
-    TThreadId threadId;
-    User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
-
-    CleanupStack::PopAndDestroy(); // session
-}
+    
+    if (uid != TUid::Uid(0) ) //only open link when default browser exist.
+    	{
+        TApaTaskList taskList( iEikonEnv->WsSession() );
+        TApaTask task = taskList.FindApp( uid );
+        if ( task.Exists() )
+            {
+            HBufC8 * param8 = HBufC8::NewLC( aUrl.Length() );
+            param8->Des().Append( aUrl );
+            task.SendMessage( TUid::Uid( 0 ), *param8 );
+            CleanupStack::PopAndDestroy( param8 );
+            }
+        else
+            {
+            // Runs the default application using the dataType
+            TThreadId threadId;
+            User::LeaveIfError( session.StartDocument( aUrl , dataType, threadId ) );
+            }
+    	}
+    CleanupStack::PopAndDestroy( &session );
+    }
 
 // --------------------------------------------------------------------------------
 // CFsEmailUiHtmlViewerView::SaveWebAddressToFavouritesL
--- a/emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -295,6 +295,12 @@
 void CFSEmailUiLauncherGridVisualiser::ResizeItemIcon( TBool aReduce )
     {
     TInt selectedItem( iCurrentLevel.iSelected );
+    TInt count = iCurrentLevel.iItemVisualData.Count();
+    if ( selectedItem < 0 || selectedItem >= count )
+        {
+        return;  // incorrect index
+        }
+    
     if( selectedItem >= 0 )
         {
         TReal transition( KScaleNotSelected );
@@ -1226,14 +1232,8 @@
                 if (Abs(iTotalDragging) >= iPhysics->DragThreshold() || iIsDragging )
                     {
                     // Hide focus always when dragging.
-                    iAppUi.SetFocusVisibility( EFalse );
-                    if ( iSelector )
-                        {
-                        TAlfTimedValue selectorOpacity;
-                        selectorOpacity.SetValueNow( 0 );
-                        iSelector->SetOpacity( selectorOpacity );
-                        }
-
+                    HandleButtonReleaseEvent();
+ 
                     iIsDragging = ETrue;
                 
                     iPhysics->RegisterPanningPosition( delta );
@@ -1438,6 +1438,12 @@
 void CFSEmailUiLauncherGridVisualiser::MoveSelectorToCurrentItem( TDirection aDir )
     {
     FUNC_LOG;
+    TInt count = iCurrentLevel.iItemVisualData.Count();
+    if ( iCurrentLevel.iSelected < 0 || iCurrentLevel.iSelected >= count )
+        {
+        return;  // incorrect index
+        }
+    
     TAlfRealPoint curPos = iSelector->Pos().ValueNow(); // this is the wrapped value of the current position
     iSelector->SetPos( curPos, 0 ); // wrap position now
 
@@ -1607,7 +1613,7 @@
 	    gridIconRect.LayoutRect(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_g1(var));
 
 	    TAknLayoutText gridText;
-	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var));
+	    gridText.LayoutText(itemrc, AknLayoutScalable_Apps::cell_cmail_l_pane_t1(0));
 
         if ( aLevel.iParent >= 0 )
             {
@@ -1678,7 +1684,22 @@
 
                 newItem.iText->SetTextStyle( iAppUi.LayoutHandler()->FSTextStyleFromLayoutL(AknLayoutScalable_Apps::cell_cmail_l_pane_t1(var)).Id() );//FSTextStyleFromIdL( EFSFontTypeSmall )->Id() );
                 newItem.iText->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
-                newItem.iText->SetAlign( EAlfAlignHCenter, EAlfAlignVTop );
+                TAlfAlignHorizontal alfAlign;
+                switch( gridText.Align() )
+                    {
+                    case ELeft: 
+                        alfAlign = EAlfAlignHLeft;
+                        break;
+                    case ECenter:
+                        alfAlign = EAlfAlignHCenter;
+                        break;
+                    case ERight:
+                        alfAlign = EAlfAlignHRight;
+                        break;
+                    default:
+                        alfAlign = EAlfAlignHCenter;
+                    }
+                newItem.iText->SetAlign( alfAlign, EAlfAlignVCenter );
 
                 newItem.iImage = CAlfImageVisual::AddNewL( *iControl, newItem.iBase );
                 newItem.iImage->SetScaleMode( CAlfImageVisual::EScaleFit );
@@ -2753,6 +2774,17 @@
 void CFSEmailUiLauncherGridVisualiser::LaunchStylusPopupMenu(
 	const TInt aItemId )
 	{
+    TInt count = iCurrentLevel.iItemVisualData.Count();
+    if ( aItemId < 0 || aItemId >= count )
+        {
+        return;  // incorrect index
+        }
+    
+    count = iCurrentLevel.iItems.Count();
+    if ( aItemId < 0 || aItemId >= count )
+        {
+        return;  // incorrect index
+        }
 	// Get the ID of the mailbox in case the user wants to delete it.
 	iMailboxToDelete = iCurrentLevel.iItems[aItemId].iMailBoxId;
 
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -97,6 +97,8 @@
 const TInt KMaxPreviewPaneLength = 60;
 const TInt KMsgUpdaterTimerDelay = 2500000; // Time to update list, 2,5sec
 const TInt KNewMailTimerDelay = 20; // sleeping timer to start processing new messages
+const TInt KSortTimerDelay = 40;    // sleeping timer to start sorting ( delay should be longer than abowe )
+const TInt KSortCountdown = 5;      // number how many times will be tried do start sorting when it's forbidden
 const TInt KNewMailMaxBatch = 7;    // number of new mails inserted into list at once
 static const TInt KMsgDeletionWaitNoteAmount = 5;
 _LIT( KMissingPreviewDataMarker, "..." );
@@ -486,6 +488,8 @@
     iDeleteTask = new (ELeave) TDeleteTask<CFSEmailUiMailListVisualiser> (*this, HandleDeleteTaskL);
 
     iNewMailTimer = CFSEmailUiGenericTimer::NewL( this );
+    iSortTimer = CFSEmailUiGenericTimer::NewL( this );
+    iSortState = ESortNone;
 
 	iTouchFeedBack = MTouchFeedback::Instance();
  	}
@@ -648,6 +652,7 @@
     delete iDeleteTask;
     DeleteSortWaitNote();
     delete iNewMailTimer;
+    delete iSortTimer;
     iNewMailIds.Close();
     }
 
@@ -693,6 +698,12 @@
         SafeDelete( iNewMailTimer );
         }
 
+    if ( iSortTimer )
+        {
+        // delete also cancels timer
+        SafeDelete( iSortTimer );
+        }
+    
     SafeDelete(iMailFolder);
     iTreeItemArray.Reset();
 	// Reset, not delete to avoid NULL checks.
@@ -765,7 +776,7 @@
         sorting = ETrue;
         }
     DeleteSortWaitNote();
-    
+
     if ( !iModel->Count() )
         {
         iFocusedControl = EControlBarComponent;
@@ -821,11 +832,10 @@
 void CFSEmailUiMailListVisualiser::SortMailListModelAsyncL()
     {
     FUNC_LOG;
-   
+
     DeleteSortWaitNote();
   
     TBool ret = UpdateMailListModelAsyncL( KCMsgBlockSort );
-    
     if ( ret )
         {
         TFsEmailUiUtility::ShowWaitNoteL( iSortWaitNote, R_FSE_WAIT_SORTING_TEXT, EFalse, ETrue );
@@ -1236,8 +1246,9 @@
         //   timer isn`t already active
         //   there are new mails in the array
         //   timer event isn`t processing
+        //   sorting timer isn't running
         if ( !iNewMailTimer->IsActive() && iNewMailIds.Count() && 
-             iNewMailTimer->iStatus != KErrInUse )
+             iNewMailTimer->iStatus != KErrInUse  && iSortState == ESortNone )
             {
             iNewMailTimer->Start( KNewMailTimerDelay );
             }
@@ -1250,44 +1261,152 @@
 //
 // ---------------------------------------------------------------------------
 //
-void CFSEmailUiMailListVisualiser::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
-    {
-    TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
-    CFSMailClient* mailClient = iAppUi.GetMailClient();
-
-    // Enter critical section
-    // Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait
-    // to ensure that only one TimerEventL method is processed at time
-    // CFSEmailUiGenericTimer`s iStatus will be used as mutex
-    iNewMailTimer->iStatus = KErrInUse;
-
-    for ( TInt i = 0; i < count; i++ )
-        {
-        CFSMailMessage* msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
+void CFSEmailUiMailListVisualiser::TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer )
+    {
+	
+    if( aTriggeredTimer == iSortTimer )
+        {
+        switch ( iSortState )
+            {
+            case ESortNone:
+                {
+                iSortTryCount = 0;
+                iSortState = ESortRequested;
+                break;
+                }
+            case ESortRequested:
+                {
+                if( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse )
+        	{
+                    // Size sorting does not use nodes, so disable those, otherwise check from CR
+                    iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
+                    SetSortButtonTextAndIconL();
+
+                    iFocusedControl = EControlBarComponent;
+                    iMailList->SetFocusedL( EFalse );
+                    iControlBarControl->SetFocusByIdL( iSortButtonId );
+
+                    SortMailListModelAsyncL();  // sort can take long time    
+                    SetMskL();
+                    iSortState = ESortStarted;
+                    }
+                else
+                    {
+                    iSortTryCount = 0;
+                    iSortState = ESortPostponed;
+                    iNewMailTimer->Stop(); // stop mail timer
+                    }
+                break;
+                }
+            case ESortPostponed:
+                {
+                if ( !iNewMailTimer->IsActive() && iNewMailTimer->iStatus != KErrInUse )
+                    {
+                    iSortState = ESortRequested; // start request again
+                    }
+                else
+                    {
+                    iSortTryCount++;
+                    }
+                if( iSortTryCount >= KSortCountdown )// repeat a few times
+                    {
+                    iSortTryCount = 0; // reset
+                    iSortState = ESortStartError; // can't start sorting  some error
+                    }
+                break;
+                }
+            case ESortStarted:
+                {
+                if ( !iSortWaitNote )// it will restart the timer elsewhere (see below)
+                    {
+                    iSortState = ESortCompleted;
+                    }
+                break;
+                }
+            case ESortStartError:
+            case ESortCompleted:
+                {
+            	if( !iNewMailTimer->IsActive() )
+            	    {
+            	    // refresh the whole mail list if list was sorted
+            	    if(iSortState != ESortStartError )
+            	    	{
+            	        RefreshL();
+            	    	}
+            	    // stop sorting process
+                    iSortState = ESortNone;
+                    iSortTimer->Stop();
+            	    // restart if more messages available
+            	    if ( iNewMailIds.Count() )
+                    {
+                    iNewMailTimer->Start( KNewMailTimerDelay );
+                    }
+                return;
+            		}
+                iNewMailTimer->Stop();
+            	break;
+                }
+            default :
+                {
+                // do nothing
+                }
+            }
+        // start timer again
+        if ( !iSortTimer->IsActive() )
+            {
+            iSortTimer->Start( KSortTimerDelay );
+            }
+        }
+    
+    if( aTriggeredTimer == iNewMailTimer )
+        {
+        TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
+        CFSMailClient* mailClient = iAppUi.GetMailClient();
+
+        // Enter critical section
+        // Because CFSMailClient::GetMessageByUidL can use CActiveSchedulerWait
+        // to ensure that only one TimerEventL method is processed at time
+        // CFSEmailUiGenericTimer`s iStatus will be used as mutex
+        iNewMailTimer->iStatus = KErrInUse;
+        iModel->SetSortCriteria(iCurrentSortCriteria);
+
+        for ( TInt i = 0; i < count; i++ )
+            {
+            // stop synchronization if mail list is being sorted
+            if( iSortState != ESortNone || iSortWaitNote )
+                {
+                iNewMailTimer->iStatus = KErrNone;
+                iNewMailTimer->Stop();
+                return; // leave  method
+                }
+    
+            CFSMailMessage* msgPtr = mailClient->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
                                                                iMailFolder->GetFolderId(),
                                                                iNewMailIds[ 0 ],
                                                                EFSMsgDataEnvelope );
-        if ( msgPtr != NULL )
-            {
-            CleanupStack::PushL( msgPtr );
-            //first item - show scrollbar
-            //last item - update scrollbar
-            TBool allowRefresh = ( i == 0 || i == count - 1 );
-            InsertNewMessageL( msgPtr, allowRefresh );
-            CleanupStack::Pop( msgPtr ); // ownership transferred to model
-            }
-        // pop processed id from the queue, this is single thread operation
-        iNewMailIds.Remove( 0 ); 
-        }
-
-    // End critical section
-    iNewMailTimer->iStatus = KErrNone;
-
-    // if timer stoped then restart if more messages available
-    if ( iNewMailIds.Count() && ! iNewMailTimer->IsActive() )
-        {
-        iNewMailTimer->Start( KNewMailTimerDelay );
-        }
+            if ( msgPtr != NULL )
+ {
+                __ASSERT_DEBUG( FolderId() == msgPtr->GetFolderId(), User::Invariant() );
+                CleanupStack::PushL( msgPtr );
+                //first item - show scrollbar
+                //last item - update scrollbar
+                TBool allowRefresh = ( i == 0 || i == count - 1 );
+                InsertNewMessageL( msgPtr, allowRefresh );
+                CleanupStack::Pop( msgPtr ); // ownership transferred to model
+                }
+            // pop processed id from the queue, this is single thread operation
+            iNewMailIds.Remove( 0 ); 
+            }
+            
+        // End critical section
+        iNewMailTimer->iStatus = KErrNone;
+
+        // if timer stoped then restart if more messages available
+        if ( iNewMailIds.Count() && ! iNewMailTimer->IsActive() && iSortState == ESortNone )
+            {
+            iNewMailTimer->Start( KNewMailTimerDelay );
+            }
+        }//iNewMailTimer
     }
 
 // ---------------------------------------------------------------------------
@@ -1560,8 +1679,17 @@
     //if the view is already active don't update the icons so they won't "blink" 
     //when the view is activated.
     if(!iThisViewActive)
-        { 
+        {     
         ScaleControlBarL();
+        
+        // Set icons on toolbar
+        iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon );
+        iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
+        iAppUi.FsTextureManager()->ClearTextureByIndex( EListTextureCreateNewMessageIcon );
+        iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
+        iAppUi.FsTextureManager()->ClearTextureByIndex( GetSortButtonTextureIndex() );
+        iSortButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ) );
+
         SetListAndCtrlBarFocusL();
         }
 
@@ -1716,6 +1844,7 @@
     if ( activationData.iMailBoxId != prevMailBoxId )
         {
         iNewMailTimer->Cancel();
+        iSortTimer->Cancel(); // stop sorting timer
         iNewMailIds.Reset();
         }
 
@@ -1757,7 +1886,7 @@
     // Set branded watermark and mailbox icon
     SetBrandedListWatermarkL();
     SetBrandedMailBoxIconL();
-
+    
     // Check sync icon timer and sync status
     ConnectionIconHandling();
 
@@ -2069,7 +2198,21 @@
 	        {
 	        aMenuPane->SetItemDimmed( EFsEmailUiCmdActionsEmptyDeleted, ETrue );
 	        }
-		}
+	    
+	    CConnectionStatusQueryExtension::TConnectionStatus connetionStatus;
+        iAppUi.GetConnectionStatusL( connetionStatus );
+        if ( connetionStatus == CConnectionStatusQueryExtension::ESynchronizing )
+            {
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, ETrue );
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, EFalse );
+            }
+        else
+            {
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdSync, EFalse );
+            aMenuPane->SetItemDimmed( EFsEmailUiCmdCancelSync, ETrue );
+            }
+	    }
+	
     // MAIN MENU ***************************************************************************
 
 
@@ -3271,15 +3414,6 @@
     else if ( aType == EScreenLayoutChanged )
         {
         UpdateButtonTextsL();
-        
-        iAppUi.FsTextureManager()->ClearTextureByIndex( EListControlBarMailboxDefaultIcon );
-        iFolderListButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListControlBarMailboxDefaultIcon ) );
-        iAppUi.FsTextureManager()->ClearTextureByIndex( EListTextureCreateNewMessageIcon );
-        iNewEmailButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( EListTextureCreateNewMessageIcon ) );
-        iAppUi.FsTextureManager()->ClearTextureByIndex( GetSortButtonTextureIndex() );
-        iSortButton->SetIconL( iAppUi.FsTextureManager()->TextureByIndex( GetSortButtonTextureIndex() ) );
-
-        ScaleControlBarL();
         }
     }
 
@@ -4075,12 +4209,17 @@
                 }
             }
             break;
-		case EFsEmailUiCmdCompose:
-			{
-			TIMESTAMP( "Create new message selected from message list" );
-			CreateNewMsgL();
-			}
-			break;
+        case EFsEmailUiCmdCompose:
+            {
+            // Switching to another view can take some time and this view
+            // can still receive some commands - so ignore them.
+            if ( iAppUi.CurrentActiveView() == this )
+                {
+                TIMESTAMP( "Create new message selected from message list" );
+                CreateNewMsgL();
+                }
+            }
+            break;
        	case EFsEmailUiCmdMessageDetails:
 			{
             // Message details can be viewed only when there's exactly one message marked or in focus
@@ -4278,6 +4417,14 @@
 				}
 			}
 			break;
+       	case EFsEmailUiCmdCancelSync:
+       	    {
+       	    if ( GetLatestSyncState() )
+       	        {
+                iAppUi.StopActiveMailBoxSyncL();
+       	        }
+       	    }
+       	    break;
        	case EFsEmailUiCmdGoOffline:
         	{
     	   	iAppUi.GetActiveMailbox()->GoOfflineL();
@@ -5283,9 +5430,9 @@
                     }
 			    }
 			}
-		else
-			{
-		
+        else if ( iAppUi.CurrentActiveView() == this )
+            {
+
 			// MAIL ITEM; OPEN MAIL
 			if ( item && item->ModelItemType() == ETypeMailItem )
 				{
@@ -5340,7 +5487,8 @@
             {
             folderType = EFSInbox;
             }
-        if ( iModel->Count() )
+        // we can't show sort list when sorting is active
+        if ( iModel->Count() && iSortState == ESortNone )
             {
             //Set touchmanager not active for preventing getting events.
             DisableMailList(ETrue);
@@ -6218,35 +6366,37 @@
                                                                                      iMailFolder->GetFolderId(),
                                                                                      modelItem->MessagePtr().GetMessageId() ,
                                                                                      EFSMsgDataEnvelope ) );
-            if ( confirmedMsgPtr )
-                {
-                // Replace message pointer in model with newly fetched one
-                Model()->ReplaceMessagePtr( aIndex, confirmedMsgPtr );
-
-                const SMailListItem& item = iTreeItemArray[aIndex];
-
-                // Update the list item contents and formating to match the message pointer
-                CFsTreePlainTwoLineItemData* itemData =
-                    static_cast<CFsTreePlainTwoLineItemData*>( item.iTreeItemData );
-                CFsTreePlainTwoLineItemVisualizer* itemVis =
-                    static_cast<CFsTreePlainTwoLineItemVisualizer*>( item.iTreeItemVisualiser );
-
-                UpdateItemDataL( itemData, confirmedMsgPtr );
-                UpdatePreviewPaneTextForItemL( itemData, confirmedMsgPtr );
-                UpdateMsgIconAndBoldingL( itemData, itemVis, confirmedMsgPtr );
-                iMailTreeListVisualizer->UpdateItemL( item.iListItemId );
-                }
-            else
-                {
-                // No confirmed message for highlighted, remove from list also
-                iMailList->RemoveL( iTreeItemArray[aIndex].iListItemId ); // remove from list
-                iTreeItemArray.Remove( aIndex ); // remove from internal array.
-                iModel->RemoveAndDestroy( aIndex ); // Remove from model
-                if ( iNodesInUse )
+            if( aIndex < iTreeItemArray.Count() )
+                {
+                if ( confirmedMsgPtr )
                     {
-                    RemoveUnnecessaryNodesL();
+                    const SMailListItem& item = iTreeItemArray[aIndex];
+                    // Replace message pointer in model with newly fetched one
+                    Model()->ReplaceMessagePtr( aIndex, confirmedMsgPtr );
+
+                    // Update the list item contents and formating to match the message pointer
+                    CFsTreePlainTwoLineItemData* itemData =
+                        static_cast<CFsTreePlainTwoLineItemData*>( item.iTreeItemData );
+                    CFsTreePlainTwoLineItemVisualizer* itemVis =
+                        static_cast<CFsTreePlainTwoLineItemVisualizer*>( item.iTreeItemVisualiser );
+
+                    UpdateItemDataL( itemData, confirmedMsgPtr );
+                    UpdatePreviewPaneTextForItemL( itemData, confirmedMsgPtr );
+                    UpdateMsgIconAndBoldingL( itemData, itemVis, confirmedMsgPtr );
+                    iMailTreeListVisualizer->UpdateItemL( item.iListItemId );
                     }
-                }
+                else
+                    {
+                    // No confirmed message for highlighted, remove from list also
+                    iMailList->RemoveL( iTreeItemArray[aIndex].iListItemId ); // remove from list
+                    iTreeItemArray.Remove( aIndex ); // remove from internal array.
+                    iModel->RemoveAndDestroy( aIndex ); // Remove from model
+                    if ( iNodesInUse )
+                        {
+                        RemoveUnnecessaryNodesL();
+                        }
+                    }
+            	}
             }
         }
     }
@@ -6600,13 +6750,21 @@
     TFSMailMsgId mailBox = iAppUi.GetActiveMailboxId();
     RArray<TFSMailMsgId> msgIds;
     CleanupClosePushL( msgIds );
-    for ( TInt i = 0; i < aEntries.Count(); i++ )
+    for ( TInt i = aEntries.Count() - 1; i >= 0; i-- )
         {
         msgIds.AppendL( MsgIdFromListId( aEntries[i] ) );
         }
+
+    // Clear the focused item to avoid repeated selection of a new focused
+    // item, unnecessary scrolling of the viewport, etc.
+    iMailTreeListVisualizer->SetFocusedItemL( KFsTreeNoneID );
+
+    iMailList->BeginUpdate();
     iAppUi.GetMailClient()->DeleteMessagesByUidL( mailBox, folderId, msgIds );
     // Remove from mail list if not already removed by mailbox events
     RemoveMsgItemsFromListIfFoundL( msgIds );
+    iMailList->EndUpdateL();
+
     CleanupStack::PopAndDestroy(); // msgIds.Close()
     }
 
@@ -7037,6 +7195,8 @@
 		if ( !iMailFolder || ( iMailFolder && iMailFolder->GetFolderId() != aSelectedFolderId ) )
 		    {
 		    iMailListModelUpdater->Cancel();
+		    iNewMailTimer->Cancel();
+		    iNewMailIds.Reset();
 		    SafeDelete(iMailFolder);
             iMailFolder = iAppUi.GetMailClient()->GetFolderByUidL( iAppUi.GetActiveMailboxId(), aSelectedFolderId );
 
@@ -7189,24 +7349,12 @@
 		}
 
 	iCurrentSortCriteria.iField = aSortField;
-
-	// Size sorting does not use nodes, so disable those, otherwise check from CR
-	iNodesInUse = iAppUi.GetCRHandler()->TitleDividers();
-	SetSortButtonTextAndIconL();
-
-	iFocusedControl = EControlBarComponent;
-	iMailList->SetFocusedL( EFalse );
-    iControlBarControl->SetFocusByIdL( iSortButtonId );
-
-    SortMailListModelAsyncL();  // sort can take long time
-    // <cmail>
-	//if ( iMailListUpdater )
-	//    {
-    	// Start updating mail list with sorting parameter.
-    //	iMailListUpdater->StartL( ETrue );
-	//    }
-    // </cmail>
-	SetMskL();
+	iModel->SetSortCriteria(iCurrentSortCriteria);
+
+	// rest of the code moved to TimerEventL ( iSortTimer part )
+	// used also in DoHandleControlBarOpenL to prevent SortList reopening
+	iSortState = ESortRequested; 
+	iSortTimer->Start( KSortTimerDelay );	
 	}
 
 // ---------------------------------------------------------------------------
--- a/emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -1586,7 +1586,7 @@
             {
             // start wait note
             iWaitDialog = new (ELeave) CAknWaitDialog(
-                    (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), EFalse );
+                    (REINTERPRET_CAST(CEikDialog**, &iWaitDialog)), ETrue );
             iWaitDialog->PrepareLC( R_FS_WAIT_NOTE_REMOVING_MAILBOX );
             iWaitDialog->SetCallback( this );
             iWaitDialog->RunLD();
--- a/emailuis/emailui/src/FreestyleEmailUiShortcutBinding.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiShortcutBinding.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -253,6 +253,7 @@
 #endif // RD_INTELLIGENT_TEXT_INPUT
         if ( iQwertyMappings )
             {
+            iQwertyMappings->SetKeyboardType( static_cast<TPtiKeyboardType>( kbType ) );
             iQwertyMappings->GetDataForKey( static_cast<TPtiKey>(aKey.iScanCode), 
                     keyData, caseMode );
             }
@@ -263,7 +264,8 @@
         // Map the key to the corresponding character in the Fn mode
         if ( iHalfQwertyMappings )
             {
-#ifdef RD_INTELLIGENT_TEXT_INPUT        
+#ifdef RD_INTELLIGENT_TEXT_INPUT 
+            iQwertyMappings->SetKeyboardType( static_cast<TPtiKeyboardType>( kbType ) );
             iHalfQwertyMappings->GetDataForKey( static_cast<TPtiKey>(aKey.iScanCode), 
                     keyData, EPtiCaseFnLower );
 #endif // RD_INTELLIGENT_TEXT_INPUT
@@ -420,9 +422,9 @@
         static_cast<CPtiCoreLanguage*>( iPtiEngine->GetLanguage( ELangEnglish ) );
     if (lang)
         {
-        iQwertyMappings = static_cast<CPtiKeyMappings*>( lang->GetQwertyKeymappings() );
+        iQwertyMappings = static_cast<CPtiQwertyKeyMappings*>( lang->GetQwertyKeymappings() );
 #ifdef RD_INTELLIGENT_TEXT_INPUT        
-        iHalfQwertyMappings = static_cast<CPtiKeyMappings*>( lang->GetHalfQwertyKeymappings() );
+        iHalfQwertyMappings = static_cast<CPtiHalfQwertyKeyMappings*>( lang->GetHalfQwertyKeymappings() );
 #endif // RD_INTELLIGENT_TEXT_INPUT        
         }
     lang = NULL; // owned by iPtiEngine
--- a/emailuis/emailui/src/FreestyleEmailUiViewBase.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiViewBase.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -175,10 +175,10 @@
                 }
             CleanupStack::PopAndDestroy(); // dimmedItems.Close()
             toolbar->SetToolbarObserver(this);
- 			if(resourceId == R_FREESTYLE_EMAIL_UI_TOOLBAR_FOLDER_LIST)
-            	{
-            	toolbar->SetToolbarVisibility(EFalse);
-				}
+
+            TBool toolbarVisible = ( resourceId != R_FREESTYLE_EMAIL_UI_TOOLBAR_FOLDER_LIST ); 
+            toolbar->SetToolbarVisibility( toolbarVisible ); 
+
             SetToolbar(toolbar);
             ShowToolbar();
             }
@@ -208,7 +208,6 @@
         CAknToolbar* toolbar(Toolbar());
         if (toolbar)
             {
-            // toolbar->SetToolbarVisibility(EFalse);
             toolbar->MakeVisible(EFalse);
             }
         }
@@ -224,8 +223,7 @@
         CAknToolbar* toolbar(Toolbar());
         if (toolbar)
             {
-            // toolbar->SetToolbarVisibility(ETrue);
-            toolbar->MakeVisible(ETrue);
+            toolbar->MakeVisible( ETrue );
             }
         }
     }
@@ -269,14 +267,14 @@
         TApaTaskList taskList( iEikonEnv->WsSession() );
         TApaTask prevAppTask = taskList.FindApp( iPreviousAppUid );
         TApaTask fsEmailTask = taskList.FindApp( KFSEmailUiUid );
+        if ( fsEmailTask.Exists() && iPreviousAppUid != KMessageReaderUid )
+            {
+            fsEmailTask.SendToBackground();
+            }
         if ( prevAppTask.Exists() )
             {
             prevAppTask.BringToForeground();
             }
-        if ( fsEmailTask.Exists() && iPreviousAppUid != KMessageReaderUid )
-            {
-            fsEmailTask.SendToBackground();
-            }
 
         iAppUi.SetSwitchingToBackground( EFalse );
         }
--- a/emailuis/emailui/src/FreestyleEmailUiWizardObserver.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiWizardObserver.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -410,12 +410,18 @@
                 tmp.iFolderId = inboxFolderId; 
                 tmp.iMailBoxId = iNewlyCreatedMailboxId; 
                 const TPckgBuf<TMailListActivationData> pkgOut( tmp );
+                // The App might have been, say, in Attachments list of some 
+                // other mailbox but we should not return there with 'Back' 
+                // button - it should go to the launcher grid.  So first
+                // switch to launcher grid (which should unwind the history
+                // back to the launcher grid, which should be the view at
+                // the bottom of the stack) and then erase the history just
+                // to make sure it's really all gone.
+                iAppUi->EnterFsEmailViewL( AppGridId );
+                iAppUi->EraseViewHistory();
+                // Now switch to the mail list.
                 iAppUi->EnterFsEmailViewL( MailListId, KStartListWithFolderId, 
                         pkgOut );
-                // the App might have been, say, in Attachments list of some 
-                // other mailbox but we should not return there with 'Back' 
-                // button
-                iAppUi->EraseViewHistory();
                 }
                 
             CleanupStack::PopAndDestroy( mailBox );
--- a/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleMessageHeaderHTML.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -47,6 +47,8 @@
 _LIT( KUrlFormat, "<a href=\"%S\">%S</a>" );
 _LIT( KUrlFormatWithHttp, "<a href=\"http://%S\">%S</a>" );
 
+_LIT( KEmpty, "" );
+
 // Define this to allow theme colorin for the header
 #define __USE_THEME_COLOR_FOR_HEADER    
 
@@ -251,11 +253,21 @@
     _LIT( KCollapseFunction, "collapseHeader(true)" );
     _LIT( KSenderFormat, "<tr><td align=\"%S\" class=\"sender_name\"><div class=\"truncate\">%S</div></td><td valign=\"top\" rowSpan=\"2\" class=\"button_cell\"><button value=\"submit\" onClick=\"%S\" class=\"%S\"></button></td></tr>\n" );
     const CFSMailAddress* sender( iMailMessage.GetSender() );
-    TPtrC displayName( sender->GetDisplayName() );
-    if ( !displayName.Length() )
+    
+    TPtrC displayName;    
+    if ( sender )
         {
-        displayName.Set( sender->GetEmailAddress() );
+        displayName.Set( sender->GetDisplayName() );
+        if ( !displayName.Length() )
+            {
+            displayName.Set( sender->GetEmailAddress() );
+            }
         }
+    else
+        {        
+        displayName.Set( KEmpty );
+        }
+    
     const TPtrC function( aCollapsed ? KExpandFunction() : KCollapseFunction() );
     const TPtrC style( aCollapsed ? KStyleExpand() : KStyleCollapse() );
     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
@@ -271,7 +283,17 @@
     {
     _LIT( KSenderAddressFormat, "<tr><td colspan=\"2\" align=\"%S\"><div class=\"truncate\"><a class=\"sender_address\" href=\"cmail://from/%S\">%S</a></div></td></tr>\n" );
     const CFSMailAddress* sender( iMailMessage.GetSender() );
-    const TPtrC emailAddress( sender->GetEmailAddress() );
+
+    TPtrC emailAddress;
+    if ( sender )
+        {
+        emailAddress.Set( sender->GetEmailAddress() );
+        }
+    else
+        {
+        emailAddress.Set( KEmpty );
+        }
+
     const TPtrC align(  iExportFlags.IsSet( EMirroredLayout ) ? KAlignRight() : KAlignLeft() );
     HBufC* formatBuffer = HBufC::NewLC( KSenderAddressFormat().Length() + emailAddress.Length() * 2 + align.Length() );
     formatBuffer->Des().Format( KSenderAddressFormat(), &align, &emailAddress, &emailAddress );
--- a/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -31,11 +31,11 @@
 #include <brctldefs.h>
 #include <e32std.h>
 #include <eikmobs.h>
-#include <coemain.h>  
+#include <coemain.h>
 #include <schemehandler.h>
 
-EXPORT_C CFreestyleMessageHeaderURLEventHandler* CFreestyleMessageHeaderURLEventHandler::NewL( 
-        CFreestyleEmailUiAppUi& aAppUi, 
+EXPORT_C CFreestyleMessageHeaderURLEventHandler* CFreestyleMessageHeaderURLEventHandler::NewL(
+        CFreestyleEmailUiAppUi& aAppUi,
         CFsEmailUiHtmlViewerView& aView )
     {
     CFreestyleMessageHeaderURLEventHandler* obj = new (ELeave) CFreestyleMessageHeaderURLEventHandler( aAppUi, aView );
@@ -45,54 +45,54 @@
     return obj;
     }
 
-CFreestyleMessageHeaderURLEventHandler::CFreestyleMessageHeaderURLEventHandler( 
-        CFreestyleEmailUiAppUi& aAppUi, 
+CFreestyleMessageHeaderURLEventHandler::CFreestyleMessageHeaderURLEventHandler(
+        CFreestyleEmailUiAppUi& aAppUi,
         CFsEmailUiHtmlViewerView& aView )
-    : iAppUi( aAppUi ), 
-    iView( aView ), 
-    iMailMessage( NULL ), 
+    : iAppUi( aAppUi ),
+    iView( aView ),
+    iMailMessage( NULL ),
     iAttachmentsListModel( NULL )
     {
     }
 
 void CFreestyleMessageHeaderURLEventHandler::ConstructL()
     {
-    iMessageHeaderURL = CFreestyleMessageHeaderURL::NewL();   
+    iMessageHeaderURL = CFreestyleMessageHeaderURL::NewL();
     iHTMLReloadAO = CFSHtmlReloadAO::NewL(iView);
-    
+
     }
 
 CFreestyleMessageHeaderURLEventHandler::~CFreestyleMessageHeaderURLEventHandler ()
     {
     delete iMessageHeaderURL;
-    delete iHTMLReloadAO; 
+    delete iHTMLReloadAO;
     if( iEmailAddressStylusPopup )
         {
-        delete iEmailAddressStylusPopup; 
+        delete iEmailAddressStylusPopup;
         }
-    
+
     if( iAttachmentStylusPopup )
         {
-        delete iAttachmentStylusPopup; 
+        delete iAttachmentStylusPopup;
         }
-    
+
     if( iWebAddressStylusPopup )
         {
-        delete iWebAddressStylusPopup; 
-        }   
-    
+        delete iWebAddressStylusPopup;
+        }
+
     delete iUrl;
     }
 
 EXPORT_C TBool CFreestyleMessageHeaderURLEventHandler::HandleEventL( const TDesC& aUri )
     {
-    iMailMessage = iView.CurrentMessage(); 
+    iMailMessage = iView.CurrentMessage();
     iAttachmentsListModel = iView.CurrentAttachmentsListModel();
-    
+
     if ( ! CFreestyleMessageHeaderURL::IsMessageHeaderURL( aUri ) )
         {
         //Handle http and https links
-        if( ( aUri.FindF( KURLHttpPrefix ) ) == 0 
+        if( ( aUri.FindF( KURLHttpPrefix ) ) == 0
                 ||( aUri.FindF( KURLHttpsPrefix ) ) == 0 )
             {
             if ( iUrl )
@@ -103,7 +103,7 @@
             iUrl = aUri.AllocL();
             LaunchWebAddressMenuL( );
             return ETrue;
-            }         
+            }
         //Link wasn't handled
         return EFalse;
         }
@@ -148,8 +148,12 @@
  */
 void CFreestyleMessageHeaderURLEventHandler::LaunchEmailAddressMenuL()
     {
+    if ( LaunchEmailAddressMenuHWKeyL() )
+        {
+        return;
+        }
     
-    //Change the creation of the stylus menu here to avoid crash when calling SetItemDimmed(ETrue) multiple times 
+    //Change the creation of the stylus menu here to avoid crash when calling SetItemDimmed(ETrue) multiple times
     //on same instance of the menu (if created only once in constructor).
     //Creating the menu everytime the user clicks on the link avoids this crash however performance is affected.
     if( iEmailAddressStylusPopup)
@@ -157,25 +161,53 @@
        delete iEmailAddressStylusPopup;
        iEmailAddressStylusPopup = NULL;
        }
-   
+
     TPoint point( 0, 0 );
     iEmailAddressStylusPopup = CAknStylusPopUpMenu::NewL( this , point );
     TResourceReader reader;
     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_STYLUS_POPUP_MENU_HTML_VIEW_EMAIL_ADDRESS );
     iEmailAddressStylusPopup->ConstructFromResourceL( reader );
     CleanupStack::PopAndDestroy(); //resource reader
-         
-    iEmailAddressStylusPopup->SetItemDimmed( EFsEmailUiCmdActionsRemoteLookup, 
-                                             !iView.IsRemoteLookupSupportedL() ); 
-    iEmailAddressStylusPopup->SetPosition( iAppUi.ClientRect().Center(), 
+
+    iEmailAddressStylusPopup->SetItemDimmed( EFsEmailUiCmdActionsRemoteLookup,
+                                             !iView.IsRemoteLookupSupportedL() );
+    iEmailAddressStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(),
                                            CAknStylusPopUpMenu::EPositionTypeRightBottom );
     iEmailAddressStylusPopup->ShowMenu();
     }
 
+
+TBool CFreestyleMessageHeaderURLEventHandler::LaunchEmailAddressMenuHWKeyL()
+    {
+    TInt wsEventType = iAppUi.LastSeenWsEventType();
+    if ( wsEventType != EEventKey )
+        {
+        return EFalse; // only hw key event handled here
+        }
+
+    CFreestylePopupMenu* popup = CFreestylePopupMenu::NewL( R_STYLUS_POPUP_MENU_HTML_VIEW_EMAIL_ADDRESS );
+    CleanupStack::PushL( popup );
+
+    popup->SetDimmed( EFsEmailUiCmdActionsRemoteLookup, 
+                     !iView.IsRemoteLookupSupportedL() );
+
+    TInt commandId = popup->LaunchPopupMenuL();
+
+    CleanupStack::PopAndDestroy( popup );
+   
+    if ( commandId != KErrCancel )
+        {
+        ProcessCommandL( commandId );
+        }
+    
+    return ETrue;
+    }
+
+
 //From MEikMenuObserver
 void CFreestyleMessageHeaderURLEventHandler::ProcessCommandL( TInt aCommand )
     {
-    
+
     switch ( aCommand )
         {
         case EFsEmailUiCmdActionsReply:
@@ -187,37 +219,37 @@
             iView.HandleEmailAddressCommandL( aCommand, *iMessageHeaderURL->ItemId() );
             break;
             }
-            
+
         case EFsEmailUiCmdCancelDownload:
             {
             iView.CancelAttachmentL( FindAttachmentL( *iMessageHeaderURL ) );
             break;
             }
-            
+
         case EFsEmailUiCmdCancelAllDownloads:
             {
             iView.CancelAllAttachmentsL();
             break;
             }
-            
+
         case EFsEmailUiCmdOpenAttachment:
             {
             iView.OpenAttachmentL( FindAttachmentL( *iMessageHeaderURL ) );
             break;
             }
-            
+
         case EFsEmailUiCmdSave:
             {
             iView.SaveAttachmentL( FindAttachmentL( *iMessageHeaderURL ) );
             break;
             }
-            
+
         case EFsEmailUiCmdSaveAll:
             {
             iView.SaveAllAttachmentsL( );
-            break;      
+            break;
             }
-            
+
         case EFsEmailUiCmdActionsOpenWeb:
         case EFsEmailUiCmdActionsAddBookmark:
         case EFsEmailUiCmdActionsCopyWWWAddressToClipboard:
@@ -225,18 +257,18 @@
             iView.HandleWebAddressCommandL( aCommand, *iUrl );
             break;
             }
-            
+
         }
     }
 
-const TAttachmentData& CFreestyleMessageHeaderURLEventHandler::FindAttachmentL( 
+const TAttachmentData& CFreestyleMessageHeaderURLEventHandler::FindAttachmentL(
         const CFreestyleMessageHeaderURL& aAttachmentUrl )
     {
     User::LeaveIfNull( iAttachmentsListModel );
     TUint id;
     TLex parser( *aAttachmentUrl.ItemId() );
     parser.Val( id );
-    
+
     TInt found = KErrNotFound;
     for (TInt i=0; i<iAttachmentsListModel->GetModel().Count(); i++)
         {
@@ -246,10 +278,10 @@
             break;
             }
         }
-    
+
     if ( found == KErrNotFound )
         {
-        // Probably, only the headers were downloaded. Check if attachments 
+        // Probably, only the headers were downloaded. Check if attachments
         // were downloaded later.
         if( iMailMessage )
             {
@@ -269,15 +301,21 @@
             User::Leave( KErrNotFound );
             }
         }
-    
+
     return iAttachmentsListModel->GetModel()[found];
     }
 
-void CFreestyleMessageHeaderURLEventHandler::LaunchAttachmentMenuL( 
+void CFreestyleMessageHeaderURLEventHandler::LaunchAttachmentMenuL(
         const TAttachmentData& aAttachment )
     {
     ASSERT( iAppUi.DownloadInfoMediator() );
     
+    if ( LaunchAttachmentMenuHWKeyL( aAttachment ) )
+        {
+        return;
+        }
+    
+    
     //Change the creation of the stylus menu here to avoid crash when calling SetItemDimmed(ETrue) multiple times 
     //on same instance of the menu (if created only once in constructor).
     //Creating the menu everytime the user clicks on the link avoids this crash however performance is affected.
@@ -292,36 +330,116 @@
     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_STYLUS_POPUP_MENU_HTML_VIEW_ATTACHMENT );
     iAttachmentStylusPopup->ConstructFromResourceL( reader );
     CleanupStack::PopAndDestroy(); //resource reader
-    
-    
+
+
     //Dim all item by default
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdOpenAttachment, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, ETrue );
-    iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, ETrue );   
+    iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelAllDownloads, ETrue );
 
     const TBool isMessage( iAttachmentsListModel->IsMessage( aAttachment ) );
+
+    if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
+        {
+        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, EFalse );
+        }
+    else if ( aAttachment.downloadProgress == KComplete )
+        {
+        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
+
+        // block saving of embedded messages if needed.
+        if ( iView.IsEmbeddedMsgView() )
+            {
+            if ( iView.IsEmbeddedMsgSavingAllowed() || !isMessage )
+                {
+                iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, EFalse );
+                }
+            }
+        else
+            {
+            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, isMessage && !iView.IsEmbeddedMsgSavingAllowed() );
+            }
+
+        if ( iAttachmentsListModel->GetModel().Count() > 1 )
+            {
+            // Save all cannot be shown if there is one message attachment and saving is not supported
+            if ( !( iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() ) )
+                {
+                // 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, isMessage );
+        if ( iAttachmentsListModel->GetModel().Count() > 1 )
+            {
+            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll,
+                    iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() );
+            }
+        }
+
+    if ( iAttachmentsListModel->IsMultiplyDownloadsOngoing() )
+        {
+        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelAllDownloads, EFalse );
+        }
+
+    iAttachmentStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(),
+                                         CAknStylusPopUpMenu::EPositionTypeRightBottom );
+    iAttachmentStylusPopup->ShowMenu();
+    }
+
+
+TBool CFreestyleMessageHeaderURLEventHandler::LaunchAttachmentMenuHWKeyL( 
+        const TAttachmentData& aAttachment )
+    {
+    ASSERT( iAppUi.DownloadInfoMediator() );
+    
+    TInt wsEventType = iAppUi.LastSeenWsEventType();
+    if ( wsEventType != EEventKey )
+        {
+        return EFalse; // only hw key event handled here
+        }
+
+    CFreestylePopupMenu* popup = CFreestylePopupMenu::NewL( R_STYLUS_POPUP_MENU_HTML_VIEW_ATTACHMENT );
+    CleanupStack::PushL( popup );
+    
+    //Dim all item by default
+    popup->SetDimmed( EFsEmailUiCmdOpenAttachment, ETrue );
+    popup->SetDimmed( EFsEmailUiCmdSave, ETrue );
+    popup->SetDimmed( EFsEmailUiCmdSaveAll, ETrue );
+    popup->SetDimmed( EFsEmailUiCmdCancelDownload, ETrue );   
+    popup->SetDimmed( EFsEmailUiCmdCancelAllDownloads, ETrue );
+
+    const TBool isMessage( iAttachmentsListModel->IsMessage( aAttachment ) );
     
     if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
         {        
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, EFalse );  
+        popup->SetDimmed( EFsEmailUiCmdCancelDownload, EFalse );  
         }
     else if ( aAttachment.downloadProgress == KComplete )
         {
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
+        popup->SetDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
         
         // block saving of embedded messages if needed.
         if ( iView.IsEmbeddedMsgView() )
             {
             if ( iView.IsEmbeddedMsgSavingAllowed() || !isMessage )
                 {
-                iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, EFalse );    
+                popup->SetDimmed( EFsEmailUiCmdSave, EFalse );    
                 }              
             }
         else
             {
-            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, isMessage && !iView.IsEmbeddedMsgSavingAllowed() );
+            popup->SetDimmed( EFsEmailUiCmdSave, isMessage && !iView.IsEmbeddedMsgSavingAllowed() );
             }
         
         if ( iAttachmentsListModel->GetModel().Count() > 1 )
@@ -333,37 +451,48 @@
                 // are any message type attachments. This is due to limitations of Activesync plugin.
                 if( !(iView.IsEmbeddedMsgView() && iAttachmentsListModel->IsThereAnyMessageAttachments()) )
                     {
-                    iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, EFalse );    
+                    popup->SetDimmed( EFsEmailUiCmdSaveAll, EFalse );    
                     }
                 }
             }         
         }
     else
         {
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, isMessage ); 
+        popup->SetDimmed( EFsEmailUiCmdOpenAttachment, EFalse );
+        popup->SetDimmed( EFsEmailUiCmdSave, isMessage ); 
         if ( iAttachmentsListModel->GetModel().Count() > 1 )
             {
-            iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll,
+            popup->SetDimmed( EFsEmailUiCmdSaveAll,
                     iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() );
             }         
         }
 
     if ( iAttachmentsListModel->IsMultiplyDownloadsOngoing() )
         {
-        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelAllDownloads, EFalse );
+        popup->SetDimmed( EFsEmailUiCmdCancelAllDownloads, EFalse );
         }
     
-    iAttachmentStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(), 
-                                         CAknStylusPopUpMenu::EPositionTypeLeftTop );
-    iAttachmentStylusPopup->ShowMenu();
+    TInt commandId = popup->LaunchPopupMenuL();
+
+    CleanupStack::PopAndDestroy( popup );
+       
+    if ( commandId != KErrCancel )
+        {
+        ProcessCommandL( commandId );
+        }
+    
+    return ETrue;    
     }
 
 //Open the Avkon stylus popup when a web address link was pressed
 void CFreestyleMessageHeaderURLEventHandler::LaunchWebAddressMenuL()
     {
-    
-    //Change the creation of the stylus menu here to avoid crash when calling SetItemDimmed(ETrue) multiple times 
+    if ( LaunchWebAddressMenuHWKeyL() )
+        {
+        return;
+        }
+        
+    //Change the creation of the stylus menu here to avoid crash when calling SetItemDimmed(ETrue) multiple times
     //on same instance of the menu (if created only once in constructor).
     //Creating the menu everytime the user clicks on the link avoids this crash however performance is affected.
     if( iWebAddressStylusPopup )
@@ -371,19 +500,44 @@
         delete iWebAddressStylusPopup;
         iWebAddressStylusPopup = NULL;
         }
-    
+
     TPoint point( 0, 0 );
     iWebAddressStylusPopup = CAknStylusPopUpMenu::NewL( this , point );
     TResourceReader reader;
     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_STYLUS_POPUP_MENU_HTML_VIEW_WEB_ADDRESS );
     iWebAddressStylusPopup->ConstructFromResourceL( reader );
     CleanupStack::PopAndDestroy(); //resource reader
- 
-    iWebAddressStylusPopup->SetPosition( iAppUi.ClientRect().Center(), 
+
+    iWebAddressStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(),
                                            CAknStylusPopUpMenu::EPositionTypeRightBottom );
     iWebAddressStylusPopup->ShowMenu();
     }
 
+
+TBool CFreestyleMessageHeaderURLEventHandler::LaunchWebAddressMenuHWKeyL()
+    {
+    TInt wsEventType = iAppUi.LastSeenWsEventType();
+    if ( wsEventType != EEventKey )
+        {
+        return EFalse; // only hw key event handled here
+        }
+
+    CFreestylePopupMenu* popup = CFreestylePopupMenu::NewL( R_STYLUS_POPUP_MENU_HTML_VIEW_WEB_ADDRESS );
+    CleanupStack::PushL( popup );
+
+    TInt commandId = popup->LaunchPopupMenuL();
+
+    CleanupStack::PopAndDestroy( popup );
+       
+    if ( commandId != KErrCancel )
+        {
+        ProcessCommandL( commandId );
+        }
+        
+    return ETrue;
+    }
+
+
 //From MEikMenuObserver
 void CFreestyleMessageHeaderURLEventHandler::SetEmphasis(CCoeControl* /*aMenuControl*/,TBool /*aEmphasis*/)
     {
@@ -398,3 +552,141 @@
     {
     return iMenuVisible;
     }
+/******************************************************************************
+ * class CFreestylePopupMenu
+ ******************************************************************************/
+
+
+CFreestylePopupMenu* CFreestylePopupMenu::NewL( TInt aResourceId )
+    {
+    CFreestylePopupMenu* self = new (ELeave) CFreestylePopupMenu( aResourceId );
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+    return self;
+    }
+
+CFreestylePopupMenu::CFreestylePopupMenu( TInt aResourceId )
+    {
+    iResourceId = aResourceId;
+    }
+
+void CFreestylePopupMenu::ConstructL()
+    {
+    TResourceReader reader;
+    CCoeEnv::Static()->CreateResourceReaderLC( reader, iResourceId );
+    
+    ConstructFromResourceL( reader );
+    
+    CleanupStack::PopAndDestroy();  // TResourceReader
+    }
+
+CFreestylePopupMenu::~CFreestylePopupMenu()
+    {
+    iItemList.Close();
+    }
+
+TInt CFreestylePopupMenu::LaunchPopupMenuL()
+    {
+    TInt selectedOption = KErrNotFound;
+    CDesCArrayFlat* arr = new (ELeave) CDesCArrayFlat( 5 );
+    CleanupStack::PushL( arr );
+
+    TInt count = iItemList.Count();
+    for ( TInt i=0; i<count; i++ )
+        {
+        TPopupMenuItem& item = iItemList[i];
+        item.iListIndex = KErrNotFound;
+        if ( !item.iDimmed )
+            {
+            arr->AppendL( item.iText );
+            item.iListIndex = arr->MdcaCount() - 1;
+            }
+        }
+
+    CAknListQueryDialog* dialog = new (ELeave) CAknListQueryDialog( &selectedOption );
+    dialog->PrepareLC( R_DRAFT_QUERY_DIALOG );
+    dialog->SetItemTextArray( arr );
+    dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
+
+    TInt ret = dialog->RunLD();
+
+    CleanupStack::PopAndDestroy( arr );
+        
+    TInt commandId = KErrCancel;
+    if ( ret )
+        {
+        commandId = CommandIdFromListIndex( selectedOption );
+        }
+    
+    return commandId;
+    }
+
+
+void CFreestylePopupMenu::SetDimmed( TInt aCommandId, TBool aDimmed )
+    {
+    TInt count = iItemList.Count();
+    
+    for ( TInt i=0; i<count; i++ )
+        {
+        TPopupMenuItem& item = iItemList[i];
+        if ( item.iCommandId == aCommandId )
+            {
+            item.iDimmed = aDimmed;
+            break;
+            }
+        }
+    }
+
+
+TInt CFreestylePopupMenu::CommandIdFromListIndex( TInt aListIndex )
+    {
+    TInt ret = KErrCancel;
+    
+    TInt count = iItemList.Count();
+    
+    for ( TInt i=0; i<count; i++ )
+        {
+        TPopupMenuItem& item = iItemList[i];
+        if ( item.iListIndex == aListIndex )
+            {
+            ret = item.iCommandId; 
+            break;
+            }
+        }
+    
+    return ret;
+    }
+
+void CFreestylePopupMenu::ConstructFromResourceL( TResourceReader& aReader )
+    {
+    TInt count = aReader.ReadInt16();
+
+    for ( TInt i=0; i<count; i++ )
+        {
+        TPopupMenuItem item;
+    
+        TPtrC ptr = aReader.ReadTPtrC();
+        StrCopy( item.iText, ptr );
+        item.iCommandId = aReader.ReadInt32();
+        item.iDimmed = EFalse;
+        item.iListIndex = KErrNotFound;
+        iItemList.AppendL( item );
+        
+        aReader.ReadInt32(); // extension link
+        }
+    }
+
+void CFreestylePopupMenu::StrCopy( TDes& aTarget, const TDesC& aSource )
+    {
+    TInt len = aTarget.MaxLength();
+    if( len < aSource.Length() ) 
+        {
+        aTarget.Copy( aSource.Left( len ) );
+        }
+    else
+        {
+        aTarget.Copy( aSource );
+        }
+    }
+
--- a/emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/freestyleemailuimailboxdeleter.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -300,7 +300,7 @@
     
     // Start wait note.
     iWaitDialog = new ( ELeave ) CAknWaitDialog(
-        ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ), EFalse );
+        ( REINTERPRET_CAST( CEikDialog**, &iWaitDialog ) ), ETrue );
     iWaitDialog->PrepareLC( R_FS_WAIT_NOTE_REMOVING_MAILBOX );
     iWaitDialog->SetCallback( this );
     iWaitDialog->RunLD();
@@ -463,24 +463,21 @@
         case TFSProgress::EFSStatus_RequestComplete:
         case TFSProgress::EFSStatus_RequestCancelled:
             {
-            if( aRequestId == iMailboxDeleteOperationId )
-                {
-                if( iMailboxesToDelete.Count() > 0 )
+            if( iMailboxesToDelete.Count() > 0 )
+            	{
+                // Delete next mailbox in queue.
+                iIdle->Cancel();
+                iIdle->Start(TCallBack(IdleCallbackL,this));
+            	}
+            else
+            	{
+                if( iWaitDialog )
                     {
-                    // Delete next mailbox in queue.
-            	    iIdle->Cancel();
-            		iIdle->Start(TCallBack(IdleCallbackL,this));
+                    iWaitDialog->ProcessFinishedL();
                     }
-                else
-                    {
-                    if( iWaitDialog )
-                        {
-                        iWaitDialog->ProcessFinishedL();
-                        }
-                    // Notify observer that the deletion is complete. 
-                    iObserver.MailboxDeletionComplete();
-                    }
-                }            
+                // Notify observer that the deletion is complete. 
+                iObserver.MailboxDeletionComplete();
+            	}          
             break;
             }
         default:
--- a/emailuis/emailui/src/ncsaddressinputfield.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/ncsaddressinputfield.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -33,6 +33,7 @@
 #include <AknUtils.h>
 #include <FreestyleEmailUi.rsg>
 #include <aknphysics.h>
+#include <centralrepository.h>
 
 #include "FreestyleEmailUiAppui.h"
 #include "FreestyleEmailUiLayoutData.h"
@@ -44,6 +45,7 @@
 #include "ncsutility.h"
 #include "ncsheadercontainer.h"
 #include "txtrich.h"
+#include "freestyleemailcenrepkeys.h"
 
 // ---------------------------------------------------------------------------
 // constructor
@@ -198,6 +200,21 @@
     iTextEditor->SetBorder( TGulBorder::ENone );
 	iTextEditor->SetAknEditorInputMode( EAknEditorTextInputMode );
 	iTextEditor->SetAknEditorFlags( EAknEditorFlagNoT9 | EAknEditorFlagUseSCTNumericCharmap );
+
+     CRepository* repository = NULL;
+     TRAPD( err, repository = CRepository::NewL( KFreestyleEmailCenRep ) );
+     if ( !err )
+         {
+         TInt value( 0 );
+         err = repository->Get( KEmailFeatureSplitScreen, value );
+         if( !err && value )
+            {
+             iTextEditor->SetAknEditorFlags( iTextEditor->AknEditorFlags() | EAknEditorFlagEnablePartialScreen );
+             }
+         }
+    delete repository;
+    repository = NULL;
+    
 	iTextEditor->SetAknEditorCurrentCase( EAknEditorLowerCase );
 	iTextEditor->CreateScrollBarFrameL()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOff );
     iTextEditor->SetEdwinSizeObserver( this );
@@ -211,15 +228,16 @@
         {
         if( iLabel )
             iLabel->SetAlignment( EHRightVCenter );
-        iTextEditor->SetAlignment( EAknEditorAlignRight );
         }
     else
         {
         if( iLabel )
             iLabel->SetAlignment( EHLeftVCenter );
-        iTextEditor->SetAlignment( EAknEditorAlignLeft );
         }
-
+    
+    // this needs to be bidi as in mirrored layout 
+    // writing language left to right can be set 
+    iTextEditor->SetAlignment( EAknEditorAlignBidi );
     }
 
 // -----------------------------------------------------------------------------
@@ -261,6 +279,11 @@
    	    {
    	    LayoutNonTouch();
    	    }
+
+    // This needs to be bidi as in mirrored layout 
+    // writing language left to right can be set. 
+    // Need to set here as layout sets it also to left or right.
+    iTextEditor->SetAlignment( EAknEditorAlignBidi );
    	    
     UpdateFontSize();
     
--- a/emailuis/emailui/src/ncscomposeview.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeview.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -37,6 +37,7 @@
 #include <freestyleemailui.mbg>
 #include <aknstyluspopupmenu.h>
 
+#include <wlaninternalpskeys.h>
 #include "ncscomposeview.h"
 #include "ncscomposeviewcontainer.h"
 #include "ncsconstants.h"
@@ -959,7 +960,7 @@
                     {
                     // Sending successful
                     HBufC* confMessage = NULL;
-                    if ( !TFsEmailUiUtility::IsOfflineModeL() )
+                    if ( !TFsEmailUiUtility::IsOfflineModeL() || WLANConnectionActive() )
                         {
                         // when sync status is currently ONLINE
                         confMessage = StringLoader::LoadLC( 
@@ -1796,6 +1797,23 @@
 
 	}
 
+// ---------------------------------------------------------------------------
+// CNcsComposeView::FadeOut()
+// enables hiding toolbar on different view -> DoActivate()  
+// which is earlier than -> CFsEmailUiViewBase::DoDeactivate() 
+// -----------------------------------------------------------------------------
+//
+void CNcsComposeView::FadeOut( TBool aDirectionOut )
+    {
+    if ( aDirectionOut && Toolbar()->IsShown() )
+        {
+        HideToolbar();
+        }
+    else if ( ! ( aDirectionOut || Toolbar()->IsShown() ) )
+        {
+        ShowToolbar();
+        }
+    }
 // -----------------------------------------------------------------------------
 // CNcsComposeView::InitReplyFieldsL()
 // Initialises the reply fields from the reply message created by the plug-in.
@@ -3402,6 +3420,30 @@
     }
 
 // ---------------------------------------------------------------------------
+// Returns ETrue if WLAN connection is active.
+// ---------------------------------------------------------------------------
+//
+TBool CNcsComposeView::WLANConnectionActive()    
+    {
+    TBool ret = EFalse;
+    
+    TInt wlanState;
+    TInt err = RProperty::Get( KPSUidWlan, KPSWlanIndicator, wlanState );
+
+    if ( err == KErrNone )
+        {
+        if ( wlanState == EPSWlanIndicatorActive ||
+             wlanState == EPSWlanIndicatorActiveSecure )
+            {
+            ret = ETrue;
+            }
+        }
+    
+    return ret;    
+    }
+
+
+// ---------------------------------------------------------------------------
 // CActiveHelper::NewL()
 // ---------------------------------------------------------------------------
 //
--- a/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeviewcontainer.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -274,6 +274,7 @@
         const TPointerEvent& aPointerEvent )
     {
     FUNC_LOG;
+	TBool clearSelection(EFalse);
     if ( aPointerEvent.iType != TPointerEvent::EButton1Down &&
          iHeader->NeedsLongTapL( aPointerEvent.iPosition ) )
         {
@@ -352,7 +353,11 @@
                     }
                 else
                     {
-                    iMessageField->ClearSelectionL();
+				    // Changes made in predictive input mode can be approved
+					// only if ClearSelection is called AFTER
+					// CCoeControl::HandlePointerEventL,
+					// so iMessageField->ClearSelection() has been moved
+					clearSelection = ETrue;
                     }
                 }
 
@@ -443,6 +448,10 @@
         }
 
     CCoeControl::HandlePointerEventL( aPointerEvent );
+	if (clearSelection)
+		{
+		iMessageField->ClearSelectionL();
+		}
     }
 
 // -----------------------------------------------------------------------------
@@ -763,6 +772,7 @@
     NcsUtility::LayoutBodyEdwin( 
             iMessageField, cmailPaneRect, iHeader->LayoutLineCount(), 
             iMessageField->LineCount(), iSeparatorLineYPos );
+    iMessageField->SetAlignment( EAknEditorAlignBidi );
     
     // we don't need format again when format was already done
     // during creation of forward/reply message
@@ -781,6 +791,7 @@
                 iReadOnlyQuoteField, cmailPaneRect, 
                 iHeader->LayoutLineCount() + iMessageField->LineCount(), 
                 iReadOnlyQuoteField->LineCount(), dummySeparatorPos );
+        iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi );
         // we don't need format again when format was already done
 		// during creation of forward/reply message
         if ( !iSwitchOffFormattingText )
@@ -952,7 +963,8 @@
 			NcsUtility::LayoutBodyEdwin( iReadOnlyQuoteField, iCmailPaneRect, 
 					iHeader->LayoutLineCount() + iMessageField->LineCount(),
 					iReadOnlyQuoteField->LineCount(), dummySeparatorPos );
-	
+            iReadOnlyQuoteField->SetAlignment( EAknEditorAlignBidi );
+            
 			RMemReadStream inputStream;
             inputStream.Open( iReadOnlyQuote->Ptr(), iReadOnlyQuote->Size() );
             TRAP_IGNORE( iReadOnlyQuoteField->RichText()->ImportTextL( 0, inputStream,
--- a/emailuis/emailui/src/ncseditor.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/ncseditor.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -28,11 +28,13 @@
 #include <AknsSkinInstance.h>
 #include <aknedsts.h>
 #include <AknsBasicBackgroundControlContext.h>
+#include <centralrepository.h>
 
 #include "ncseditor.h"
 #include "ncsutility.h"
 #include "ncscustomdraw.h"
 #include "ncseditorcustomdraw.h"
+#include "freestyleemailcenrepkeys.h"
 
 // ========================= MEMBER FUNCTIONS ==================================
 
@@ -71,6 +73,19 @@
             CEikEdwin::ENoAutoSelection | CEikEdwin::EInclusiveSizeFixed |
             CEikEdwin::ENoHorizScrolling | CEikRichTextEditor::EPasteAsPlainText );
     
+    CRepository* repository = NULL;
+    TRAPD( err, repository = CRepository::NewL( KFreestyleEmailCenRep ) );
+    if ( !err )
+        {
+        TInt value( 0 );
+        err = repository->Get( KEmailFeatureSplitScreen, value );
+        if( !err && value )
+            {
+            SetAknEditorFlags( AknEditorFlags() | EAknEditorFlagEnablePartialScreen );  
+            }
+        }
+    delete repository;
+    repository = NULL;
     iGlobalCharFormat = CCharFormatLayer::NewL();
     iGlobalCharFormat->SetBase( GlobalText()->GlobalCharFormatLayer() );
     GlobalText()->SetGlobalCharFormat( iGlobalCharFormat );
--- a/emailuis/emailui/src/ncssubjectfield.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/emailui/src/ncssubjectfield.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -192,15 +192,17 @@
         {
         iLabel->SetAlignment( EHLeftVCenter );
         iLabel->SetLabelAlignment( ELayoutAlignLeft );
-        iTextEditor->SetAlignment( EAknEditorAlignRight );
         }
     else
         {
         iLabel->SetAlignment( EHRightVCenter );
         iLabel->SetLabelAlignment( ELayoutAlignRight );
-        iTextEditor->SetAlignment( EAknEditorAlignLeft );
         }
     
+    // this needs to be bidi as in mirrored layout 
+    // writing language left to right can be set 
+    iTextEditor->SetAlignment( EAknEditorAlignBidi );
+    
 	UpdateFontSize();
 
 	iTextEditor->UpdateCustomDrawer();
--- a/emailuis/uicomponents/src/fstextparser.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/uicomponents/src/fstextparser.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -25,7 +25,7 @@
 #include <alf/alftextstylemanager.h>
 // </cmail>
 #include <eikenv.h>
-#include <imagedata.h>
+#include <icl/imagedata.h>
 // <cmail>
 #include <AknUtils.h>
 // </cmail>
--- a/emailuis/uicomponents/src/fstreenode.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/uicomponents/src/fstreenode.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -67,7 +67,7 @@
     FUNC_LOG;
     TInt childIndex = 0;
 
-    if ( aIndex == KFsTreeChildIndexLast )
+    if ( aIndex >= iChildren.Count() || aIndex == KFsTreeChildIndexLast )
         {
         childIndex = iChildren.Append( aItem );
         }
--- a/emailuis/uicomponents/src/fstreeplainonelinenodevisualizer.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/uicomponents/src/fstreeplainonelinenodevisualizer.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -371,12 +371,6 @@
                 mainIconMetrics,
                 rect,
                 mainIconVariety );
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK
-    if (rect.iTl.iY < 15)
-        {
-        rect.Move(0, 15 - rect.iTl.iY);    
-        }
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK   
     tpMainIconTl.SetTarget(TAlfRealPoint(rect.iTl));
     tpMainIconBr.SetTarget(TAlfRealPoint(rect.iBr));
 
@@ -385,12 +379,6 @@
             markIconMetrics,
             rect,
             markIconVariety );
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK
-    if (rect.iTl.iY < 15)
-        {
-        rect.Move(0, 15 - rect.iTl.iY);    
-        }
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK   
     tpMarkIconTl.SetTarget(TAlfRealPoint(rect.iTl));
     tpMarkIconBr.SetTarget(TAlfRealPoint(rect.iBr));
 
@@ -399,12 +387,6 @@
             menuIconMetrics,
             rect,
             menuIconVariety );
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK
-    if (rect.iTl.iY < 15)
-        {
-        rect.Move(0, 15 - rect.iTl.iY);    
-        }
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK   
     tpMenuIconTl.SetTarget(TAlfRealPoint(rect.iTl));
     tpMenuIconBr.SetTarget(TAlfRealPoint(rect.iBr));
 
@@ -421,12 +403,6 @@
     CFsLayoutManager::TFsText textInfo;
     CFsLayoutManager::LayoutMetricsText(textRect,
             textMetrics, textInfo, textPaneVariety);
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK
-    if (textInfo.iTextRect.iTl.iY < 15)
-        {
-        textInfo.iTextRect.Move(0, 15 - textInfo.iTextRect.iTl.iY);    
-        }
-    // WORKAROUND FIX FOR LAYOUT PROBLEM -- RETURN THIS TO NORMAL WHEN LAYOUT'S ARE OK
     tpTextTl.SetTarget(TAlfRealPoint(textInfo.iTextRect.iTl)); 
     tpTextBr.SetTarget(TAlfRealPoint(textInfo.iTextRect.iBr));
 
@@ -557,7 +533,7 @@
         if (!iIconVisual)
             {
             iIconVisual = CAlfImageVisual::AddNewL(iOwnerControl,iLayout);
-            iIconVisual->SetScaleMode( CAlfImageVisual::EScaleNormal );
+            iIconVisual->SetScaleMode( CAlfImageVisual::EScaleFitInside);
             iIconVisual->SetFlag( EAlfVisualFlagIgnorePointer );
             }
 
@@ -579,7 +555,7 @@
         if (!iIconMarked)
             {
             iIconMarked = CAlfImageVisual::AddNewL( iOwnerControl, iLayout );
-            iIconMarked->SetScaleMode( CAlfImageVisual::EScaleNormal);
+            iIconMarked->SetScaleMode( CAlfImageVisual::EScaleFitInside);
             iIconMarked->SetFlag( EAlfVisualFlagIgnorePointer );
             }
 
@@ -587,7 +563,7 @@
             {
             iIconMenu =
                         CAlfImageVisual::AddNewL(iOwnerControl, iLayout);
-            iIconMenu->SetScaleMode( CAlfImageVisual::EScaleNormal);
+            iIconMenu->SetScaleMode( CAlfImageVisual::EScaleFitInside);
             iIconMenu->SetFlag( EAlfVisualFlagIgnorePointer );
             }
 
--- a/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -2892,11 +2892,11 @@
     iWorld.RemoveL(aItemId);
     if (iFocusedItem == aItemId)
         {
-        if (iWorld.ItemCount() > removedindex)
+        if ( iWorld.ItemCount() > removedindex && removedindex != KErrNotFound )
             {
             SetFocusedItemL(iWorld.Item(removedindex), EFalse);
             }
-        else if (iWorld.ItemCount() > 0)
+        else if ( iWorld.ItemCount() > 0 && removedindex != KErrNotFound )
             {
             SetFocusedItemL(iWorld.Item(removedindex - 1), EFalse);
             }
Binary file help/data/xhtml.zip has changed
--- a/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgimap4populateop.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -92,6 +92,8 @@
 CIpsPlgImap4PopulateOp::~CIpsPlgImap4PopulateOp()
     {
     FUNC_LOG;
+    
+    Cancel();
     iSelection.Close();
 
     if ( iTempSelection )
@@ -216,7 +218,19 @@
             }
         case EStateInfoEntryChange:
             {
-            DoPopulateL();
+            TMsvEntry tentry;
+            TMsvId service;
+            iMsvSession.GetEntry( iService, service, tentry );
+          
+            if( err == KErrNone && tentry.Connected() )
+            	{
+            	DoPopulateL();  
+            	}  
+            else
+            	{
+            	iState = EStateIdle;
+            	CompleteObserver( err );
+            	}            
             break;
             }
         case EStateIdle:
--- a/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgmapper.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -359,6 +359,11 @@
     // EFSMsgFlag_Answered: supported only with IMAP4 (see below)
 
     // EFSMsgFlag_Forwarded: no counterpart in Symbian message in S60 3.1
+    if ( LogicalXor( aEmlEntry.Forwarded(), msgFlags & EFSMsgFlag_Forwarded ) )
+        {
+        aEmlEntry.SetForwarded( !aEmlEntry.Forwarded() );
+        modified = ETrue;
+        }
 
     // EFSMsgFlag_OnlyToMe: no counterpart in Symbian message
 
@@ -749,7 +754,14 @@
     aMsg.ResetFlag( EFSMsgFlag_Answered );
 
     // EFSMsgFlag_Forwarded: not supported in S60 3.1
-    aMsg.ResetFlag( EFSMsgFlag_Forwarded );
+    if ( aEntry.Forwarded() )
+        {
+        aMsg.SetFlag( EFSMsgFlag_Forwarded );
+        }
+    else
+        {
+        aMsg.ResetFlag( EFSMsgFlag_Forwarded );
+        }
 
     // EFSMsgFlag_OnlyToMe: like EFSMsgFlag_Multiple
 
--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -2325,6 +2325,8 @@
     TMsvEntry tEntry;
     TMsvId serv;
     iSession->GetEntry( service, serv, tEntry );
+    
+    CancelSyncL( aMailBoxId );
 
     if ( tEntry.Connected() )
         {
--- a/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Thu Aug 19 09:38:05 2010 +0300
@@ -383,7 +383,7 @@
             itemlabel = qtn_fse_settings_mail_user_name;
             itemid = EIpsSetUiOutgoingUserName;
             itemtype = EIpsSetUiItemText;
-            itemmaxlength = KIpsSetUiMaxSettingsTextLength;
+            itemmaxlength = KIPsSetUiMaxSettingsUsrNameLength;
             itemflags = KIpsSetUiFlagLatinOnly;
             },
         // User password
--- a/ipsservices/ipssossettings/group/ipssossettings.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssossettings/group/ipssossettings.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -57,7 +57,6 @@
 
 
 APP_LAYER_SYSTEMINCLUDE
-SYSTEMINCLUDE   /epoc32/include/cshelp
 
 // SOURCE
 SOURCE  ipssetdatactrlaccount.cpp
--- a/ipsservices/ipssossettings/src/ipssetuinotes.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuinotes.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -172,14 +172,10 @@
     const CAknQueryDialog::TTone aTone )
     {
     FUNC_LOG;
-    CAknLocalScreenClearer* localScreenClearer =
-        CAknLocalScreenClearer::NewL( EFalse );
-    CleanupStack::PushL( localScreenClearer );
 
     // Create dialog and execute the dialog
     CAknQueryDialog* dlg = CAknQueryDialog::NewL( aTone );
     TInt button = dlg->ExecuteLD( aDialogResource, aText );
-    CleanupStack::PopAndDestroy( localScreenClearer );
 
     return button;
     }
--- a/ipsservices/ipssossettings/tsrc/IpsSosTestApp/group/ipssostestapp.mmp	Thu Jul 15 18:19:25 2010 +0300
+++ b/ipsservices/ipssossettings/tsrc/IpsSosTestApp/group/ipssostestapp.mmp	Thu Aug 19 09:38:05 2010 +0300
@@ -50,19 +50,13 @@
 TARGETPATH /private/10003a3f/apps
 END
 
-// <cmail>
 APP_LAYER_SYSTEMINCLUDE
-// </cmail>
+
 USERINCLUDE ../inc
 USERINCLUDE ../../../inc
 USERINCLUDE ..\..\..\..\..\..\ODSUtility\inc
 
-SYSTEMINCLUDE   /epoc32/include
-//<cmail>
-//<cmail>
 USERINCLUDE ../../../../../inc
-//</cmail>
-//</cmail>
 
 LIBRARY euser.lib
 LIBRARY apparc.lib