ipsservices/ipssosplugin/src/ipsplgimap4plugin.cpp
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
    13 *
    13 *
    14 * Description: This file implements class CIpsPlgImap4Plugin.
    14 * Description: This file implements class CIpsPlgImap4Plugin.
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
       
    19 
       
    20 #include "emailtrace.h"
    18 #include "emailtrace.h"
    21 #include "ipsplgheaders.h"
    19 #include "ipsplgheaders.h"
    22 
    20 
    23 const TInt KConnectOpPriority = CActive::EPriorityStandard;
    21 // <qmail> priority const has been removed
    24 
    22 
    25 // ---------------------------------------------------------------------------
    23 // ---------------------------------------------------------------------------
    26 // CIpsPlgImap4Plugin::CIpsPlgImap4Plugin()
    24 // CIpsPlgImap4Plugin::CIpsPlgImap4Plugin()
    27 // ---------------------------------------------------------------------------
    25 // ---------------------------------------------------------------------------
    28 //
    26 //
    31     {
    29     {
    32     FUNC_LOG;
    30     FUNC_LOG;
    33     // none
    31     // none
    34     }
    32     }
    35 
    33 
    36 
       
    37 // ---------------------------------------------------------------------------
    34 // ---------------------------------------------------------------------------
    38 // CIpsPlgImap4Plugin::ConstructL()
    35 // CIpsPlgImap4Plugin::ConstructL()
    39 // ---------------------------------------------------------------------------
    36 // ---------------------------------------------------------------------------
    40 //
    37 //
    41 void CIpsPlgImap4Plugin::ConstructL()
    38 void CIpsPlgImap4Plugin::ConstructL()
    42     {
    39     {
    43     FUNC_LOG;
    40     FUNC_LOG;
    44     BaseConstructL();
    41     BaseConstructL();
    45     }
    42     }
    46 
       
    47 
    43 
    48 // ---------------------------------------------------------------------------
    44 // ---------------------------------------------------------------------------
    49 // CIpsPlgImap4Plugin::NewL()
    45 // CIpsPlgImap4Plugin::NewL()
    50 // ---------------------------------------------------------------------------
    46 // ---------------------------------------------------------------------------
    51 //
    47 //
    54     FUNC_LOG;
    50     FUNC_LOG;
    55     CIpsPlgImap4Plugin* self = CIpsPlgImap4Plugin::NewLC();
    51     CIpsPlgImap4Plugin* self = CIpsPlgImap4Plugin::NewLC();
    56     CleanupStack::Pop( self );
    52     CleanupStack::Pop( self );
    57     return self;
    53     return self;
    58     }
    54     }
    59 
       
    60 
    55 
    61 // ---------------------------------------------------------------------------
    56 // ---------------------------------------------------------------------------
    62 // CIpsPlgImap4Plugin::NewLC()
    57 // CIpsPlgImap4Plugin::NewLC()
    63 // ---------------------------------------------------------------------------
    58 // ---------------------------------------------------------------------------
    64 //
    59 //
   149     TMsvId service = aMailBoxId.Id();
   144     TMsvId service = aMailBoxId.Id();
   150     
   145     
   151     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL( *this );
   146     CIpsPlgSingleOpWatcher* watcher = CIpsPlgSingleOpWatcher::NewL( *this );
   152     CleanupStack::PushL( watcher );
   147     CleanupStack::PushL( watcher );
   153     
   148     
       
   149     // <qmail> priority parameter has been removed
   154     CIpsPlgBaseOperation* op = CIpsPlgImap4ConnectOp::NewL(
   150     CIpsPlgBaseOperation* op = CIpsPlgImap4ConnectOp::NewL(
   155     		*iSession,
   151     		*iSession,
   156     		KConnectOpPriority, 
       
   157     		watcher->iStatus, 
   152     		watcher->iStatus, 
   158     		service,
   153     		service,
   159     		ActivityTimerL( aMailBoxId ),
   154     		ActivityTimerL( aMailBoxId ),
   160           	aMailBoxId, 
   155           	aMailBoxId, 
   161           	aOperationObserver,
   156           	&aOperationObserver,
   162           	aRequestId,
   157           	aRequestId,
   163           	iEventHandler );
   158           	iEventHandler );
   164     
   159     
   165     watcher->SetOperation( op );
   160     watcher->SetOperation( op );
   166     iOperations.AppendL( watcher );
   161     iOperations.AppendL( watcher );
   295     info.iTotalSizeLimit = KMaxTInt32;
   290     info.iTotalSizeLimit = KMaxTInt32;
   296     info.iBodyTextSizeLimit = KMaxTInt32;
   291     info.iBodyTextSizeLimit = KMaxTInt32;
   297     info.iAttachmentSizeLimit = 0;
   292     info.iAttachmentSizeLimit = 0;
   298     info.iDestinationFolder = aFolderId.Id();
   293     info.iDestinationFolder = aFolderId.Id();
   299     
   294     
       
   295     // <qmail> priority parameter has been removed
   300     CIpsPlgBaseOperation* op = CIpsPlgImap4PopulateOp::NewL( 
   296     CIpsPlgBaseOperation* op = CIpsPlgImap4PopulateOp::NewL( 
   301         *iSession, 
   297         *iSession, 
   302         watcher->iStatus,
   298         watcher->iStatus,
   303         CActive::EPriorityStandard,
       
   304         aMailBoxId.Id(),
   299         aMailBoxId.Id(),
   305         ActivityTimerL( aMailBoxId ),
   300         ActivityTimerL( aMailBoxId ),
   306         info,
   301         info,
   307         *sel,
   302         *sel,
   308         aMailBoxId, 
   303         aMailBoxId, 
   309         aObserver,
   304         &aObserver,
   310         aRequestId,
   305         aRequestId,
   311         iEventHandler, 
   306         iEventHandler, 
   312         EFalse ); // do not filter mail selection
   307         EFalse ); // do not filter mail selection
   313     
   308     
   314     watcher->SetOperation( op );
   309     watcher->SetOperation( op );
   352     	for ( TInt i(0); i< msgIdCount; i++ )
   347     	for ( TInt i(0); i< msgIdCount; i++ )
   353             {
   348             {
   354             sel->AppendL( aMessageIds[i].Id() );
   349             sel->AppendL( aMessageIds[i].Id() );
   355             }
   350             }
   356     	
   351     	
   357     	TPckgBuf<TImImap4GetMailInfo> optionsBuf;
       
   358         TImImap4GetMailInfo& options = optionsBuf();
       
   359         options.iMaxEmailSize = KMaxTInt32;
       
   360         options.iGetMailBodyParts = EGetImap4EmailBodyTextAndAttachments;
       
   361         options.iDestinationFolder = aDestinationFolderId.Id();
       
   362 
       
   363         MFSMailRequestObserver* observer = NULL;
       
   364         // Synchronous operation
   352         // Synchronous operation
       
   353         // <qmail> following constructor's parameters have changed
   365     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   354     	CIpsPlgBaseOperation* op = CIpsPlgImap4MoveRemoteOp::NewL(
   366             *iSession, 
   355             *iSession, 
   367             watcher->iStatus,
   356             watcher->iStatus,
   368             KIMAP4MTMMoveMailSelectionWhenAlreadyConnected,
       
   369             service,
   357             service,
   370             ActivityTimerL( aMailBoxId ),
   358             ActivityTimerL( aMailBoxId ),
   371             options,
   359             aDestinationFolderId.Id(),
   372             *sel,
   360             *sel,
   373             aMailBoxId,
   361             aMailBoxId,
   374             *observer, // async not supported
   362             NULL, // no observer, async not supported
   375             0 ); // async not supported
   363             0 ); // no reqId, async not supported
   376             
   364             
   377         watcher->SetOperation( op );
   365         watcher->SetOperation( op );
   378         CleanupStack::PopAndDestroy( sel );
   366         CleanupStack::PopAndDestroy( sel );
   379         iOperations.AppendL( watcher );
   367         iOperations.AppendL( watcher );
   380         CleanupStack::Pop( watcher );
   368         CleanupStack::Pop( watcher );
   381         }
       
   382      else
       
   383         {
       
   384         //do nothing
       
   385         }
   369         }
   386 	} 	
   370 	} 	
   387 
   371 
   388 // ---------------------------------------------------------------------------
   372 // ---------------------------------------------------------------------------
   389 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   373 // CIpsPlgImap4Plugin::FetchMessagePartsL()
   446                         
   430                         
   447             return;
   431             return;
   448             }
   432             }
   449         
   433         
   450         }
   434         }
   451     
   435         
   452     TPckgBuf<TImImap4GetMailInfo> optionsBuf;
       
   453     TImImap4GetMailInfo& options = optionsBuf();
       
   454     options.iMaxEmailSize = KMaxTInt32;
       
   455     options.iGetMailBodyParts = EGetImap4EmailAttachments;
       
   456     options.iDestinationFolder = 0; // not used
       
   457     
       
   458     CIpsPlgBaseOperation* op = CIpsPlgImap4FetchAttachmentOp::NewL( 
   436     CIpsPlgBaseOperation* op = CIpsPlgImap4FetchAttachmentOp::NewL( 
   459         *iSession, watcher->iStatus, KIMAP4MTMPopulate, aMailBoxId.Id(),
   437         *iSession, 
   460         ActivityTimerL( aMailBoxId ), options, *sel, aMailBoxId,
   438         watcher->iStatus,
   461         aOperationObserver, aRequestId );
   439         aMailBoxId.Id(),
       
   440         ActivityTimerL( aMailBoxId ), 
       
   441         sel, // ownership is transferred
       
   442         aMailBoxId,
       
   443         &aOperationObserver,
       
   444         aRequestId );
   462     
   445     
   463     watcher->SetOperation( op );
   446     watcher->SetOperation( op );
   464     CleanupStack::PopAndDestroy( sel );
       
   465     iOperations.AppendL( watcher );
   447     iOperations.AppendL( watcher );
       
   448     CleanupStack::Pop( sel );
   466     CleanupStack::Pop( watcher );
   449     CleanupStack::Pop( watcher );
   467     }
   450     }
   468 
   451 
   469 // ----------------------------------------------------------------------------
   452 // ----------------------------------------------------------------------------
   470 // CIpsPlgImap4Plugin::PopulateNewMailL( )
   453 // CIpsPlgImap4Plugin::PopulateNewMailL( )
   517     CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   500     CMsvEntrySelection* sel = new(ELeave) CMsvEntrySelection;
   518     CleanupStack::PushL(sel);
   501     CleanupStack::PushL(sel);
   519     sel->AppendL( aMailboxId.Id() );
   502     sel->AppendL( aMailboxId.Id() );
   520     sel->AppendL( aNewId );
   503     sel->AppendL( aNewId );
   521     
   504     
       
   505     // <qmail> priority parameter has been removed
   522     CIpsPlgBaseOperation* op = CIpsPlgImap4PopulateOp::NewL( 
   506     CIpsPlgBaseOperation* op = CIpsPlgImap4PopulateOp::NewL( 
   523         *iSession, 
   507         *iSession, 
   524         watcher->iStatus,
   508         watcher->iStatus,
   525         KIMAP4MTMPopulateMailSelectionWhenAlreadyConnected,
       
   526         aMailboxId.Id(),
   509         aMailboxId.Id(),
   527         ActivityTimerL( aMailboxId ),
   510         ActivityTimerL( aMailboxId ),
   528         info,
   511         info,
   529         *sel,
   512         *sel,
   530         aMailboxId, 
   513         aMailboxId, 
   531         *this,
   514         NULL, // no operation observer
   532         KErrNotFound,
   515         0,    // no use for requestId
   533         iEventHandler,
   516         iEventHandler,
   534         EFalse ); // do not block entry changed and created events
   517         EFalse ); // do not block entry changed and created events
   535     
   518     
   536     watcher->SetOperation( op );
   519     watcher->SetOperation( op );
   537     CleanupStack::PopAndDestroy( sel );
   520     CleanupStack::PopAndDestroy( sel );