emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp
branchRCL_3
changeset 34 cd2816114bd1
parent 31 72d484772ca6
child 19 b13141f05c3d
--- a/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Wed Mar 31 21:08:33 2010 +0300
+++ b/emailservices/emailserver/cmailhandlerplugin/src/cmailcpshandler.cpp	Wed Apr 14 15:42:15 2010 +0300
@@ -50,9 +50,12 @@
 //
 CMailCpsHandler::CMailCpsHandler( MFSNotificationHandlerMgr& aOwner ): 
     CFSNotificationHandlerBase( aOwner ),
-    iWaitingForNewMailbox(NULL)
+    iWaitingForNewMailbox( NULL ),
+    iWaitingForNewWidget()
     {
     FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( KNullUid );
+    iWaitingForNewWidget.SetId( 0 );
     }
 
 // ---------------------------------------------------------
@@ -140,14 +143,7 @@
             {
             mailboxId = mailbox->GetId().Id();
             }
-        if ( !mailboxId )
-            {
-            // Remove box from settings
-            iSettings->RemoveMailboxL( ii );
-            // Array indexing changes now since one item was deleted
-            ii--;
-            }
-        else
+        if ( mailboxId )
             {
             CleanupStack::PushL( mailbox );
             CMailMailboxDetails* mailboxDetails = CreateMailboxDetailsL( *mailbox );
@@ -863,6 +859,10 @@
         {
         iSettings->AssociateWidgetToSetting( iWaitingForNewMailbox->Des(), aMailbox );
         }
+    else
+        {
+        iLiwIf->AddWidgetToHomescreenL( aMailbox );
+        }
     }
 
 // ---------------------------------------------------------
@@ -1828,3 +1828,76 @@
         iWaitingForNewMailbox = NULL;
         }
     }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::SetWaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+void CMailCpsHandler::SetWaitingForNewWidget( const TFSMailMsgId aMailbox )
+    {
+    FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( aMailbox.PluginId() );
+    iWaitingForNewWidget.SetId( aMailbox.Id() );   
+    }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::CleanWaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+void CMailCpsHandler::CleanWaitingForNewWidget()
+    {
+    FUNC_LOG;
+    iWaitingForNewWidget.SetPluginId( KNullUid );
+    iWaitingForNewWidget.SetId( 0 );
+    }
+
+// -----------------------------------------------------------------------------
+//  CMailCpsHandler::WaitingForNewWidget()
+// -----------------------------------------------------------------------------
+//
+TFSMailMsgId CMailCpsHandler::WaitingForNewWidget()
+    {
+    FUNC_LOG;
+    return iWaitingForNewWidget;    
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsSettings::AssociateWidgetToSetting
+// ---------------------------------------------------------------------------
+//
+void CMailCpsHandler::AssociateWidgetToSetting( const TDesC& aContentId,
+                                                const TFSMailMsgId aMailbox )
+    {
+    FUNC_LOG;
+    iSettings->AssociateWidgetToSetting( aContentId, aMailbox );
+    }
+
+
+// ---------------------------------------------------------------------------
+// CMailCpsHandler::Associated
+// ---------------------------------------------------------------------------
+//
+TBool CMailCpsHandler::Associated( const TDesC& aContentId )
+    {
+    FUNC_LOG;    
+    return iSettings->Associated( aContentId );
+    }
+
+// ---------------------------------------------------------------------------
+// CMailCpsSettings::DisplayHSPageFullNoteL
+// ---------------------------------------------------------------------------
+//
+void CMailCpsHandler::DisplayHSPageFullNoteL()
+    {
+    FUNC_LOG;
+    if (!iQuery)
+        {
+        iQuery = CAknGlobalNote::NewL();
+        iQuery->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY);
+        }   
+    HBufC* str( NULL );
+    str = StringLoader::LoadLC( R_EMAILWIDGET_TEXT_HS_PAGE_FULL );
+    iQuery->ShowNoteL(EAknGlobalConfirmationNote, str->Des());
+    CleanupStack::PopAndDestroy( str );    
+    }
+