ipsservices/ipssosplugin/inc/ipsplgimap4populateop.h
branchRCL_3
changeset 63 d189ee25cf9d
parent 0 8466d47a6819
child 64 3533d4323edc
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
    13 *
    13 *
    14 * Description:  IMAP4 populate messages operation
    14 * Description:  IMAP4 populate messages operation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef __IPSPLGIMAP4POPULATEOP_H__
    18 #ifndef IPSPLGIMAP4POPULATEOP_H
    19 #define __IPSPLGIMAP4POPULATEOP_H__
    19 #define IPSPLGIMAP4POPULATEOP_H
    20 
    20 
    21 #include "ipsplgonlineoperation.h"
    21 #include "ipsplgonlineoperation.h"
    22 
    22 
    23 class CIpsPlgEventHandler;
    23 class CIpsPlgEventHandler;
    24 
    24 
    25 /**
    25 /**
    26 * class CIpsPlgImap4PopulateOp
    26 * class CIpsPlgImap4PopulateOp
    27 *
    27 * loads message's actual content/ message parts
    28 */
    28 */
    29 
    29 NONSHARABLE_CLASS ( CIpsPlgImap4PopulateOp ) :
    30 class CIpsPlgImap4PopulateOp :
       
    31     public CIpsPlgOnlineOperation
    30     public CIpsPlgOnlineOperation
    32     {
    31     {
    33     public:
    32 public:
    34 
    33 
    35         /**
    34     /**
    36         * NewL()
    35     * NewL()
    37         * Basic factory function - creates dialog with standard title resource
    36     * Basic factory function - creates dialog with standard title resource
    38         * @param CMsvSession& 
    37     * @param aMsvSession client/server session to msvServer 
    39         *
    38     * @param aObserverRequestStatus caller's status
    40         *
    39     * @param aService serviceId of the mailbox
    41         *
    40     * @param aActivityTimer mailbox specific activity timer
    42         *
    41     * @param aPartialMailInfo parameter struct for the service request to msvServer
    43         *
    42     * @param aSel selection of messages to populate (first entry contains service entry)
    44         *
    43     * @param aFSMailBoxId mailbox identifier
    45         * @return CIpsPlgImap4PopulateOperation* self pointer
    44     * @param aFSOperationObserver observer for this operation
    46         */
    45     * @param aFSRequestId client assigned request Id
       
    46     * @param aEventHandler 
       
    47     * @param aDoFilterSelection specifies whether a full populate is requested (i.e. refetch already fecthed or not)
       
    48     * @return CIpsPlgImap4PopulateOperation* self pointer
       
    49     */
       
    50     // <qmail> priority parameter has been removed
       
    51 	// <qmail> MFSMailRequestObserver& changed to pointer
       
    52     IMPORT_C static CIpsPlgImap4PopulateOp* NewL(
       
    53         CMsvSession& aMsvSession,
       
    54         TRequestStatus& aObserverRequestStatus,
       
    55         TMsvId aService,
       
    56         CIpsPlgTimerOperation& aActivityTimer,
       
    57         const TImImap4GetPartialMailInfo& aPartialMailInfo,
       
    58         const CMsvEntrySelection& aSel,
       
    59         TFSMailMsgId aFSMailBoxId,
       
    60         MFSMailRequestObserver* aFSOperationObserver,
       
    61         TInt aFSRequestId,
       
    62         CIpsPlgEventHandler* aEventHandler,  
       
    63         TBool aDoFilterSelection = ETrue );
    47 
    64 
    48         IMPORT_C static CIpsPlgImap4PopulateOp* NewL(
    65     virtual ~CIpsPlgImap4PopulateOp();
    49             CMsvSession& aMsvSession,
       
    50             TRequestStatus& aObserverRequestStatus,
       
    51             TInt aPriority,
       
    52             TMsvId aService,
       
    53             CIpsPlgTimerOperation& aActivityTimer,
       
    54             const TImImap4GetPartialMailInfo& aPartialMailInfo,
       
    55             const CMsvEntrySelection& aSel,
       
    56             TFSMailMsgId aFSMailBoxId,
       
    57             MFSMailRequestObserver& aFSOperationObserver,
       
    58             TInt aFSRequestId,
       
    59             CIpsPlgEventHandler* aEventHandler,  
       
    60             TBool aDoFilterSelection = ETrue );
       
    61 
    66 
    62         /**
    67     /**
    63         * ~CIpsPlgImap4PopulateOp()
    68     * From MsvOperation
    64         * destructor
    69     * Gets information on the progress of the operation
    65         */
    70     * (see MsvOperation header)
       
    71     */
       
    72     const TDesC8& ProgressL();
       
    73     
       
    74     /**
       
    75     * From CIpsPlgBaseOperation
       
    76     * For reporting if DoRunL leaves
       
    77     */
       
    78     const TDesC8& GetErrorProgressL( TInt aError );
       
    79     
       
    80     TFSProgress GetFSProgressL() const;
       
    81      
       
    82     // <qmail> change ret val type
       
    83     /**
       
    84      * Returns operation type
       
    85      */
       
    86     TIpsOpType IpsOpType() const;
       
    87     
       
    88 private:
       
    89     // <qmail> priority parameter has been removed
       
    90     CIpsPlgImap4PopulateOp(
       
    91         CMsvSession& aMsvSession,
       
    92         TRequestStatus& aObserverRequestStatus,
       
    93         TMsvId aService,
       
    94         CIpsPlgTimerOperation& aActivityTimer,
       
    95         const TImImap4GetPartialMailInfo& aGetMailInfo,
       
    96         TFSMailMsgId aFSMailBoxId,
       
    97         MFSMailRequestObserver* aFSOperationObserver,
       
    98         TInt aFSRequestId,
       
    99         CIpsPlgEventHandler* aEventHandler );
    66 
   100 
    67         virtual ~CIpsPlgImap4PopulateOp();
   101     void ConstructL( const CMsvEntrySelection& aSel, TBool aDoFilterSelection );
    68 
   102 
    69         /**
   103     void RunL();
    70         *
       
    71         */
       
    72         const TDesC8& ProgressL();
       
    73 
   104 
    74         
   105     void DoRunL();
    75         /**
   106     
    76         *
   107     void DoCancel();
    77         */
       
    78         const TDesC8& GetErrorProgressL( TInt aError );
       
    79         
       
    80         /**
       
    81         *
       
    82         */        
       
    83         TFSProgress GetFSProgressL() const;
       
    84         
       
    85         /**
       
    86         *
       
    87         */
       
    88         virtual TInt IpsOpType() const;
       
    89         
       
    90     private:
       
    91 
   108 
       
   109     /**
       
   110      * completes the status of the observer
       
   111      */
       
   112     void Complete();
       
   113     
       
   114     /**
       
   115     * handle connecting state
       
   116     */
       
   117     void DoConnectL();
       
   118     
       
   119     /**
       
   120     * Filters given selection of entries
       
   121     * The result is set to internal iSelection member
       
   122     * (filtering is done on basis of what is the current populate status of the particular message)
       
   123     * @param aSelection list of entries to fetch
       
   124     */
       
   125     void FilterSelectionL( const CMsvEntrySelection& aSelection );
       
   126     
       
   127     /**
       
   128     * helper for selection filtering
       
   129     */
       
   130     TBool IsPartialPopulate();
    92 
   131 
    93         /**
   132 protected:
    94         * CIpsPlgImap4PopulateOp()
   133     
    95         * @param 
   134     /**
    96         *
   135     * starts the actual populate command to msvserver
    97         *
   136     */
    98         *
   137     void DoPopulateL();
    99         *
   138     
   100         *
   139     // <qmail> remove GetEngineProgress( const TDesC8& aProgress );
   101         *
   140     
   102         
   141 private: //Data
   103         */
   142     // <qmail> members changed
   104 
   143     // internal state of the operation
   105         CIpsPlgImap4PopulateOp(
   144     enum TFetchState 
   106             CMsvSession& aMsvSession,
   145         {
   107             TRequestStatus& aObserverRequestStatus,
   146         EStateIdle,
   108             TInt aPriority,
   147         EStateConnecting,
   109             TMsvId aService,
   148         EStateFetching,
   110             CIpsPlgTimerOperation& aActivityTimer,
   149         EStateInfoEntryChange
   111             const TImImap4GetPartialMailInfo& aGetMailInfo,
   150         };
   112             TFSMailMsgId aFSMailBoxId,
   151     TFetchState                       iState;
   113             MFSMailRequestObserver& aFSOperationObserver,
   152     
   114             TInt aFSRequestId,
   153     // parameter struct for the populate command to msvserver
   115             CIpsPlgEventHandler* aEventHandler );
   154     TImImap4GetPartialMailInfo        iPartialMailInfo;
   116 
   155     // contains full list of messages to fetch
   117         /**
   156     CMsvEntrySelection*               iSelection;
   118         * 
   157     // contains serviceId and one message entry id from iSelection list
   119         */
   158     // i.e. populate op loops through iSelection with this iTempSelection
   120 
   159     CMsvEntrySelection*               iTempSelection;
   121         void ConstructL( 
   160     // not owned
   122                 const CMsvEntrySelection& aSel, 
   161     CIpsPlgEventHandler*              iEventHandler;
   123                 TBool aDoFilterSelection );
   162     TDesC8*                           iFetchErrorProgress;
   124 
   163     TPckgBuf<TImap4SyncProgress>      iSyncProgress;
   125 
       
   126         /**
       
   127         * 
       
   128         */
       
   129 
       
   130         void RunL();
       
   131 
       
   132         /**
       
   133         * 
       
   134         */
       
   135         void DoRunL();
       
   136         
       
   137         /**
       
   138         * 
       
   139         */
       
   140         void DoCancel();
       
   141 
       
   142         /**
       
   143         * 
       
   144         */
       
   145 
       
   146         void Complete();
       
   147         
       
   148         /**
       
   149         *
       
   150         */
       
   151         void DoConnectL();
       
   152         
       
   153         /**
       
   154         *
       
   155         */
       
   156         void FilterSelectionL( const CMsvEntrySelection& aSelection );
       
   157         
       
   158         /**
       
   159         *
       
   160         */
       
   161         TBool IsPartialPopulate( );
       
   162 
       
   163     protected:
       
   164         
       
   165         /**
       
   166         *
       
   167         */
       
   168         void DoPopulateL();
       
   169         
       
   170         /**
       
   171         * From CIpsPlgOnlineoperation
       
   172         */
       
   173         TInt GetEngineProgress( const TDesC8& aProgress );
       
   174         
       
   175     protected:
       
   176 
       
   177         enum TFetchState 
       
   178             {
       
   179             EStateIdle,
       
   180             EStateConnecting,
       
   181             EStateFetching,
       
   182             EStateInfoEntryChange
       
   183             };
       
   184 
       
   185    
       
   186     private: //Data
       
   187         
       
   188         TImImap4GetPartialMailInfo        iPartialMailInfo;
       
   189         RArray<TMsvId>                    iSelection;
       
   190         // not owned
       
   191         CIpsPlgEventHandler*              iEventHandler;
       
   192         CMsvEntrySelection*               iTempSelection;
       
   193         TDesC8*                           iFetchErrorProgress;
       
   194         TPckgBuf<TImap4SyncProgress>      iSyncProgress;
       
   195         TMsvId                            iParent;
       
   196         TFetchState                       iState;
       
   197         
       
   198     };
   164     };
   199 
   165 
   200 #endif //__IPSPLGIMAP4POPULATEOP_H__
   166 #endif // IPSPLGIMAP4POPULATEOP_H