emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
branchRCL_3
changeset 61 dcf0eedfc1a3
parent 60 d620048b4810
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Thu Jul 15 18:19:25 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Thu Aug 19 09:38:05 2010 +0300
@@ -43,6 +43,8 @@
 #include "cmailpluginproxy.h"
 #include "cmailhandlerpluginpanic.h"
 
+#include "fsemailserverpskeys.h"
+
 using namespace EmailInterface;
 
 // ---------------------------------------------------------
@@ -98,6 +100,18 @@
     InitializeExternalAccountsL();
 
     iSettings->StartObservingL( this );
+
+    TInt err = RProperty::Define( KPSUidEmailServerCategory, 
+                                  KIntMailboxCount, 
+                                  RProperty::EInt );
+    if ( err != KErrAlreadyExists && err != KErrNone )
+        {
+        User::LeaveIfError( err );
+        }
+    
+    // set mailbox initial count 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }
 
 // ---------------------------------------------------------
@@ -470,7 +484,7 @@
                 // Use localisation format when displaying also unread messages
 
                 // Arrays must be used when loc string contains indexed parameters
-                CDesCArrayFlat* strings = new CDesCArrayFlat( 1 );
+                CDesCArrayFlat* strings = new( ELeave) CDesCArrayFlat( 1 );
                 CleanupStack::PushL( strings );
                 strings->AppendL( accountName ); // replace "%0U" with mailbox name
 
@@ -852,8 +866,8 @@
 void CMailCpsHandler::HandleEventL(
     TFSMailEvent aEvent,
     TFSMailMsgId aMailbox,
-    TAny* aParam1,
-    TAny* aParam2,
+    TAny* /*aParam1*/,
+    TAny* /*aParam2*/,
     TAny* /*aParam3*/ )
     {
     FUNC_LOG;
@@ -886,6 +900,7 @@
             }
         case TFSEventNewMail:
             {
+            iSettings->ToggleWidgetNewMailIconL( ETrue, aMailbox );
             SetUpdateNeeded( aMailbox );
             UpdateFullL();
             break;
@@ -930,6 +945,10 @@
         {
         iLiwIf->AddWidgetToHomescreenL( aMailbox );
         }
+
+    // update total mailbox count. 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }
 
 // ---------------------------------------------------------
@@ -979,6 +998,9 @@
             break;
             }
         }
+    // update total mailbox count. 
+    TInt intCount = TotalIntMailboxCount();
+    User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
     }