ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp
changeset 3 a4d6f1ea0416
parent 0 8466d47a6819
child 8 e1b6206813b4
child 18 578830873419
--- a/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp	Mon Jan 18 20:08:26 2010 +0200
+++ b/ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp	Tue Jan 26 11:45:42 2010 +0200
@@ -17,10 +17,13 @@
 */
 
 
+#include <AknMessageQueryDialog.h>
+
 #include "emailtrace.h"
 #include "ipsplgheaders.h"
 
 #include <ipssossettings.rsg>
+#include <fsmailserver.rsg>     // For R_FS_MSERVER_*
 
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
@@ -170,38 +173,41 @@
     {
     FUNC_LOG;
     MFSMailRequestObserver* observer = NULL;
+    int err = iStatus.Int();
     
-    if( iStatus.Int() != KErrNone )
+    if ( err != KErrNone )
         {
         iState = ECompleted;
-        CompleteObserver();
+        if( err == KErrImapBadLogon )
+            {
+            DisplayLoginFailedDialogL();
+            RunError(err);
+            }
+        else
+            {
+            CompleteObserver();
+            }
         return;
-        }
+        }   
     
-    switch(iState)
+    TBuf8<1> dummyParam;
+    switch( iState )
         {
         case EStartConnect:
             delete iOperation;
             iOperation = NULL;
-            iOperation = CIpsPlgImap4ConnectOp::NewL(
-                            iSession,
-                            CActive::EPriorityStandard,
-                            iStatus,
-                            iService,
-                            *iTimer,
-                            iMailboxId,
-                            *observer,
-                            NULL, //FSRequestId
-                            NULL, // Event handler
-                            ETrue, // Plain connect
-                            EFalse ); // No signalling needed )
+            InvokeClientMtmAsyncFunctionL( 
+							KIMAP4MTMConnect, 
+							*iMsvEntry,
+            	            iService,
+            	            dummyParam );
             iState = EConnecting;
             SetActive();
             break;
 	    case EConnecting:
 	        {
 	        //  We have successfully completed connecting
-	        TBuf8<1> dummyParam;
+	        
 	        delete iOperation;
 	        iOperation = NULL;
 	        InvokeClientMtmAsyncFunctionL( 
@@ -253,5 +259,33 @@
     iState = ECompleted;
     }
 
+// ----------------------------------------------------------------------------
+// CIpsPlgConnectAndRefreshFolderList::DisplayLoginFailedDialogL()
+// ----------------------------------------------------------------------------
+//
+void CIpsPlgConnectAndRefreshFolderList::DisplayLoginFailedDialogL()
+    {
+    // Get the TMsvEntry for the mailbox, which we use to get its name.
+    TMsvId serviceId;
+    TMsvEntry mailboxServiceEntry;
+    User::LeaveIfError( iSession.GetEntry( iMailboxId.Id(), serviceId, mailboxServiceEntry ) );
+
+    // Load/construct the strings for the dialog.
+    HBufC* headerText( NULL );
+    headerText = StringLoader::LoadLC( R_FS_MSERVER_MAILBOX_NAME, mailboxServiceEntry.iDetails );
+    HBufC* text( NULL );
+    text = StringLoader::LoadLC( R_FS_MSERVER_TEXT_LOGIN_FAILED );
+
+    // Create and display the dialog.
+    CAknMessageQueryDialog *dlg = new (ELeave) CAknMessageQueryDialog;
+    dlg->PrepareLC( R_FS_MSERVER_DIALOG_MESSAGE_QUERY );
+    dlg->SetHeaderTextL( headerText->Des() );
+    dlg->SetMessageTextL( text->Des() );
+    dlg->RunLD();
+
+    CleanupStack::PopAndDestroy( text );
+    CleanupStack::PopAndDestroy( headerText );
+    }
+
 // End of File