emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
branchRCL_3
changeset 34 cd2816114bd1
parent 31 72d484772ca6
child 19 b13141f05c3d
equal deleted inserted replaced
33:da5135c61bad 34:cd2816114bd1
    48 // CMailCpsHandler::CMailCpsHandler
    48 // CMailCpsHandler::CMailCpsHandler
    49 // ---------------------------------------------------------
    49 // ---------------------------------------------------------
    50 //
    50 //
    51 CMailCpsHandler::CMailCpsHandler( MFSNotificationHandlerMgr& aOwner ): 
    51 CMailCpsHandler::CMailCpsHandler( MFSNotificationHandlerMgr& aOwner ): 
    52     CFSNotificationHandlerBase( aOwner ),
    52     CFSNotificationHandlerBase( aOwner ),
    53     iWaitingForNewMailbox(NULL)
    53     iWaitingForNewMailbox( NULL ),
    54     {
    54     iWaitingForNewWidget()
    55     FUNC_LOG;
    55     {
       
    56     FUNC_LOG;
       
    57     iWaitingForNewWidget.SetPluginId( KNullUid );
       
    58     iWaitingForNewWidget.SetId( 0 );
    56     }
    59     }
    57 
    60 
    58 // ---------------------------------------------------------
    61 // ---------------------------------------------------------
    59 // CMailCpsHandler::NewL
    62 // CMailCpsHandler::NewL
    60 // ---------------------------------------------------------
    63 // ---------------------------------------------------------
   138         TInt mailboxId(0);
   141         TInt mailboxId(0);
   139         if (mailbox)
   142         if (mailbox)
   140             {
   143             {
   141             mailboxId = mailbox->GetId().Id();
   144             mailboxId = mailbox->GetId().Id();
   142             }
   145             }
   143         if ( !mailboxId )
   146         if ( mailboxId )
   144             {
       
   145             // Remove box from settings
       
   146             iSettings->RemoveMailboxL( ii );
       
   147             // Array indexing changes now since one item was deleted
       
   148             ii--;
       
   149             }
       
   150         else
       
   151             {
   147             {
   152             CleanupStack::PushL( mailbox );
   148             CleanupStack::PushL( mailbox );
   153             CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox );
   149             CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox );
   154             CleanupStack::PushL( mailboxDetails );
   150             CleanupStack::PushL( mailboxDetails );
   155 
   151 
   861     FUNC_LOG;
   857     FUNC_LOG;
   862     if (iWaitingForNewMailbox)
   858     if (iWaitingForNewMailbox)
   863         {
   859         {
   864         iSettings->AssociateWidgetToSetting( iWaitingForNewMailbox->Des(), aMailbox );
   860         iSettings->AssociateWidgetToSetting( iWaitingForNewMailbox->Des(), aMailbox );
   865         }
   861         }
       
   862     else
       
   863         {
       
   864         iLiwIf->AddWidgetToHomescreenL( aMailbox );
       
   865         }
   866     }
   866     }
   867 
   867 
   868 // ---------------------------------------------------------
   868 // ---------------------------------------------------------
   869 // CMailCpsHandler::HandleMailboxRenamedEventL
   869 // CMailCpsHandler::HandleMailboxRenamedEventL
   870 // ---------------------------------------------------------
   870 // ---------------------------------------------------------
  1826         {
  1826         {
  1827         delete iWaitingForNewMailbox;
  1827         delete iWaitingForNewMailbox;
  1828         iWaitingForNewMailbox = NULL;
  1828         iWaitingForNewMailbox = NULL;
  1829         }
  1829         }
  1830     }
  1830     }
       
  1831 
       
  1832 // -----------------------------------------------------------------------------
       
  1833 //  CMailCpsHandler::SetWaitingForNewWidget()
       
  1834 // -----------------------------------------------------------------------------
       
  1835 //
       
  1836 void CMailCpsHandler::SetWaitingForNewWidget( const TFSMailMsgId aMailbox )
       
  1837     {
       
  1838     FUNC_LOG;
       
  1839     iWaitingForNewWidget.SetPluginId( aMailbox.PluginId() );
       
  1840     iWaitingForNewWidget.SetId( aMailbox.Id() );   
       
  1841     }
       
  1842 
       
  1843 // -----------------------------------------------------------------------------
       
  1844 //  CMailCpsHandler::CleanWaitingForNewWidget()
       
  1845 // -----------------------------------------------------------------------------
       
  1846 //
       
  1847 void CMailCpsHandler::CleanWaitingForNewWidget()
       
  1848     {
       
  1849     FUNC_LOG;
       
  1850     iWaitingForNewWidget.SetPluginId( KNullUid );
       
  1851     iWaitingForNewWidget.SetId( 0 );
       
  1852     }
       
  1853 
       
  1854 // -----------------------------------------------------------------------------
       
  1855 //  CMailCpsHandler::WaitingForNewWidget()
       
  1856 // -----------------------------------------------------------------------------
       
  1857 //
       
  1858 TFSMailMsgId CMailCpsHandler::WaitingForNewWidget()
       
  1859     {
       
  1860     FUNC_LOG;
       
  1861     return iWaitingForNewWidget;    
       
  1862     }
       
  1863 
       
  1864 // ---------------------------------------------------------------------------
       
  1865 // CMailCpsSettings::AssociateWidgetToSetting
       
  1866 // ---------------------------------------------------------------------------
       
  1867 //
       
  1868 void CMailCpsHandler::AssociateWidgetToSetting( const TDesC& aContentId,
       
  1869                                                 const TFSMailMsgId aMailbox )
       
  1870     {
       
  1871     FUNC_LOG;
       
  1872     iSettings->AssociateWidgetToSetting( aContentId, aMailbox );
       
  1873     }
       
  1874 
       
  1875 
       
  1876 // ---------------------------------------------------------------------------
       
  1877 // CMailCpsHandler::Associated
       
  1878 // ---------------------------------------------------------------------------
       
  1879 //
       
  1880 TBool CMailCpsHandler::Associated( const TDesC& aContentId )
       
  1881     {
       
  1882     FUNC_LOG;    
       
  1883     return iSettings->Associated( aContentId );
       
  1884     }
       
  1885 
       
  1886 // ---------------------------------------------------------------------------
       
  1887 // CMailCpsSettings::DisplayHSPageFullNoteL
       
  1888 // ---------------------------------------------------------------------------
       
  1889 //
       
  1890 void CMailCpsHandler::DisplayHSPageFullNoteL()
       
  1891     {
       
  1892     FUNC_LOG;
       
  1893     if (!iQuery)
       
  1894         {
       
  1895         iQuery = CAknGlobalNote::NewL();
       
  1896         iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
       
  1897         }   
       
  1898     HBufC* str( NULL );
       
  1899     str = StringLoader::LoadLC( R_EMAILWIDGET_TEXT_HS_PAGE_FULL );
       
  1900     iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des());
       
  1901     CleanupStack::PopAndDestroy( str );    
       
  1902     }
       
  1903