Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 15:20:54 +0300
branchRCL_3
changeset 20 efd4f1afd43e
parent 18 6b8f3b30d0ec
child 22 d620048b4810
Revision: 201023 Kit: 2010125
emailcontacts/contactactionservice/group/bld.inf
emailservices/emailclientapi/src/emailcontent.cpp
emailservices/emailframework/bwins/FSMailFrameworkU.DEF
emailservices/emailframework/commonlib/src/CFSMailBox.cpp
emailservices/emailframework/data/fsmailbrandmanager.rss
emailservices/emailframework/data/mail_for_exchange.svg
emailservices/emailframework/eabi/FSMailFrameworkU.DEF
emailservices/emailframework/group/bld.inf
emailservices/emailframework/group/mail_for_exchange_brand_graphics.mk
emailservices/emailframework/inc/CFSMailClient.h
emailservices/emailframework/inc/emailversionnumbers.hrh
emailservices/emailframework/rom/FSEmailFramework.iby
emailservices/emailframework/src/CFSMailBrand.cpp
emailservices/emailframework/src/CFSMailClient.cpp
emailservices/emailserver/cmailhandlerplugin/data/iconlist.txt
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h
emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h
emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp
emailservices/emailserver/cmailhandlerplugin/src/cmailpluginproxy.cpp
emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp
emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp
emailservices/emailstore/message_store/server/src/ContainerStoreSortingTable.cpp
emailservices/psmruadapter/src/CPsMruAdapter.cpp
emailuis/emailui/conf/freestyleemailui.confml
emailuis/emailui/conf/freestyleemailui_2001E277.crml
emailuis/emailui/data/FreestyleEmailUi.rss
emailuis/emailui/inc/FreestyleEmailCenRepKeys.h
emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h
emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h
emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h
emailuis/emailui/inc/FreestyleEmailUiLauncherGridVisualiser.h
emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h
emailuis/emailui/inc/FreestyleEmailUiSettingsListView.h
emailuis/emailui/inc/ncscomposeview.h
emailuis/emailui/sis/commonemail.pkg
emailuis/emailui/sis/commonemail_loc.pkg
emailuis/emailui/sis/commonemail_udeb.pkg
emailuis/emailui/sis/commonemail_udeb_loc.pkg
emailuis/emailui/src/FreestyleEmailUiAppui.cpp
emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp
emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp
emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp
emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiMailListModel.cpp
emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp
emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp
emailuis/emailui/src/FreestyleEmailUiSettingsListView.cpp
emailuis/emailui/src/FreestyleEmailUiUtilities.cpp
emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp
emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp
emailuis/emailui/src/ncsaddressinputfield.cpp
emailuis/emailui/src/ncsaifeditor.cpp
emailuis/emailui/src/ncscomposeview.cpp
emailuis/uicomponents/inc/fstreeitemvisualizer.h
emailuis/uicomponents/inc/fstreeitemvisualizerbase.h
emailuis/uicomponents/inc/fstreenodevisualizerbase.h
emailuis/uicomponents/src/fstreeitemvisualizerbase.cpp
emailuis/uicomponents/src/fstreenodevisualizerbase.cpp
emailuis/uicomponents/src/fstreeplainonelineitemvisualizer.cpp
emailuis/uicomponents/src/fstreevisualizerbase.cpp
emailuis/widget/emailwidgetsettings/group/backup_registration.xml
emailuis/widget/emailwidgetsettings/group/bld.inf
emailuis/widget/emailwidgetsettings/rom/emailwidgetsettings.iby
ipsservices/ipssosplugin/inc/ipsplgmsgiterator.h
ipsservices/ipssosplugin/inc/ipsplgmsgkey.h
ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp
ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp
ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp
ipsservices/ipssossettings/data/ipssetuimailsettings.ra
ipsservices/ipssossettings/inc/ipssetdata.h
ipsservices/ipssossettings/inc/ipssetuidialog.h
ipsservices/ipssossettings/inc/ipssetutilsconsts.h
ipsservices/ipssossettings/inc/ipssetutilspageids.hrh
ipsservices/ipssossettings/src/ipssetdata.cpp
ipsservices/ipssossettings/src/ipssetuibasearray.cpp
ipsservices/ipssossettings/src/ipssetuibasedialog.cpp
ipsservices/ipssossettings/src/ipssetuidialog.cpp
meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp
--- a/emailcontacts/contactactionservice/group/bld.inf	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailcontacts/contactactionservice/group/bld.inf	Mon Jun 21 15:20:54 2010 +0300
@@ -37,7 +37,7 @@
 // per component stubs are removed and replaced by one stub under emailui.
 //../data/fsccontactactionservicestub.sis  /epoc32/data/z/system/install/fsccontactactionservicestub.sis
 ../rom/fsccontactactionservice.iby CORE_APP_LAYER_IBY_EXPORT_PATH(fsccontactactionservice.iby)
-../rom/fsccontactactionserviceresources.iby CORE_APP_LAYER_IBY_EXPORT_PATH(fsccontactactionserviceresources.iby)
+../rom/fsccontactactionserviceresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(fsccontactactionserviceresources.iby)
 
 // Generic configuration interface for component cenrep settings  
 // <cmail> S60 UID update
--- a/emailservices/emailclientapi/src/emailcontent.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailclientapi/src/emailcontent.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -257,8 +257,11 @@
             iBuf = iBuf->ReAlloc( size );
             }
         ptr.Set( iBuf->Des() );
-        iPart->GetContentToBufferL( ptr, iUsed );
-        iUsed += size;
+        if(iUsed < size)
+            {
+            iPart->GetContentToBufferL( ptr, iUsed );
+            iUsed += size;
+            }
         }    
     return ptr;
     }
--- a/emailservices/emailframework/bwins/FSMailFrameworkU.DEF	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/bwins/FSMailFrameworkU.DEF	Mon Jun 21 15:20:54 2010 +0300
@@ -27,4 +27,5 @@
 	?CancelAllL@CFSMailClient@@QAEXXZ @ 26 NONAME ; void CFSMailClient::CancelAllL(void)
 	?NewL@CFSMailClient@@SAPAV1@XZ @ 27 NONAME ; class CFSMailClient * CFSMailClient::NewL(void)
 	?AddObserverL@CFSMailClient@@QAEXAAVMFSMailEventObserver@@@Z @ 28 NONAME ; void CFSMailClient::AddObserverL(class MFSMailEventObserver &)
+	?GetMailBoxByUidLC@CFSMailClient@@QAEPAVCFSMailBox@@VTFSMailMsgId@@@Z @ 29 NONAME ; class CFSMailBox * CFSMailClient::GetMailBoxByUidLC(class TFSMailMsgId)
 
--- a/emailservices/emailframework/commonlib/src/CFSMailBox.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/commonlib/src/CFSMailBox.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -348,6 +348,12 @@
 EXPORT_C TDesC& CFSMailBox::GetBrandingIdL( )
 {
     FUNC_LOG;
+	if ( CFSMailPlugin* plugin = iRequestHandler->GetPluginByUid( GetId() ) )
+        {
+        TDesC& result = plugin->GetBrandingIdL( GetId() );
+        return result;
+        }
+
     return BrandingId();
 }
 
--- a/emailservices/emailframework/data/fsmailbrandmanager.rss	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/data/fsmailbrandmanager.rss	Mon Jun 21 15:20:54 2010 +0300
@@ -24,6 +24,7 @@
 #include <microsoft_brand_graphics.mbg>
 #include <ovi_brand_graphics.mbg>
 #include <aol_brand_graphics.mbg>
+#include <mail_for_exchange_brand_graphics.mbg>
 
 #include "mailbrandmanager.hrh"
 #include "mailbrandmanager.rh"
@@ -101,46 +102,82 @@
 
                 brand_id_match_strings =
                     {
-                    BRAND_MATCH_STRING { text = "*ymail.com"; },
-                    BRAND_MATCH_STRING { text = "*kimo.com"; },
-                    BRAND_MATCH_STRING { text = "*geocities.com"; },
-                    BRAND_MATCH_STRING { text = "*rocketmail.com"; },
-                    BRAND_MATCH_STRING { text = "*wans.net"; },
-                    BRAND_MATCH_STRING { text = "*wans.net"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.ca"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.cn"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.co.in"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.in"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.co.kr"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.co.uk"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.ar"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.br"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.cn"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.hk"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.mx"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.sg"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.tw"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.my"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.vn"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.ph"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.tr"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.co"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.pe"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.com.ve"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.de"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.dk"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.es"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.fr"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.gr"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.ie"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.it"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.no"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.se"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.co.id"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.co.th"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.pl"; },
-                    BRAND_MATCH_STRING { text = "*yahoo.cl"; }
+                    BRAND_MATCH_STRING { text = "*.ymail.com"; },
+                    BRAND_MATCH_STRING { text = "ymail.com"; },
+                    BRAND_MATCH_STRING { text = "*.kimo.com"; },
+                    BRAND_MATCH_STRING { text = "kimo.com"; },
+                    BRAND_MATCH_STRING { text = "*.geocities.com"; },
+                    BRAND_MATCH_STRING { text = "geocities.com"; },
+                    BRAND_MATCH_STRING { text = "*.rocketmail.com"; },
+                    BRAND_MATCH_STRING { text = "rocketmail.com"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.ca"; },
+                    BRAND_MATCH_STRING { text = "yahoo.ca"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.cn"; },
+                    BRAND_MATCH_STRING { text = "yahoo.cn"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.co.in"; },
+                    BRAND_MATCH_STRING { text = "yahoo.co.in"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.in"; },
+                    BRAND_MATCH_STRING { text = "yahoo.in"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.co.kr"; },
+                    BRAND_MATCH_STRING { text = "yahoo.co.kr"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.co.uk"; },
+                    BRAND_MATCH_STRING { text = "yahoo.co.uk"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.ar"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.ar"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.br"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.br"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.cn"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.cn"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.hk"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.hk"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.mx"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.mx"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.sg"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.sg"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.tw"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.tw"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.my"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.my"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.vn"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.vn"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.ph"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.ph"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.tr"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.tr"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.co"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.co"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.pe"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.pe"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.com.ve"; },
+                    BRAND_MATCH_STRING { text = "yahoo.com.ve"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.de"; },
+                    BRAND_MATCH_STRING { text = "yahoo.de"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.dk"; },
+                    BRAND_MATCH_STRING { text = "yahoo.dk"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.es"; },
+                    BRAND_MATCH_STRING { text = "yahoo.es"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.fr"; },
+                    BRAND_MATCH_STRING { text = "yahoo.fr"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.gr"; },
+                    BRAND_MATCH_STRING { text = "yahoo.gr"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.ie"; },
+                    BRAND_MATCH_STRING { text = "yahoo.ie"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.it"; },
+                    BRAND_MATCH_STRING { text = "yahoo.it"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.no"; },
+                    BRAND_MATCH_STRING { text = "yahoo.no"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.se"; },
+                    BRAND_MATCH_STRING { text = "yahoo.se"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.co.id"; },
+                    BRAND_MATCH_STRING { text = "yahoo.co.id"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.co.th"; },
+                    BRAND_MATCH_STRING { text = "yahoo.co.th"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.pl"; },
+                    BRAND_MATCH_STRING { text = "yahoo.pl"; },
+                    BRAND_MATCH_STRING { text = "*.yahoo.cl"; },
+                    BRAND_MATCH_STRING { text = "yahoo.cl"; }
                     };
                 
                 graphics = 
@@ -161,173 +198,6 @@
                 	red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
                 	};
                 },
-                
-          BRAND {
-                // Definition of Aol Mail brand   
-                graphics_file_path = APP_BITMAP_DIR"\\aol_brand_graphics.mif";
-
-                brand_id_match_strings =
-                {
-                    BRAND_MATCH_STRING { text = "*aol.com"; },
-                    BRAND_MATCH_STRING { text = "*aolchina.com"; },
-                    BRAND_MATCH_STRING { text = "*myaol.jp"; },
-                    BRAND_MATCH_STRING { text = "*aol.cz"; },
-                    BRAND_MATCH_STRING { text = "*aol.ch"; },
-                    BRAND_MATCH_STRING { text = "*aol.be"; },
-                    BRAND_MATCH_STRING { text = "*aol.co.nz"; },
-                    BRAND_MATCH_STRING { text = "*aol.cl"; },
-                    BRAND_MATCH_STRING { text = "*aol.kr"; },
-                    BRAND_MATCH_STRING { text = "*aol.co.uk"; },
-                    BRAND_MATCH_STRING { text = "*aol.ru"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.au"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.ar"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.co"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.ve"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.mx"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.tr"; },
-                    BRAND_MATCH_STRING { text = "*aol.com.br"; },
-                    BRAND_MATCH_STRING { text = "*aol.de"; },
-                    BRAND_MATCH_STRING { text = "*aol.nl"; },
-                    BRAND_MATCH_STRING { text = "*aol.es"; },
-                    BRAND_MATCH_STRING { text = "*aol.fr"; },
-                    BRAND_MATCH_STRING { text = "*aol.dk"; },
-                    BRAND_MATCH_STRING { text = "*aol.at"; },
-                    BRAND_MATCH_STRING { text = "*aol.it"; },
-                    BRAND_MATCH_STRING { text = "*aol.hk"; },
-                    BRAND_MATCH_STRING { text = "*aol.se"; },
-                    BRAND_MATCH_STRING { text = "*aol.tw"; },
-                    BRAND_MATCH_STRING { text = "*aol.jp"; }
-                    };
-                    
-                graphics = 
-                    {
-                    BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                    icon_id = EMbmAol_brand_graphicsAol;
-                    mask_id = EMbmAol_brand_graphicsAol_mask; }                    
-                    };
-                        
-                texts = 
-                    {
-                    BRANDABLE_TEXT { id = EFSMailboxName; text = "AOL Mail"; }
-                    };
-                        
-                colors =
-                    {
-                    BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                    red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                    };
-                },
-                    
-          BRAND {
-                    // Definition of Aol Mail brand   
-                    graphics_file_path = APP_BITMAP_DIR"\\aol_brand_graphics.mif";
-
-                    brand_id_match_strings =
-                    {
-                       BRAND_MATCH_STRING { text = "*aim.com"; }
-                    };
-                        
-                    graphics = 
-                    {
-                        BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                        icon_id = EMbmAol_brand_graphicsAol;
-                        mask_id = EMbmAol_brand_graphicsAol_mask; }                    
-                    };
-                            
-                    texts = 
-                    {
-                        BRANDABLE_TEXT { id = EFSMailboxName; text = "AIM Mail"; }
-                    };
-                            
-                    colors =
-                    {
-                        BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                        red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                    };
-                },
-                        
-                BRAND {
-                      // Definition of Aol Mail brand   
-                      graphics_file_path = APP_BITMAP_DIR"\\aol_brand_graphics.mif";
-
-                      brand_id_match_strings =
-                      {
-                          BRAND_MATCH_STRING { text = "*aol.pl"; }
-                      };
-                            
-                      graphics = 
-                      {
-                          BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                          icon_id = EMbmAol_brand_graphicsAol;
-                          mask_id = EMbmAol_brand_graphicsAol_mask; }                    
-                      };
-                                
-                      texts = 
-                      {
-                          BRANDABLE_TEXT { id = EFSMailboxName; text = "AOL Poczta"; }
-                      };
-                                
-                      colors =
-                      {
-                          BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                          red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                      };
-                  },
-                  BRAND {
-                          // Definition of Aol Mail brand   
-                          graphics_file_path = APP_BITMAP_DIR"\\aol_brand_graphics.mif";
-
-                          brand_id_match_strings =
-                          {
-                              BRAND_MATCH_STRING { text = "*aol.no"; }
-                          };
-                                
-                          graphics = 
-                          {
-                              BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                              icon_id = EMbmAol_brand_graphicsAol;
-                              mask_id = EMbmAol_brand_graphicsAol_mask; }                    
-                          };
-                                    
-                          texts = 
-                          {
-                              BRANDABLE_TEXT { id = EFSMailboxName; text = "AOL epost"; }
-                          };
-                                    
-                          colors =
-                          {
-                              BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                              red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                          };
-                      },
-                                
-                      BRAND {
-                            // Definition of Aol Mail brand   
-                            graphics_file_path = APP_BITMAP_DIR"\\aol_brand_graphics.mif";
-
-                            brand_id_match_strings =
-                            {
-                                BRAND_MATCH_STRING { text = "*aol.fi"; }
-                            };
-                                    
-                            graphics = 
-                            {
-                                BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                                icon_id = EMbmAol_brand_graphicsAol;
-                                mask_id = EMbmAol_brand_graphicsAol_mask; }                    
-                            };
-                                        
-                            texts = 
-                            {
-                                BRANDABLE_TEXT { id = EFSMailboxName; text = "AOL Sähköposti"; }
-                            };
-                                        
-                            colors =
-                            {
-                                BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                                red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                            };
-                      },
 
                 BRAND {
                     // Definition of Yahoo!7 Mail brand   
@@ -335,8 +205,10 @@
 
                     brand_id_match_strings =
                         {
-                        BRAND_MATCH_STRING { text = "*y7mail.com"; },
-                        BRAND_MATCH_STRING { text = "*yahoo.com.au"; }
+                        BRAND_MATCH_STRING { text = "*.y7mail.com"; },
+                        BRAND_MATCH_STRING { text = "y7mail.com"; },
+                        BRAND_MATCH_STRING { text = "*.yahoo.com.au"; },
+                        BRAND_MATCH_STRING { text = "yahoo.com.au"; }
                         };
                     
                     graphics = 
@@ -357,116 +229,7 @@
                         red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
                         };
                     },
-                    
-                    BRAND {
-                        // Definition of ... Yahoo! Mail brand   
-                        graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
-
-                        brand_id_match_strings =
-                            {
-                            BRAND_MATCH_STRING { text = "ameritech.net"; },
-                            BRAND_MATCH_STRING { text = "flash.net"; },
-                            BRAND_MATCH_STRING { text = "nvbell.net"; },
-                            BRAND_MATCH_STRING { text = "pacbell.net"; },
-                            BRAND_MATCH_STRING { text = "prodigy.net"; },
-                            BRAND_MATCH_STRING { text = "sbcglobal.net"; },
-                            BRAND_MATCH_STRING { text = "bellsouth.net"; },
-                            BRAND_MATCH_STRING { text = "snet.net"; },
-                            BRAND_MATCH_STRING { text = "swbell.net"; }
-                            };
-                        
-                        graphics = 
-                            {
-                            BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                            icon_id = EMbmYahoo_brand_graphicsYahoo;
-                            mask_id = EMbmYahoo_brand_graphicsYahoo_mask; }                    
-                            };
-                            
-                        texts = 
-                            {
-                            BRANDABLE_TEXT { id = EFSMailboxName; text = "AT&T Yahoo! Mail"; }
-                            };
-                            
-                        colors =
-                            {
-                            BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                            red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                            };
-                        },
-                        
-                        BRAND {
-                            // Definition of BT Yahoo! Mail brand   
-                            graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
-
-                            brand_id_match_strings =
-                                {
-                                BRAND_MATCH_STRING { text = "btopenworld.com"; },
-                                BRAND_MATCH_STRING { text = "talk21.com"; }
-                                };
-                            
-                            graphics = 
-                                {
-                                BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                                icon_id = EMbmYahoo_brand_graphicsYahoo;
-                                mask_id = EMbmYahoo_brand_graphicsYahoo_mask; }                    
-                                };
-                                
-                            texts = 
-                                {
-                                BRANDABLE_TEXT { id = EFSMailboxName; text = "BT Yahoo! Mail"; }
-                                };
-                                
-                            colors =
-                                {
-                                BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                                red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                                };
-                            },
-                        BRAND {
-                            // Definition of btinternet.com brand with default icon   
-                            brand_id_match_strings =
-                                {
-                                BRAND_MATCH_STRING { text = "btinternet.com"; }
-                                };
-                                
-                            texts = 
-                                {
-                                 BRANDABLE_TEXT { id = EFSMailboxName; text = "BT Internet"; }
-                                };
-                            },
-
-
-                            BRAND {
-                                // Definition of ... Yahoo! Mail brand   
-                                graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
-
-                                brand_id_match_strings =
-                                    {
-                                    BRAND_MATCH_STRING { text = "ort.rogers.com"; },
-                                    BRAND_MATCH_STRING { text = "nl.rogers.com"; },
-                                    BRAND_MATCH_STRING { text = "rogers.com"; },
-                                    BRAND_MATCH_STRING { text = "uat.rogers.com"; }
-                                    };
-                                
-                                graphics = 
-                                    {
-                                    BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
-                                    icon_id = EMbmYahoo_brand_graphicsYahoo;
-                                    mask_id = EMbmYahoo_brand_graphicsYahoo_mask; }                    
-                                    };
-                                    
-                                texts = 
-                                    {
-                                    BRANDABLE_TEXT { id = EFSMailboxName; text = "Rogers Yahoo! Mail"; }
-                                    };
-                                    
-                                colors =
-                                    {
-                                    BRANDABLE_COLOR { id = EFSMailboxNameColor;
-                                    red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
-                                    };
-                                },
-
+                     
                                     BRAND {
                                         // Definition of Yahoo!Xtra Mail brand   
                                         graphics_file_path = APP_BITMAP_DIR"\\yahoo_brand_graphics.mif";
@@ -501,54 +264,98 @@
 
                 brand_id_match_strings =
                         {
-                        BRAND_MATCH_STRING { text = "*msn.com"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.com"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.co.uk"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.co.jp"; },
-                        BRAND_MATCH_STRING { text = "*hotmail-int.com"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.de"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.fr"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.it"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.nl"; },
-                        BRAND_MATCH_STRING { text = "*hotmail.es"; },
-                        BRAND_MATCH_STRING { text = "*live.com"; },
-                        BRAND_MATCH_STRING { text = "*live.at"; },
-                        BRAND_MATCH_STRING { text = "*live.be"; },
-                        BRAND_MATCH_STRING { text = "*live.ca"; },
-                        BRAND_MATCH_STRING { text = "*live.cl"; },
-                        BRAND_MATCH_STRING { text = "*live.cn"; },
-                        BRAND_MATCH_STRING { text = "*live.de"; },
-                        BRAND_MATCH_STRING { text = "*live.dk"; },
-                        BRAND_MATCH_STRING { text = "*live.fr"; },
-                        BRAND_MATCH_STRING { text = "*live.hk"; },
-                        BRAND_MATCH_STRING { text = "*live.it"; },
-                        BRAND_MATCH_STRING { text = "*live.jp"; },
-                        BRAND_MATCH_STRING { text = "*live.nl"; },
-                        BRAND_MATCH_STRING { text = "*live.no"; },
-                        BRAND_MATCH_STRING { text = "*live.ph"; },
-                        BRAND_MATCH_STRING { text = "*live.ru"; },
-                        BRAND_MATCH_STRING { text = "*live.se"; },
-                        BRAND_MATCH_STRING { text = "*live.ie"; },
-                        BRAND_MATCH_STRING { text = "*live.in"; },
-                        BRAND_MATCH_STRING { text = "*live.co.kr"; },
-                        BRAND_MATCH_STRING { text = "*live.co.uk"; },
-                        BRAND_MATCH_STRING { text = "*live.co.za"; },
-                        BRAND_MATCH_STRING { text = "*live.com.ar"; },
-                        BRAND_MATCH_STRING { text = "*live.com.au"; },
-                        BRAND_MATCH_STRING { text = "*live.com.mx"; },
-                        BRAND_MATCH_STRING { text = "*live.com.my"; },
-                        BRAND_MATCH_STRING { text = "*live.com.pe"; },
-                        BRAND_MATCH_STRING { text = "*live.com.pk"; },
-                        BRAND_MATCH_STRING { text = "*live.com.pt"; },
-                        BRAND_MATCH_STRING { text = "*live.com.sg"; },
-                        BRAND_MATCH_STRING { text = "*live.com.ve"; },
-                        BRAND_MATCH_STRING { text = "*live.com.ph"; },
-                        BRAND_MATCH_STRING { text = "*livemail.com.br"; },
-                        BRAND_MATCH_STRING { text = "*livemail.tw"; },
-                        BRAND_MATCH_STRING { text = "*mibli.com"; },
-                        BRAND_MATCH_STRING { text = "*oxicash.in"; },
-                        BRAND_MATCH_STRING { text = "*windowslive.com"; },
-                        BRAND_MATCH_STRING { text = "*windowslive.es"; }
+                        BRAND_MATCH_STRING { text = "*.msn.com"; },
+                        BRAND_MATCH_STRING { text = "msn.com"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.com"; },
+                        BRAND_MATCH_STRING { text = "hotmail.com"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.co.uk"; },
+                        BRAND_MATCH_STRING { text = "hotmail.co.uk"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.co.jp"; },
+                        BRAND_MATCH_STRING { text = "hotmail.co.jp"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail-int.com"; },
+                        BRAND_MATCH_STRING { text = "hotmail-int.com"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.de"; },
+                        BRAND_MATCH_STRING { text = "hotmail.de"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.fr"; },
+                        BRAND_MATCH_STRING { text = "hotmail.fr"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.it"; },
+                        BRAND_MATCH_STRING { text = "hotmail.it"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.nl"; },
+                        BRAND_MATCH_STRING { text = "hotmail.nl"; },
+                        BRAND_MATCH_STRING { text = "*.hotmail.es"; },
+                        BRAND_MATCH_STRING { text = "hotmail.es"; },
+                        BRAND_MATCH_STRING { text = "*.live.com"; },
+                        BRAND_MATCH_STRING { text = "live.com"; },
+                        BRAND_MATCH_STRING { text = "*.live.at"; },
+                        BRAND_MATCH_STRING { text = "live.at"; },
+                        BRAND_MATCH_STRING { text = "*.live.be"; },
+                        BRAND_MATCH_STRING { text = "live.be"; },
+                        BRAND_MATCH_STRING { text = "*.live.ca"; },
+                        BRAND_MATCH_STRING { text = "live.ca"; },
+                        BRAND_MATCH_STRING { text = "*.live.cl"; },
+                        BRAND_MATCH_STRING { text = "live.cl"; },
+                        BRAND_MATCH_STRING { text = "*.live.cn"; },
+                        BRAND_MATCH_STRING { text = "live.cn"; },
+                        BRAND_MATCH_STRING { text = "*.live.de"; },
+                        BRAND_MATCH_STRING { text = "live.de"; },
+                        BRAND_MATCH_STRING { text = "*.live.dk"; },
+                        BRAND_MATCH_STRING { text = "live.dk"; },
+                        BRAND_MATCH_STRING { text = "*.live.fr"; },
+                        BRAND_MATCH_STRING { text = "live.fr"; },
+                        BRAND_MATCH_STRING { text = "*.live.hk"; },
+                        BRAND_MATCH_STRING { text = "live.hk"; },
+                        BRAND_MATCH_STRING { text = "*.live.it"; },
+                        BRAND_MATCH_STRING { text = "live.it"; },
+                        BRAND_MATCH_STRING { text = "*.live.jp"; },
+                        BRAND_MATCH_STRING { text = "live.jp"; },
+                        BRAND_MATCH_STRING { text = "*.live.nl"; },
+                        BRAND_MATCH_STRING { text = "live.nl"; },
+                        BRAND_MATCH_STRING { text = "*.live.no"; },
+                        BRAND_MATCH_STRING { text = "live.no"; },
+                        BRAND_MATCH_STRING { text = "*.live.ph"; },
+                        BRAND_MATCH_STRING { text = "live.ph"; },
+                        BRAND_MATCH_STRING { text = "*.live.ru"; },
+                        BRAND_MATCH_STRING { text = "live.ru"; },
+                        BRAND_MATCH_STRING { text = "*.live.se"; },
+                        BRAND_MATCH_STRING { text = "live.se"; },
+                        BRAND_MATCH_STRING { text = "*.live.ie"; },
+                        BRAND_MATCH_STRING { text = "live.ie"; },
+                        BRAND_MATCH_STRING { text = "*.live.in"; },
+                        BRAND_MATCH_STRING { text = "live.in"; },
+                        BRAND_MATCH_STRING { text = "*.live.co.kr"; },
+                        BRAND_MATCH_STRING { text = "live.co.kr"; },
+                        BRAND_MATCH_STRING { text = "*.live.co.uk"; },
+                        BRAND_MATCH_STRING { text = "live.co.uk"; },
+                        BRAND_MATCH_STRING { text = "*.live.co.za"; },
+                        BRAND_MATCH_STRING { text = "live.co.za"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.ar"; },
+                        BRAND_MATCH_STRING { text = "live.com.ar"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.au"; },
+                        BRAND_MATCH_STRING { text = "live.com.au"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.mx"; },
+                        BRAND_MATCH_STRING { text = "live.com.mx"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.my"; },
+                        BRAND_MATCH_STRING { text = "live.com.my"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.pe"; },
+                        BRAND_MATCH_STRING { text = "live.com.pe"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.pk"; },
+                        BRAND_MATCH_STRING { text = "live.com.pk"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.pt"; },
+                        BRAND_MATCH_STRING { text = "live.com.pt"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.sg"; },
+                        BRAND_MATCH_STRING { text = "live.com.sg"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.ve"; },
+                        BRAND_MATCH_STRING { text = "live.com.ve"; },
+                        BRAND_MATCH_STRING { text = "*.live.com.ph"; },
+                        BRAND_MATCH_STRING { text = "live.com.ph"; },
+                        BRAND_MATCH_STRING { text = "*.livemail.com.br"; },
+                        BRAND_MATCH_STRING { text = "livemail.com.br"; },
+                        BRAND_MATCH_STRING { text = "*.livemail.tw"; },
+                        BRAND_MATCH_STRING { text = "livemail.tw"; },
+                        BRAND_MATCH_STRING { text = "*.windowslive.com"; },
+                        BRAND_MATCH_STRING { text = "windowslive.com"; },
+                        BRAND_MATCH_STRING { text = "*.windowslive.es"; },
+                        BRAND_MATCH_STRING { text = "windowslive.es"; }
                         };
                 
                 graphics = 
@@ -575,7 +382,8 @@
 
         	    brand_id_match_strings =
                     {
-                    BRAND_MATCH_STRING { text = "*ovi.com"; }
+                    BRAND_MATCH_STRING { text = "*.ovi.com"; },
+                    BRAND_MATCH_STRING { text = "ovi.com"; }
                     };
             
         	    graphics = 
@@ -594,6 +402,28 @@
                     {
                     BRANDABLE_COLOR { id = EFSMailboxNameColor; red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
                     };
+            },
+
+            BRAND {
+        	    // definition of Mail for Exchange brand
+        	    graphics_file_path = APP_BITMAP_DIR"\\mail_for_exchange_brand_graphics.mif";
+
+        	    brand_id_match_strings =
+                    {
+                    BRAND_MATCH_STRING { text = "Mail for Exchange"; }
+                    };
+            
+        	    graphics = 
+                    {
+                    BRANDABLE_GRAPHIC { id = EFSMailboxIcon;
+                    icon_id = EMbmMail_for_exchange_brand_graphicsMail_for_exchange;
+                    mask_id = EMbmMail_for_exchange_brand_graphicsMail_for_exchange_mask; }                    
+                    };
+
+        	    colors =
+                    {
+                    BRANDABLE_COLOR { id = EFSMailboxNameColor; red = 0xff; green = 0x30; blue = 0x20; alpha = 0xff; }
+                    };
             }
         };
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailservices/emailframework/data/mail_for_exchange.svg	Mon Jun 21 15:20:54 2010 +0300
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="88" height="88" viewBox="0 0 88 88">
+<rect fill="none" height="88" width="88"/>
+<polygon fill="#84A8CB" points="13.797,59.469 15.453,62.75 10.761,64.775 "/>
+<polygon fill="#7BA1C7" points="62.822,60.844 67.454,57.852 79.166,59.672 74.484,64.297 "/>
+<polygon fill="#7BA1C7" points="10.021,49.15 15.95,47.283 28.258,50.204 22.063,53.797 "/>
+<polygon fill="#9BB8D5" points="11.714,59.057 10.761,64.775 10.021,49.15 11.435,53.034 "/>
+<linearGradient id="_11" gradientUnits="userSpaceOnUse" x1="72.77" y1="62.84" x2="72.14" y2="80.04">
+<stop stop-color="#97B5D3" offset="0"/>
+<stop stop-color="#7EA4C9" offset="1"/>
+</linearGradient>
+<path d="M79.166,59.672c-2.936,9.025-9.674,13.959-13.182,16.893l8.62-13.314L79.166,59.672z" fill="url(#_11)"/>
+<polygon fill="#7BA1C7" points="12.876,56.288 14.328,60.688 10.761,64.775 11.203,58 "/>
+<polygon fill="#7BA1C7" points="15.25,54 23.313,51.859 18.859,56.875 13.844,55.891 "/>
+<polygon fill="#84A7CB" points="22.529,52.333 28.258,50.204 24.414,53.982 18.668,56.223 "/>
+<linearGradient id="_12" gradientUnits="userSpaceOnUse" x1="30.28" y1="61.64" x2="43.78" y2="69.31">
+<stop stop-color="#A0BBD7" offset="0"/>
+<stop stop-color="#7EA4C9" offset="1"/>
+</linearGradient>
+<path d="M48.67,70.793c3.58,0,6.643-0.996,8.811-2.109c-4.15,4.209-9.992,5.7-13.953,5.7 c-13.027,0-22.402-12.509-24.75-18.286l5.745-2.24C31.158,65.936,40.203,70.793,48.67,70.793z" fill="url(#_12)"/>
+<polygon fill="#90B0D0" points="11,53.781 10.021,49.15 22.529,52.333 14.453,54.641 "/>
+<polygon fill="#91B1D1" points="63.875,66.016 62.822,60.844 75.003,62.926 68.781,66.984 "/>
+<linearGradient id="_13" gradientUnits="userSpaceOnUse" x1="22.31" y1="65.7" x2="44.83" y2="68.75">
+<stop stop-color="#DDE7F1" offset="0"/>
+<stop stop-color="#C2D4E5" offset="1"/>
+</linearGradient>
+<path d="M62.822,60.844c-2.621,6.602-9.156,13.252-19.223,13.252 c-10.282,0-19.287-7.408-24.821-17.998l-5.184-0.488C15.917,59.743,25.484,78.7,43.75,78.7c13.297,0,19.408-9.746,20.422-12.669 L62.822,60.844z" fill="url(#_13)"/>
+<linearGradient id="_14" gradientUnits="userSpaceOnUse" x1="69.5" y1="70.31" x2="15.38" y2="70.31">
+<stop stop-color="#A8C1DA" offset="0"/>
+<stop stop-color="#98B6D4" offset="0.14"/>
+<stop stop-color="#97B5D3" offset="0.67"/>
+<stop stop-color="#A0BBD7" offset="1"/>
+</linearGradient>
+<path d="M75.003,62.926c-4.901,13.627-16.201,20.838-27.737,20.838 c-17.267,0-28.895-15-33.075-22.945l-1.535-3.959c8.831,15.174,18.64,24.109,32.393,24.109c11.688,0,20.42-6.422,23.295-14.047 L75.003,62.926z" fill="url(#_14)"/>
+<path d="M10.844,53.034l4.701,1.284l-1.294,1.35c3.103,5.018,11.175,22.555,30.467,22.555 c8.979,0,16.841-6.492,19.351-12.586l4.85,0.922c-3.79,10.387-15.307,14.918-23.868,14.918c-15.613,0-25.775-12.442-32.281-24.39 l-1.644,1.968L10.844,53.034z" fill="#98B6D4"/>
+<linearGradient id="_15" gradientUnits="userSpaceOnUse" x1="43.19" y1="24.29" x2="54.76" y2="58.04">
+<stop stop-color="#87AACD" offset="0"/>
+<stop stop-color="#9DB9D6" offset="0.17"/>
+<stop stop-color="#A8C1DA" offset="0.5"/>
+<stop stop-color="#A2BDD8" offset="0.76"/>
+<stop stop-color="#87AACD" offset="1"/>
+</linearGradient>
+<path d="M58.648,44.975c0,6.789-2.688,10.896-5.711,13.146c-1.797,1.335-5.822,3.345-5.822,3.345 c12.443-9.374,5.458-34.56-12.553-34.823c3.625-0.734,5.781-1.129,7.201-1.129C51.613,25.512,58.648,36.182,58.648,44.975z" fill="url(#_15)"/>
+<path d="M49.459,47.875c0,6.898-3.8,13.334-11.084,13.334c-4.325,0-14.333-5.535-14.333-18.709 c0-7.689,5.275-12.375,10.792-12.375C43.271,30.125,49.459,39.787,49.459,47.875z" fill="#98B6D4"/>
+<linearGradient id="_16" gradientUnits="userSpaceOnUse" x1="47.25" y1="34.33" x2="32.25" y2="52.33">
+<stop stop-color="#DDE7F1" offset="0"/>
+<stop stop-color="#97B5D3" offset="1"/>
+</linearGradient>
+<path d="M49.25,47.875c0,6.898-3.633,12.917-10.917,12.917c-4.325,0-14.125-5.076-14.125-18.25 c0-7.689,5.109-12.125,10.625-12.125C41.978,30.417,49.25,38.554,49.25,47.875z M35.875,26.542c-6.564,0-12.75,5.983-12.75,15.625 c0,9.617,7.249,21.167,17.708,21.167c4.284,0,12.708-3.243,12.708-15.834C53.542,35.913,44.502,26.542,35.875,26.542z" fill="url(#_16)"/>
+<path d="M46.318,46.104c0,4.533-2.313,6.504-4.754,6.504c-0.954-0.016-2.277-0.233-3.086-1.102 c-0.129,0.041-0.56,0.102-0.693,0.102c-3.618,0-5.7-4.024-5.7-7.065c0.001-1.983,1.022-4.791,3.8-4.798 c1.886,0,3.457,1.442,4.319,2.572c0.137,0.18,0.258,0.379,0.26,0.566c0.002,0.21,0.068,5.999,0.072,6.243 c0.002,0.221,0.644,0.26,0.713,0.262c1.188,0,2.484-1.259,2.524-3.605c0-4.724-4.501-9.12-8.524-9.083 c-3.271,0.03-5.488,3.223-5.509,7.067c-0.023,3.882,2.681,10.765,9.667,11.157c0.005,0.777,0.028,2.767,0.03,2.938 c-8.344-0.688-12.106-9.104-12.106-14.776c0.01-5.028,2.711-9.441,7.336-9.441C40.878,33.642,46.318,40.912,46.318,46.104z M38.082,43.448c-0.445-0.491-1.098-0.779-1.707-0.779c-1.438,0-1.866,1.331-1.866,2.269c0,2.203,1.426,3.826,3.068,3.826 c0.29,0,0.566-0.062,0.563-0.277C38.141,48.486,38.127,43.552,38.082,43.448z" fill="#4879AA"/>
+<linearGradient id="_17" gradientUnits="userSpaceOnUse" x1="23.68" y1="31.81" x2="28.74" y2="16.09">
+<stop stop-color="#97B5D3" offset="0"/>
+<stop stop-color="#7EA4C9" offset="1"/>
+</linearGradient>
+<path d="M21.841,31.093c1.517-7.152,7.593-14.731,15.543-16.523 c-12.223-1.207-19.357,8.29-21.665,16.711c0,0,0.073,1.031,0.073,1.03L21.841,31.093z" fill="url(#_17)"/>
+<linearGradient id="_18" gradientUnits="userSpaceOnUse" x1="46.98" y1="6.55" x2="62.61" y2="15.12">
+<stop stop-color="#8FB0D0" offset="0"/>
+<stop stop-color="#A0BBD7" offset="1"/>
+</linearGradient>
+<path d="M72.594,20.86C58.841,1.271,42.613,3.297,37.359,3.297 c11.892,0.92,21.475,5.828,32.032,20.813L72.594,20.86z" fill="url(#_18)"/>
+<linearGradient id="_19" gradientUnits="userSpaceOnUse" x1="69.16" y1="22.16" x2="24.08" y2="17.66">
+<stop stop-color="#DDE7F1" offset="0"/>
+<stop stop-color="#C2D4E5" offset="1"/>
+</linearGradient>
+<path d="M67.594,31.625C57.518,15.184,46.482,7.656,35.022,7.656 c-12.503,0-23.295,10.224-25.272,22.031l-1.426,2.146c2.287-17.459,15.323-28.53,27.877-28.53c14.976,0,25.434,8.804,33.017,20.477 L67.594,31.625z" fill="url(#_19)"/>
+<polygon fill="#85A8CC" points="76.529,16.32 68.609,35.047 61.375,33.172 54.84,36.833 73.666,39.793 78.023,37.797 80.902,15.665 "/>
+<polygon fill="#7CA2C8" points="69.531,27.641 76.529,16.32 73.666,39.793 69.084,35.577 "/>
+<linearGradient id="_20" gradientUnits="userSpaceOnUse" x1="12.53" y1="22" x2="64.94" y2="22">
+<stop stop-color="#A8C1DA" offset="0"/>
+<stop stop-color="#98B6D4" offset="0.14"/>
+<stop stop-color="#97B5D3" offset="0.67"/>
+<stop stop-color="#A0BBD7" offset="1"/>
+</linearGradient>
+<path d="M15.792,32.312c2.844-11.856,11.524-17.781,19.958-17.781 c12.076,0,18.857,7.519,25.261,17.316l4.885,1.809C58.951,22.865,49.361,10.346,35.05,10.346c-11.049,0-20.77,8.923-22.987,19.171 L15.792,32.312z" fill="url(#_20)"/>
+<polygon fill="#82A6CA" points="12.422,29.234 15.792,32.312 8.325,31.834 9.578,29.063 "/>
+<path d="M69.169,23.729l-1.745,6.592c-4.197-6.592-14.98-23.219-32.395-23.219 c-15.737,0-25.085,15.032-25.526,22.091l3.059,0.151c0.745-5.328,7.952-18.523,22.528-18.523c16.141,0,25.055,15.369,29.51,21.796 l-3.828-1.145l-5.933,5.361l7.396-2.13l6.961,0.985l0.897-7.997l6.437-11.371L69.169,23.729z" fill="#98B6D4"/>
+</svg>
\ No newline at end of file
--- a/emailservices/emailframework/eabi/FSMailFrameworkU.DEF	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/eabi/FSMailFrameworkU.DEF	Mon Jun 21 15:20:54 2010 +0300
@@ -41,4 +41,5 @@
 	_ZTV20CFSMailPluginManager @ 40 NONAME
 	_ZTV23CFSMailBrandManagerImpl @ 41 NONAME
 	_ZTV26CFSClientAPIRequestHandler @ 42 NONAME
+	_ZN13CFSMailClient17GetMailBoxByUidLCE12TFSMailMsgId @ 43 NONAME
 
--- a/emailservices/emailframework/group/bld.inf	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/group/bld.inf	Mon Jun 21 15:20:54 2010 +0300
@@ -78,3 +78,10 @@
 OPTION SOURCEDIR ../data
 OPTION SOURCES -c16,8 yahoo.svg
 END
+
+START EXTENSION s60/mifconv
+OPTION TARGETFILE mail_for_exchange_brand_graphics.mif
+OPTION HEADERFILE mail_for_exchange_brand_graphics.mbg
+OPTION SOURCEDIR ../data
+OPTION SOURCES -c16,8 mail_for_exchange.svg
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailservices/emailframework/group/mail_for_exchange_brand_graphics.mk	Mon Jun 21 15:20:54 2010 +0300
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Make file for email branding icons.
+#
+
+ifeq (WINS,$(findstring WINS, $(PLATFORM)))
+ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z
+else
+ZDIR=\epoc32\data\z
+endif
+
+TARGETDIR=$(ZDIR)\RESOURCE\APPS
+HEADERDIR=\epoc32\include
+ICONTARGETFILENAME=$(TARGETDIR)\mail_for_exchange_brand_graphics.mif
+HEADERFILENAME=$(HEADERDIR)\mail_for_exchange_brand_graphics.MBG
+SOURCEDIR=..\data
+
+do_nothing :
+	@rem do_nothing
+
+MAKMAKE : do_nothing
+
+BLD : do_nothing
+
+CLEAN : do_nothing
+
+LIB : do_nothing
+
+CLEANLIB : do_nothing
+
+RESOURCE :
+	mifconv $(ICONTARGETFILENAME) /H$(HEADERFILENAME) \
+	/c16,8 $(SOURCEDIR)\mail_for_exchange.svg
+
+FREEZE : do_nothing
+
+SAVESPACE : do_nothing
+
+RELEASABLES :
+	@echo $(HEADERFILENAME)&& \
+	@echo $(ICONTARGETFILENAME)
+
+FINAL : do_nothing
\ No newline at end of file
--- a/emailservices/emailframework/inc/CFSMailClient.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/inc/CFSMailClient.h	Mon Jun 21 15:20:54 2010 +0300
@@ -212,10 +212,27 @@
      * returns email mailbox object related to given mailbox id
      *
      * @param aMailBoxId mailbox id
-     * @return mailbox object ( CFSMailBox ), ownership is transferred to user
+     * @return mailbox object ( CFSMailBox )
+     *         or NULL if no matching mailbox found. 
+     *         Ownership is transferred to user!
      */
      IMPORT_C CFSMailBox* GetMailBoxByUidL( const TFSMailMsgId aMailBoxId);
-                
+      	  		
+
+    /**
+     * returns email mailbox object related to given mailbox id. Otherwise 
+     * identical to GetMailBoxByUidL but mailbox object is stored to cleanup 
+     * stack.
+     *
+     * @param aMailBoxId mailbox id
+     * @return mailbox object ( CFSMailBox )
+     *         or NULL if no matching mailbox found.
+     *         CFSMailBox pointer is stored to cleanup stack (even if NULL). 
+     *         Ownership is transferred to user! 
+     */
+     IMPORT_C CFSMailBox* GetMailBoxByUidLC( const TFSMailMsgId aMailBoxId);
+
+     
     /**
      * returns email folder object related to given folder id
      *
--- a/emailservices/emailframework/inc/emailversionnumbers.hrh	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/inc/emailversionnumbers.hrh	Mon Jun 21 15:20:54 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description : Common email version number definitions
-* Version     : %version: 10.1.5 %
+* Version     : %version: 10.1.7 %
 *
 */
 
@@ -25,14 +25,14 @@
  *  version number both major and minor version are stored in separate 32 bit
  *  location.
  */
-#define KEmailBinaryVersionNumber 10.7
+#define KEmailBinaryVersionNumber 10.9
 
 /** 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 7
+#define KEmailEcomVersionNumber 9
 
 /** Binary paging setting (paged/non-paged)
  */
--- a/emailservices/emailframework/rom/FSEmailFramework.iby	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/rom/FSEmailFramework.iby	Mon Jun 21 15:20:54 2010 +0300
@@ -40,6 +40,7 @@
 data=DATAZ_\RESOURCE\APPS\google_brand_graphics.mif	APP_BITMAP_DIR\google_brand_graphics.mif
 data=DATAZ_\RESOURCE\APPS\aol_brand_graphics.mif	APP_BITMAP_DIR\aol_brand_graphics.mif
 data=DATAZ_\RESOURCE\APPS\microsoft_brand_graphics.mif	APP_BITMAP_DIR\microsoft_brand_graphics.mif
+data=DATAZ_\RESOURCE\APPS\mail_for_exchange_brand_graphics.mif  APP_BITMAP_DIR\mail_for_exchange_brand_graphics.mif
 
 // ECOM_PLUGIN( CFSMailMockupPlugin.dll, CFSMailMockupPlugin.rsc)
 
--- a/emailservices/emailframework/src/CFSMailBrand.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/src/CFSMailBrand.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -223,16 +223,32 @@
 TBool CFSMailBrand::IsMatching( const TDesC& aBrandId )
     {
     FUNC_LOG;
-
+    const TChar KStar = '*';
+    TBool ret = EFalse;
+    TInt intRet = 0; 
     TInt count = iBrandMatchStrings.Count();
-    for(TInt i=0;i<count;i++)
+    for( TInt i=0;i<count;i++ )
         {
-        if ( aBrandId.MatchC( *iBrandMatchStrings[i] ) == KErrNone )
+        TPtrC brandMatchStringPtr = *iBrandMatchStrings[i];
+        TInt matchPos = aBrandId.MatchC( *iBrandMatchStrings[i] );
+        if ( matchPos >= 0 )
             {
-            return ETrue;
+        	TPtrC rightPartPtr = aBrandId.Right( aBrandId.Length()-matchPos );
+            TChar isStar = brandMatchStringPtr[0];
+            TInt cut = 0;
+            if ( isStar == KStar )
+                {
+                cut = 1;	
+                }
+            TPtrC matchString = brandMatchStringPtr.Right( brandMatchStringPtr.Length()-cut );
+        	intRet = rightPartPtr.CompareC( matchString );
+            if ( intRet == 0 )
+                {
+        	    ret = ETrue;
+        	    }
             }
         }
-    return EFalse;
+    return ret;
     }
 
 // -----------------------------------------------------------------------------
--- a/emailservices/emailframework/src/CFSMailClient.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailframework/src/CFSMailClient.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -133,6 +133,19 @@
 }
 
 // -----------------------------------------------------------------------------
+// CFSMailClient::GetMailBoxByUidLC
+// -----------------------------------------------------------------------------
+EXPORT_C CFSMailBox* CFSMailClient::GetMailBoxByUidLC(const TFSMailMsgId aMailBoxId)
+{
+    FUNC_LOG;
+    CFSMailBox* mailBox = GetMailBoxByUidL( aMailBoxId );
+    CleanupStack::PushL( mailBox );
+    return mailBox;
+}
+
+
+
+// -----------------------------------------------------------------------------
 // CFSMailClient::GetFolderByUidL
 // -----------------------------------------------------------------------------
 EXPORT_C CFSMailFolder* CFSMailClient::GetFolderByUidL( const TFSMailMsgId aMailBoxId,
--- a/emailservices/emailserver/cmailhandlerplugin/data/iconlist.txt	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/data/iconlist.txt	Mon Jun 21 15:20:54 2010 +0300
@@ -54,5 +54,5 @@
 -c16,8 qgn_indi_cmail_calendar_event_read_attachments_high_prio.svg
 -c16,8 qgn_indi_cmail_calendar_event_read_low_prio.svg
 -c16,8 qgn_indi_cmail_calendar_event_read_attachments_low_prio.svg
--c16,8 qgn_stat_message_mail_uni.svg
+-c16,8 qgn_indi_cmail_unseen_msg.svg
 -c16,8 qgn_indi_cmail_outbox_msg.svg
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpshandler.h	Mon Jun 21 15:20:54 2010 +0300
@@ -440,8 +440,6 @@
      *         if not found, NULL is retuned
      */
     CMailPluginProxy* GetExtPluginL( const TDesC& aContentId );
-
-    TBool BackupOrRestoreMode();
     
 private: // data
     CEikonEnv* iEnv;
--- a/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/inc/cmailcpssettings.h	Mon Jun 21 15:20:54 2010 +0300
@@ -19,6 +19,9 @@
 #ifndef CMAILCPSSETTINGS_H_
 #define CMAILCPSSETTINGS_H_
 
+#include "PSSubscriber.h"
+#include "PSSubscribeHandler.h"
+
 class CRepository;
 class CMailExternalAccount;
 
@@ -47,7 +50,8 @@
  *  @lib fsmailserver.exe
  *  @since S60 v5.1
  */
-NONSHARABLE_CLASS( CMailCpsSettings ) : public CActive
+NONSHARABLE_CLASS( CMailCpsSettings ) : public CActive,
+                                        public MPSSubscribeHandler
     {
 public:
     /**
@@ -195,6 +199,18 @@
      */    
     TBool Associated( const TDesC& aContentId );
     
+    /**
+     * Callback from PSSubscriber about a PS key event
+     * @param aCategory defines the key category
+     * @param aKey defines the changed key
+     */
+    void HandlePropertyChangedL( const TUid& aCategory, TInt aKey );
+
+    /**
+     *
+     */
+    TBool BackupOrRestoreMode();
+    
 protected:
     /**
      * From CActive
@@ -296,6 +312,12 @@
     TInt32                    iConfigData;
     // large buffer for reading cenrep data
     TBuf<KMaxFileName>        iCenrepText;
+    // PubSub subsriber for notifying restore operation
+    CPSSubscriber*            iBackupRestoreSubscriber;
+    // Indicates if restore operation is started
+    TBool                     iRestoreStarted;
+    // Indicates if backup operation is ongoing
+    TBool                     iBackupOngoing;
     };
 
 #endif /*CMAILCPSSETTINGS_H_*/
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -26,8 +26,6 @@
 #include <emailobserverplugin.h>
 #include <memaildata.h>
 #include <memailmailboxdata.h>
-#include <e32property.h>
-#include <connect/sbdefs.h>
 #include <scs/cleanuputils.h> // CleanupResetAndDestroyPushL
 
 #include "emailtrace.h"
@@ -410,7 +408,7 @@
             // if contentId found from array, update the mailbox
             if ( found )
                 {
-                 INFO_1("found = TRUE iAccountsArray.Count() == %d", iAccountsArray.Count());
+                INFO_1("found = TRUE iAccountsArray.Count() == %d", iAccountsArray.Count());
                 // Update fields from left to right
                 UpdateMailBoxIconL( mailbox, aInstance, row );
                 UpdateMailboxNameL( mailbox, aInstance, row );
@@ -789,7 +787,7 @@
             {
             iLiwIf->PublishIndicatorIconL( aWidgetInstance,
                                            aRowNumber,
-                                           EMbmCmailhandlerpluginQgn_stat_message_mail_uni );
+                                           EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg );
             }
         else if( !IsOutboxEmptyL(mailBoxId) )
             {
@@ -861,11 +859,10 @@
     FUNC_LOG;
 
     // If backup or restore is ongoing ignore all events
-    if ( BackupOrRestoreMode() )
+    if ( iSettings->BackupOrRestoreMode() )
         {
         return;
         }
-    
     switch ( aEvent )
         {
         case TFSEventNewMailbox:
@@ -906,7 +903,13 @@
             SetUpdateNeeded( aMailbox );
             UpdateFullL();
             break;
-            }            
+            }
+        case TFSEventMailMoved:
+            {
+            SetUpdateNeeded( aMailbox );
+            UpdateFullL();
+            break;
+            }
         default:
             {
             break;
@@ -1107,9 +1110,7 @@
     CMailMailboxDetails* mailbox = FindMailboxDetails( aMailbox );
     if ( !mailbox )
         {
-        //<Cmail>
         CleanupStack::PopAndDestroy( entries );
-        //<Cmail>
         return;
         }
 
@@ -1154,10 +1155,11 @@
         TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) );
         delete mailbox; // transferred ownership
         // Check that folder is correct
-        CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId );
-        if ( !folder )
+        CFSMailFolder* folder(NULL);                                                    
+        TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
+        if ( !folder || err != KErrNone )
             {
-            return KErrNotFound;
+            return 0;
             }
         CleanupStack::PushL( folder );
 
@@ -1189,10 +1191,11 @@
         TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSInbox ) );
         delete mailbox; // transferred ownership
         // Check that folder is correct
-        CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId );
-        if ( !folder )
+        CFSMailFolder* folder(NULL);                                                    
+        TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
+        if ( !folder || err != KErrNone )        
             {
-            return KErrNotFound;
+            return 0;
             }
         CleanupStack::PushL( folder );
 
@@ -1225,10 +1228,11 @@
         TFSMailMsgId folderId( mailbox->GetStandardFolderId( EFSOutbox ) );
         delete mailbox; // ownership was transferred
         // Check that folder is correct
-        CFSMailFolder* folder = MailClient().GetFolderByUidL( aMailbox, folderId );
-        if ( !folder )
+        CFSMailFolder* folder(NULL);
+        TRAPD( err, folder = MailClient().GetFolderByUidL( aMailbox, folderId ) );
+        if ( !folder || err != KErrNone )        
             {
-            return KErrNotFound;
+            return ret;
             }
         CleanupStack::PushL( folder );
 
@@ -1974,45 +1978,6 @@
     }
 
 // ----------------------------------------------------------------------------
-// CMailCpsHandler::BackupOrRestoreMode()
-// Check if phone is in backup/restore mode
-// ----------------------------------------------------------------------------
-//
-TBool CMailCpsHandler::BackupOrRestoreMode()
-    {
-    FUNC_LOG;
-    
-    TBool backupOrRestore = EFalse;
-    
-    // Get the back-up restore key, return EFalse if we can't get the key
-    TInt keyVal = 0;
-    const TInt error = RProperty::Get(  KUidSystemCategory, conn::KUidBackupRestoreKey, keyVal );
-    if( error == KErrNone )
-        {
-        const conn::TBURPartType partType = 
-                static_cast< conn::TBURPartType >( keyVal & conn::KBURPartTypeMask );
-                
-        if ( keyVal != 0 )
-            {
-            switch( partType )
-                {
-                case conn::EBURBackupFull:
-                case conn::EBURBackupPartial:
-                case conn::EBURRestoreFull:
-                case conn::EBURRestorePartial:
-                    backupOrRestore = ETrue;
-                    break;
-                case conn::EBURUnset:
-                case conn::EBURNormal:
-                default:
-                    break;                
-                }
-            }
-        }
-    return backupOrRestore;
-    }
-
-// ----------------------------------------------------------------------------
 // class CMailCpsUpdateHelper : public CTimer
 // Used to limit the rate of updates to Homescreen widget
 // ----------------------------------------------------------------------------
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpsif.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -638,13 +638,13 @@
     if (!iconIds.Length())
         {
         TBuf<KMaxDescLen> id;    
-        if ( aBitmapId == EMbmCmailhandlerpluginQgn_stat_message_mail_uni )
+        if ( aBitmapId == EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg )
             {
             iconIds.Append( KSkinPrefix );
             id.Num( EAknsMajorGeneric );
             iconIds.Append( id );
             iconIds.Append( KSpace );
-            id.Num( EAknsMinorGenericQgnStatMessageMailUni );
+            id.Num( EAknsMinorGenericQgnIndiCmailUnseenMsg );
             iconIds.Append( id );
             iconIds.Append( KSkinPostfix );                    
             }
@@ -960,7 +960,7 @@
                              CleanupStack::PopAndDestroy( cid );
                              }
                          else if (trigger.Compare(KPluginShutdown16) == 0)
-                             {                            
+                             {
                              // Widget removed from homescreen.
                              HBufC* cid = contentid.AllocLC();                             
                              ResetPublishedDataL( cid->Des() );							 
@@ -1197,6 +1197,7 @@
         {
         rVal = iInstIdList[aInstance].iUpdateNeeded;
         }
+    INFO_1("CMAIL CMailCpsIf::UpdateNeeded(): ret = %d",rVal);
     return rVal;
     }
 
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpssettings.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -20,6 +20,7 @@
 #include <e32base.h>
 // CRepository
 #include <centralrepository.h>
+#include <connect/sbdefs.h>
 
 // Email Framework APIs
 //<cmail>
@@ -59,6 +60,7 @@
     FUNC_LOG;
     Cancel();
     iMailboxArray.Close();
+    delete iBackupRestoreSubscriber;
     delete iCenRep;
     }
 
@@ -70,7 +72,9 @@
     CActive( EPriorityStandard ),
     iMailClient( aMailClient ),
     iCenRep( NULL ),
-    iConfigData( 0 )
+    iConfigData( 0 ),
+    iRestoreStarted( EFalse ),
+    iBackupOngoing( EFalse )
     {
     FUNC_LOG;
     CActiveScheduler::Add( this );
@@ -87,6 +91,9 @@
     // Trapping is done by MailServer infrastructure, not by CPS handler
     // In practice, this is fatal to cps handling, and widget won't work
     iCenRep = CRepository::NewL( KCRUidCmailWidget );
+    iBackupRestoreSubscriber = CPSSubscriber::NewL(
+        *this, KUidSystemCategory, conn::KUidBackupRestoreKey );
+    iBackupRestoreSubscriber->Subscribe();
     LoadSettingsL(); // mailboxes etc. user changeable data
     LoadConfigurationL(); // internal configuration data
     }
@@ -98,10 +105,13 @@
 void CMailCpsSettings::RunL()
     {
     FUNC_LOG;
-    StartObservingL();
-    LoadSettingsL(); // mailboxes etc. user changeable data
-    LoadConfigurationL(); // internal configuration data
-    iObserver->SettingsChangedCallback();
+    if ( !BackupOrRestoreMode() )
+        {
+        StartObservingL();
+        LoadSettingsL(); // mailboxes etc. user changeable data
+        LoadConfigurationL(); // internal configuration data
+        iObserver->SettingsChangedCallback();
+        }
     }
 
 // ---------------------------------------------------------------------------
@@ -348,7 +358,7 @@
     FUNC_LOG;
     RPointerArray<CFSMailBox> mailboxarray;
     TInt err = iMailClient.ListMailBoxes( TFSMailMsgId(), mailboxarray );
-	INFO_1("CMailCpsSettings::ResolveMailbox():: ListMailBoxes() returns %d", err);
+	INFO_1("CMAIL CMailCpsSettings::ResolveMailbox():: ListMailBoxes() returns %d", err);
     if( !err ) // KErrNone = 0
         {
         err = KErrNotFound;
@@ -914,6 +924,60 @@
     return ret;
     }
 
+// ---------------------------------------------------------------------------
+// CMailCpsSettings::HandlePropertyChangedL
+// ---------------------------------------------------------------------------
+//
+void CMailCpsSettings::HandlePropertyChangedL( const TUid& aCategory, TInt aKey )
+    {
+    FUNC_LOG;
 
+    if ( aCategory == KUidSystemCategory && aKey == conn::KUidBackupRestoreKey )
+        {
+        TInt keyVal = 0;
+        const TInt error = RProperty::Get(  KUidSystemCategory, conn::KUidBackupRestoreKey, keyVal );
+        if( error == KErrNone )
+            {
+            const conn::TBURPartType partType = 
+                    static_cast< conn::TBURPartType >( keyVal & conn::KBURPartTypeMask );
 
+            if ( keyVal != 0 )
+                {
+                switch( partType )
+                    {
+                    case conn::EBURRestoreFull:
+                    case conn::EBURRestorePartial:
+                        iRestoreStarted = ETrue;
+                        break;
+                    case conn::EBURBackupFull:
+                    case conn::EBURBackupPartial:                        
+                        iBackupOngoing = ETrue;
+                        break;
+                    case conn::EBURUnset:
+                    case conn::EBURNormal:
+                    default:
+                        iBackupOngoing = EFalse;
+                        break;
+                    }
+                }
+            }
+        }
+    }
 
+// ----------------------------------------------------------------------------
+// CMailCpsHandler::BackupOrRestoreMode()
+// Check if phone is in backup/restore mode
+// ----------------------------------------------------------------------------
+//
+TBool CMailCpsSettings::BackupOrRestoreMode()
+    {
+    FUNC_LOG;
+
+    TBool backupOrRestore = EFalse;
+    
+    if ( iRestoreStarted || iBackupOngoing )
+        {
+        backupOrRestore = ETrue;
+        }
+    return backupOrRestore;
+    }
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailpluginproxy.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailpluginproxy.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -345,7 +345,7 @@
     TInt indicator( 0 );
     if ( aMailboxData.Unseen() )
         {
-        indicator = EMbmCmailhandlerpluginQgn_stat_message_mail_uni;
+        indicator = EMbmCmailhandlerpluginQgn_indi_cmail_unseen_msg;
         }
     else if ( !aMailboxData.IsOutboxEmpty() )
         {
--- a/emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailstore/message_store/client/src/RMessageStoreSession.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -525,7 +525,7 @@
         User::LeaveIfError( fs.Connect() );
         fs.ShareProtected();        
         
-        User::LeaveIfError( file.Open( fs, aContentFilename, EFileRead | EFileShareAny ) );
+        User::LeaveIfError( file.Open( fs, aContentFilename, EFileShareReadersOnly ) );
         User::LeaveIfError( file.TransferToServer( ipcArgs, KIpcArgsIndex2, KIpcArgsIndex3 ) );	    	    
 	    } // end if
 
--- a/emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailstore/message_store/server/src/ContainerStoreContainersTable.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -297,9 +297,22 @@
     iIsRowEncryptedColNum  = colSet->ColNo( KContainersTableIsRowEncryptedCol );
 
 	CleanupStack::PopAndDestroy( colSet );
-	
-	// Set the table's index to the ID index.
-	User::LeaveIfError( iTable.SetIndex( KContainersTableIdIndex ) );
+
+    // make sure KContainersTableParentIdIndex exists
+    TInt err = iTable.SetIndex( KContainersTableParentIdIndex );
+    if ( err == KErrNotFound )
+        {
+        iUtils.CloseTable( iTable );
+        CreateIndexL( KContainersTableName, KContainersTableParentIdIndex, KContainersTableParentIdCol );
+        iUtils.OpenTableL( iTable, KContainersTableName );
+        }
+    else
+        {
+        User::LeaveIfError( err );
+        }
+
+    // Set the table's index to the ID index.
+    User::LeaveIfError( iTable.SetIndex( KContainersTableIdIndex ) );
 	
 	__LOG_EXIT
 	} // end OpenTableL
@@ -348,7 +361,8 @@
 	// Create table index.
     CreateIndexL( KContainersTableName, KContainersTableIdIndex, KContainersTableIdCol );
     CreateIndexL( KContainersTableName, KContainersTableParentIdIndex, KContainersTableParentIdCol );
-	OpenTableL();
+
+    OpenTableL();
 	
 	__LOG_EXIT	
 	} // end CreateTableL
@@ -932,7 +946,9 @@
 	    queryString.AppendNum( toBeSearched[0] );    	    
         toBeSearched.Remove( 0 );
         
-        if ( aType == EMsgStorePartBits )
+        if ( aType == EMsgStorePartBits || 
+           ( ( aId & KContainerTypeMask ) == EMsgStoreMessageBits ) ||
+           ( ( aId & KContainerTypeMask ) == EMsgStorePartBits ) )
         	{
         	//must sort the message parts by containerId in ascending order
         	// to preserve the same order as they are created
@@ -1216,35 +1232,13 @@
     {
     __LOG_ENTER( "FirstChildForDeleteL" )
     __LOG_WRITE8_FORMAT1_INFO( "id=%x", aId )
-    
+
     TContainerId returnValue = KContainerInvalidId;
-    
-    TInt rc = iTable.SetIndex( KContainersTableParentIdIndex );
-    if ( rc == KErrNone )
-        {
-        TRAP_IGNORE(returnValue = GetFirstChildForDeleteL(aId, aBookmark));       
-        //remember to set the index back
-        iTable.SetIndex( KContainersTableIdIndex );
-        }
-    else
-        {
-        //older version of the db does not have the index on parent id, so do the slow Find instead
-        const TUint bufSize = 60;
-        TBuf<bufSize> queryString;
-        
-        _LIT( KEquals, "=" );
-        
-        queryString.Copy( KContainersTableParentIdCol );
-        queryString.Append( KEquals );
-        queryString.AppendNum( aId );
-    
-        returnValue = FindL( queryString );
-        if ( returnValue != KContainerInvalidId )
-            {
-            aBookmark = Bookmark();
-            }
-        }
-    
+    User::LeaveIfError( iTable.SetIndex( KContainersTableParentIdIndex ) );
+    TRAP_IGNORE( returnValue = GetFirstChildForDeleteL( aId, aBookmark ) );
+    //remember to set the index back
+    iTable.SetIndex( KContainersTableIdIndex );
+
     __LOG_EXIT
     return returnValue;   
     }
@@ -1270,7 +1264,7 @@
         returnValue = iTable.ColUint32( iIdColNum );
         aBookmark = Bookmark();
         __LOG_WRITE8_FORMAT1_INFO( "found id=%x", returnValue )
-        }        
+        }
     __LOG_EXIT
     return returnValue;   
     }
--- a/emailservices/emailstore/message_store/server/src/ContainerStoreSortingTable.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/emailstore/message_store/server/src/ContainerStoreSortingTable.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -28,7 +28,6 @@
 #include "MsgStoreInMemorySortRowSet.h"
 	
 _LIT( KSelect,  "SELECT "   );
-_LIT( KDelete,  "DELETE "   );
 _LIT( KFrom,    " FROM "    );
 _LIT( KWhere,   " WHERE "   );
 _LIT( KEquals,  " = "       );
--- a/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailservices/psmruadapter/src/CPsMruAdapter.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -286,15 +286,13 @@
 // code was simplified not to trace all mailboxes
 // function has trap in  Event() -case> TFSEventNewMailbox and in DeleayedMailboxCreationEventL()
 // should not leave when new mailbox only when new mail address
-    CFSMailBox *mailBox = iMailClient->GetMailBoxByUidL(aId);
-    if ( mailBox )
+    CFSMailBox *mailBox = iMailClient->GetMailBoxByUidLC(aId);
+    if( mailBox )
         {
-        CleanupStack::PushL( mailBox );
         AddMailboxObserverL( aId );
         
         // Get MRU list for this mailbox
         MDesCArray* mruList = mailBox->ListMrusL();
-        CleanupStack::PopAndDestroy( mailBox );
         
         // update the caching status as InProgress
         iDataStoreObserver->UpdateCachingStatus( aDataStoreURI,
@@ -319,6 +317,7 @@
             }
         result = ETrue;
         }   // if (mailBox)
+    CleanupStack::PopAndDestroy( mailBox );
     return result;
     }
 
@@ -452,12 +451,18 @@
                 {
                 mailboxPtr = NULL;
                 }
-            if (NULL == mailboxPtr) // mailbox still does not exist 
+            if( mailboxPtr ) 
                 {
+                delete mailboxPtr;
+                mailboxPtr = NULL;
+                }
+            else
+                {
+                // mailbox still does not exist
                 DeleayMailboxCreationEventL( aMailbox ); // start timer to postpone creation	
                 break;
                 }
-            mailboxPtr = NULL;
+            
             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
             if ( GetUriFromMailboxIdentifier( aMailbox, *identifier ) )
                 {
@@ -572,6 +577,9 @@
             }
         if ( mailboxPtr ) 
             {
+            delete mailboxPtr;
+            mailboxPtr = NULL;
+            
             HBufC* identifier = HBufC::NewLC( KMaximumMailboxUriLength ); // new string ident
             if ( GetUriFromMailboxIdentifier( iDelayedCreatedMailboxes[i], *identifier ) )
                 {
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	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/data/FreestyleEmailUi.rss	Mon Jun 21 15:20:54 2010 +0300
@@ -1271,7 +1271,7 @@
 RESOURCE TBUF r_freestyle_email_ui_message_to_folder		{ buf=qtn_fse_confirm_note_message_moved; }
 RESOURCE TBUF r_freestyle_email_ui_messages_to_folder		{ buf=qtn_fse_confirm_note_messages_moved; }
 RESOURCE TBUF r_freestyle_email_ui_settings_ips_text		{ buf=qtn_fse_message_list_options_settings_mailbox; }
-RESOURCE TBUF r_freestyle_email_ui_markingmode			{ buf=qtn_fse_message_list_options_mark; }
+RESOURCE TBUF r_freestyle_email_ui_markingmode			{ buf=qtn_navi_pane_marking_mode; }
 
 // OUTBOX NOTE
 RESOURCE TBUF r_freestyle_email_ui_open_from_outbox_note	{ buf=qtn_fse_info_note_cannot_open; }
@@ -3077,6 +3077,11 @@
 	    {
 	        txt = qtn_cmail_popup_cancel_download;    // Cancel attachment downloads
                 command = EFsEmailUiCmdCancelDownload;
+            },
+        STYLUS_POPUP_MENU_ITEM
+            {
+                txt = qtn_fse_viewer_options_attach_cancel_all_downloads;    // Cancel all attachment downloads
+                command = EFsEmailUiCmdCancelAllDownloads;
             }
         };
     }
--- a/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailCenRepKeys.h	Mon Jun 21 15:20:54 2010 +0300
@@ -74,18 +74,12 @@
 
 
 // These keys define limits on how much data is allowed to load by plugins 
-/* The setting allows to limit max body size in MfE protocol plugin, KB */
-const TUint32 KFreestyleMfeMaxBodySize                   = 0x00002000;
-/* The setting allows to limit max body size for Ozone protocol plugin, KB */
-const TUint32 KFreestyleOzoneMaxBodySize                 = 0x00002001;
-/* The setting allows to limit max body size in POP/IMAP protocol plugin, KB */
-const TUint32 KFreestyleIPSMaxBodySize                   = 0x00002002;
-/* The setting allows to limit max body size in e-mail viewer, KB */
-const TUint32 KFreestyleViewerMaxBodySize                = 0x00002003;
-/* The setting allows to limit max body size in editor for reply/forward, KB. */
-const TUint32 KFreestyleEditorMaxBodySize                = 0x00002004;
-/* The setting allows to limit max size of mail attachments shown in mail viewer, KB */
-const TUint32 KFreestyleViewerMaxAttachmentSize          = 0x00002005;
+/* The setting allows to limit max body size, KB */
+const TUint32 KFreestyleMaxBodySize                      = 0x00002000;
+/* The setting allows to limit max body size in reply/forward, KB. */
+const TUint32 KFreestyleReplyMaxBodySize                 = 0x00002001;
+/* The setting allows to limit max total size of mail attachments shown in mail viewer, KB */
+const TUint32 KFreestyleViewerMaxAttachmentsSize         = 0x00002002;
 
 
 //
--- a/emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiAttachmentsListModel.h	Mon Jun 21 15:20:54 2010 +0300
@@ -151,6 +151,8 @@
     void UpdateListL( CFSMailMessage* aEmbeddedMessage );
     // Creates and returns mail subject text. Ownership is transferred to CleanupStack.
     HBufC* CreateMailSubjectTextLC() const;
+    // Returns ETrue if there is multiple attachment downloads requested
+    TBool IsMultiplyDownloadsOngoing();
 
 public: // from CFSEmailUiAttachmentsModelBase
     // get attachment data from list using tree entry 
--- a/emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiFolderListVisualiser.h	Mon Jun 21 15:20:54 2010 +0300
@@ -268,6 +268,7 @@
 	void UpdateListSizeAttributes();
 	void ResizeListIcons();
 	void ResizeListItemsL();
+	void StartScrollingListItemsL();
 	void AdaptScreenRectToListContent();
 	void AdjustWidthByContent( TRect& aRect ) const;
 	void SetAnchors();
--- a/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiHtmlViewerView.h	Mon Jun 21 15:20:54 2010 +0300
@@ -131,6 +131,7 @@
     void DownloadAttachmentL( const TAttachmentData& aAttachment );
     void DownloadAllAttachmentsL();
     void CancelAttachmentL( const TAttachmentData& aAttachment );    
+    void CancelAllAttachmentsL();    
     void OpenAttachmentL( const TAttachmentData& aAttachment );
     void SaveAttachmentL( const TAttachmentData& aAttachment );
     void SaveAllAttachmentsL();
--- a/emailuis/emailui/inc/FreestyleEmailUiLauncherGridVisualiser.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiLauncherGridVisualiser.h	Mon Jun 21 15:20:54 2010 +0300
@@ -334,6 +334,7 @@
     void ScrollToRow(TInt row);
 	void PopulateL(TLevel& aLevel);
 	void UpdateLauncherItemListL();
+	void UpdateGridOffset();
 	void SetDefaultStatusPaneTextL();
 
     void DetachSelectorMappingFunctions();
--- a/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiMailListVisualiser.h	Mon Jun 21 15:20:54 2010 +0300
@@ -82,6 +82,7 @@
 class CEUiEmailListTouchManager;
 class MFSMailIterator;
 class CAknStylusPopUpMenu;
+class CFSEmailUiGenericTimer;
 template <class T> struct TDeleteTask;
 
 /**
@@ -141,6 +142,10 @@
         };
 
 public:
+    /**
+     * 
+     */
+    static CMailListModelUpdater* NewL();
 
     /**
      * Constructor
@@ -162,7 +167,7 @@
     /**
      * Update model.
      */
-    void UpdateModelL(MObserver& aObserver, MFSMailIterator* aIterator);
+    void UpdateModelL(MObserver& aObserver, MFSMailIterator* aIterator, TInt aBlockSize);
 
     /**
      * Returns ETrue if updating.
@@ -180,6 +185,10 @@
      * @see CActive::DoCancel
      */
     void DoCancel();
+    /**
+     * @see CActive::RunError
+     */
+    TInt RunError(TInt aError);
 
 private:
 
@@ -207,6 +216,8 @@
      * Reset to uninitialized state.
      */
     void Reset();
+private:
+    void ConstructL();
 
 private:
 
@@ -218,6 +229,7 @@
     MFSMailIterator* iIterator;
     TFsTreeItemId iParentId;
     TInt iBlockSize;
+    RTimer iTimer;
     };
 
 struct SMailListItem
@@ -264,7 +276,8 @@
 									 public MFsTreeListObserver,
 									 public MFSEmailUiContactHandlerObserver,
 									 public CMailListModelUpdater::MObserver,
-									 public MEmailMailboxState
+                                     public MEmailMailboxState,
+                                     public MFSEmailUiGenericTimerCallback
 // </cmail>
 	{
 friend class CMailListUpdater;
@@ -449,6 +462,15 @@
     // check from settings if manual or auto sync
     TBool CheckAutoSyncSettingL();
     
+public: // from MFSEmailUiGenericTimerCallback
+
+    /**
+     * From MFSEmailUiGenericTimerCallback.
+     * Generic timer event callback.
+     * Handles insertion of new mails into mail list.
+     */
+    void TimerEventL( CFSEmailUiGenericTimer* aTriggeredTimer );
+
 private: // from
 
     /**
@@ -522,9 +544,11 @@
     void UpdateCancelled(const TBool aForceRefresh);
 
 	// Mail model update
-    void UpdateMailListModelAsyncL();
+    void SortMailListModelAsyncL();
+    TBool UpdateMailListModelAsyncL(TInt aBlockSize);
 	void UpdateMailListModelL();
 	void CreateModelItemsL( RPointerArray<CFSMailMessage>& aMessages );
+	void DeleteSortWaitNote();
 
 	// Create title divider model item for the given message. Separator text depends on active sorting mode.
 	CFSEmailUiMailListModelItem* CreateSeparatorModelItemLC( CFSMailMessage& aMessage ) const;
@@ -912,7 +936,17 @@
 	TPoint iMarkingModeTextPos;
 	TSize iMarkingModeTextSize;
 	TRect iMarkingModeTextRect;
-  	};
+    CAknWaitDialog* iSortWaitNote;
+    // 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;
+
+    // skin text colors for the list items
+    TRgb iFocusedTextColor;
+    TRgb iNormalTextColor;
+    TRgb iNodeTextColor;
+    };
 
 
 // Definition of the mail updater timer. This timer is used for
--- a/emailuis/emailui/inc/FreestyleEmailUiSettingsListView.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/FreestyleEmailUiSettingsListView.h	Mon Jun 21 15:20:54 2010 +0300
@@ -95,6 +95,10 @@
 	 */
 	void DisplayStylusPopUpMenu( const TPoint& aPosition );
 	
+    /**
+     * Hides the pop-up menu.
+     */
+    void HideStylusPopUpMenu();
 
 protected: // From base class CAknView.
 
@@ -149,6 +153,8 @@
     // A long tap detector and a pop-up menu that is invoked by long tap
     // events. Used for e.g. deleting mail boxes.
     CAknStylusPopUpMenu* iStylusPopUpMenu;
+    // dymmy control for hiding stylus pop up menu
+    CCoeControl* iCoeControl;
 	};
 
 #endif // FSEMAILSETTINGSLISTVIEW_H
--- a/emailuis/emailui/inc/ncscomposeview.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/inc/ncscomposeview.h	Mon Jun 21 15:20:54 2010 +0300
@@ -714,6 +714,11 @@
      * "Opening" wait dialog.
      */
     CAknWaitDialog* iOpeningWaitDialog;
+    
+    /**
+     * Flag indicating that adding attachment dialog is opened.
+     */
+    TBool iAddingAttachmentDialogOpened;
     };
 
 /**
--- a/emailuis/emailui/sis/commonemail.pkg	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/sis/commonemail.pkg	Mon Jun 21 15:20:54 2010 +0300
@@ -109,6 +109,7 @@
 "\epoc32\data\z\resource\apps\microsoft_brand_graphics.mif"      - "c:\resource\apps\microsoft_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\ovi_brand_graphics.mif"            - "c:\resource\apps\ovi_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\yahoo_brand_graphics.mif"          - "c:\resource\apps\yahoo_brand_graphics.mif"
+"\epoc32\data\z\resource\apps\mail_for_exchange_brand_graphics.mif" - "c:\resource\apps\mail_for_exchange_brand_graphics.mif"
 
 ; emailservices / psmruadapter
 "\epoc32\release\armv5\urel\PsMruAdapter.dll"                    - "c:\sys\bin\PsMruAdapter.dll"
@@ -225,7 +226,7 @@
 ; meetingrequest / location url parser plugin
 "\epoc32\release\armv5\urel\esmrurlparserplugin.dll"             - "c:\sys\bin\esmrurlparserplugin.dll"
 "\epoc32\data\Z\resource\Plugins\esmrurlparserplugin.rsc"        - "c:\resource\plugins\esmrurlparserplugin.rsc"
-"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
+;"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
 
 ; meetingrequest / cenrep
 "\epoc32\data\Z\private\10202BE9\2001E610.txt"                   - "c:\private\10202be9\2001E610.txt"
--- a/emailuis/emailui/sis/commonemail_loc.pkg	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_loc.pkg	Mon Jun 21 15:20:54 2010 +0300
@@ -111,6 +111,7 @@
 "\epoc32\data\z\resource\apps\microsoft_brand_graphics.mif"      - "c:\resource\apps\microsoft_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\ovi_brand_graphics.mif"            - "c:\resource\apps\ovi_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\yahoo_brand_graphics.mif"          - "c:\resource\apps\yahoo_brand_graphics.mif"
+"\epoc32\data\z\resource\apps\mail_for_exchange_brand_graphics.mif"  - "c:\resource\apps\mail_for_exchange_brand_graphics.mif"
 
 ; emailservices / psmruadapter
 "\epoc32\release\armv5\urel\PsMruAdapter.dll"                    - "c:\sys\bin\PsMruAdapter.dll"
@@ -237,7 +238,7 @@
 ; meetingrequest / location url parser plugin
 "\epoc32\release\armv5\urel\esmrurlparserplugin.dll"             - "c:\sys\bin\esmrurlparserplugin.dll"
 "\epoc32\data\Z\resource\Plugins\esmrurlparserplugin.rsc"        - "c:\resource\plugins\esmrurlparserplugin.rsc"
-"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
+;"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
 
 ; meetingrequest / cenrep
 "\epoc32\data\Z\private\10202BE9\2001E610.txt"                   - "c:\private\10202be9\2001E610.txt"
--- a/emailuis/emailui/sis/commonemail_udeb.pkg	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_udeb.pkg	Mon Jun 21 15:20:54 2010 +0300
@@ -97,6 +97,7 @@
 "\epoc32\data\z\resource\apps\microsoft_brand_graphics.mif"      - "c:\resource\apps\microsoft_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\ovi_brand_graphics.mif"            - "c:\resource\apps\ovi_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\yahoo_brand_graphics.mif"          - "c:\resource\apps\yahoo_brand_graphics.mif"
+"\epoc32\data\z\resource\apps\mail_for_exchange_brand_graphics.mif"  - "c:\resource\apps\mail_for_exchange_brand_graphics.mif"
 
 ; emailservices / psmruadapter
 "\epoc32\release\armv5\udeb\PsMruAdapter.dll"                    - "c:\sys\bin\PsMruAdapter.dll"
@@ -213,7 +214,7 @@
 ; meetingrequest / location url parser plugin
 "\epoc32\release\armv5\udeb\esmrurlparserplugin.dll"             - "c:\sys\bin\esmrurlparserplugin.dll"
 "\epoc32\data\Z\resource\Plugins\esmrurlparserplugin.rsc"        - "c:\resource\plugins\esmrurlparserplugin.rsc"
-"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
+;"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
 
 ; meetingrequest / cenrep
 "\epoc32\data\Z\private\10202BE9\2001E610.txt"                   - "c:\private\10202be9\2001E610.txt"
--- a/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/sis/commonemail_udeb_loc.pkg	Mon Jun 21 15:20:54 2010 +0300
@@ -99,6 +99,7 @@
 "\epoc32\data\z\resource\apps\microsoft_brand_graphics.mif"      - "c:\resource\apps\microsoft_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\ovi_brand_graphics.mif"            - "c:\resource\apps\ovi_brand_graphics.mif"
 "\epoc32\data\z\resource\apps\yahoo_brand_graphics.mif"          - "c:\resource\apps\yahoo_brand_graphics.mif"
+"\epoc32\data\z\resource\apps\mail_for_exchange_brand_graphics.mif"  - "c:\resource\apps\mail_for_exchange_brand_graphics.mif"
 
 ; emailservices / psmruadapter
 "\epoc32\release\armv5\udeb\PsMruAdapter.dll"                    - "c:\sys\bin\PsMruAdapter.dll"
@@ -225,7 +226,7 @@
 ; meetingrequest / location url parser plugin
 "\epoc32\release\armv5\udeb\esmrurlparserplugin.dll"             - "c:\sys\bin\esmrurlparserplugin.dll"
 "\epoc32\data\Z\resource\Plugins\esmrurlparserplugin.rsc"        - "c:\resource\plugins\esmrurlparserplugin.rsc"
-"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
+;"\epoc32\data\z\resource\esmrurlparserplugindata.rsc"            - "c:\resource\esmrurlparserplugindata.rsc"
 
 ; meetingrequest / cenrep
 "\epoc32\data\Z\private\10202BE9\2001E610.txt"                   - "c:\private\10202be9\2001E610.txt"
--- a/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAppui.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -1286,7 +1286,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>(iMailListVisualiser->Model()->Item(i+1));
-		if ( item->ModelItemType() == ETypeMailItem )
+		if ( item && item->ModelItemType() == ETypeMailItem )
 			{
 			ret++;
 			}
@@ -2159,14 +2159,19 @@
    		case TFSEventMailboxOnline:
    		case TFSEventMailboxOffline:
    			{
-   			if (aEvent == TFSEventMailboxOnline)
-   			    {
-   			    UpdateTitlePaneConnectionStatus(EForceToConnected);
+   			//must check event go to right MailBox
+    		if( aMailbox == GetActiveMailboxId() ) 
+    			{
+      			if (aEvent == TFSEventMailboxOnline)
+    			    {
+    			    UpdateTitlePaneConnectionStatus(EForceToConnected);
+    			    }
+    			else if (aEvent == TFSEventMailboxOffline)
+    			    { 
+    			    UpdateTitlePaneConnectionStatus(EForceToDisconnected);
+    				}
    			    }
-   			else if (aEvent == TFSEventMailboxOffline)
-   			    {
-   			    UpdateTitlePaneConnectionStatus(EForceToDisconnected);
-   			    }
+				
             // Cancel all ongoing downloads for the disconnected mailbox
             if (iDwnldMediator && aEvent == TFSEventMailboxOffline)
               {
@@ -2203,6 +2208,11 @@
     		{
     		TBool tryRunningFakeSyncAnim( EFalse );
     		TSSMailSyncState* newSyncState = static_cast<TSSMailSyncState*>( aParam1 );
+
+    		//must check event go to right MailBox
+    		if( aMailbox != GetActiveMailboxId() )
+    			break;
+    		
     		if ( newSyncState !=0 && *newSyncState )
     			{
         		switch ( *newSyncState )
--- a/emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiAttachmentsListModel.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -655,3 +655,22 @@
     return subjectText;
     }
 
+TBool CFSEmailUiAttachmentsListModel::IsMultiplyDownloadsOngoing()
+    {
+    TBool multiplyDownloads( EFalse );
+    TInt downloads = 0;
+    for ( TInt i = 0; i < iAttachments.Count() && downloads <= 1; i++ )
+        {   
+        if ( IsDownloading( iAttachments[i] ))
+            {
+            downloads++;
+            }
+        }
+
+    if ( downloads > 1 )
+        {
+        multiplyDownloads = ETrue;
+        }
+    
+    return multiplyDownloads;
+    }
--- a/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiFolderListVisualiser.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -422,9 +422,10 @@
         iTreeVisualizer->RefreshListViewL();
         }
     
-    ResizeListIcons();
-    ResizeListItemsL();
-    
+    if ( iFullScreen )
+    	{
+    	StartScrollingListItemsL();
+    	}
 	}
 
 // ---------------------------------------------------------------------------
@@ -682,9 +683,7 @@
     iCurrentFolderId = aFolderId;
     DoShowInPopupL( aButton, aCallback, NULL );
     
-    ResizeListIcons();
-    ResizeListItemsL();
-    
+    StartScrollingListItemsL();
     }
 
 // ---------------------------------------------------------------------------
@@ -1330,10 +1329,19 @@
 void CFSEmailUiFolderListVisualiser::FadeOut( TBool aDirectionOut )
 	{
     FUNC_LOG;
-    if ( aDirectionOut && iTreeVisualizer != NULL )
-        {
-        iTreeVisualizer->HideList();
-        }
+    if ( aDirectionOut )
+    	{
+    	if ( iTreeVisualizer != NULL )
+    		{
+			iTreeVisualizer->HideList();
+    		}
+    	
+		if ( iTitleCaptionVisible && iHeaderTextVisual )
+			{
+			iTitleCaptionVisible = EFalse;
+			iHeaderTextVisual->SetOpacity( KFSInvisible );
+			}
+    	}
 	}
 
 // ---------------------------------------------------------------------------
@@ -2804,6 +2812,20 @@
 	}
 
 // ---------------------------------------------------------------------------
+// Start scrolling
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiFolderListVisualiser::StartScrollingListItemsL()
+	{
+    FUNC_LOG;
+	TInt arraySize = iListItemVisulizers.Count();
+	for( TInt i = 0 ; i < arraySize ; i++ )
+		{
+		iListItemVisulizers[i]->MarqueeL( EFsTextMarqueeForth, 30, 1000, 500, 1 ); // same values as in CFsTreeVisualizerBase constructor
+		}
+	}
+
+// ---------------------------------------------------------------------------
 // Optimises the screen rect by the list content
 // ---------------------------------------------------------------------------
 //
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerContainer.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -677,8 +677,14 @@
         emailHtmlFile.Append( KMessageHtmlRTLFile );
         }
 
-    CreateBrowserControlInterfaceL();
-
+    // If scroll position is not to be reset, re-creation of browser control
+    // interface object is skipped (we're just reloading the page with new
+    // content)
+    if ( aResetScrollPos )
+        {
+        CreateBrowserControlInterfaceL();
+        }
+    
     LoadContentFromFileL( emailHtmlFile );
 
     UpdateOverlayButtons( ETrue );
--- a/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiHtmlViewerView.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -907,7 +907,7 @@
             }
         else
             {
-            htmlData.iActivationDataType = THtmlViewerActivationData::EmbeddedEmailMessage;
+            htmlData.iActivationDataType = THtmlViewerActivationData::EMailMessage;
             htmlData.iMailBoxId = iOpenMessages->Head()->GetMailBoxId();
             htmlData.iFolderId  = iOpenMessages->Head()->GetFolderId();
             htmlData.iMessageId = iOpenMessages->Head()->GetMessageId();
@@ -1604,6 +1604,12 @@
     iAttachmentsListModel->CancelDownloadL(aAttachment);
     }
 
+void CFsEmailUiHtmlViewerView::CancelAllAttachmentsL()
+    {
+    FUNC_LOG;
+    iAttachmentsListModel->CancelAllDownloadsL();
+    }
+
 void CFsEmailUiHtmlViewerView::OpenAttachmentL( const TAttachmentData& aAttachment )
     {
     if ( iAppUi.DownloadInfoMediator()->IsDownloading( aAttachment.partData.iMessagePartId ) )
--- a/emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiLauncherGridVisualiser.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -912,6 +912,7 @@
 	        iAppUi.SetFocusVisibility( EFalse );
 	        HandleButtonReleaseEvent(); // Finishes the focus removal.
 	        iStylusPopUpMenuLaunched = EFalse;
+	        UpdateGridOffset();
 			break;
 			}
 		case EFsEmailUiCmdSync:
@@ -1826,6 +1827,7 @@
         {
         iDoubleClickLock = EFalse;
         }
+    UpdateGridOffset();
     }
 
 void CFSEmailUiLauncherGridVisualiser::GetParentLayoutsL(
@@ -2778,6 +2780,7 @@
         iStartupCallbackTimer->Start( 200 );
         }
 
+	UpdateGridOffset();
     CFsEmailUiViewBase::HandleAppForegroundEventL( aForeground );	
     }
 
@@ -2816,3 +2819,18 @@
         }
     }
 
+// ---------------------------------------------------------------------------
+// CFSEmailUiLauncherGridVisualiser::UpdateGridOffset()
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiLauncherGridVisualiser::UpdateGridOffset()
+	{
+	if ( iConstructionCompleted )
+		{
+        TAlfTimedPoint alfScrollOffset;
+        alfScrollOffset.iY.SetTarget( 1.0 , 0);
+        iCurrentLevel.iGridLayout->SetScrollOffset(alfScrollOffset);
+        iCurrentLevel.iParentPos.iY = 1.0;
+		}
+	}
+
--- a/emailuis/emailui/src/FreestyleEmailUiMailListModel.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListModel.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -250,20 +250,23 @@
     CFSEmailUiMailListModelItem* item = 
         static_cast< CFSEmailUiMailListModelItem* >( Item(aIndex) );
     
-    // Mail type items own the message. Delete the existing message first.
-    if ( item->ModelItemType() == ETypeMailItem )
+    if ( item ) // Safety
         {
-        delete &item->MessagePtr();
-        }
-    item->SetMessagePtr( aNewPtr );
-    
-    // If the item was the first child of a node, then also message pointer in the parent
-    // node needs to be updated
-    if ( aIndex > 0 &&
-         item->ModelItemType() == ETypeMailItem &&
-         iItems[aIndex-1]->ModelItemType() == ETypeSeparator )
-        {
-        iItems[aIndex-1]->SetMessagePtr( aNewPtr );
+        // Mail type items own the message. Delete the existing message first.
+        if ( item->ModelItemType() == ETypeMailItem )
+            {
+            delete &item->MessagePtr();
+            }
+        item->SetMessagePtr( aNewPtr );
+        
+        // If the item was the first child of a node, then also message pointer in the parent
+        // node needs to be updated
+        if ( aIndex > 0 &&
+             item->ModelItemType() == ETypeMailItem &&
+             iItems[aIndex-1]->ModelItemType() == ETypeSeparator )
+            {
+            iItems[aIndex-1]->SetMessagePtr( aNewPtr );
+            }
         }
     }
 
--- a/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiMailListVisualiser.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -96,12 +96,14 @@
 const TInt KControlBarTransitionTime = 250;
 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 KNewMailMaxBatch = 7;    // number of new mails inserted into list at once
 static const TInt KMsgDeletionWaitNoteAmount = 5;
 _LIT( KMissingPreviewDataMarker, "..." );
 
 static const TInt KMaxItemsFethed = 1000;
 static const TInt KCMsgBlock = 15;
-static const TInt KCMsgMaxBlock = 120;
+static const TInt KCMsgBlockSort = 50;
 
 // ---------------------------------------------------------------------------
 // Generic method for deleting a pointer and setting it NULL.
@@ -186,19 +188,46 @@
     {
     iEntries.Reset();
     }
+
+
 // CMailListModelUpdater
 
-// ---------------------------------------------------------------------------
-// Constructor
+
+// ---------------------------------------------------------------------------
+// CMailListModelUpdater::NewL
+// ---------------------------------------------------------------------------
+//
+CMailListModelUpdater* CMailListModelUpdater::NewL()
+    {
+    CMailListModelUpdater* self = new (ELeave) CMailListModelUpdater();
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );
+
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// CMailListModelUpdater::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CMailListModelUpdater::ConstructL()
+    {
+    User::LeaveIfError( iTimer.CreateLocal() );
+    }
+
+// ---------------------------------------------------------------------------
+// CMailListModelUpdater::CMailListModelUpdater
 // ---------------------------------------------------------------------------
 //
 CMailListModelUpdater::CMailListModelUpdater() : CActive(EPriorityStandard)
     {
     CActiveScheduler::Add(this);
-    }
-
-// ---------------------------------------------------------------------------
-// Destructor
+    iBlockSize = KCMsgBlock;
+    }
+
+// ---------------------------------------------------------------------------
+// CMailListModelUpdater::~CMailListModelUpdater
 // ---------------------------------------------------------------------------
 //
 CMailListModelUpdater::~CMailListModelUpdater()
@@ -206,6 +235,7 @@
     iObserver = NULL;
     Cancel();
     iSorting.Close();
+    iTimer.Close();
     }
 
 // ---------------------------------------------------------------------------
@@ -224,25 +254,35 @@
 // informed to the observer.
 // ---------------------------------------------------------------------------
 //
-void CMailListModelUpdater::UpdateModelL(MObserver& aObserver, MFSMailIterator* aIterator)
+void CMailListModelUpdater::UpdateModelL(MObserver& aObserver, 
+                                         MFSMailIterator* aIterator, TInt aBlockSize)
     {
     Cancel();
     iObserver = &aObserver;
     iIterator = aIterator;
     Signal(EInitialize);
+    iBlockSize = aBlockSize;
     }
 
 // ---------------------------------------------------------------------------
 // Internal method. Sets new state and signals itself.
 // ---------------------------------------------------------------------------
 //
-void CMailListModelUpdater::Signal(TState aState, TInt aError)
-    {
+void CMailListModelUpdater::Signal(TState aState, TInt /*aError*/)
+    {
+    const TInt KDelayInMicroSeconds = 5 * 1000; // 5 ms
+    
+    // timer used to get CAknWaitDialog animation working
     iState = aState;
-    iStatus = KRequestPending;
+    iTimer.After(iStatus, KDelayInMicroSeconds);
     SetActive();
-    TRequestStatus* status = &iStatus;
-    User::RequestComplete(status, aError);
+    
+    
+    //iState = aState;
+    //iStatus = KRequestPending;
+    //SetActive();
+    //TRequestStatus* status = &iStatus;
+    //User::RequestComplete(status, aError);
     }
 
 // ---------------------------------------------------------------------------
@@ -251,7 +291,6 @@
 //
 void CMailListModelUpdater::InitializeL()
     {
-    iBlockSize = KCMsgBlock;
     iParentId = KFsTreeRootID;
     iId = TFSMailMsgId();
     iItemsFetched = 0;
@@ -266,17 +305,26 @@
 //
 void CMailListModelUpdater::FetchL()
     {
-    RPointerArray<CFSMailMessage> messages(iBlockSize);
+    TInt blockSize = iBlockSize;
+    if ( iItemsFetched == 0 )
+        {
+        blockSize = KCMsgBlock;
+        }
+
+    RPointerArray<CFSMailMessage> messages(blockSize);
     CleanupClosePushL(messages);
-    const TBool moreMessages(iIterator->NextL(iId, iBlockSize, messages));
-    iBlockSize = Min(KCMsgMaxBlock, iBlockSize * 2);
+   
+    const TBool moreMessages(iIterator->NextL(iId, blockSize, messages));
+
     if (messages.Count() > 0)
         {
         iItemsFetched += messages.Count();
         iId = messages[messages.Count() - 1]->GetMessageId();
         iObserver->UpdateProgressL(iParentId, messages);
         }
+    
     CleanupStack::PopAndDestroy(); // messages.Close()
+    
     if (moreMessages && iItemsFetched < KMaxItemsFethed)
         {
         Signal(EFetch);
@@ -343,7 +391,7 @@
         }
     else
         {
-        iObserver->UpdateErrorL(error);
+        User::Leave(error);  // causes RunError to be called
         }
     }
 
@@ -358,7 +406,26 @@
         iObserver->UpdateCancelled(IsUpdating());
         }
     Reset();
-    }
+    
+    iTimer.Cancel();
+    }
+// ---------------------------------------------------------------------------
+// CMailListModelUpdater::RunError
+// ---------------------------------------------------------------------------
+//
+TInt CMailListModelUpdater::RunError(TInt aError)
+    {
+    if ( aError != KErrNone )
+        {
+        TRAP_IGNORE( iObserver->UpdateErrorL( aError ) );
+        }
+    
+    return aError;
+    }
+
+
+
+
 
 // ---------------------------------------------------------------------------
 // Static constructor.
@@ -400,7 +467,7 @@
 
 	BaseConstructL( R_FSEMAILUI_MAIL_LIST_VIEW );
 
-	iMailListModelUpdater = new (ELeave) CMailListModelUpdater();
+	iMailListModelUpdater = CMailListModelUpdater::NewL();
 
 	// Don't construct this anywhere else than here.
 	// Don't delete this until in the destructor to avoid NULL checks.
@@ -418,6 +485,8 @@
 	iLastFocus = EFalse;
     iDeleteTask = new (ELeave) TDeleteTask<CFSEmailUiMailListVisualiser> (*this, HandleDeleteTaskL);
 
+    iNewMailTimer = CFSEmailUiGenericTimer::NewL( this );
+
 	iTouchFeedBack = MTouchFeedback::Instance();
  	}
 
@@ -481,8 +550,10 @@
     iMailTreeListVisualizer->SetEmptyListTextL( *emptyText );
     CleanupStack::PopAndDestroy( emptyText );
 
-    TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
-    iMailTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( normalColor );
+    iFocusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
+    iNormalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
+    iNodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor();
+    iMailTreeListVisualizer->RootNodeVisualizer()->SetNormalStateTextColor( iNormalTextColor );
 
     // Set page up and page down keys
     iMailTreeListVisualizer->AddCustomPageUpKey( EStdKeyPageUp );
@@ -573,8 +644,11 @@
 	// Don't construct this anywhere else than in constructor.
 	// Don't delete anywhere else thatn here to avoid NULL checks.
     delete iModel;
-    
+
     delete iDeleteTask;
+    DeleteSortWaitNote();
+    delete iNewMailTimer;
+    iNewMailIds.Close();
     }
 
 void CFSEmailUiMailListVisualiser::PrepareForExit()
@@ -583,27 +657,25 @@
     iMailListModelUpdater->Cancel();
     if ( iMsgNoteTimer )
         {
-        iMsgNoteTimer->Cancel();
+        // delete also cancels timer
         SafeDelete(iMsgNoteTimer);
         }
     if ( iDateChangeTimer )
         {
-        iDateChangeTimer->Cancel();
+        // delete also cancels timer
         SafeDelete(iDateChangeTimer);
         }
     if ( iMailListUpdater )
         {
-        iMailListUpdater->Stop();
+        // delete also cancels timer
         SafeDelete(iMailListUpdater);
         }
     if ( iAsyncRedrawer )
         {
-        iAsyncRedrawer->Cancel();
         SafeDelete(iAsyncRedrawer);
         }
     if ( iAsyncCallback )
         {
-        iAsyncCallback->Cancel();
         SafeDelete(iAsyncCallback);
         }
     if ( iMailList )
@@ -614,6 +686,13 @@
         {
         iControlBarControl->RemoveObserver( *this );
         }
+
+    if ( iNewMailTimer )
+        {
+        // delete also cancels timer
+        SafeDelete( iNewMailTimer );
+        }
+
     SafeDelete(iMailFolder);
     iTreeItemArray.Reset();
 	// Reset, not delete to avoid NULL checks.
@@ -639,6 +718,8 @@
 void CFSEmailUiMailListVisualiser::UpdateErrorL(TInt aError)
     {
     FUNC_LOG;
+    
+    DeleteSortWaitNote();
     User::Leave(aError);
     }
 
@@ -649,8 +730,13 @@
 void CFSEmailUiMailListVisualiser::UpdateBeginL()
     {
     FUNC_LOG;
+    iMailList->BeginUpdate();
+    iMailList->RemoveAllL();
+    iTreeItemArray.Reset();
     iModel->Reset();
-    iTreeItemArray.Reset();
+    iMailList->EndUpdateL();
+
+    SetListAndCtrlBarFocusL();
     }
 
 // ---------------------------------------------------------------------------
@@ -660,6 +746,7 @@
 void CFSEmailUiMailListVisualiser::UpdateProgressL(TFsTreeItemId& aParentId, RPointerArray<CFSMailMessage>& aMessages)
     {
     FUNC_LOG;
+    
     const TInt itemsInModel(iModel->Count());
     CreateModelItemsL(aMessages);
     RefreshListItemsL(aParentId, itemsInModel, iModel->Count());
@@ -672,6 +759,13 @@
 void CFSEmailUiMailListVisualiser::UpdateCompleteL()
     {
     FUNC_LOG;
+    TBool sorting = EFalse;
+    if ( iSortWaitNote )
+        {
+        sorting = ETrue;
+        }
+    DeleteSortWaitNote();
+    
     if ( !iModel->Count() )
         {
         iFocusedControl = EControlBarComponent;
@@ -685,10 +779,12 @@
             }
         }
     SetListAndCtrlBarFocusL();
-    if(!CheckAutoSyncSettingL())
+    
+    if( !CheckAutoSyncSettingL() && !sorting )
         {
         iAppUi.StartMonitoringL();
         }
+    
     TIMESTAMP( "Locally stored messages fetched for message list" );
     }
 
@@ -699,16 +795,51 @@
 void CFSEmailUiMailListVisualiser::UpdateCancelled(const TBool aForceRefresh)
     {
     FUNC_LOG;
+    
     iForceRefresh = aForceRefresh;
+    DeleteSortWaitNote();
+    }
+
+// ---------------------------------------------------------------------------
+// CFSEmailUiMailListVisualiser::DeleteSortWaitNote
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiMailListVisualiser::DeleteSortWaitNote()
+    {
+    if ( iSortWaitNote )
+        {
+        TRAP_IGNORE( iSortWaitNote->ProcessFinishedL() );
+        iSortWaitNote = NULL;
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// Asynchronous mail list model sort.
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiMailListVisualiser::SortMailListModelAsyncL()
+    {
+    FUNC_LOG;
+   
+    DeleteSortWaitNote();
+  
+    TBool ret = UpdateMailListModelAsyncL( KCMsgBlockSort );
+    
+    if ( ret )
+        {
+        TFsEmailUiUtility::ShowWaitNoteL( iSortWaitNote, R_FSE_WAIT_SORTING_TEXT, EFalse, ETrue );
+        }
     }
 
 // ---------------------------------------------------------------------------
 // Asynchronous mail list model update.
 // ---------------------------------------------------------------------------
 //
-void CFSEmailUiMailListVisualiser::UpdateMailListModelAsyncL()
-    {
-    FUNC_LOG;
+TBool CFSEmailUiMailListVisualiser::UpdateMailListModelAsyncL(TInt aBlockSize)
+    {
+    FUNC_LOG;
+    TBool ret = EFalse;
     if ( iMailFolder )
         {
         TFSMailDetails details( EFSMsgDataEnvelope );
@@ -723,12 +854,15 @@
             sorting.AppendL( secondarySortCriteria );
             }
         // List all or maximum number of messages
-        iMailListModelUpdater->UpdateModelL(*this, iMailFolder->ListMessagesL(details, sorting));
+        iMailListModelUpdater->UpdateModelL(*this, iMailFolder->ListMessagesL(details, sorting), aBlockSize);
+        ret = ETrue;
         }
     else
         {
         UpdateCompleteL();
         }
+    
+    return ret;
     }
 
 // ---------------------------------------------------------------------------
@@ -813,13 +947,16 @@
 		    {
 		    CFSMailMessage* nextMessage = aMessages[0];
 		    CFSEmailUiMailListModelItem* previousMessage(static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(iModel->Count() - 1)));
-            TBool needANewDivider =
-                !MessagesBelongUnderSameSeparatorL( previousMessage->MessagePtr(), *nextMessage );
-            if ( needANewDivider )
+            if ( previousMessage ) // Safety
                 {
-                newItem = CreateSeparatorModelItemLC( *nextMessage );
-                iModel->AppendL( newItem );
-                CleanupStack::Pop( newItem );
+                TBool needANewDivider =
+                    !MessagesBelongUnderSameSeparatorL( previousMessage->MessagePtr(), *nextMessage );
+                if ( needANewDivider )
+                    {
+                    newItem = CreateSeparatorModelItemLC( *nextMessage );
+                    iModel->AppendL( newItem );
+                    CleanupStack::Pop( newItem );
+                    }
                 }
             }
 		else
@@ -1084,28 +1221,59 @@
         SetMailListItemsExtendedL();
         TInt count(0);
         count = aMessages.Count();
+
         for ( TInt i = 0 ; i < count ; ++i )
             {
             // Make sure we don't add duplicate items.
             TInt existingIdx = ItemIndexFromMessageId( aMessages[i] );
             if ( existingIdx < 0 )
                 {
-                CFSMailMessage* msgPtr = iAppUi.GetMailClient()->GetMessageByUidL( iAppUi.GetActiveMailboxId(),
-                                                                                    iMailFolder->GetFolderId(),
-                                                                                    aMessages[i] ,
-                                                                                   EFSMsgDataEnvelope );
-                if (msgPtr == NULL)
-                    {
-                    User::Leave(KErrNotFound);
-                    }
-                CleanupStack::PushL( msgPtr );
-                //first item - show scrollbar
-                //last item - updete scrollbar
-                TBool allowRefresh = ( i == 0 || i == count - 1 );
-                InsertNewMessageL( msgPtr, allowRefresh );
-                CleanupStack::Pop( msgPtr ); // ownership transferred to model
+                iNewMailIds.Append( aMessages[ i ] );
                 }
             }
+
+        // if iNewMailIds is not empty - start timer
+        if ( !iNewMailTimer->IsActive() && iNewMailIds.Count() )
+            {
+            iNewMailTimer->Start( KNewMailTimerDelay );
+            }
+        }
+    }
+
+
+// ---------------------------------------------------------------------------
+// TimerEventL
+//
+// ---------------------------------------------------------------------------
+//
+void CFSEmailUiMailListVisualiser::TimerEventL( CFSEmailUiGenericTimer* /*aTriggeredTimer*/ )
+    {
+    TInt count = Min( KNewMailMaxBatch, iNewMailIds.Count() );
+    CFSMailClient* mailClient = iAppUi.GetMailClient();
+
+    for ( TInt i = 0; i < count; i++ )
+        {
+        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 ); 
+        }
+
+    // if timer stoped then restart if more messages available
+    if ( iNewMailIds.Count() && ! iNewMailTimer->IsActive() )
+        {
+        iNewMailTimer->Start( KNewMailTimerDelay );
         }
     }
 
@@ -1274,7 +1442,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
-		if ( item->ModelItemType() == ETypeMailItem )
+		if ( item && item->ModelItemType() == ETypeMailItem )
 			{
 			if ( !item->MessagePtr().IsFlagSet(EFSMsgFlag_Read) )
 				{
@@ -1531,6 +1699,13 @@
     // Tries to create an extension for the Ozone plugin
     CreateExtensionL();
 
+    // if mailbox changed stop timer driven insertion of new mails into list
+    if ( activationData.iMailBoxId != prevMailBoxId )
+        {
+        iNewMailTimer->Cancel();
+        iNewMailIds.Reset();
+        }
+
     // CHECK IF MODEL NEEDS TO BE UPDATED
     if ( activationData.iMailBoxId != prevMailBoxId ||
          activationData.iFolderId != prevFolderId ||
@@ -1595,20 +1770,24 @@
             }
         else
             {
-            UpdateMailListModelAsyncL();
+            UpdateMailListModelAsyncL( KCMsgBlockSort );
             }
         }
     else if(refreshState == EFocusChangeNeeded)
         {//Move focus to the beginning of the list
         TInt firstIndex(0);
-        TFsTreeItemId firstItemId = iMailList->Child( KFsTreeRootID, firstIndex );
+        TFsTreeItemId firstItemId(KFsTreeNoneID);
+        if ( iMailList->CountChildren( KFsTreeRootID ) )
+            {
+            firstItemId = iMailList->Child( KFsTreeRootID, firstIndex );
+            }
         iMailTreeListVisualizer->SetFocusedItemL( firstItemId, EFalse );
         //if the view is already active don't update the list so it won't "blink" 
         //when the view is activated.
         if(!iThisViewActive)
-          {
+            {
             iMailList->ShowListL();
-          }
+            }
         }
     // THE CORRECT FOLDER IS ALREADY OPEN. CHECK IF SOME PARTIAL UPDATE IS NEEDED.
     else
@@ -2069,15 +2248,18 @@
                 {
                 CFSEmailUiMailListModelItem* item =
                         static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) );
-                CFSMailMessage* confirmedMsgPtr(0);
-                confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(),
-                iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope );
-                TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read );
-                delete confirmedMsgPtr;
-                if ( !isReadMessage )
+                if ( item ) // Safety
                     {
-                    ret = EFalse;
-                    break;
+                    CFSMailMessage* confirmedMsgPtr(0);
+                    confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(),
+                    iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope );
+                    TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read );
+                    delete confirmedMsgPtr;
+                    if ( !isReadMessage )
+                        {
+                        ret = EFalse;
+                        break;
+                        }
                     }
                 }
             }
@@ -2105,15 +2287,18 @@
                 {
                 CFSEmailUiMailListModelItem* item =
                         static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(i) );
-                CFSMailMessage* confirmedMsgPtr(0);
-                confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(),
-                iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope );
-                TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read );
-                delete confirmedMsgPtr;
-                if ( isReadMessage )
+                if ( item ) // Safety
                     {
-                    ret = EFalse;
-                    break;
+                    CFSMailMessage* confirmedMsgPtr(0);
+                    confirmedMsgPtr = iAppUi.GetMailClient()->GetMessageByUidL(iAppUi.GetActiveMailboxId(),
+                    iMailFolder->GetFolderId(), item->MessagePtr().GetMessageId(), EFSMsgDataEnvelope );
+                    TBool isReadMessage = confirmedMsgPtr->IsFlagSet( EFSMsgFlag_Read );
+                    delete confirmedMsgPtr;
+                    if ( isReadMessage )
+                        {
+                        ret = EFalse;
+                        break;
+                        }
                     }
                 }
             }
@@ -2657,15 +2842,11 @@
 TFsTreeItemId CFSEmailUiMailListVisualiser::InsertListItemL( TInt aModelIndex,
                                                              TFsTreeItemId aParentNodeId,
                                                              TInt aChildIdx, /*= KErrNotFound*/
-                                                             TBool aAllowRefresh )
-    {
-    FUNC_LOG;
-    TRect screenRec( iAppUi.ClientRect() );
+                                                             TBool aAllowRefresh /*= ETrue*/ )
+    {
+    FUNC_LOG;
     CFsTreePlainTwoLineItemData* itemData = NULL;
     CFsTreePlainTwoLineItemVisualizer* itemVisualizer = NULL;
-    TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
-    TRgb normalColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
-
     CFSEmailUiMailListModelItem* item =
         static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(aModelIndex) );
 
@@ -2691,8 +2872,9 @@
    	itemVisualizer->SetPreviewPaneOn( previewOn );
    	itemVisualizer->SetExtendable( ETrue );
 
-    itemVisualizer->SetFocusedStateTextColor( focusedColor );
-    itemVisualizer->SetNormalStateTextColor( normalColor );
+   	// Set correct skin text colors for the list items
+   	itemVisualizer->SetFocusedStateTextColor( iFocusedTextColor );
+    itemVisualizer->SetNormalStateTextColor( iNormalTextColor );
 
     // Set font height
     itemVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
@@ -2944,11 +3126,14 @@
                         {
                         CFSEmailUiMailListModelItem* modelItem =
                             static_cast<CFSEmailUiMailListModelItem*>( iModel->Item(idx) );
-                        CFSMailMessage& msgRef = modelItem->MessagePtr();
-                        UpdatePreviewPaneTextForItemL( aListItemId, &msgRef );
-                        if ( aUpdateItem )
+                        if ( modelItem ) // For safety
                             {
-                            iMailTreeListVisualizer->UpdateItemL( aListItemId );
+                            CFSMailMessage& msgRef = modelItem->MessagePtr();
+                            UpdatePreviewPaneTextForItemL( aListItemId, &msgRef );
+                            if ( aUpdateItem )
+                                {
+                                iMailTreeListVisualizer->UpdateItemL( aListItemId );
+                                }
                             }
                         }
                     }
@@ -2965,40 +3150,40 @@
 void CFSEmailUiMailListVisualiser::CreatePlainNodeL( const TDesC* aItemDataBuff,
                                                      CFsTreePlainOneLineNodeData* &aItemData,
                                                      CFsTreePlainOneLineNodeVisualizer* &aNodeVisualizer ) const
-	{
+    {
     FUNC_LOG;
     aItemData = CFsTreePlainOneLineNodeData::NewL();
     CleanupStack::PushL( aItemData );
 
     aItemData->SetDataL( *aItemDataBuff );
-	aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ));
+    aItemData->SetIconExpanded( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeExpanded ));
     aItemData->SetIconCollapsed( iAppUi.FsTextureManager()->TextureByIndex( EListTextureNodeCollapsed ));
     aNodeVisualizer = CFsTreePlainOneLineNodeVisualizer::NewL(*iMailList->TreeControl());
     CleanupStack::PushL( aNodeVisualizer );
-    TRect screenRect = iAppUi.ClientRect();
     TInt nodeHeight = iAppUi.LayoutHandler()->OneLineListNodeHeight();
-    aNodeVisualizer->SetSize( TSize(screenRect.Width(), nodeHeight) );
+    // use cached client rect instead of iAppUi.ClientRect() to save time
+    // ASSERT in debug to be sure that rects are these same
+    __ASSERT_DEBUG( iAppUi.ClientRect() == iCurrentClientRect, User::Invariant() );
+    aNodeVisualizer->SetSize( TSize(iCurrentClientRect.Width(), nodeHeight) );
     aNodeVisualizer->SetExtendable(EFalse);
-  	// Set correct skin text colors for the list items
-   	TRgb focusedColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
-   	TRgb normalColor = iAppUi.LayoutHandler()->ListNodeTextColor();
-    aNodeVisualizer->SetFocusedStateTextColor( focusedColor );
-    aNodeVisualizer->SetNormalStateTextColor( normalColor );
-	// Set font height
-	aNodeVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
-	// Set font always bolded in nodes
-	aNodeVisualizer->SetTextBold( ETrue );
+    // Set correct skin text colors for the list items
+    aNodeVisualizer->SetFocusedStateTextColor( iFocusedTextColor );
+    aNodeVisualizer->SetNormalStateTextColor( iNodeTextColor );
+    // Set font height
+    aNodeVisualizer->SetFontHeight( iAppUi.LayoutHandler()->ListItemFontHeightInTwips() );
+    // Set font always bolded in nodes
+    aNodeVisualizer->SetTextBold( ETrue );
 
     //<cmail>
     CAlfBrush* titleDividerBgBrush =
         iAppUi.FsTextureManager()->TitleDividerBgBrushL();
     // ownership is not transfered
-	aNodeVisualizer->SetBackgroundBrush( titleDividerBgBrush );
+    aNodeVisualizer->SetBackgroundBrush( titleDividerBgBrush );
     //</cmail>
 
-	CleanupStack::Pop( aNodeVisualizer );
-	CleanupStack::Pop( aItemData );
-	}
+    CleanupStack::Pop( aNodeVisualizer );
+    CleanupStack::Pop( aItemData );
+    }
 
 // ---------------------------------------------------------------------------
 //
@@ -3073,6 +3258,15 @@
     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();
         }
     }
 
@@ -3445,17 +3639,18 @@
     {
     iSkinChanged = iSkinChanged || aSystemUpdate;
 
-    TRgb focusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
-    TRgb normalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
-
-    iNewEmailButton->SetNormalTextColor( normalTextColor );
-    iNewEmailButton->SetFocusedTextColor( focusedTextColor );
-
-    iFolderListButton->SetNormalTextColor( normalTextColor );
-    iFolderListButton->SetFocusedTextColor( focusedTextColor );
-
-    iSortButton->SetNormalTextColor( normalTextColor );
-    iSortButton->SetFocusedTextColor( focusedTextColor );
+    iFocusedTextColor = iAppUi.LayoutHandler()->ListFocusedStateTextSkinColor();
+    iNormalTextColor = iAppUi.LayoutHandler()->ListNormalStateTextSkinColor();
+    iNodeTextColor = iAppUi.LayoutHandler()->ListNodeTextColor();
+
+    iNewEmailButton->SetNormalTextColor( iNormalTextColor );
+    iNewEmailButton->SetFocusedTextColor( iFocusedTextColor );
+
+    iFolderListButton->SetNormalTextColor( iNormalTextColor );
+    iFolderListButton->SetFocusedTextColor( iFocusedTextColor );
+
+    iSortButton->SetNormalTextColor( iNormalTextColor );
+    iSortButton->SetFocusedTextColor( iFocusedTextColor );
 
     //sometimes theme wasn't properly refreshed on buttons, this helps
     iNewEmailButton->HideButton();
@@ -4776,7 +4971,7 @@
                             CFSEmailUiMailListModelItem* item =
                                 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) );
 
-                            if ( item->ModelItemType() == ETypeMailItem )  // Separators are not markable
+                            if ( item && item->ModelItemType() == ETypeMailItem )  // Separators are not markable
                                 {
                                 if ( iMailList->IsMarked( iMailList->FocusedItem() ) )
                                     {
@@ -5917,31 +6112,34 @@
         {
         CFSEmailUiMailListModelItem* selectedItem =
             static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( aIndex ));
-        CFSMailMessage& msgPtr = selectedItem->MessagePtr();
-        TBool msgWasReadBefore = msgPtr.IsFlagSet( EFSMsgFlag_Read );
-        if ( aRead != msgWasReadBefore )
-            {
-            if ( aRead )
-                {
-                // Send flags, local and server
-                msgPtr.SetFlag( EFSMsgFlag_Read );
-                }
-            else
+        if ( selectedItem ) // Safety
+            {
+            CFSMailMessage& msgPtr = selectedItem->MessagePtr();
+            TBool msgWasReadBefore = msgPtr.IsFlagSet( EFSMsgFlag_Read );
+            if ( aRead != msgWasReadBefore )
                 {
-                // Send flags, local and server
-                msgPtr.ResetFlag( EFSMsgFlag_Read );
-                }
-            msgPtr.SaveMessageL();  // Save flag
-
-            // Switch icon to correct one if mail list is visible
-            TBool needRefresh = ( iAppUi.CurrentActiveView()->Id() == MailListId );
-            UpdateMsgIconAndBoldingL( aIndex, needRefresh);
-
-            if ( iCurrentSortCriteria.iField == EFSMailSortByUnread )
-                {
-                // Attribute affecting the current sorting order has been changed.
-                // Thus, the list order may now be incorrect.
-                iListOrderMayBeOutOfDate = ETrue;
+                if ( aRead )
+                    {
+                    // Send flags, local and server
+                    msgPtr.SetFlag( EFSMsgFlag_Read );
+                    }
+                else
+                    {
+                    // Send flags, local and server
+                    msgPtr.ResetFlag( EFSMsgFlag_Read );
+                    }
+                msgPtr.SaveMessageL();  // Save flag
+
+                // Switch icon to correct one if mail list is visible
+                TBool needRefresh = ( iAppUi.CurrentActiveView()->Id() == MailListId );
+                UpdateMsgIconAndBoldingL( aIndex, needRefresh);
+
+                if ( iCurrentSortCriteria.iField == EFSMailSortByUnread )
+                    {
+                    // Attribute affecting the current sorting order has been changed.
+                    // Thus, the list order may now be incorrect.
+                    iListOrderMayBeOutOfDate = ETrue;
+                    }
                 }
             }
         }
@@ -5999,7 +6197,7 @@
         {
         CFSEmailUiMailListModelItem* modelItem =
             static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( aIndex ) );
-        if ( modelItem->ModelItemType() == ETypeMailItem )
+        if ( modelItem && modelItem->ModelItemType() == ETypeMailItem )
             {
             // This is beacause message deleted event migh have occured.
             CFSMailMessage* confirmedMsgPtr = NULL;
@@ -6056,7 +6254,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( HighlightedIndex() ) );
-		if ( item->ModelItemType() == ETypeMailItem )
+		if ( item && item->ModelItemType() == ETypeMailItem )
 			{
 			// This is beacause message deleted event migh have occured.
 			CFSMailMessage* confirmedMsgPtr = NULL;
@@ -6108,21 +6306,24 @@
 			CFSEmailUiMailListModelItem* item =
 				static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( mailItemIdx ) );
 
-			// Update all flags
-			TUint32 prevFlags = item->MessagePtr().GetFlags();
-			TUint32 newFlags = aMsgPtr->GetFlags();
-			if ( prevFlags != newFlags )
-			    {
-			    item->MessagePtr().ResetFlag( prevFlags );
-			    item->MessagePtr().SetFlag( newFlags );
-
-			    // Save changed flags in internal model array
-			    item->MessagePtr().SaveMessageL();
-			    }
-
-			// Update the list item graphics
-			UpdateMsgIconAndBoldingL( mailItemIdx );
-			}
+            if ( item ) // For safety
+                {
+                // Update all flags
+                TUint32 prevFlags = item->MessagePtr().GetFlags();
+                TUint32 newFlags = aMsgPtr->GetFlags();
+                if ( prevFlags != newFlags )
+                    {
+                    item->MessagePtr().ResetFlag( prevFlags );
+                    item->MessagePtr().SetFlag( newFlags );
+
+                    // Save changed flags in internal model array
+                    item->MessagePtr().SaveMessageL();
+                    }
+
+                // Update the list item graphics
+                UpdateMsgIconAndBoldingL( mailItemIdx );
+                }
+            }
 		}
 	}
 
@@ -6490,7 +6691,7 @@
         {
         CFSEmailUiMailListModelItem* item =
     			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(aItemIdx));
-    	if ( item->ModelItemType() == ETypeMailItem )
+    	if ( item && item->ModelItemType() == ETypeMailItem )
     	    {
     	    msgId = item->MessagePtr().GetMessageId();
     	    }
@@ -6518,7 +6719,7 @@
             {
             CFSEmailUiMailListModelItem* item =
                 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) );
-            if ( aListId == item->CorrespondingListId() )
+            if ( item && aListId == item->CorrespondingListId() )
                 {
                 msgId = item->MessagePtr().GetMessageId();
                 // if list id points to separator
@@ -6642,27 +6843,27 @@
     		CFSEmailUiMailListModelItem* item =
                 static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( i ) );
 			// when the item is a separator check whether its MessagePtr is valid (actually it's a reference)
-			if( &(item->MessagePtr()) != NULL)
-				{
-    		if ( aMessageId == item->MessagePtr().GetMessageId() )
-    			{
-    			TModelItemType itemType = item->ModelItemType();
-    			TBool separator( aMessageId.IsSeparator() );
-
-    			// Because separator and the first message after separator
-    			// have same message id, we need to separate these cases
-    			// and that is made with separator flag which is stored to
-    			// TFSMailMsgId object. If separator flag is on item need to be
-    			// separator if it is not on item needs to be mail item.
-    			if( ( separator && itemType == ETypeSeparator ) ||
-    			    ( !separator && itemType == ETypeMailItem ) )
+            if( item && &(item->MessagePtr()) != NULL)
+                {
+                if ( aMessageId == item->MessagePtr().GetMessageId() )
                     {
-                    idx = i;
-                    break;
+                    TModelItemType itemType = item->ModelItemType();
+                    TBool separator( aMessageId.IsSeparator() );
+
+                    // Because separator and the first message after separator
+                    // have same message id, we need to separate these cases
+                    // and that is made with separator flag which is stored to
+                    // TFSMailMsgId object. If separator flag is on item need to be
+                    // separator if it is not on item needs to be mail item.
+                    if( ( separator && itemType == ETypeSeparator ) ||
+                        ( !separator && itemType == ETypeMailItem ) )
+                        {
+                        idx = i;
+                        break;
+                        }
                     }
-    			}
-    		}
-        }
+                }
+            }
 		}
 	return idx;
     }
@@ -6731,7 +6932,7 @@
     	{
     	const CFSEmailUiMailListModelItem* item =
 		    static_cast<const CFSEmailUiMailListModelItem*>( iModel->Item(i) );
-    	if ( aItemId == item->CorrespondingListId() )
+    	if ( item && aItemId == item->CorrespondingListId() )
     		{
     		ret = i;
     		break;
@@ -6984,12 +7185,13 @@
 	iMailList->SetFocusedL( EFalse );
     iControlBarControl->SetFocusByIdL( iSortButtonId );
 
+    SortMailListModelAsyncL();  // sort can take long time
     // <cmail>
-	if ( iMailListUpdater )
-	    {
+	//if ( iMailListUpdater )
+	//    {
     	// Start updating mail list with sorting parameter.
-    	iMailListUpdater->StartL( ETrue );
-	    }
+    //	iMailListUpdater->StartL( ETrue );
+	//    }
     // </cmail>
 	SetMskL();
 	}
@@ -7035,7 +7237,7 @@
 	    {
 	    CFSEmailUiMailListModelItem* item =
 	        static_cast<CFSEmailUiMailListModelItem*>( Model()->Item(idx) );
-	    if ( item->ModelItemType() == ETypeMailItem )
+	    if ( item && item->ModelItemType() == ETypeMailItem )
 	        {
 	        // First make sure that the highlighted message really exists in the store
 	        // Get confirmed msg ptr
@@ -7764,7 +7966,7 @@
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) );
 
-		if ( item->ModelItemType() == ETypeMailItem )  // Separators are not markable
+		if ( item && item->ModelItemType() == ETypeMailItem )  // Separators are not markable
 		    {
 			if ( !iListMarkItemsState )
 				{
--- a/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSearchListVisualiser.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -1021,16 +1021,19 @@
 				{
 				CFSEmailUiMailListModelItem* item =
 					static_cast<CFSEmailUiMailListModelItem*>( Model()->Item( HighlightedIndex() ) );
-				CFSMailMessage& msg = item->MessagePtr();
-
-	  			TMsgDetailsActivationData msgDetailsData;
-	  			msgDetailsData.iMailBoxId = msg.GetMailBoxId();
-	  			msgDetailsData.iFolderId = msg.GetFolderId();
-	  			msgDetailsData.iMessageId = msg.GetMessageId();
-
-				const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData );
-				iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning,  pkgOut);
-				}
+                if ( item ) // Safety
+                    {
+                    CFSMailMessage& msg = item->MessagePtr();
+                    
+                    TMsgDetailsActivationData msgDetailsData;
+                    msgDetailsData.iMailBoxId = msg.GetMailBoxId();
+                    msgDetailsData.iFolderId = msg.GetFolderId();
+                    msgDetailsData.iMessageId = msg.GetMessageId();
+                    
+                    const TPckgBuf<TMsgDetailsActivationData> pkgOut( msgDetailsData );
+                    iAppUi.EnterFsEmailViewL( MsgDetailsViewId, KStartMsgDetailsToBeginning,  pkgOut);					
+                    }
+                }
 			}
 			break;
        	case EFsEmailUiCmdHelp:
@@ -1319,9 +1322,20 @@
                 break;
             }
         }
-    else if (aEvent.IsPointerEvent())
+    else if ( aEvent.IsPointerEvent() )
         {
-        iSearchList->TreeControl()->OfferEventL(aEvent);
+        // event should be forwarded to list only if it 
+        // contains at least one item
+        if ( iModel->Count() )
+            {
+            result = iSearchList->TreeControl()->OfferEventL( aEvent );
+            }
+        else
+            {
+            // otherwise we consume it so no other ALF controls gets it
+            // e.g. ControlBar
+            result = ETrue;
+            }
         }
 
     return result;
@@ -1395,7 +1409,7 @@
         {
         CFSEmailUiMailListModelItem* item =
     			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(aItemIdx));
-    	if ( item->ModelItemType() == ETypeMailItem )
+    	if ( item && item->ModelItemType() == ETypeMailItem )
     	    {
     	    msgId = item->MessagePtr().GetMessageId();
     	    }
@@ -1412,7 +1426,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
-		if ( item->ModelItemType() == ETypeMailItem &&
+		if ( item && item->ModelItemType() == ETypeMailItem &&
 		     aListId == item->CorrespondingListId() )
 			{
 			msgId = item->MessagePtr().GetMessageId();
@@ -1430,7 +1444,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
-		if ( aListId == item->CorrespondingListId() )
+		if ( item && aListId == item->CorrespondingListId() )
 			{
 			msgPtr = &item->MessagePtr();
 			}
@@ -1479,7 +1493,7 @@
 		{
 		CFSEmailUiMailListModelItem* item =
 			static_cast<CFSEmailUiMailListModelItem*>(iModel->Item(i));
-		if ( item->ModelItemType() == ETypeMailItem &&
+		if ( item && item->ModelItemType() == ETypeMailItem &&
 		     aMessageId == item->MessagePtr().GetMessageId() )
 			{
 			idx = i;
@@ -1542,7 +1556,7 @@
 
 	CFSEmailUiMailListModelItem* item =
 		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ) );
-	if ( item->ModelItemType() == ETypeMailItem )
+	if ( item && item->ModelItemType() == ETypeMailItem )
 		{
 		// First make sure that the highlighted message really exists in the store
 		// Get confirmed msg ptr
@@ -2047,30 +2061,32 @@
 		{
 		CFSEmailUiMailListModelItem* selectedItem =
 	 		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( HighlightedIndex() ));
-
-	 	TBool wasRead = selectedItem->MessagePtr().IsFlagSet( EFSMsgFlag_Read );
-	 	if ( (wasRead && !aRead) || (!wasRead && aRead) )
-	 	    {
-	 	    // Read status is changed
-	 	    iMsgDataCouldBeChanged = ETrue;
+        if ( selectedItem ) // Safety
+            {
+            TBool wasRead = selectedItem->MessagePtr().IsFlagSet( EFSMsgFlag_Read );
+            if ( (wasRead && !aRead) || (!wasRead && aRead) )
+                {
+                // Read status is changed
+                iMsgDataCouldBeChanged = ETrue;
 
-    		if ( aRead )
-     			{
-    			// Send flags, local and server
-     			selectedItem->MessagePtr().SetFlag( EFSMsgFlag_Read );
-    			}
-    		else
-    			{
-    			// Send flags, local and server
-     			selectedItem->MessagePtr().ResetFlag( EFSMsgFlag_Read );
-    			}
-    		selectedItem->MessagePtr().SaveMessageL();	// Save flag
-    		// Switch icon to correct one
-    		UpdateMsgIconAndBoldingL( HighlightedIndex() );
-	 	    }
-		}
-	}
-
+                if ( aRead )
+                    {
+                    // Send flags, local and server
+                    selectedItem->MessagePtr().SetFlag( EFSMsgFlag_Read );
+                    }
+                else
+                    {
+                    // Send flags, local and server
+                    selectedItem->MessagePtr().ResetFlag( EFSMsgFlag_Read );
+                    }
+                selectedItem->MessagePtr().SaveMessageL();	// Save flag
+                // Switch icon to correct one
+                UpdateMsgIconAndBoldingL( HighlightedIndex() );
+                }
+            }
+        }
+	} 
+	
 void CFSEmailUiSearchListVisualiser::CheckAndUpdateFocusedMessageL()
 	{
     FUNC_LOG;
@@ -2079,7 +2095,7 @@
 		TInt highlightedIndex = HighlightedIndex();
 		CFSEmailUiMailListModelItem* selectedItem =
 	 		static_cast<CFSEmailUiMailListModelItem*>( iModel->Item( highlightedIndex ));
-		if ( selectedItem->ModelItemType() == ETypeMailItem )
+		if ( selectedItem && selectedItem->ModelItemType() == ETypeMailItem )
 			{
 			CFSMailMessage* msgPtr = &selectedItem->MessagePtr();
 			if ( msgPtr )
--- a/emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSettingsList.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -519,6 +519,8 @@
 void CFsEmailSettingsList::HandleUserSelectionsL()
     {
     FUNC_LOG;
+    
+    iView.HideStylusPopUpMenu();
 
     TInt index = iListBox->CurrentItemIndex();
     TInt count = Count();
@@ -1804,12 +1806,17 @@
 // ---------------------------------------------------------------------------
 //
 void CFsEmailSettingsList::ClearFocus()
-	{
-	iListBox->ItemDrawer()->SetFlags( CListItemDrawer::EDisableHighlight );
-	iListBox->ClearSelection();
-	iListBox->DrawNow();
-	iListBox->ItemDrawer()->ClearFlags( CListItemDrawer::EDisableHighlight );
-	}
+    {
+    FUNC_LOG;
+    iListBox->ItemDrawer()->ClearFlags( CListItemDrawer::EPressedDownState );
+    iListBox->ItemDrawer()->SetFlags( CListItemDrawer::ESingleClickDisabledHighlight
+                                    | CListItemDrawer::ESingleClickEnabled ); 
+    TInt ci( iListBox->CurrentItemIndex() );
+    if ( KErrNotFound != ci )
+        {
+        iListBox->DrawItem( ci );
+        }
+    }
 
 
 // End of file. 
--- a/emailuis/emailui/src/FreestyleEmailUiSettingsListView.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiSettingsListView.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -87,6 +87,8 @@
    		delete iStylusPopUpMenu;
    		iStylusPopUpMenu = NULL;
    		}
+   	
+   	delete iCoeControl;
 	}
 
 
@@ -179,6 +181,19 @@
     	}
 	}
 
+// -----------------------------------------------------------------------------
+// CFsEmailSettingsListView::HideStylusPopUpMenu()
+// Hides the pop-up menu.
+// -----------------------------------------------------------------------------
+//
+void CFsEmailSettingsListView::HideStylusPopUpMenu()
+    {
+    if ( iStylusPopUpMenu )
+        {
+        TRAP_IGNORE( iStylusPopUpMenu->HandleControlEventL( iCoeControl,
+                        MCoeControlObserver::EEventRequestExit ) );
+        }
+    }
 
 // -----------------------------------------------------------------------------
 // CFsEmailSettingsListView::DisplayCreateQuery
@@ -297,8 +312,11 @@
         	}
         case KErrCancel:
         	{
-        	// The pop-up menu was cancelled.
-        	iFsEmailSettingsList->ClearFocus();
+        	if ( iFsEmailSettingsList )
+        	    {
+                // The pop-up menu was cancelled.
+                iFsEmailSettingsList->ClearFocus();
+        	    }
         	break;
         	}
 		default:
@@ -464,6 +482,12 @@
 		}
 	// setup status pane title
     SetupStatusPaneL();
+    
+    if ( !iCoeControl )
+        {
+        // dymmy control for closing stylus pop up menu
+        iCoeControl = new( ELeave )CCoeControl;
+        }
 
     if( !iStylusPopUpMenu )
         {
@@ -531,40 +555,33 @@
 // ---------------------------------------------------------------------------
 //
 void CFsEmailSettingsListView::DynInitMenuPaneL( 
-		TInt aResourceId, 
-		CEikMenuPane* aMenuPane )
-	{
+        TInt aResourceId, 
+        CEikMenuPane* aMenuPane )
+    {
     FUNC_LOG;
 
-	if ( iFsEmailSettingsList && aResourceId == R_FS_EMAIL_SETTINGS_LIST_MENU_PANE )
-		{
-		
-	    if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
-		   {
-		   // remove help support in pf5250
-		   aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
-		   }
-	    		
+    if ( iFsEmailSettingsList && aResourceId == R_FS_EMAIL_SETTINGS_LIST_MENU_PANE )
+        {
+        aMenuPane->SetItemDimmed( EFsEmailUiCmdSettingsRemoveAccount, ETrue );
+
+        if ( FeatureManager::FeatureSupported( KFeatureIdFfCmailIntegration ) )
+           {
+           // remove help support in pf5250
+           aMenuPane->SetItemDimmed( EFsEmailUiCmdHelp, ETrue);      
+           }
+        
         TInt lastIndex = iFsEmailSettingsList->Count()-1;
-		// Dimm add/remove in 2nd level
+        // Dimm add/remove in 2nd level
         if ( iFsEmailSettingsList->Get2ndLevelListIndicator() )
             {
             aMenuPane->SetItemDimmed(EFsEmailUiCmdSettingsAddAccount, ETrue );
-            aMenuPane->SetItemDimmed( EFsEmailUiCmdSettingsRemoveAccount, ETrue );
             }
-		// Else dimm remove mailbox if no mailbox selected 
-		else if ( iFsEmailSettingsList->ListBox()->CurrentItemIndex() == 0
-			|| ( iFsEmailSettingsList->ListBox()->CurrentItemIndex() == lastIndex
-			&& iFsEmailSettingsList->PIMSyncItemVisible())  )
-			{
-			aMenuPane->SetItemDimmed( EFsEmailUiCmdSettingsRemoveAccount, ETrue );
-			}
-		}
+        }
 
-	// Add shortcut hints
-	iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, 
-	                             CFSEmailUiShortcutBinding::EContextSettings );	
-	}
+    // Add shortcut hints
+    iAppUi.ShortcutBinding().AppendShortcutHintsL( *aMenuPane, 
+                                 CFSEmailUiShortcutBinding::EContextSettings );
+    }
 
 // ---------------------------------------------------------------------------
 // SetupStatusPaneL()
--- a/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleEmailUiUtilities.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -236,7 +236,7 @@
         iHandleOpen = EFalse;
         }
     MAknServerAppExitObserver::HandleServerAppExit( aReason );
-    
+
     // Get current AppUi.
     CFreestyleEmailUiAppUi* appUi = (CFreestyleEmailUiAppUi*)CCoeEnv::Static()->AppUi();
     if( appUi->EmbeddedApp() )
@@ -244,7 +244,7 @@
         // Set embedded application flag to false when embedded application exit.
         appUi->SetEmbeddedApp( EFalse );
         }
-    
+
     // if email editor is not started from embedded app.
     if( !appUi->EditorStartedFromEmbeddedApp() )
         {
@@ -521,7 +521,7 @@
 // -----------------------------------------------------------------------------
 void TFsEmailUiUtility::ShowDiscreetInfoNoteL( TInt aResourceStringId )
     {
-    FUNC_LOG;   
+    FUNC_LOG;
     HBufC* noteText = StringLoader::LoadLC( aResourceStringId );
     ShowDiscreetInfoNoteL( *noteText );
     CleanupStack::PopAndDestroy( noteText );
@@ -532,7 +532,7 @@
 // -----------------------------------------------------------------------------
 void TFsEmailUiUtility::ShowDiscreetInfoNoteL( const TDesC& aNoteText )
     {
-    FUNC_LOG;   
+    FUNC_LOG;
     //create a host of dummy parameters in order to change the popup duration flag...
     const TDesC& dummyText = KNullDesC;
     CGulIcon* dummyIcon = NULL;
@@ -540,18 +540,18 @@
     const TDesC& dummyBitmapFile = KNullDesC;
     const TInt dummyBitmapId = 0;
     const TInt dummyMaskId = 0;
-    
+
     //Set timeout flag
     TInt flags = 0;
     flags |= KAknDiscreetPopupDurationLong;
-    
-    CAknDiscreetPopup::ShowLocalPopupL( aNoteText, 
-                                        dummyText, 
-                                        dummyIcon, 
+
+    CAknDiscreetPopup::ShowLocalPopupL( aNoteText,
+                                        dummyText,
+                                        dummyIcon,
                                         dummySkinId,
-                                        dummyBitmapFile, 
-                                        dummyBitmapId, 
-                                        dummyMaskId, 
+                                        dummyBitmapFile,
+                                        dummyBitmapId,
+                                        dummyMaskId,
                                         flags);
     }
 
@@ -704,8 +704,8 @@
 void TFsEmailUiUtility::ShowFilesSavedToFolderNoteL( TInt aCount )
     {
     FUNC_LOG;
-    if ( !iDownloadSave || iSaveSelect ) 
-        { 
+    if ( !iDownloadSave || iSaveSelect )
+        {
 	    if ( aCount == 1 )
 	        {
 	        HBufC* noteText = StringLoader::LoadLC( R_FREESTYLE_EMAIL_UI_ONE_ATTACHMENT_SAVED );
@@ -719,8 +719,8 @@
 	        CleanupStack::PopAndDestroy( noteText );
 	        }
         }
-    TFsEmailUiUtility::SetSaveSelect( ETrue ); 
-    TFsEmailUiUtility::SetDownloadSave( EFalse ); 
+    TFsEmailUiUtility::SetSaveSelect( ETrue );
+    TFsEmailUiUtility::SetDownloadSave( EFalse );
     }
 
 void TFsEmailUiUtility::SetDownloadSave( TBool aValue )
@@ -842,7 +842,7 @@
                 EFSMsgDataEnvelope ) );
 
         // If we still have no message, then try to convert the attachment file to message object (Activesync case).
-        if ( !message ) 
+        if ( !message )
             {
             // This takes some time so we show a wait dialog.
             if ( iOpeningWaitNote )
@@ -866,15 +866,15 @@
         // Open message to viewer if we got it. Otherwise continue with the standard file opening logic.
         if ( message )
             {
-            // Check that the embedded message has text body part or html body part. 
+            // Check that the embedded message has text body part or html body part.
             // Otherwise we cannot display it viewer and needs to be handled as a normal attachment.
-            
+
             CFSMailMessagePart* htmlPart = message->HtmlBodyPartL();
             CFSMailMessagePart* textPart = message->PlainTextBodyPartL();
-            
+
             if ( htmlPart || textPart  )
                 {
-                THtmlViewerActivationData htmlData; 
+                THtmlViewerActivationData htmlData;
                 htmlData.iActivationDataType = THtmlViewerActivationData::EmbeddedEmailMessage;
                 htmlData.iMailBoxId = aAttachmentPart.GetMailBoxId();
                 htmlData.iFolderId = aAttachmentPart.GetFolderId();
@@ -883,7 +883,7 @@
                 htmlData.iEmbeddedMessage = message;
                 htmlData.iEmbeddedMessageMode = ETrue;
                 TPckgBuf<THtmlViewerActivationData> pckgData( htmlData );
-                
+
                 appUi->EnterFsEmailViewL( HtmlViewerId, KStartViewerWithEmbeddedMsgPtr, pckgData );
                 openedAsMessage = ETrue;
                 }
@@ -892,7 +892,7 @@
                 //delete message object owned by us.
                 delete message;
                 }
-            
+
             if( htmlPart )
                 {
                 delete htmlPart;
@@ -901,7 +901,7 @@
                 {
                 delete textPart;
                 }
-            
+
             }
         }
 
@@ -1231,7 +1231,7 @@
     	{
     	mimeType.Set( aMimeType.Left(semiColonPos) );
     	}
-    
+
 	if ( !mimeType.CompareF(KPdfMimeString) )
 		{
 		fileType = EPdfType;
@@ -2330,7 +2330,7 @@
 
 // -----------------------------------------------------------------------------
 // TFsEmailUiUtility::CountRecipientsSmart
-// Calculates recipient count from To and Cc recipient as well as tries to 
+// Calculates recipient count from To and Cc recipient as well as tries to
 // see if the message is sent via message list.
 // -----------------------------------------------------------------------------
 TInt TFsEmailUiUtility::CountRecipientsSmart( CFreestyleEmailUiAppUi& aAppUi, CFSMailMessage* aMsgPtr )
@@ -2340,9 +2340,9 @@
     if ( numRecipients == 1 )
         {
         CFSMailBox* mailBox = NULL;
-        
+
         TRAPD( error, mailBox = aAppUi.GetMailClient()->GetMailBoxByUidL( aMsgPtr->GetMailBoxId() ) );
-        
+
         if (mailBox && !error)
             {
             //check if the malbox ownmailaddress is same as the recipients email address. If not, then assume that the
@@ -2369,10 +2369,10 @@
                     }
                 }
             }
-        
+
         delete mailBox;
         }
-    
+
     return numRecipients;
     }
 
@@ -2447,7 +2447,7 @@
 			}
         // <cmail>
 		TBool cancellationMsg = EFalse;
-		TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
+		//TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
 		if ( cancellationMsg )
 		    {
 		    textureId = EMessageCalInvitationCancelled;
@@ -2604,7 +2604,7 @@
 			}
 		// <cmail>
 		TBool cancellationMsg = EFalse;
-		TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
+		//TRAP_IGNORE( cancellationMsg = IsMrCancellationMsgL( aMsgPtr ) );
 		if ( cancellationMsg )
 		    {
             textureId = EMessageCalInvitationCancelled;
@@ -2809,16 +2809,16 @@
             mailbox.Num(aMailBox.Id());
 
             TBuf<256> str;
-            str.Copy(_L("<"));    
+            str.Copy(_L("<"));
             str.Append(mailbox);
-            str.Append(_L(">"));    
+            str.Append(_L(">"));
 
             TBuf<256> stored;
             TUint32 key(KCMailMailboxesWithNewMail);
             repository->Get( key, stored );
-    
+
             TInt result = stored.Find(str);
-    
+
             if (aIconOn)
                 {
                 if (result < 0) // Not found
@@ -2839,7 +2839,7 @@
         delete repository;
         }
 	}
-	
+
 // -----------------------------------------------------------------------------
 // TFsEmailUiUtility::DisplayMsgsMovedNoteL
 // -----------------------------------------------------------------------------
--- a/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/FreestyleMessageHeaderURLEventHandler.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -194,6 +194,12 @@
             break;
             }
             
+        case EFsEmailUiCmdCancelAllDownloads:
+            {
+            iView.CancelAllAttachmentsL();
+            break;
+            }
+            
         case EFsEmailUiCmdOpenAttachment:
             {
             iView.OpenAttachmentL( FindAttachmentL( *iMessageHeaderURL ) );
@@ -293,6 +299,7 @@
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSave, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdSaveAll, ETrue );
     iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelDownload, ETrue );   
+    iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelAllDownloads, ETrue );
 
     const TBool isMessage( iAttachmentsListModel->IsMessage( aAttachment ) );
     
@@ -341,7 +348,11 @@
                     iAttachmentsListModel->IsThereAnyMessageAttachments() && !iView.IsEmbeddedMsgSavingAllowed() );
             }         
         }
-   
+
+    if ( iAttachmentsListModel->IsMultiplyDownloadsOngoing() )
+        {
+        iAttachmentStylusPopup->SetItemDimmed( EFsEmailUiCmdCancelAllDownloads, EFalse );
+        }
     
     iAttachmentStylusPopup->SetPosition( iAppUi.LastSeenPointerPosition(), 
                                          CAknStylusPopUpMenu::EPositionTypeLeftTop );
--- a/emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/fsemailstatuspaneindicatorhandler.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -94,6 +94,7 @@
                 if ( prevMbox )
                     {
                     commonEmailRepository->Set( KCmailNewEmailDisplayText, prevMbox->GetName() );
+                    delete prevMbox;
                     }
                 }
             }
--- a/emailuis/emailui/src/ncsaddressinputfield.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/ncsaddressinputfield.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -872,4 +872,5 @@
 void CNcsAddressInputField::SetPhysicsEmulationOngoing( TBool aPhysOngoing )
     {
     iTextEditor->SetPhysicsEmulationOngoing( aPhysOngoing );
+    iButton->EnableFeedback( !aPhysOngoing );
     }
--- a/emailuis/emailui/src/ncsaifeditor.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/ncsaifeditor.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -351,10 +351,6 @@
         ret = CNcsEditor::OfferKeyEventL( aKeyEvent, aType );
         }
     
-    if( ret == EKeyWasNotConsumed  && aType == EEventKeyDown )
-        {
-        HandleTextUpdateDeferred(); // update for lang that don't support CPS
-        }
     return ret;
     }
 
@@ -594,7 +590,7 @@
     // First, add all the addresses without updating the editor text contents 
     for ( TInt i=0 ; i<aAddresses.Count() ; i++ )
         {
-    	AddAddressL( *aAddresses[i], ETrue );
+        AddAddressL( *aAddresses[i], EFalse );
         }
     // Update editor text content after all the items have been added
     RepositionEntriesL( NULL );
--- a/emailuis/emailui/src/ncscomposeview.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/emailui/src/ncscomposeview.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -746,13 +746,19 @@
         {
         // Hide toolbar if remotesearch is in progress, 
         // because it takes you into a different view
-        TBool hideToolbar = iContainer->IsRemoteSearchInprogress();
+        TBool hideToolbar = ( iContainer->IsRemoteSearchInprogress() 
+                || iAddingAttachmentDialogOpened );
         SetToolbarItemDimmed( EFsEmailUiTbCmdSend, iContainer->AreAddressFieldsEmpty() );
      
         CAknToolbar* toolbar(Toolbar());
         if (toolbar)
             {
             toolbar->SetToolbarVisibility(!hideToolbar);
+            // If toolbar is not hidden, redraw it (otherwise only dimmed/undimmed button will be redrawn)
+            if(!hideToolbar)
+            	{
+                toolbar->DrawDeferred();
+            	}
             }
         }
     }
@@ -1396,12 +1402,14 @@
         {
         toolbar->SetDimmed(ETrue); 
         }
-
+    
+    self->iAddingAttachmentDialogOpened = ETrue;
     self->iContainer->SwitchChangeMskOff( ETrue );
     TRAP( error, ok = attachmentControl->AppendAttachmentToListL(
                 self->iAttachmentAddType) );
     self->iContainer->SwitchChangeMskOff( EFalse );
-
+    self->iAddingAttachmentDialogOpened = EFalse;
+    
     if ( ok && error == KErrNone )
         {
         TRAP( error, self->SetAttachmentLabelContentL() );
--- a/emailuis/uicomponents/inc/fstreeitemvisualizer.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/inc/fstreeitemvisualizer.h	Mon Jun 21 15:20:54 2010 +0300
@@ -328,7 +328,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetFocusedStateTextColor( TRgb& aColor ) = 0;
+    virtual void SetFocusedStateTextColor( const TRgb& aColor ) = 0;
     
     /**
      * The function returns item's text color for the focused state.
@@ -340,7 +340,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetNormalStateTextColor( TRgb& aColor ) = 0;
+    virtual void SetNormalStateTextColor( const TRgb& aColor ) = 0;
     
     /**
      * The function returns item's text color for the normal (unfocused) state
--- a/emailuis/uicomponents/inc/fstreeitemvisualizerbase.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/inc/fstreeitemvisualizerbase.h	Mon Jun 21 15:20:54 2010 +0300
@@ -90,7 +90,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetFocusedStateTextColor( TRgb& aColor );
+    virtual void SetFocusedStateTextColor( const TRgb& aColor );
     
     /**
      * The function returns item's text color for the focused state.
@@ -102,7 +102,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetNormalStateTextColor( TRgb& aColor );
+    virtual void SetNormalStateTextColor( const TRgb& aColor );
     
     /**
      * The function returns item's text color for the normal (unfocused) state
--- a/emailuis/uicomponents/inc/fstreenodevisualizerbase.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/inc/fstreenodevisualizerbase.h	Mon Jun 21 15:20:54 2010 +0300
@@ -87,7 +87,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetFocusedStateTextColor( TRgb& aColor );
+    virtual void SetFocusedStateTextColor( const TRgb& aColor );
     
     /**
      * The function returns item's text color for the focused state.
@@ -99,7 +99,7 @@
      *
      * @param aColor New color to be set.
      */
-    virtual void SetNormalStateTextColor( TRgb& aColor );
+    virtual void SetNormalStateTextColor( const TRgb& aColor );
     
     /**
      * The function returns item's text color for the normal (unfocused) state
--- a/emailuis/uicomponents/src/fstreeitemvisualizerbase.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/src/fstreeitemvisualizerbase.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -81,7 +81,7 @@
 //  The function sets item's text color for the focused state.
 // ---------------------------------------------------------------------------
 //
-void CFsTreeItemVisualizerBase::SetFocusedStateTextColor( TRgb& aColor )
+void CFsTreeItemVisualizerBase::SetFocusedStateTextColor( const TRgb& aColor )
     {
     FUNC_LOG;
     iIsCustomTextFocusedColor = ETrue;
@@ -104,7 +104,7 @@
 //  The function sets item's text color for the normal (unfocused) state.
 // ---------------------------------------------------------------------------
 //
-void CFsTreeItemVisualizerBase::SetNormalStateTextColor( TRgb& aColor )
+void CFsTreeItemVisualizerBase::SetNormalStateTextColor( const TRgb& aColor )
     {
     FUNC_LOG;
     iIsCustomTextNormalColor = ETrue;
--- a/emailuis/uicomponents/src/fstreenodevisualizerbase.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/src/fstreenodevisualizerbase.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -81,7 +81,7 @@
 //  The function sets item's text color for the focused state.
 // ---------------------------------------------------------------------------
 //
-void CFsTreeNodeVisualizerBase::SetFocusedStateTextColor( TRgb& aColor )
+void CFsTreeNodeVisualizerBase::SetFocusedStateTextColor( const TRgb& aColor )
     {
     FUNC_LOG;
     iIsCustomTextFocusedColor = ETrue;
@@ -103,7 +103,7 @@
 //  The function sets item's text color for the normal (unfocused) state.
 // ---------------------------------------------------------------------------
 //
-void CFsTreeNodeVisualizerBase::SetNormalStateTextColor( TRgb& aColor )
+void CFsTreeNodeVisualizerBase::SetNormalStateTextColor( const TRgb& aColor )
     {
     FUNC_LOG;
     iIsCustomTextNormalColor = ETrue;
--- a/emailuis/uicomponents/src/fstreeplainonelineitemvisualizer.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/src/fstreeplainonelineitemvisualizer.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -594,8 +594,6 @@
 					iTextVisual->SetWrapping( CAlfTextVisual::ELineWrapTruncate );
 					}
             	}
-            
-            iManualWrapper = EFalse;
             }
         }
     }
--- a/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/uicomponents/src/fstreevisualizerbase.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -78,6 +78,7 @@
 #include "cuicscrollbar.h"
 
 #include <aknphysics.h>
+#include <touchfeedback.h> // for MTouchFeedback
 
 
 //CONSTANTS
@@ -1552,7 +1553,8 @@
         INFO_1("visual: $%x", aEvent.Visual());
         if (KErrNotFound != id || type == TPointerEvent::EDrag ||
                 type  == TPointerEvent::EButtonRepeat ||
-                type  == TPointerEvent::EButton1Up)
+                type  == TPointerEvent::EButton1Up ||
+                type  == TPointerEvent::EButton1Down)
             {
             switch (type)
                 {
@@ -4078,9 +4080,12 @@
                 if ( iMarqueeType != EFsTextMarqueeNone )
                     {
                     vis = iTreeData->ItemVisualizer( iFocusedItem );
-                    vis->MarqueeL( iMarqueeType, iMarqueeSpeed,
-                    		iMarqueStartDelay, iMarqueCycleStartDelay,
-                            iMarqueeRepetitions );
+                    if (vis)
+                        {
+                        vis->MarqueeL( iMarqueeType, iMarqueeSpeed,
+                    	        iMarqueStartDelay, iMarqueCycleStartDelay,
+                                iMarqueeRepetitions );
+                        }
                     }
                 }
             else
@@ -5207,6 +5212,12 @@
                 MFsTreeVisualizerObserver::EFsTreeItemTouchAction, aItemId, aPoint );
             }
         }
+    // Added for tactile feedback
+    MTouchFeedback* feedback = MTouchFeedback::Instance();
+    if( feedback )
+        {
+        feedback->InstantFeedback( ETouchFeedbackBasic );
+        }
     }
 
 // CFsTreeVisualizerBase::CDragHandler
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/emailuis/widget/emailwidgetsettings/group/backup_registration.xml	Mon Jun 21 15:20:54 2010 +0300
@@ -0,0 +1,5 @@
+<?xml version="1.0" standalone="yes"?>
+<backup_registration version="1.0">
+    <proxy_data_manager sid = "0x10202BE9" />
+    <restore requires_reboot = "no"/>
+</backup_registration>
--- a/emailuis/widget/emailwidgetsettings/group/bld.inf	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/widget/emailwidgetsettings/group/bld.inf	Mon Jun 21 15:20:54 2010 +0300
@@ -38,3 +38,7 @@
 
 ../conf/cmailwidget.confml                      APP_LAYER_CONFML(cmailwidget.confml)
 ../conf/cmailwidget_2001E272.crml               APP_LAYER_CRML(cmailwidget_2001E272.crml)
+
+// Backup registration
+../group/backup_registration.xml /epoc32/data/z/private/2001E272/backup_registration.xml
+
--- a/emailuis/widget/emailwidgetsettings/rom/emailwidgetsettings.iby	Wed Jun 09 09:22:57 2010 +0300
+++ b/emailuis/widget/emailwidgetsettings/rom/emailwidgetsettings.iby	Mon Jun 21 15:20:54 2010 +0300
@@ -24,4 +24,6 @@
 S60_UPGRADABLE_APP_REG_RSC(emailwidgetsettings)
 SCALABLE_IMAGE(APP_BITMAP_DIR,APP_BITMAP_DIR,emailwidgetsettings)
 
+data=DATAZ_\private\2001E272\backup_registration.xml  private\2001E272\backup_registration.xml
+
 #endif // EMAILWIDGETSETTINGS_IBY
--- a/ipsservices/ipssosplugin/inc/ipsplgmsgiterator.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgmsgiterator.h	Mon Jun 21 15:20:54 2010 +0300
@@ -238,6 +238,7 @@
      */
     CMsvEntry* iFolderEntry;
     
+    CMsvEntrySelection* iMessages;
     /**
      * Controls data to be returned
      */    
--- a/ipsservices/ipssosplugin/inc/ipsplgmsgkey.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssosplugin/inc/ipsplgmsgkey.h	Mon Jun 21 15:20:54 2010 +0300
@@ -83,7 +83,7 @@
     /**
      * Compares the subject strings omitting the reply & forward prefixes
      */
-    TInt CompareSubjectsL( const TDesC& aLeft, const TDesC& aRight ) const; // <cmail> change to leaving function
+    TInt CompareSubjects( const TDesC& aLeft, const TDesC& aRight ) const;
 
 private:
     // Folder objects the messages of which are sorted. Not owned.    
--- a/ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgiterator.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -71,7 +71,7 @@
     delete iMsgMapper;
     delete iMsgSortKey;
     delete iMsgSwapper;
-    
+    delete iMessages;
     iSortingCriteria.Reset();
     }
 
@@ -89,15 +89,16 @@
     TBool result = EFalse;
     TInt baseIndex;
     
-    // Messages are sorted always before reading the messages 
-    Sort();
-    
-    CMsvEntrySelection* messages = FilterMessagesL();
-    CleanupStack::PushL( messages );
+    if ( !iMessages )
+        {
+        // Messages are sorted before first reading the messages 
+        Sort();
+        iMessages = FilterMessagesL();
+        }
 
     if ( !aCurrentMessageId.IsNullId() )
         {
-        baseIndex = messages->Find( aCurrentMessageId.Id() );
+        baseIndex = iMessages->Find( aCurrentMessageId.Id() );
         
         // aCurrentMessageId is not included to the result set
         if ( baseIndex != KErrNotFound )
@@ -112,12 +113,11 @@
         }
         
     if ( ( baseIndex != KErrNotFound ) && 
-         ( baseIndex < messages->Count() ) )
+         ( baseIndex < iMessages->Count() ) )
         {
-        result = NextL(baseIndex, messages, aCount, aMessages);
+        result = NextL(baseIndex, iMessages, aCount, aMessages);
         }
 
-    CleanupStack::PopAndDestroy(messages);
     return result;
     }
 
@@ -136,20 +136,20 @@
     TInt status;
     TInt baseIndex;
     
-    // Messages are sorted always before reading the messages 
-    Sort();
+    if ( !iMessages )
+        {
+        // Messages are sorted before first reading the messages 
+        Sort();
+        iMessages = FilterMessagesL();
+        }
 
-    CMsvEntrySelection* messages = FilterMessagesL();
-    CleanupStack::PushL( messages );
-
-    status = SearchL( messages, aStartWith, baseIndex );
+    status = SearchL( iMessages, aStartWith, baseIndex );
     
     if ( status == KErrNone )
         {
-        result = NextL(baseIndex, messages, aCount, aMessages);
+        result = NextL( baseIndex, iMessages, aCount, aMessages );
         }
 
-    CleanupStack::PopAndDestroy(messages);
     return result;
     }
 
@@ -168,15 +168,16 @@
     TBool result = EFalse;
     TInt baseIndex;
     
-    // Messages are sorted always before reading the messages 
-    Sort();
-
-    CMsvEntrySelection* messages = FilterMessagesL();
-    CleanupStack::PushL(messages);
+    if ( !iMessages )
+        {
+        // Messages are sorted before first reading the messages 
+        Sort();
+        iMessages = FilterMessagesL();
+        }
 
     if ( !aCurrentMessageId.IsNullId() )
         {
-        baseIndex = messages->Find(aCurrentMessageId.Id());
+        baseIndex = iMessages->Find(aCurrentMessageId.Id());
         
         // aCurrentMessageId is not included to the result set
         if ( baseIndex != KErrNotFound )
@@ -188,7 +189,7 @@
         {
         // check whether we should start from the end of 
         // the message list in the case of a NULL ID
-        baseIndex = messages->Count() - 1;
+        baseIndex = iMessages->Count() - 1;
         }
 
     // Actually, if the matching message is the first one, baseIndex is equal
@@ -198,10 +199,9 @@
     if ( ( baseIndex != KErrNotFound ) &&
          ( baseIndex >= 0 ) )
         {
-        result = PreviousL(baseIndex, messages, aCount, aMessages);
+        result = PreviousL(baseIndex, iMessages, aCount, aMessages);
         }
 
-    CleanupStack::PopAndDestroy(messages);
     return result;
     }
 
@@ -225,20 +225,20 @@
     TInt status;
     TInt baseIndex;
     
-    // Messages are sorted always before reading the messages 
-    Sort();
+    if ( !iMessages )
+        {
+        // Messages are sorted before first reading the messages 
+        Sort();
+        iMessages = FilterMessagesL();
+        }
 
-    CMsvEntrySelection* messages = FilterMessagesL();
-    CleanupStack::PushL( messages );
-
-    status = SearchL( messages, aStartWith, baseIndex );
+    status = SearchL( iMessages, aStartWith, baseIndex );
     
     if (  status == KErrNone ) 
         {
-        result = PreviousL(baseIndex, messages, aCount, aMessages);
+        result = PreviousL(baseIndex, iMessages, aCount, aMessages);
         }
 
-    CleanupStack::PopAndDestroy(messages);
     return result;
     }
 
--- a/ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgmsgkey.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -100,10 +100,8 @@
                 }
             case EFSMailSortBySubject:
                 {
-                // <cmail> due to changes in CompareSubject method
-                TRAP_IGNORE( result = CompareSubjectsL( 
-                    leftEntry.iDescription, rightEntry.iDescription ) );
-                // </cmail>
+                result = CompareSubjects( leftEntry.iDescription,
+                    rightEntry.iDescription );
                 break;
                 }
             case EFSMailSortByPriority:
@@ -208,38 +206,37 @@
 // Strips the subject prefixes before comparing the strings
 // ---------------------------------------------------------------------------
 
-TInt TIpsPlgMsgKey::CompareSubjectsL( 
+TInt TIpsPlgMsgKey::CompareSubjects(
     const TDesC& aLeft, 
     const TDesC& aRight ) const
     {
     FUNC_LOG;
     TInt  result( KEqual );
-    TPtrC leftPtr( aLeft );
-    TPtrC rightPtr( aRight );
-    TInt  leftOffset( FindSubjectStart( aLeft ) );
-    TInt  rightOffset( FindSubjectStart( aRight ) );
-    
-    leftPtr.Set( 
-        leftPtr.Ptr() + leftOffset, leftPtr.Length() - leftOffset );
-    rightPtr.Set( 
-        rightPtr.Ptr() + rightOffset, rightPtr.Length() - rightOffset );
-    
-    // <cmail> for unifying with UI - remove all white spaces
-    HBufC* croppedLeft = leftPtr.AllocLC();
-    TPtr croppedLeftPtr = croppedLeft->Des();
-    HBufC* croppedRight = rightPtr.AllocLC();
-    TPtr croppedRightPtr = croppedRight->Des();
-        
-    AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' );
-    croppedLeftPtr.TrimAll();
-    AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' );
-    croppedRightPtr.TrimAll();
-    
-    result = croppedLeftPtr.CompareC( croppedRightPtr );
-    
-    CleanupStack::PopAndDestroy( croppedRight );
-    CleanupStack::PopAndDestroy( croppedLeft );
-    // </cmail>
+    const TInt leftOffset = FindSubjectStart( aLeft );
+    const TInt rightOffset = FindSubjectStart( aRight );
+    TPtrC leftPtr( aLeft.Ptr() + leftOffset, aLeft.Length() - leftOffset );
+    TPtrC rightPtr( aRight.Ptr() + rightOffset, aRight.Length() - rightOffset );
+ 
+    // for unifying with UI - remove all white spaces
+    HBufC* croppedLeft = leftPtr.Alloc();
+    HBufC* croppedRight = rightPtr.Alloc();
+ 
+    // Comparison is done only when allocation succeeds
+    if ( croppedLeft && croppedRight )
+        {
+        TPtr croppedLeftPtr = croppedLeft->Des();
+        TPtr croppedRightPtr = croppedRight->Des();
+ 
+        AknTextUtils::ReplaceCharacters( croppedLeftPtr, KCharsToReplace, ' ' );
+        croppedLeftPtr.TrimAll();
+        AknTextUtils::ReplaceCharacters( croppedRightPtr, KCharsToReplace, ' ' );
+        croppedRightPtr.TrimAll();
+ 
+        result = croppedLeftPtr.CompareC( croppedRightPtr );
+        }
+ 
+    delete croppedRight;
+    delete croppedLeft;
         
     return result;
     }
--- a/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssosplugin/src/ipsplgsosbaseplugin.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -204,12 +204,8 @@
         if ( tEntry.Connected() )
             {
             status = EFSMailBoxOnline;
-            }
-        else if ( ConnOpRunning( aMailBoxId ) )
-            {
-            status = EFSMailBoxOnline;
-            }
-        else
+            }			
+		else
             {
             status = EFSMailBoxOffline;
             }
@@ -392,15 +388,32 @@
         {
         User::Leave( KErrNotReady );
         }
-    CMsvEntry* mboxEntry = iSession->GetEntryL( aMailBoxId.Id() );
-    CleanupStack::PushL( mboxEntry );
-
-    TDesC& address = iSettingsApi->GetServerAddressL( *mboxEntry );
-    delete iBrandingId;
-    iBrandingId = NULL;
-    iBrandingId = address.AllocL();
-    CleanupStack::PopAndDestroy( mboxEntry );
-
+    
+    TMsvEntry tEntry;
+    TMsvId serviceId;
+    TInt status = iSession->GetEntry( aMailBoxId.Id(), serviceId, tEntry );
+ 
+    if ( status == KErrNone )
+        {
+        HBufC* address( NULL );
+        iSettingsApi->GetMailboxAddressL( tEntry, address );
+        CleanupStack::PushL( address );
+        TPtrC ptr = address->Des();
+        TInt index = ptr.Locate('@') + 1;
+        if( index > 0 && ptr.Length() > 0 )
+            {
+            if( iBrandingId )
+                {
+                delete iBrandingId;
+                iBrandingId = NULL;
+                }
+            ptr.Set( ptr.Right( ptr.Length() - index ) );        
+            iBrandingId = HBufC::NewL( ptr.Length() );
+            iBrandingId->Des().Copy( ptr );
+            }
+        CleanupStack::PopAndDestroy( address );
+        }    
+    
     return *iBrandingId;
     }
 
--- a/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/data/ipssetuimailsettings.ra	Mon Jun 21 15:20:54 2010 +0300
@@ -456,11 +456,11 @@
         // Emails to retrieve (POP3)
         IPS_SET_ITEM
             {
-            itemtype = EIpsSetUiRadioButtonArray;
+            itemtype = EIpsSetUiItemValue;
             itemid = EIpsSetUiWhatRetrievePop3;
             itemlabel = qtn_fse_settings_mail_downl_ctrl_retrieve_limit;
-            itemarray = r_ips_set_what_to_sync_array_email_retrieve_pop3;
-            itemflags = KIpsSetUiFlagPop3Only | KIpsSetUiFlagLangSpecificNumConv;
+            itemflags = KIpsSetUiFlagPop3Only | KIpsSetUiFlagLangSpecificNumConv |
+                        KIpsSetUiFlagForceMustFill;
             },
         // Emails to retrieve (IMAP4)
         IPS_SET_ITEM
@@ -737,42 +737,6 @@
         };
     }
 
-// ---------------------------------------------------------------------------
-//
-//   r_ips_set_what_to_sync_array_email_retrieve_pop3
-//
-// ---------------------------------------------------------------------------
-//
-RESOURCE IPS_SET_ARRAY r_ips_set_what_to_sync_array_email_retrieve_pop3
-    {
-    items =
-        {
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrievePop3BtnAll;
-            itemlabel = qtn_fse_settings_mail_retrieve_all;
-            },
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrievePop3BtnCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagFindEditor;
-            },
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemValue;
-            itemid = EIpsSetUiWhatRetrievePop3EditCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagPermanentlyHidden |
-                KIpsSetUiFlagForceMustFill;
-            }
-        };
-    }
 
 // ---------------------------------------------------------------------------
 //
@@ -784,17 +748,15 @@
     {
     items =
         {
-        //
         IPS_SET_ITEM
             {
-            itemtype = EIpsSetUiRadioButtonArray;
+            itemtype = EIpsSetUiItemValue;
             itemid = EIpsSetUiWhatRetrieveImap4Inbox;
             itemlabel = qtn_fse_settings_mail_retrieve_from_inbox;
-            itemarray =
-                r_ips_set_what_to_sync_array_email_retrieve_imap4_inbox;
-            itemflags = KIpsSetUiFlagLangSpecificNumConv;
+            itemmaxlength = KIpsSetUiMaxSettingsTextLength;
+            itemflags = KIpsSetUiFlagForceMustFill | KIpsSetUiFlagLangSpecificNumConv;
             },
-        //
+         
         IPS_SET_ITEM
             {
             itemtype = EIpsSetUiRadioButtonArray;
@@ -807,42 +769,6 @@
         };
     }
 
-// ---------------------------------------------------------------------------
-//
-//   r_ips_set_what_to_sync_array_email_retrieve_imap4_inbox
-//
-// ---------------------------------------------------------------------------
-//
-RESOURCE IPS_SET_ARRAY r_ips_set_what_to_sync_array_email_retrieve_imap4_inbox
-    {
-    items =
-        {
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrieveImap4InboxBtnAll;
-            itemlabel = qtn_fse_settings_mail_retrieve_all;
-            },
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrieveImap4InboxBtnCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagFindEditor;
-            },
-        //
-        IPS_SET_ITEM
-            {
-            itemtype = EIpsSetUiItemValue;
-            itemid = EIpsSetUiWhatRetrieveImap4InboxEditCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagPermanentlyHidden |
-                KIpsSetUiFlagForceMustFill;
-            }
-        };
-    }
 
 // ---------------------------------------------------------------------------
 //
@@ -858,25 +784,25 @@
         IPS_SET_ITEM
             {
             itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrieveImap4FolderBtnAll;
-            itemlabel = qtn_fse_settings_mail_retrieve_all;
+            itemid = EIpsSetUiWhatRetrieveImap4FolderBtn50;
+            itemlabel = "50";
+            itemflags = KIpsSetUiFlagLangSpecificNumConv;
             },
         //
         IPS_SET_ITEM
             {
             itemtype = EIpsSetUiItemRadioButton;
-            itemid = EIpsSetUiWhatRetrieveImap4FolderBtnCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagFindEditor;
+            itemid = EIpsSetUiWhatRetrieveImap4FolderBtn100;
+            itemlabel = "100";
+            itemflags = KIpsSetUiFlagLangSpecificNumConv;
             },
         //
         IPS_SET_ITEM
             {
-            itemtype = EIpsSetUiItemValue;
-            itemid = EIpsSetUiWhatRetrieveImap4FolderEditCustom;
-            itemlabel = qtn_fse_settings_mail_retrieve_amount;
-            itemflags = KIpsSetUiFlagPermanentlyHidden |
-                KIpsSetUiFlagForceMustFill;
+            itemtype = EIpsSetUiItemRadioButton;
+            itemid = EIpsSetUiWhatRetrieveImap4FolderBtn250;
+            itemlabel = "250";
+            itemflags = KIpsSetUiFlagLangSpecificNumConv;
             }
         };
     }
--- a/ipsservices/ipssossettings/inc/ipssetdata.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/inc/ipssetdata.h	Mon Jun 21 15:20:54 2010 +0300
@@ -84,6 +84,12 @@
         ECustomHours
         };
 
+    enum TRetrieveImap4Folder
+        {
+        EImapFolder50Messages = 0,
+        EImapFolder100Messages = 1,
+        EImapFolder250Messages = 2
+        };
 
     /** */
     enum TSyncInterval
--- a/ipsservices/ipssossettings/inc/ipssetuidialog.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/inc/ipssetuidialog.h	Mon Jun 21 15:20:54 2010 +0300
@@ -230,7 +230,7 @@
      *
      * @param aBaseItem Download size page
      */
-    void HandleEmailsToRetrieve( CIpsSetUiItem& aBaseItem );
+    //void HandleEmailsToRetrieve( CIpsSetUiItem& aBaseItem );
 
     /**
      * Changes resource for port editor
--- a/ipsservices/ipssossettings/inc/ipssetutilsconsts.h	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/inc/ipssetutilsconsts.h	Mon Jun 21 15:20:54 2010 +0300
@@ -92,7 +92,7 @@
 
 // default settings values
 
-const TInt KIpsSetFetchHeadersDefaultLimit  = 30;
+const TInt KIpsSetFetchHeadersDefaultLimit  = 50;
 const TInt KIpsSetMaxFetchHeadersDefaultLimit  = 2000;
 const TInt KIpsSetDataFiveMinutes           = 5;
 const TInt KIpsSetDataTenMinutes            = 10;
@@ -108,6 +108,9 @@
 const TInt KIpsSetDataDefaultDownloadSizeKb = 2; 
 const TUint KIpsSetDataEveryDayMask = 0x7f;
 
+const TInt KRetrieve50Messages = 50;
+const TInt KRetrieve100Messages = 100;
+const TInt KRetrieve250Messages = 250;
 // default values for ipssetdataextension
 //<cmail> cmail has different default value
 const TInt KIpsSetExtDefaultAlwaysOnlineState = EMailAoOff;
--- a/ipsservices/ipssossettings/inc/ipssetutilspageids.hrh	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/inc/ipssetutilspageids.hrh	Mon Jun 21 15:20:54 2010 +0300
@@ -113,15 +113,20 @@
     EIpsSetUiWhatDownloadSizeBtnFull,
 
     // Emails to Retrieve
-    EIpsSetUiWhatRetrievePop3BtnAll,
-    EIpsSetUiWhatRetrievePop3BtnCustom,
-    EIpsSetUiWhatRetrievePop3EditCustom,
-    EIpsSetUiWhatRetrieveImap4InboxBtnAll,
-    EIpsSetUiWhatRetrieveImap4InboxBtnCustom,
-    EIpsSetUiWhatRetrieveImap4InboxEditCustom,
-    EIpsSetUiWhatRetrieveImap4FolderBtnAll,
-    EIpsSetUiWhatRetrieveImap4FolderBtnCustom, //3630
-    EIpsSetUiWhatRetrieveImap4FolderEditCustom,
+    //EIpsSetUiWhatRetrievePop3BtnAll,
+    //EIpsSetUiWhatRetrievePop3BtnCustom,
+    //EIpsSetUiWhatRetrievePop3EditCustom,
+    //EIpsSetUiWhatRetrieveImap4InboxBtnAll,
+    //EIpsSetUiWhatRetrieveImap4InboxBtnCustom,
+    //EIpsSetUiWhatRetrieveImap4InboxEditCustom,
+    
+    //EIpsSetUiWhatRetrieveImap4FolderBtnAll,
+    //EIpsSetUiWhatRetrieveImap4FolderBtnCustom, //3630
+    //EIpsSetUiWhatRetrieveImap4FolderEditCustom,
+    
+    EIpsSetUiWhatRetrieveImap4FolderBtn50,
+    EIpsSetUiWhatRetrieveImap4FolderBtn100,
+    EIpsSetUiWhatRetrieveImap4FolderBtn250,
 
     // Sync Interval
     EIpsSetUiWhenScheduleBtn5Min,
--- a/ipsservices/ipssossettings/src/ipssetdata.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetdata.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -891,16 +891,13 @@
     if ( iProtocol == KSenduiMtmImap4Uid )
         {
         iImap4Settings->SetServerAddressL( aIncomingServer );
-		iImap4Settings->SetBearerMobility(ETrue);
         }
     else
         {
         iPop3Settings->SetServerAddressL( aIncomingServer );
-		iPop3Settings->SetBearerMobility(ETrue);
         }
         
     iSmtpSettings->SetServerAddressL( aOutgoingServer ); 
-	iSmtpSettings->SetBearerMobility(ETrue);
     }
 
 // ---------------------------------------------------------------------------
--- a/ipsservices/ipssossettings/src/ipssetuibasearray.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuibasearray.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -197,8 +197,12 @@
     TIpsSetUtilsTextPlain& aText ) const
     {
     FUNC_LOG;
-    aText.Append( aBaseItem.Value() );
-    aText.SetLength( KIpsSetUiVisibleTextLength );
+    const TInt KNumberSize = 10;
+    
+    if ( aText.MaxLength() - aText.Length() >= KNumberSize )
+        {
+        aText.AppendNum( aBaseItem.Value() );
+        }
     }
 
 // ----------------------------------------------------------------------------
--- a/ipsservices/ipssossettings/src/ipssetuibasedialog.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuibasedialog.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -476,7 +476,7 @@
             iTitlePane.SetTextL( *titleText );
             break;
         case R_IPS_SET_MENU_WHAT_TO_SYNC:
-        case R_IPS_SET_WHAT_TO_SYNC_ARRAY_EMAIL_RETRIEVE_POP3:
+        //case R_IPS_SET_WHAT_TO_SYNC_ARRAY_EMAIL_RETRIEVE_POP3:
         case R_IPS_SET_WHAT_TO_SYNC_ARRAY_EMAIL_RETRIEVE_IMAP4:
             titleText = StringLoader::LoadLC( 
                     R_FSE_SETTINGS_SERVICE_WHAT_TO_SYNC_TITLE );
--- a/ipsservices/ipssossettings/src/ipssetuidialog.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/ipsservices/ipssossettings/src/ipssetuidialog.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -68,7 +68,8 @@
 
 // All day mask
 const TUint KIpsSetUiAllDays = 0x7F;
-const TInt KIpsSetDefaultLimit = 30;
+const TInt KImapPopDefaultMessageLimit = 50;
+const TInt KImapPopMaxMessageLimit = 999;
 const TInt KIpsSetDefaultSizeLimit = 1;
 
 // ----------------------------------------------------------------------------
@@ -303,21 +304,18 @@
             break;
 
         case EIpsSetUiWhatRetrievePop3:
-        case EIpsSetUiWhatRetrievePop3EditCustom:
             InitRetrieve(
                 aBaseItem,
                 iData->RetrieveLimit( CIpsSetData::EPop3Limit ) );
             break;
 
         case EIpsSetUiWhatRetrieveImap4Inbox:
-        case EIpsSetUiWhatRetrieveImap4InboxEditCustom:
             InitRetrieve(
                 aBaseItem,
                 iData->RetrieveLimit( CIpsSetData::EImap4Inbox ) );
             break;
 
         case EIpsSetUiWhatRetrieveImap4Folders:
-        case EIpsSetUiWhatRetrieveImap4FolderEditCustom:
             InitRetrieve(
                 aBaseItem,
                 iData->RetrieveLimit( CIpsSetData::EImap4Folders ) );
@@ -707,24 +705,37 @@
     {
     FUNC_LOG;
     // Retrieve radio button values
-    TInt popBtn = GetItem( TUid::Uid( EIpsSetUiWhatRetrievePop3 ) )->Value();
-    TInt inboxBtn = GetItem( TUid::Uid(
-        EIpsSetUiWhatRetrieveImap4Inbox ) )->Value();
-    TInt folderBtn = GetItem( TUid::Uid(
+    TInt imapFolderBtn = GetItem( TUid::Uid(
         EIpsSetUiWhatRetrieveImap4Folders ) )->Value();
+   
 
     // Retrieve editor values
-    TInt popValue = GetItem(
-        TUid::Uid( EIpsSetUiWhatRetrievePop3EditCustom ) )->Value();
-    TInt inboxValue = GetItem( TUid::Uid(
-            EIpsSetUiWhatRetrieveImap4InboxEditCustom ) )->Value();
-    TInt folderValue = GetItem( TUid::Uid(
-            EIpsSetUiWhatRetrieveImap4FolderEditCustom ) )->Value();
+    TInt popInboxValue = GetItem(
+        TUid::Uid( EIpsSetUiWhatRetrievePop3 ) )->Value();
+    TInt imapInboxValue = GetItem( TUid::Uid(
+            EIpsSetUiWhatRetrieveImap4Inbox ) )->Value();
 
-    iData->SetRetrieveLimit(
-        popBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : popValue,
-        inboxBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : inboxValue,
-        folderBtn == CIpsSetData::EAll ? KIpsSetMaxFetchHeadersDefaultLimit : folderValue );
+    TInt imapFolderValue = KRetrieve50Messages;
+    if ( imapFolderBtn == CIpsSetData::EImapFolder100Messages )
+        {
+        imapFolderValue = KRetrieve100Messages;
+        }
+    else if ( imapFolderBtn == CIpsSetData::EImapFolder250Messages )
+        {
+        imapFolderValue = KRetrieve250Messages;
+        }
+    
+    if ( imapInboxValue < 0 || imapInboxValue > KImapPopMaxMessageLimit )
+        {
+        imapInboxValue = KImapPopDefaultMessageLimit;
+        }
+    
+    if ( popInboxValue < 0 || popInboxValue > KImapPopMaxMessageLimit )
+        {
+        popInboxValue = KImapPopDefaultMessageLimit;
+        }
+
+    iData->SetRetrieveLimit( popInboxValue, imapInboxValue, imapFolderValue );
     }
 
 // ---------------------------------------------------------------------------
@@ -1009,11 +1020,6 @@
             HandleDownloadSizeL( aBaseItem );
             break;
 
-        case EIpsSetUiWhatRetrievePop3:
-        case EIpsSetUiWhatRetrieveImap4Inbox:
-        case EIpsSetUiWhatRetrieveImap4Folders:
-            HandleEmailsToRetrieve( aBaseItem );
-            break;
 
         default: break;
         }
@@ -1021,54 +1027,7 @@
     return KErrNone;
     }
 
-// ---------------------------------------------------------------------------
-// CIpsSetUiDialogCtrl::HandleEmailsToRetrieve()
-// ---------------------------------------------------------------------------
-//
-void CIpsSetUiDialogCtrl::HandleEmailsToRetrieve( CIpsSetUiItem& aBaseItem )
-    {
-    FUNC_LOG;
-    CIpsSetUiItemLink* linkArray = static_cast<CIpsSetUiItemLink*>( &aBaseItem );
 
-    CIpsSetUiItem* subItem =
-        GetSubItem( *linkArray, linkArray->Value() );
-
-    TInt retlimit = 0;
-
-    switch( subItem->iItemId.iUid )
-        {
-        case EIpsSetUiWhatRetrieveImap4InboxBtnCustom:
-            {
-            retlimit = GetItem( TUid::Uid(
-                EIpsSetUiWhatRetrieveImap4InboxEditCustom ) )->Value();
-            break;
-            }
-        case EIpsSetUiWhatRetrieveImap4FolderBtnCustom:
-            {
-            retlimit = GetItem( TUid::Uid(
-                EIpsSetUiWhatRetrieveImap4FolderEditCustom ) )->Value();
-            break;
-            }
-        case EIpsSetUiWhatRetrievePop3BtnCustom:
-            {
-            retlimit = GetItem( TUid::Uid(
-                EIpsSetUiWhatRetrievePop3EditCustom ) )->Value();
-            break;
-            }
-        default:
-            {
-            retlimit = KErrNotFound;
-            break;
-            }
-        }
-
-    if( retlimit >= 0)
-        {
-        CIpsSetUiItemLink& linkItem =
-            *static_cast<CIpsSetUiItemLink*>( &aBaseItem );
-        linkItem.iItemSettingText->Num( retlimit );
-        }
-    }
 
 // ---------------------------------------------------------------------------
 // CIpsSetUiDialogCtrl::HandleDownloadSizeL()
@@ -1399,25 +1358,31 @@
     TInt id = aBaseItem.iItemId.iUid;
 
     // Initialize radiobutton editor
-    if ( id == EIpsSetUiWhatRetrievePop3 ||
-         id == EIpsSetUiWhatRetrieveImap4Inbox ||
-         id == EIpsSetUiWhatRetrieveImap4Folders )
+    if ( id == EIpsSetUiWhatRetrieveImap4Folders )
         {
-        TInt button = ( aValue == KIpsSetMaxFetchHeadersDefaultLimit ) ?
-            EIpsSetUiDefault : EIpsSetUiCustom;
+        TInt button = CIpsSetData::EImapFolder50Messages;
+        if ( aValue == KRetrieve100Messages )
+            {
+            button = CIpsSetData::EImapFolder100Messages;
+            }
+        else if ( aValue == KRetrieve250Messages )
+            {
+            button = CIpsSetData::EImapFolder250Messages;
+            }
+        
         InitAnyItem( aBaseItem, button, KNullDesC );
-        HandleEmailsToRetrieve( aBaseItem );
         }
+
     // Initialize value editor
-    else if ( id == EIpsSetUiWhatRetrievePop3EditCustom ||
-        id == EIpsSetUiWhatRetrieveImap4InboxEditCustom ||
-        id == EIpsSetUiWhatRetrieveImap4FolderEditCustom )
+    else if ( id == EIpsSetUiWhatRetrieveImap4Inbox ||
+              id == EIpsSetUiWhatRetrievePop3 )
         {
-        InitAnyItem(
-            aBaseItem,
-            ( aValue == KIpsSetMaxFetchHeadersDefaultLimit ) 
-                ? KIpsSetDefaultLimit : aValue,
-            KNullDesC );
+        TInt messageLimit = aValue;
+        if ( messageLimit < 0 || messageLimit > KImapPopMaxMessageLimit )
+            {
+            messageLimit = KImapPopDefaultMessageLimit;
+            }
+        InitAnyItem( aBaseItem, messageLimit, KNullDesC );
         }
     }
 
--- a/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp	Wed Jun 09 09:22:57 2010 +0300
+++ b/meetingrequest/mrgui/mrfieldbuilderpluginextension/src/cesmrresponseitem.cpp	Mon Jun 21 15:20:54 2010 +0300
@@ -28,7 +28,7 @@
 
 namespace // codescanner::namespace
     {
-    const TInt KMaxLinesInResponseTopicItem( 2 );
+    const TInt KMaxLinesInResponseTopicItem( 1 );
     const TInt KEdge(8);
     } // unnamed namespace
 // ======== MEMBER FUNCTIONS ========