ipsservices/ipssosplugin/src/ipsplgconnectandrefreshfolderlist.cpp
changeset 3 a4d6f1ea0416
parent 0 8466d47a6819
child 8 e1b6206813b4
equal deleted inserted replaced
2:5253a20d2a1e 3:a4d6f1ea0416
    15 *       folder refresh operation
    15 *       folder refresh operation
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
       
    20 #include <AknMessageQueryDialog.h>
       
    21 
    20 #include "emailtrace.h"
    22 #include "emailtrace.h"
    21 #include "ipsplgheaders.h"
    23 #include "ipsplgheaders.h"
    22 
    24 
    23 #include <ipssossettings.rsg>
    25 #include <ipssossettings.rsg>
       
    26 #include <fsmailserver.rsg>     // For R_FS_MSERVER_*
    24 
    27 
    25 // ----------------------------------------------------------------------------
    28 // ----------------------------------------------------------------------------
    26 // ----------------------------------------------------------------------------
    29 // ----------------------------------------------------------------------------
    27 EXPORT_C CIpsPlgConnectAndRefreshFolderList* 
    30 EXPORT_C CIpsPlgConnectAndRefreshFolderList* 
    28             CIpsPlgConnectAndRefreshFolderList::NewL(
    31             CIpsPlgConnectAndRefreshFolderList::NewL(
   168 // ----------------------------------------------------------------------------
   171 // ----------------------------------------------------------------------------
   169 void CIpsPlgConnectAndRefreshFolderList::DoRunL()
   172 void CIpsPlgConnectAndRefreshFolderList::DoRunL()
   170     {
   173     {
   171     FUNC_LOG;
   174     FUNC_LOG;
   172     MFSMailRequestObserver* observer = NULL;
   175     MFSMailRequestObserver* observer = NULL;
   173     
   176     int err = iStatus.Int();
   174     if( iStatus.Int() != KErrNone )
   177     
       
   178     if ( err != KErrNone )
   175         {
   179         {
   176         iState = ECompleted;
   180         iState = ECompleted;
   177         CompleteObserver();
   181         if( err == KErrImapBadLogon )
       
   182             {
       
   183             DisplayLoginFailedDialogL();
       
   184             RunError(err);
       
   185             }
       
   186         else
       
   187             {
       
   188             CompleteObserver();
       
   189             }
   178         return;
   190         return;
   179         }
   191         }   
   180     
   192     
   181     switch(iState)
   193     TBuf8<1> dummyParam;
       
   194     switch( iState )
   182         {
   195         {
   183         case EStartConnect:
   196         case EStartConnect:
   184             delete iOperation;
   197             delete iOperation;
   185             iOperation = NULL;
   198             iOperation = NULL;
   186             iOperation = CIpsPlgImap4ConnectOp::NewL(
   199             InvokeClientMtmAsyncFunctionL( 
   187                             iSession,
   200 							KIMAP4MTMConnect, 
   188                             CActive::EPriorityStandard,
   201 							*iMsvEntry,
   189                             iStatus,
   202             	            iService,
   190                             iService,
   203             	            dummyParam );
   191                             *iTimer,
       
   192                             iMailboxId,
       
   193                             *observer,
       
   194                             NULL, //FSRequestId
       
   195                             NULL, // Event handler
       
   196                             ETrue, // Plain connect
       
   197                             EFalse ); // No signalling needed )
       
   198             iState = EConnecting;
   204             iState = EConnecting;
   199             SetActive();
   205             SetActive();
   200             break;
   206             break;
   201 	    case EConnecting:
   207 	    case EConnecting:
   202 	        {
   208 	        {
   203 	        //  We have successfully completed connecting
   209 	        //  We have successfully completed connecting
   204 	        TBuf8<1> dummyParam;
   210 	        
   205 	        delete iOperation;
   211 	        delete iOperation;
   206 	        iOperation = NULL;
   212 	        iOperation = NULL;
   207 	        InvokeClientMtmAsyncFunctionL( 
   213 	        InvokeClientMtmAsyncFunctionL( 
   208 	                    KIMAP4MTMSyncTree, 
   214 	                    KIMAP4MTMSyncTree, 
   209 	                    *iMsvEntry,
   215 	                    *iMsvEntry,
   251         }
   257         }
   252     CompleteObserver( KErrCancel );
   258     CompleteObserver( KErrCancel );
   253     iState = ECompleted;
   259     iState = ECompleted;
   254     }
   260     }
   255 
   261 
       
   262 // ----------------------------------------------------------------------------
       
   263 // CIpsPlgConnectAndRefreshFolderList::DisplayLoginFailedDialogL()
       
   264 // ----------------------------------------------------------------------------
       
   265 //
       
   266 void CIpsPlgConnectAndRefreshFolderList::DisplayLoginFailedDialogL()
       
   267     {
       
   268     // Get the TMsvEntry for the mailbox, which we use to get its name.
       
   269     TMsvId serviceId;
       
   270     TMsvEntry mailboxServiceEntry;
       
   271     User::LeaveIfError( iSession.GetEntry( iMailboxId.Id(), serviceId, mailboxServiceEntry ) );
       
   272 
       
   273     // Load/construct the strings for the dialog.
       
   274     HBufC* headerText( NULL );
       
   275     headerText = StringLoader::LoadLC( R_FS_MSERVER_MAILBOX_NAME, mailboxServiceEntry.iDetails );
       
   276     HBufC* text( NULL );
       
   277     text = StringLoader::LoadLC( R_FS_MSERVER_TEXT_LOGIN_FAILED );
       
   278 
       
   279     // Create and display the dialog.
       
   280     CAknMessageQueryDialog *dlg = new (ELeave) CAknMessageQueryDialog;
       
   281     dlg->PrepareLC( R_FS_MSERVER_DIALOG_MESSAGE_QUERY );
       
   282     dlg->SetHeaderTextL( headerText->Des() );
       
   283     dlg->SetMessageTextL( text->Des() );
       
   284     dlg->RunLD();
       
   285 
       
   286     CleanupStack::PopAndDestroy( text );
       
   287     CleanupStack::PopAndDestroy( headerText );
       
   288     }
       
   289 
   256 // End of File
   290 // End of File
   257 
   291