emailservices/emailstore/base_plugin/inc/baseplugindelayedopsprivate.h
changeset 0 8466d47a6819
child 18 578830873419
child 19 b13141f05c3d
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Support for executing asynchronously certain plugin
       
    15 * operations.
       
    16 */
       
    17 #ifndef BASEPLUGINDELAYEDOPSPRIVATE_H
       
    18 #define BASEPLUGINDELAYEDOPSPRIVATE_H
       
    19 
       
    20 
       
    21 #include "baseplugindelayedops.h"
       
    22 
       
    23 
       
    24 /**
       
    25  * Lets the user enqueue and dequeue asynchronous jobs for handling
       
    26  * plugin-related actions. 
       
    27  */
       
    28 NONSHARABLE_CLASS ( CDelayedOpsManager ) :
       
    29     public CBase,
       
    30     public MDelayedOpsManager
       
    31     {
       
    32 
       
    33 public:
       
    34 
       
    35     static CDelayedOpsManager* NewL( CBasePlugin& aPlugin );
       
    36     
       
    37     virtual ~CDelayedOpsManager();
       
    38     
       
    39     // MDelayedOpsManager::EnqueueOpL
       
    40     virtual void EnqueueOpL( CDelayedOp* aOp );
       
    41     
       
    42     // MDelayedOpsManager::DequeueOpL
       
    43     virtual void DequeueOp( const CDelayedOp& aOp );
       
    44     
       
    45     // MDelayedOpsManager::Extension1
       
    46     virtual TInt Extension1(
       
    47         TUint /*aExtensionId*/, TAny*& /*a0*/, TAny* /*a1*/ );
       
    48 
       
    49 
       
    50 private:
       
    51     
       
    52     CDelayedOpsManager( CBasePlugin& aPlugin );
       
    53 
       
    54     void ConstructL();
       
    55     
       
    56     void ExecutePendingOps();
       
    57     
       
    58     CDelayedOpsManager( const CDelayedOpsManager& );
       
    59     CDelayedOpsManager& operator= ( const CDelayedOpsManager& );    
       
    60     
       
    61 
       
    62 private:
       
    63     CBasePlugin& iPlugin;
       
    64     RPointerArray<CDelayedOp> iDelayedOps;
       
    65     
       
    66     __LOG_DECLARATION
       
    67     };
       
    68 
       
    69 
       
    70 /**
       
    71  * 
       
    72  */
       
    73 NONSHARABLE_CLASS( CDelayedDeleteMessagesOp ) : public CDelayedOp
       
    74     {
       
    75 
       
    76 public:
       
    77 
       
    78     static CDelayedDeleteMessagesOp* NewLC(
       
    79         TMsgStoreId aMailBoxId,
       
    80         TMsgStoreId aFolderId,
       
    81         const RArray<TFSMailMsgId>& aMessages );
       
    82     
       
    83     static CDelayedDeleteMessagesOp* NewLC(
       
    84         TMsgStoreId aMailBoxId,
       
    85         TMsgStoreId aFolderId,
       
    86         TMsgStoreId aMsgId );
       
    87 
       
    88     virtual ~CDelayedDeleteMessagesOp();
       
    89 
       
    90     //CDelayedOp::ExecuteOpL
       
    91     virtual void ExecuteOpL();
       
    92     
       
    93 private:
       
    94 
       
    95     void ConstructL( const RArray<TFSMailMsgId>& aMessages );
       
    96     void ConstructL( TMsgStoreId aMsgId );
       
    97     
       
    98     CDelayedDeleteMessagesOp(
       
    99         TMsgStoreId aMailBoxId,
       
   100         TMsgStoreId aFolderId );
       
   101     
       
   102     CDelayedDeleteMessagesOp( const CDelayedDeleteMessagesOp& );
       
   103     CDelayedDeleteMessagesOp& operator= ( const CDelayedDeleteMessagesOp& );    
       
   104     
       
   105 private:
       
   106     
       
   107     TMsgStoreId iMailBoxId;
       
   108     TMsgStoreId iFolderId;
       
   109     RArray<TMsgStoreId> iMessages;
       
   110     TBool iImmediateDelete;
       
   111     
       
   112     __LOG_DECLARATION
       
   113     };
       
   114 
       
   115 
       
   116 /**
       
   117  * This most likely needs "large-content" mode where the content buffer is not
       
   118  * copied in memory but stored on a fast drive and then do a
       
   119  * ReplaceContentWithFileL.
       
   120  */
       
   121 NONSHARABLE_CLASS( CDelayedSetContentOp ) : public CDelayedOp
       
   122     {
       
   123 
       
   124 public:
       
   125 
       
   126     static CDelayedSetContentOp* NewLC(
       
   127        TMsgStoreId aMailBoxId,
       
   128        TMsgStoreId aMessageId,
       
   129        TMsgStoreId aMessagePartId,
       
   130        const TDesC& aContent );
       
   131 
       
   132     static CDelayedSetContentOp* NewLC(
       
   133        TMsgStoreId aMailBoxId,
       
   134        TMsgStoreId aMessageId,
       
   135        TMsgStoreId aMessagePartId,
       
   136        TInt aContentLength );
       
   137 
       
   138     virtual ~CDelayedSetContentOp();
       
   139 
       
   140     //CDelayedOp::ExecuteOpL
       
   141     virtual void ExecuteOpL();
       
   142     
       
   143 private:
       
   144 
       
   145     void ConstructL( const TDesC& aContent );
       
   146     void ConstructL();
       
   147 
       
   148     CDelayedSetContentOp(
       
   149         TMsgStoreId aMailBoxId,
       
   150         TMsgStoreId aMessageId,
       
   151         TMsgStoreId aMessagePartId );
       
   152 
       
   153     CDelayedSetContentOp(
       
   154         TMsgStoreId aMailBoxId,
       
   155         TMsgStoreId aMessageId,
       
   156         TMsgStoreId aMessagePartId,
       
   157         TInt aContentLength );
       
   158     
       
   159     CMsgStoreMessagePart* FetchMessagePartLC();    
       
   160     
       
   161     CDelayedSetContentOp( const CDelayedSetContentOp& );
       
   162     CDelayedSetContentOp& operator= ( const CDelayedSetContentOp& );    
       
   163     
       
   164 private:
       
   165     
       
   166     TMsgStoreId iMailBoxId;
       
   167     TMsgStoreId iMessageId;
       
   168     TMsgStoreId iMessagePartId;
       
   169     HBufC* iContent;
       
   170     TInt iContentLength;
       
   171     TBool iStepOne;
       
   172     
       
   173     __LOG_DECLARATION
       
   174     };
       
   175 
       
   176 
       
   177 #endif // BASEPLUGINDELAYEDOPSPRIVATE_H