ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp
changeset 18 578830873419
parent 1 12c456ceeff2
child 20 ecc8def7944a
equal deleted inserted replaced
4:e7aa27f58ae1 18:578830873419
    96         {
    96         {
    97         // These should be clear    
    97         // These should be clear    
    98         case EFSMBoxCapaCanBeDeleted:
    98         case EFSMBoxCapaCanBeDeleted:
    99         case EFSMBoxCapaSupportsSaveToDrafts:
    99         case EFSMBoxCapaSupportsSaveToDrafts:
   100         case EFSMBoxCapaMeetingRequestRespond:
   100         case EFSMBoxCapaMeetingRequestRespond:
   101         case EFSMboxCapaSupportsAttahmentsInMR:
       
   102         case EFSMBoxCapaMeetingRequestCreate:
   101         case EFSMBoxCapaMeetingRequestCreate:
   103         case EFSMBoxCapaCanUpdateMeetingRequest:
   102         case EFSMBoxCapaCanUpdateMeetingRequest:
   104         case EFSMBoxCapaMoveToFolder:
   103         case EFSMBoxCapaMoveToFolder:
   105         case EFSMBoxCapaCopyToFolder:
   104         case EFSMBoxCapaCopyToFolder:
   106         case EFSMBoxCapaSupportsSync:
   105         case EFSMBoxCapaSupportsSync:
   107         case EFSMBoxCapaRemoveFromCalendar:
       
   108         case EFSMBoxCapaMoveMessageNoConnectNeeded:
       
   109             {
   106             {
   110             result = ETrue;
   107             result = ETrue;
   111             break;
   108             break;
   112             }
   109             }
   113         // These are positively not supported 
   110         // These are positively not supported 
   117         case EFSMBoxCapaSmartReply:
   114         case EFSMBoxCapaSmartReply:
   118         case EFSMBoxCapaSmartForward:
   115         case EFSMBoxCapaSmartForward:
   119         case EFSMBoxCapaSupportsMRU:
   116         case EFSMBoxCapaSupportsMRU:
   120         case EFSMBoxCapaSymbianMsgIntegration:
   117         case EFSMBoxCapaSymbianMsgIntegration:
   121         case EFSMBoxCapaNewEmailNotifications:
   118         case EFSMBoxCapaNewEmailNotifications:
   122         default:
       
   123             {
   119             {
   124             result = EFalse;
   120             result = EFalse;
   125             break;
   121             break;
   126             }
   122             }
   127         }
   123         }
   168     
   164     
   169     watcher->SetOperation( op );
   165     watcher->SetOperation( op );
   170     iOperations.AppendL( watcher );
   166     iOperations.AppendL( watcher );
   171     CleanupStack::Pop( watcher );
   167     CleanupStack::Pop( watcher );
   172     
   168     
       
   169 	//<qmail>
   173     // send part of refresh
   170     // send part of refresh
   174     EmptyOutboxL( aMailBoxId );
   171     //EmptyOutboxL( aMailBoxId ); // not used in qmail yet
       
   172 	//</qmail>
   175     }
   173     }
   176 
   174 
   177 // ---------------------------------------------------------------------------
   175 // ---------------------------------------------------------------------------
   178 // CIpsPlgImap4Plugin::ListFoldersL()
   176 // CIpsPlgImap4Plugin::ListFoldersL()
   179 // ---------------------------------------------------------------------------
   177 // ---------------------------------------------------------------------------
   327 void CIpsPlgImap4Plugin::MoveMessagesL( 
   325 void CIpsPlgImap4Plugin::MoveMessagesL( 
   328     const TFSMailMsgId& aMailBoxId, 
   326     const TFSMailMsgId& aMailBoxId, 
   329     const RArray<TFSMailMsgId>& aMessageIds, 
   327     const RArray<TFSMailMsgId>& aMessageIds, 
   330     const TFSMailMsgId& aSourceFolderId, 
   328     const TFSMailMsgId& aSourceFolderId, 
   331     const TFSMailMsgId& aDestinationFolderId )
   329     const TFSMailMsgId& aDestinationFolderId )
   332     {
   330 	{
   333     FUNC_LOG;
   331     FUNC_LOG;
   334     if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
   332 	if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
   335         {
   333 	    {
   336         // Move to Drafts folder
   334 	    // Move to Drafts folder
   337         MoveMessagesToDraftL( aMailBoxId, 
   335 	    MoveMessagesToDraftL( aMailBoxId, 
   338                 aMessageIds, 
   336 	                          aMessageIds, 
   339                 aSourceFolderId, 
   337 	                          aSourceFolderId, 
   340                 aDestinationFolderId );
   338 	                          aDestinationFolderId );
   341         }
   339 	    }
   342     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
   340     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
   343         {
   341         {
   344         TMsvId service = aMailBoxId.Id();
   342     	TMsvId service = aMailBoxId.Id();
   345 
   343     	
   346         CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   344     	CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   347         CleanupStack::PushL( watcher );
   345         CleanupStack::PushL( watcher );
   348         
   346         
   349         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   347         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   350         CleanupStack::PushL(sel);
   348         CleanupStack::PushL(sel);
   351         sel->AppendL( service );
   349         sel->AppendL( service );
   352 
   350         
   353         TInt msgIdCount( aMessageIds.Count() );
   351         TInt msgIdCount( aMessageIds.Count() );
   354         for ( TInt i(0); i< msgIdCount; i++ )
   352     	for ( TInt i(0); i< msgIdCount; i++ )
   355             {
   353             {
   356             sel->AppendL( aMessageIds[i].Id() );
   354             sel->AppendL( aMessageIds[i].Id() );
   357             }
   355             }
   358 
   356     	
   359         TPckgBuf<TImImap4GetMailInfo> optionsBuf;
   357     	TPckgBuf<TImImap4GetMailInfo> optionsBuf;
   360         TImImap4GetMailInfo& options = optionsBuf();
   358         TImImap4GetMailInfo& options = optionsBuf();
   361         options.iMaxEmailSize = KMaxTInt32;
   359         options.iMaxEmailSize = KMaxTInt32;
   362         options.iGetMailBodyParts = EGetImap4EmailHeaders;
   360         options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
   363         options.iDestinationFolder = aDestinationFolderId.Id();
   361         options.iDestinationFolder = aDestinationFolderId.Id();
   364 
   362 
   365         CIpsPlgImap4MoveRemoteOpObserver* observer =
   363         MFSMailRequestObserver* observer = NULL;
   366             CIpsPlgImap4MoveRemoteOpObserver::NewL( *iSession, *iEventHandler,
       
   367                 aSourceFolderId, aMessageIds );
       
   368         watcher->SetRequestObserver( observer );
       
   369 
       
   370         // Synchronous operation
   364         // Synchronous operation
   371         CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   365     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   372             *iSession, 
   366             *iSession, 
   373             watcher->iStatus,
   367             watcher->iStatus,
   374             KIMAP4MTMMoveMailSelectionWhenAlreadyConnected,
   368             KIMAP4MTMMoveMailSelectionWhenAlreadyConnected,
   375             service,
   369             service,
   376             ActivityTimerL( aMailBoxId ),
   370             ActivityTimerL( aMailBoxId ),
   377             options,
   371             options,
   378             *sel,
   372             *sel,
   379             aMailBoxId,
   373             aMailBoxId,
   380             *observer, // async not supported
   374             *observer, // async not supported
   381             0 ); // async not supported
   375             0 ); // async not supported
   382 
   376             
   383         watcher->SetOperation( op );
   377         watcher->SetOperation( op );
   384         CleanupStack::PopAndDestroy( sel );
   378         CleanupStack::PopAndDestroy( sel );
   385         iOperations.AppendL( watcher );
   379         iOperations.AppendL( watcher );
   386         CleanupStack::Pop( watcher );
   380         CleanupStack::Pop( watcher );
   387         }
   381         }
   388     else
   382      else
   389         {
   383         {
   390         //do nothing
   384         //do nothing
   391         }
   385         }
   392     }
   386 	} 	
   393 
       
   394 // ---------------------------------------------------------------------------
       
   395 // CIpsPlgImap4Plugin::MoveMessagesL()
       
   396 // asynchronic move message function
       
   397 // ---------------------------------------------------------------------------
       
   398 //
       
   399 TInt CIpsPlgImap4Plugin::MoveMessagesL( 
       
   400     const TFSMailMsgId& aMailBoxId,
       
   401     const RArray<TFSMailMsgId>& aMessageIds, 
       
   402     const TFSMailMsgId& aSourceFolderId,
       
   403     const TFSMailMsgId& aDestinationFolderId,
       
   404     MFSMailRequestObserver& aOperationObserver,
       
   405     TInt aRequestId )
       
   406     {
       
   407     FUNC_LOG;
       
   408     TInt ret = KErrNone;
       
   409     if( aDestinationFolderId.Id() == KMsvDraftEntryId  )
       
   410         {
       
   411         // Move to Drafts folder
       
   412         MoveMessagesToDraftL( aMailBoxId, 
       
   413                 aMessageIds, 
       
   414                 aSourceFolderId, 
       
   415                 aDestinationFolderId );
       
   416         TFSProgress progress = { 
       
   417                 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret };
       
   418         aOperationObserver.RequestResponseL( 
       
   419                 progress, aRequestId );
       
   420         }
       
   421     else if( aDestinationFolderId.Id() != aSourceFolderId.Id() )
       
   422         {
       
   423         TMsvId service = aMailBoxId.Id();
       
   424 
       
   425         CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
       
   426         CleanupStack::PushL( watcher );
       
   427         
       
   428         CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
       
   429         CleanupStack::PushL(sel);
       
   430         sel->AppendL( service );
       
   431 
       
   432         TInt msgIdCount( aMessageIds.Count() );
       
   433         for ( TInt i(0); i< msgIdCount; i++ )
       
   434             {
       
   435             sel->AppendL( aMessageIds[i].Id() );
       
   436             }
       
   437 
       
   438         TPckgBuf<TImImap4GetMailInfo> optionsBuf;
       
   439         TImImap4GetMailInfo& options = optionsBuf();
       
   440         options.iMaxEmailSize = KMaxTInt32;
       
   441         options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
       
   442         options.iDestinationFolder = aDestinationFolderId.Id();
       
   443 
       
   444         CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
       
   445             *iSession, 
       
   446             watcher->iStatus,
       
   447             KIMAP4MTMMoveMailSelectionWhenAlreadyConnected,
       
   448             service,
       
   449             ActivityTimerL( aMailBoxId ),
       
   450             options,
       
   451             *sel,
       
   452             aMailBoxId,
       
   453             aOperationObserver,
       
   454             aRequestId ); 
       
   455 
       
   456         watcher->SetOperation( op );
       
   457         CleanupStack::PopAndDestroy( sel );
       
   458         iOperations.AppendL( watcher );
       
   459         CleanupStack::Pop( watcher );
       
   460         }
       
   461     else
       
   462         {
       
   463         ret = KErrNotSupported;
       
   464         TFSProgress progress = { 
       
   465                 TFSProgress::EFSStatus_RequestComplete, 0, 0, ret };
       
   466         aOperationObserver.RequestResponseL( 
       
   467                 progress, aRequestId );
       
   468         }
       
   469     return ret;
       
   470     }
       
   471 
   387 
   472 // ---------------------------------------------------------------------------
   388 // ---------------------------------------------------------------------------
   473 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   389 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   474 // ---------------------------------------------------------------------------
   390 // ---------------------------------------------------------------------------
   475 //
   391 //
   582     CEmailAccounts* accounts = CEmailAccounts::NewLC();
   498     CEmailAccounts* accounts = CEmailAccounts::NewLC();
   583     TImapAccount imapAcc;
   499     TImapAccount imapAcc;
   584     accounts->GetImapAccountL( aMailboxId.Id(), imapAcc );
   500     accounts->GetImapAccountL( aMailboxId.Id(), imapAcc );
   585     accounts->LoadImapSettingsL( imapAcc, *settings );
   501     accounts->LoadImapSettingsL( imapAcc, *settings );
   586     TImImap4GetPartialMailInfo info;
   502     TImImap4GetPartialMailInfo info;
   587     CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings );
   503     info.iPartialMailOptions = ENoSizeLimits;
       
   504     //CIpsSetDataApi::ConstructImapPartialFetchInfo( info, *settings );
   588     CleanupStack::PopAndDestroy( 2, settings );
   505     CleanupStack::PopAndDestroy( 2, settings );
   589     
   506     /*
   590     if ( info.iTotalSizeLimit == KIpsSetDataHeadersOnly )
   507     if ( info.iTotalSizeLimit == KIpsSetDataHeadersOnly )
   591         {
   508         {
   592         return;
   509         return;
   593         }
   510         }*/
   594     
   511     
   595     TPckgBuf<TImImap4GetPartialMailInfo> package(info);
   512     TPckgBuf<TImImap4GetPartialMailInfo> package(info);
   596     
   513     
   597     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   514     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL(*this);
   598     CleanupStack::PushL( watcher );
   515     CleanupStack::PushL( watcher );