ipsservices/ipssosplugin/inc/ipsplgimap4moveremoteop.h
changeset 20 ecc8def7944a
parent 18 578830873419
child 23 2dc6caa42ec3
equal deleted inserted replaced
18:578830873419 20:ecc8def7944a
    13 *
    13 *
    14 * Description:  IMAP4 remote move message operation
    14 * Description:  IMAP4 remote move message operation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #ifndef __IPSPLGIMAP4MOVEREMOTEOP_H__
    18 #ifndef IPSPLGIMAP4MOVEREMOTEOP_H
    19 #define __IPSPLGIMAP4MOVEREMOTEOP_H__
    19 #define IPSPLGIMAP4MOVEREMOTEOP_H
    20 
       
    21 
    20 
    22 #include "ipsplgonlineoperation.h"
    21 #include "ipsplgonlineoperation.h"
    23 
    22 
    24 /**
    23 /**
    25 * Move a selection of messages that may or may not be complete.
    24 * Move a selection of messages that may or may not be complete.
    26 * Always fetches entire messages.
    25 * Always fetches entire messages.
    27 */
    26 */
    28 NONSHARABLE_CLASS ( CIpsPlgImap4MoveRemoteOp ) :
    27 NONSHARABLE_CLASS ( CIpsPlgImap4MoveRemoteOp ) :
    29     public CIpsPlgOnlineOperation
    28     public CIpsPlgOnlineOperation
    30     {
    29     {
    31     public:
    30 public:
    32         /**
    31     /**
    33         *
    32     * NewL
    34         * @param aSession: Server session.
    33     * @param aMsvSession client/server session to MsvServer
    35         * @param aStatus: Observer completion status.
    34     * @param aObserverRequestStatus client's status
    36         * @param aReporter: Progress reporter.
    35     * @param aService serviceId of the mailbox
    37         * @param aSel: The message ids to get.
    36     * @param aActivityTimer mailbox specific activity timer
    38         * @param aTargetId: Where to fetch the messages to.
    37     * @param aDestinationFolder destination folder id to where the messages are to be moved
    39         * @param aCopy: Copying or moving.
    38     * @param aSelection selection of messages
    40         */
    39     * @param aFSMailBoxId identifies mailbox
    41         static CIpsPlgImap4MoveRemoteOp* NewL(
    40     * @param aFSOperationObserver observer of this operation
    42             CMsvSession& aMsvSession,
    41     * @param aFSRequestId client assigned request identifier
    43             TRequestStatus& aObserverRequestStatus,
    42     * @return class instance
    44             TInt aFunctionId,
    43     */
    45             TMsvId aService,
    44     // <qmail> parameters changed
    46             CIpsPlgTimerOperation& aActivityTimer,
    45     static CIpsPlgImap4MoveRemoteOp* NewL(
    47             const TImImap4GetMailInfo& aGetMailInfo,
    46         CMsvSession& aMsvSession,
    48             const CMsvEntrySelection& aSel,
    47         TRequestStatus& aObserverRequestStatus,
    49             TFSMailMsgId aFSMailBoxId,
    48         TMsvId aService,
    50             MFSMailRequestObserver& aFSOperationObserver,
    49         CIpsPlgTimerOperation& aActivityTimer,
    51             TInt aFSRequestId );
    50         const TMsvId& aDestinationFolder,
       
    51         const CMsvEntrySelection& aSelection,
       
    52         TFSMailMsgId aFSMailBoxId,
       
    53         MFSMailRequestObserver* aFSOperationObserver,
       
    54         TInt aFSRequestId );
    52 
    55 
    53         /**
    56     virtual ~CIpsPlgImap4MoveRemoteOp();
    54         *
    57     
    55         */
    58     /**
    56         virtual ~CIpsPlgImap4MoveRemoteOp();
    59     * From MsvOperation
    57         
    60     * Gets information on the progress of the operation
    58         /**
    61     * (see MsvOperation header)
    59         *
    62     */
    60         */
    63     const TDesC8& ProgressL();
    61         const TDesC8& ProgressL();
    64     
    62         
    65     /**
    63         /**
    66     * From CIpsPlgBaseOperation
    64         *
    67     * For reporting if DoRunL leaves
    65         */
    68     */
    66         const TDesC8& GetErrorProgressL( TInt aError );
    69     const TDesC8& GetErrorProgressL( TInt aError );
    67         
    70     
    68         /**
    71     TFSProgress GetFSProgressL() const;
    69         *
    72     
    70         */
    73     // <qmail> new func to this op
    71         TFSProgress GetFSProgressL() const;
    74     /**
    72         
    75      * Returns operation type
    73     private:
    76      */
       
    77     TIpsOpType IpsOpType() const;
       
    78     
       
    79 private:
       
    80     // <qmail> parameters changed
       
    81     CIpsPlgImap4MoveRemoteOp(
       
    82         CMsvSession& aMsvSession,
       
    83         TRequestStatus& aObserverRequestStatus,
       
    84         TMsvId aService,
       
    85         CIpsPlgTimerOperation& aActivityTimer,
       
    86         const TMsvId& aDestinationFolder,
       
    87         TFSMailMsgId aFSMailBoxId,
       
    88         MFSMailRequestObserver* aFSOperationObserver,
       
    89         TInt aFSRequestId );
    74 
    90 
    75         /**
    91     void ConstructL( const CMsvEntrySelection& aSelection );
    76         * for explanation of parameters, see NewL
    92     
    77         */
    93     void RunL();
    78         CIpsPlgImap4MoveRemoteOp(
    94     
    79             CMsvSession& aMsvSession,
    95     /**
    80             TRequestStatus& aObserverRequestStatus,
    96      * actual implementation of RunL's functionality
    81             TInt aFunctionId,
    97      * RunL wraps and traps this function
    82             TMsvId aService,
    98      */
    83             CIpsPlgTimerOperation& aActivityTimer,
    99     void DoRunL();
    84             const TImImap4GetMailInfo& aGetMailInfo,
   100     
    85             TFSMailMsgId aFSMailBoxId,
   101     void DoConnectL();
    86             MFSMailRequestObserver& aFSOperationObserver,
   102     
    87             TInt aFSRequestId );
   103     /**
       
   104     * Sort messages into complete and incomplete.
       
   105     */
       
   106     void SortMessageSelectionL(const CMsvEntrySelection& aSel);
       
   107     
       
   108     /**
       
   109      * Completes client's status
       
   110      */
       
   111     void Complete();
       
   112     
       
   113     /**
       
   114      * handles local moving
       
   115      */
       
   116     void DoMoveLocalL();
    88 
   117 
    89         /**
   118     /**
    90         *
   119      * handles remote moving
    91         */
   120      */
    92         void ConstructL(const CMsvEntrySelection& aSel);
   121     void DoMoveRemoteL();
    93         
   122     
    94         /**
   123     // <qmail> removed TInt GetEngineProgress( const TDesC8& aProgress );
    95         * RunL()
       
    96         */
       
    97         void RunL();
       
    98         
       
    99         /**
       
   100         *
       
   101         */
       
   102         void DoRunL();
       
   103         
       
   104         
       
   105         /**
       
   106         *
       
   107         */
       
   108         void DoConnectL();
       
   109         
       
   110         /**
       
   111         *
       
   112         * Sort messages into complete and incomplete.
       
   113         */
       
   114         void SortMessageSelectionL(const CMsvEntrySelection& aSel);
       
   115         
       
   116         /**
       
   117         *
       
   118         */
       
   119 
   124 
   120         void Complete();
   125 private:
   121         
   126     // internal state of this operation
   122         /**
   127     enum TState 
   123         *
   128         { 
   124         */
   129         EIdle, 
   125         void DoMoveLocalL();
   130         EConnecting, 
       
   131         ELocalMsgs, 
       
   132         ERemoteMsgs 
       
   133         };
       
   134     TState                              iState;
   126 
   135 
   127         /**
   136     // <qmail> iFunctionId; removed
   128         *
   137     // used in error situations
   129         */
   138     TDesC8*                             iMoveErrorProgress;
   130         void DoMoveRemoteL();
   139     // <qmail> using destination folder Id instead of mailInfo struct
   131         
   140     // specifies folder where to move
   132     protected:
   141     TMsvId                              iDestinationFolderId;
   133     
   142     // <qmail> removed iSelection;
   134         /**
   143     CMsvEntrySelection*                 iLocalSel;      // Complete messages
   135         * From CIpsPlgOnlineoperation
   144     CMsvEntrySelection*                 iRemoteSel;     // Incomplete messages to be fetched.
   136         */
   145     TPckgBuf<TImap4CompoundProgress>    iProgressBuf;
   137         TInt GetEngineProgress( const TDesC8& aProgress );
   146     TPckgBuf<TImap4SyncProgress>        iSyncProgress;
   138 
       
   139     private:
       
   140         enum TState { EIdle, EConnecting, ELocalMsgs, ERemoteMsgs };
       
   141         TState                              iState;
       
   142         TInt                                iFunctionId;
       
   143         TDesC8*                             iMoveErrorProgress;
       
   144         TImImap4GetMailInfo                 iGetMailInfo;
       
   145         CMsvEntrySelection*                 iSelection;
       
   146         CMsvEntrySelection*                 iLocalSel;      // Complete messages
       
   147         CMsvEntrySelection*                 iRemoteSel;     // Incomplete messages to be fetched.
       
   148         TPckgBuf<TImap4CompoundProgress>    iProgressBuf;
       
   149         TPckgBuf<TImap4SyncProgress>        iSyncProgress;
       
   150     };
   147     };
   151 
   148 
   152 
   149 #endif // IPSPLGIMAP4MOVEREMOTEOP_H
   153 #endif //__IPSPLGIMAP4MOVEREMOTEOP_H__
       
   154 
       
   155 // End of File