emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
branchRCL_3
changeset 61 dcf0eedfc1a3
parent 60 d620048b4810
equal deleted inserted replaced
60:d620048b4810 61:dcf0eedfc1a3
    41 #include "cmailcpsifconsts.h"
    41 #include "cmailcpsifconsts.h"
    42 #include "FreestyleEmailUiConstants.h"
    42 #include "FreestyleEmailUiConstants.h"
    43 #include "cmailpluginproxy.h"
    43 #include "cmailpluginproxy.h"
    44 #include "cmailhandlerpluginpanic.h"
    44 #include "cmailhandlerpluginpanic.h"
    45 
    45 
       
    46 #include "fsemailserverpskeys.h"
       
    47 
    46 using namespace EmailInterface;
    48 using namespace EmailInterface;
    47 
    49 
    48 // ---------------------------------------------------------
    50 // ---------------------------------------------------------
    49 // CMailCpsHandler::CMailCpsHandler
    51 // CMailCpsHandler::CMailCpsHandler
    50 // ---------------------------------------------------------
    52 // ---------------------------------------------------------
    96 
    98 
    97     InitializeL();
    99     InitializeL();
    98     InitializeExternalAccountsL();
   100     InitializeExternalAccountsL();
    99 
   101 
   100     iSettings->StartObservingL( this );
   102     iSettings->StartObservingL( this );
       
   103 
       
   104     TInt err = RProperty::Define( KPSUidEmailServerCategory, 
       
   105                                   KIntMailboxCount, 
       
   106                                   RProperty::EInt );
       
   107     if ( err != KErrAlreadyExists && err != KErrNone )
       
   108         {
       
   109         User::LeaveIfError( err );
       
   110         }
       
   111     
       
   112     // set mailbox initial count 
       
   113     TInt intCount = TotalIntMailboxCount();
       
   114     User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
   101     }
   115     }
   102 
   116 
   103 // ---------------------------------------------------------
   117 // ---------------------------------------------------------
   104 // CMailCpsHandler::~CMailCpsHandler
   118 // CMailCpsHandler::~CMailCpsHandler
   105 // ---------------------------------------------------------
   119 // ---------------------------------------------------------
   468             if ( unreadCount > 0 )
   482             if ( unreadCount > 0 )
   469                 {
   483                 {
   470                 // Use localisation format when displaying also unread messages
   484                 // Use localisation format when displaying also unread messages
   471 
   485 
   472                 // Arrays must be used when loc string contains indexed parameters
   486                 // Arrays must be used when loc string contains indexed parameters
   473                 CDesCArrayFlat* strings = new CDesCArrayFlat( 1 );
   487                 CDesCArrayFlat* strings = new( ELeave) CDesCArrayFlat( 1 );
   474                 CleanupStack::PushL( strings );
   488                 CleanupStack::PushL( strings );
   475                 strings->AppendL( accountName ); // replace "%0U" with mailbox name
   489                 strings->AppendL( accountName ); // replace "%0U" with mailbox name
   476 
   490 
   477                 CArrayFix<TInt>* ints = new(ELeave) CArrayFixFlat<TInt>( 1 );
   491                 CArrayFix<TInt>* ints = new(ELeave) CArrayFixFlat<TInt>( 1 );
   478                 CleanupStack::PushL( ints );
   492                 CleanupStack::PushL( ints );
   850 // ---------------------------------------------------------
   864 // ---------------------------------------------------------
   851 //
   865 //
   852 void CMailCpsHandler::HandleEventL(
   866 void CMailCpsHandler::HandleEventL(
   853     TFSMailEvent aEvent,
   867     TFSMailEvent aEvent,
   854     TFSMailMsgId aMailbox,
   868     TFSMailMsgId aMailbox,
   855     TAny* aParam1,
   869     TAny* /*aParam1*/,
   856     TAny* aParam2,
   870     TAny* /*aParam2*/,
   857     TAny* /*aParam3*/ )
   871     TAny* /*aParam3*/ )
   858     {
   872     {
   859     FUNC_LOG;
   873     FUNC_LOG;
   860 
   874 
   861     // If backup or restore is ongoing ignore all events
   875     // If backup or restore is ongoing ignore all events
   884             UpdateFullL();
   898             UpdateFullL();
   885             break;
   899             break;
   886             }
   900             }
   887         case TFSEventNewMail:
   901         case TFSEventNewMail:
   888             {
   902             {
       
   903             iSettings->ToggleWidgetNewMailIconL( ETrue, aMailbox );
   889             SetUpdateNeeded( aMailbox );
   904             SetUpdateNeeded( aMailbox );
   890             UpdateFullL();
   905             UpdateFullL();
   891             break;
   906             break;
   892             }
   907             }
   893         case TFSEventMailDeleted:
   908         case TFSEventMailDeleted:
   928         }
   943         }
   929     else
   944     else
   930         {
   945         {
   931         iLiwIf->AddWidgetToHomescreenL( aMailbox );
   946         iLiwIf->AddWidgetToHomescreenL( aMailbox );
   932         }
   947         }
       
   948 
       
   949     // update total mailbox count. 
       
   950     TInt intCount = TotalIntMailboxCount();
       
   951     User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
   933     }
   952     }
   934 
   953 
   935 // ---------------------------------------------------------
   954 // ---------------------------------------------------------
   936 // CMailCpsHandler::HandleMailboxRenamedEventL
   955 // CMailCpsHandler::HandleMailboxRenamedEventL
   937 // ---------------------------------------------------------
   956 // ---------------------------------------------------------
   977             iSettings->RemoveMailboxL( aMailbox );
   996             iSettings->RemoveMailboxL( aMailbox );
   978             iSettings->ToggleWidgetNewMailIconL( EFalse, aMailbox );
   997             iSettings->ToggleWidgetNewMailIconL( EFalse, aMailbox );
   979             break;
   998             break;
   980             }
   999             }
   981         }
  1000         }
       
  1001     // update total mailbox count. 
       
  1002     TInt intCount = TotalIntMailboxCount();
       
  1003     User::LeaveIfError( RProperty::Set( KPSUidEmailServerCategory, KIntMailboxCount, intCount ) );
   982     }
  1004     }
   983 
  1005 
   984 
  1006 
   985 // ---------------------------------------------------------
  1007 // ---------------------------------------------------------
   986 // CMailCpsHandler::GetUnreadCountL
  1008 // CMailCpsHandler::GetUnreadCountL