ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp
changeset 23 2dc6caa42ec3
parent 20 ecc8def7944a
child 44 c2d07d913565
equal deleted inserted replaced
20:ecc8def7944a 23:2dc6caa42ec3
    91         {
    91         {
    92         // These should be clear    
    92         // These should be clear    
    93         case EFSMBoxCapaCanBeDeleted:
    93         case EFSMBoxCapaCanBeDeleted:
    94         case EFSMBoxCapaSupportsSaveToDrafts:
    94         case EFSMBoxCapaSupportsSaveToDrafts:
    95         case EFSMBoxCapaMeetingRequestRespond:
    95         case EFSMBoxCapaMeetingRequestRespond:
       
    96         case EFSMboxCapaSupportsAttahmentsInMR:
    96         case EFSMBoxCapaMeetingRequestCreate:
    97         case EFSMBoxCapaMeetingRequestCreate:
    97         case EFSMBoxCapaCanUpdateMeetingRequest:
    98         case EFSMBoxCapaCanUpdateMeetingRequest:
    98         case EFSMBoxCapaMoveToFolder:
    99         case EFSMBoxCapaMoveToFolder:
    99         case EFSMBoxCapaCopyToFolder:
   100         case EFSMBoxCapaCopyToFolder:
   100         case EFSMBoxCapaSupportsSync:
   101         case EFSMBoxCapaSupportsSync:
       
   102         case EFSMBoxCapaRemoveFromCalendar:
       
   103         case EFSMBoxCapaMoveMessageNoConnectNeeded:
   101             {
   104             {
   102             result = ETrue;
   105             result = ETrue;
   103             break;
   106             break;
   104             }
   107             }
   105         // These are positively not supported 
   108         // These are positively not supported 
   109         case EFSMBoxCapaSmartReply:
   112         case EFSMBoxCapaSmartReply:
   110         case EFSMBoxCapaSmartForward:
   113         case EFSMBoxCapaSmartForward:
   111         case EFSMBoxCapaSupportsMRU:
   114         case EFSMBoxCapaSupportsMRU:
   112         case EFSMBoxCapaSymbianMsgIntegration:
   115         case EFSMBoxCapaSymbianMsgIntegration:
   113         case EFSMBoxCapaNewEmailNotifications:
   116         case EFSMBoxCapaNewEmailNotifications:
       
   117         default:
   114             {
   118             {
   115             result = EFalse;
   119             result = EFalse;
   116             break;
   120             break;
   117             }
   121             }
   118         }
   122         }
   320 void CIpsPlgImap4Plugin::MoveMessagesL( 
   324 void CIpsPlgImap4Plugin::MoveMessagesL( 
   321     const TFSMailMsgId& aMailBoxId, 
   325     const TFSMailMsgId& aMailBoxId, 
   322     const RArray<TFSMailMsgId>& aMessageIds, 
   326     const RArray<TFSMailMsgId>& aMessageIds, 
   323     const TFSMailMsgId& aSourceFolderId, 
   327     const TFSMailMsgId& aSourceFolderId, 
   324     const TFSMailMsgId& aDestinationFolderId )
   328     const TFSMailMsgId& aDestinationFolderId )
   325 	{
   329     {
   326     FUNC_LOG;
   330     FUNC_LOG;
   327 	if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
   331     if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
   328 	    {
   332         {
   329 	    // Move to Drafts folder
   333         // Move to Drafts folder
   330 	    MoveMessagesToDraftL( aMailBoxId, 
   334         MoveMessagesToDraftL( aMailBoxId, 
   331 	                          aMessageIds, 
   335                 aMessageIds, 
   332 	                          aSourceFolderId, 
   336                 aSourceFolderId, 
   333 	                          aDestinationFolderId );
   337                 aDestinationFolderId );
   334 	    }
   338         }
   335     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
   339     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
   336         {
   340         {
   337     	TMsvId service = aMailBoxId.Id();
   341         TMsvId service = aMailBoxId.Id();
   338     	
   342 
   339     	CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   343         CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   340         CleanupStack::PushL( watcher );
   344         CleanupStack::PushL( watcher );
   341         
   345         
   342         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   346         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   343         CleanupStack::PushL(sel);
   347         CleanupStack::PushL(sel);
   344         sel->AppendL( service );
   348         sel->AppendL( service );
   345         
   349 
   346         TInt msgIdCount( aMessageIds.Count() );
   350         TInt msgIdCount( aMessageIds.Count() );
   347     	for ( TInt i(0); i< msgIdCount; i++ )
   351         for ( TInt i(0); i< msgIdCount; i++ )
   348             {
   352             {
   349             sel->AppendL( aMessageIds[i].Id() );
   353             sel->AppendL( aMessageIds[i].Id() );
   350             }
   354             }
   351     	
   355     	
       
   356 		// <qmail> TImImap4GetMailInfo options not needed
       
   357 
       
   358         CIpsPlgImap4MoveRemoteOpObserver* observer =
       
   359             CIpsPlgImap4MoveRemoteOpObserver::NewL( *iSession, *iEventHandler,
       
   360                 aSourceFolderId, aMessageIds );
       
   361         watcher->SetRequestObserver( observer );
       
   362 
   352         // Synchronous operation
   363         // Synchronous operation
   353         // <qmail> following constructor's parameters have changed
   364         // <qmail> following constructor's parameters have changed
   354     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   365     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   355             *iSession, 
   366             *iSession, 
   356             watcher->iStatus,
   367             watcher->iStatus,
   358             ActivityTimerL( aMailBoxId ),
   369             ActivityTimerL( aMailBoxId ),
   359             aDestinationFolderId.Id(),
   370             aDestinationFolderId.Id(),
   360             *sel,
   371             *sel,
   361             aMailBoxId,
   372             aMailBoxId,
   362             NULL, // no observer, async not supported
   373             NULL, // no observer, async not supported
   363             0 ); // no reqId, async not supported
   374             0 ); // async not supported
   364             
   375 
   365         watcher->SetOperation( op );
   376         watcher->SetOperation( op );
   366         CleanupStack::PopAndDestroy( sel );
   377         CleanupStack::PopAndDestroy( sel );
   367         iOperations.AppendL( watcher );
   378         iOperations.AppendL( watcher );
   368         CleanupStack::Pop( watcher );
   379         CleanupStack::Pop( watcher );
   369         }
   380         }
   370 	} 	
   381     else
       
   382         {
       
   383         //do nothing
       
   384         }
       
   385     }
       
   386 
       
   387 // ---------------------------------------------------------------------------
       
   388 // CIpsPlgImap4Plugin::MoveMessagesL()
       
   389 // asynchronic move message function
       
   390 // ---------------------------------------------------------------------------
       
   391 //
       
   392 TInt CIpsPlgImap4Plugin::MoveMessagesL( 
       
   393     const TFSMailMsgId& aMailBoxId,
       
   394     const RArray<TFSMailMsgId>& aMessageIds, 
       
   395     const TFSMailMsgId& aSourceFolderId,
       
   396     const TFSMailMsgId& aDestinationFolderId,
       
   397     MFSMailRequestObserver& aOperationObserver,
       
   398     TInt aRequestId )
       
   399     {
       
   400     FUNC_LOG;
       
   401     TInt ret = KErrNone;
       
   402     if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
       
   403         {
       
   404         // Move to Drafts folder
       
   405         MoveMessagesToDraftL( aMailBoxId, 
       
   406                 aMessageIds, 
       
   407                 aSourceFolderId, 
       
   408                 aDestinationFolderId );
       
   409         TFSProgress progress = { 
       
   410                 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret };
       
   411         aOperationObserver.RequestResponseL( 
       
   412                 progress, aRequestId );
       
   413         }
       
   414     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
       
   415         {
       
   416         TMsvId service = aMailBoxId.Id();
       
   417 
       
   418         CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
       
   419         CleanupStack::PushL( watcher );
       
   420         
       
   421         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
       
   422         CleanupStack::PushL(sel);
       
   423         sel->AppendL( service );
       
   424 
       
   425         TInt msgIdCount( aMessageIds.Count() );
       
   426         for ( TInt i(0); i< msgIdCount; i++ )
       
   427             {
       
   428             sel->AppendL( aMessageIds[i].Id() );
       
   429             }
       
   430 
       
   431         TPckgBuf<TImImap4GetMailInfo> optionsBuf;
       
   432         TImImap4GetMailInfo& options = optionsBuf();
       
   433         options.iMaxEmailSize = KMaxTInt32;
       
   434         options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
       
   435         options.iDestinationFolder = aDestinationFolderId.Id();
       
   436 
       
   437 		// <qmail> following constructor's parameters have changed
       
   438     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
       
   439             *iSession, 
       
   440             watcher->iStatus,
       
   441             service,
       
   442             ActivityTimerL( aMailBoxId ),
       
   443             aDestinationFolderId.Id(),
       
   444             *sel,
       
   445             aMailBoxId,
       
   446             &aOperationObserver, // async not supported
       
   447             0 ); // async not supported
       
   448 
       
   449         watcher->SetOperation( op );
       
   450         CleanupStack::PopAndDestroy( sel );
       
   451         iOperations.AppendL( watcher );
       
   452         CleanupStack::Pop( watcher );
       
   453         }
       
   454     else
       
   455         {
       
   456         ret = KErrNotSupported;
       
   457         TFSProgress progress = { 
       
   458                 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret };
       
   459         aOperationObserver.RequestResponseL( 
       
   460                 progress, aRequestId );
       
   461         }
       
   462     return ret;
       
   463     }
   371 
   464 
   372 // ---------------------------------------------------------------------------
   465 // ---------------------------------------------------------------------------
   373 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   466 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   374 // ---------------------------------------------------------------------------
   467 // ---------------------------------------------------------------------------
   375 //
   468 //
   430                         
   523                         
   431             return;
   524             return;
   432             }
   525             }
   433         
   526         
   434         }
   527         }
   435         
   528        
       
   529 	// <qmail> TImImap4GetMailInfo options removed
   436     CIpsPlgBaseOperation* op = CIpsPlgImap4FetchAttachmentOp::NewL( 
   530     CIpsPlgBaseOperation* op = CIpsPlgImap4FetchAttachmentOp::NewL( 
   437         *iSession, 
   531         *iSession, 
   438         watcher->iStatus,
   532         watcher->iStatus,
   439         aMailBoxId.Id(),
   533         aMailBoxId.Id(),
   440         ActivityTimerL( aMailBoxId ), 
   534         ActivityTimerL( aMailBoxId ), 
   443         &aOperationObserver,
   537         &aOperationObserver,
   444         aRequestId );
   538         aRequestId );
   445     
   539     
   446     watcher->SetOperation( op );
   540     watcher->SetOperation( op );
   447     iOperations.AppendL( watcher );
   541     iOperations.AppendL( watcher );
       
   542 // <qmail>
   448     CleanupStack::Pop( sel );
   543     CleanupStack::Pop( sel );
       
   544 // </qmail>
   449     CleanupStack::Pop( watcher );
   545     CleanupStack::Pop( watcher );
   450     }
   546     }
   451 
   547 
   452 // ----------------------------------------------------------------------------
   548 // ----------------------------------------------------------------------------
   453 // CIpsPlgImap4Plugin::PopulateNewMailL( )
   549 // CIpsPlgImap4Plugin::PopulateNewMailL( )
   481     CEmailAccounts* accounts = CEmailAccounts::NewLC();
   577     CEmailAccounts* accounts = CEmailAccounts::NewLC();
   482     TImapAccount imapAcc;
   578     TImapAccount imapAcc;
   483     accounts->GetImapAccountL( aMailboxId.Id(), imapAcc );
   579     accounts->GetImapAccountL( aMailboxId.Id(), imapAcc );
   484     accounts->LoadImapSettingsL( imapAcc, *settings );
   580     accounts->LoadImapSettingsL( imapAcc, *settings );
   485     TImImap4GetPartialMailInfo info;
   581     TImImap4GetPartialMailInfo info;
       
   582 // <qmail>	
   486     info.iPartialMailOptions = ENoSizeLimits;
   583     info.iPartialMailOptions = ENoSizeLimits;
   487     //CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings );
   584     //CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings );
   488     CleanupStack::PopAndDestroy( 2, settings );
   585     CleanupStack::PopAndDestroy( 2, settings );
   489     /*
   586     /*
   490     if ( info.iTotalSizeLimit == KIpsSetDataHeadersOnly )
   587     if ( info.iTotalSizeLimit == KIpsSetDataHeadersOnly )
   491         {
   588         {
   492         return;
   589         return;
   493         }*/
   590         }*/
       
   591 // </qmail>
   494     
   592     
   495     TPckgBuf<TImImap4GetPartialMailInfo> package(info);
   593     TPckgBuf<TImImap4GetPartialMailInfo> package(info);
   496     
   594     
   497     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   595     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   498     CleanupStack::PushL( watcher );
   596     CleanupStack::PushL( watcher );