email/imum/Mtms/Inc/ImapPopulateOperation.h
branchRCL_3
changeset 60 7fdbb852d323
parent 0 72b543305e3a
equal deleted inserted replaced
57:ebe688cedc25 60:7fdbb852d323
       
     1 /*
       
     2 * Copyright (c) 2006 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: 
       
    15 *       CImapPopulateOp declaration file
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef __IMAPPOPULATEOP_H__
       
    20 #define __IMAPPOPULATEOP_H__
       
    21 
       
    22 
       
    23 #include <msvapi.h>
       
    24 #include <imapset.h>
       
    25 #include "imapconnectionobserver.h"
       
    26 #include <mtmuibas.h>
       
    27 #include <MTMStore.h>
       
    28 #include <MsvPrgReporter.h>
       
    29 #include <imapconnectcompletionstates.h>
       
    30 #include <MuiuMsvSingleOpWatcher.h>
       
    31 
       
    32 //  Forward declarations
       
    33 //
       
    34 class CMsvEmailConnectionProgressProvider;
       
    35 class CCoeEnv;
       
    36 
       
    37 /**
       
    38 * class CImapPopulateOp
       
    39 *
       
    40 */
       
    41 
       
    42 
       
    43 class CImapPopulateOp :
       
    44     public CMsvOperation,
       
    45     public MMsvProgressDecoder
       
    46     {
       
    47     public:
       
    48 
       
    49         /**
       
    50         * NewL()
       
    51         * Basic factory function - creates dialog with standard title resource
       
    52         * @param CMsvSession& CMsvSession reference
       
    53         * @param TInt priority
       
    54         * @param TRequestStatus& request status
       
    55         * @param TMsvId service (mailbox) id
       
    56         * @param MMsvProgressReporter& prog. reporter reference
       
    57         * @param TImapConnectionType connection type
       
    58         * @return CImapPopulateOp* self pointer
       
    59         */
       
    60 
       
    61         static CImapPopulateOp* NewL(
       
    62             CMsvSession& aSession,
       
    63             TInt aPriority,
       
    64             TRequestStatus& aStatus,
       
    65             TMsvId aService,
       
    66             MMsvProgressReporter& aProgressReporter);
       
    67 
       
    68         /**
       
    69         * ~CImapPopulateOp()
       
    70         * destructor
       
    71         */
       
    72 
       
    73         ~CImapPopulateOp();
       
    74 
       
    75         /**
       
    76         * ProgressL()
       
    77         * @return TDesC8&, progress
       
    78         */
       
    79 
       
    80         const TDesC8& ProgressL();
       
    81 
       
    82 
       
    83         /**
       
    84         * DecodeProgress()
       
    85         * From MMsvProgressDecoder
       
    86         * @param TDesC8& progress
       
    87         * @param TBuf<CBaseMtmUi::EProgressStringMaxLen>&, return string
       
    88         * @param TInt&, total entry count
       
    89         * @param TInt& entries done
       
    90         * @param TInt& current entry size
       
    91         * @param TInt& current bytes transferred
       
    92         * @param TBool internal flag
       
    93         */
       
    94 
       
    95         virtual TInt DecodeProgress(
       
    96             const TDesC8& aProgress,
       
    97             TBuf<CBaseMtmUi::EProgressStringMaxLen>& aReturnString,
       
    98             TInt& aTotalEntryCount,
       
    99             TInt& aEntriesDone,
       
   100             TInt& aCurrentEntrySize,
       
   101             TInt& aCurrentBytesTrans,
       
   102             TBool aInternal);
       
   103 
       
   104     private:
       
   105 
       
   106 
       
   107         /**
       
   108         * CImapPopulateOp()
       
   109         * @param CMsvSession&, CMsvSession reference
       
   110         * @param TInt, priority
       
   111         * @param TRequestStatus&, request status
       
   112         * @param TMsvId, service ( mailbox ) id
       
   113         * @param MMsvProgressReporter&, prog. reporter
       
   114         */
       
   115 
       
   116         CImapPopulateOp(
       
   117             CMsvSession& aSession,
       
   118             TInt aPriority,
       
   119             TRequestStatus& aStatus,
       
   120             TMsvId aService,
       
   121             MMsvProgressReporter& aProgressReporter);
       
   122 
       
   123         /**
       
   124         * ConstructL()
       
   125         */
       
   126 
       
   127         void ConstructL();
       
   128 
       
   129 
       
   130         /**
       
   131         * RunL()
       
   132         */
       
   133 
       
   134         virtual void RunL();
       
   135 
       
   136         /**
       
   137         * DoRunL()
       
   138         */
       
   139 
       
   140         void DoRunL();
       
   141 
       
   142         /**
       
   143         * FinishConstructionL()
       
   144         */
       
   145 
       
   146         void FinishConstructionL();
       
   147 
       
   148         /**
       
   149         * ConnectionCompletionL()
       
   150         */
       
   151 
       
   152         void ConnectionCompletionL();
       
   153 
       
   154         /**
       
   155         * DoCancel()
       
   156         */
       
   157 
       
   158         virtual void DoCancel();
       
   159 
       
   160         /**
       
   161         * Complete()
       
   162         */
       
   163 
       
   164         void Complete();
       
   165 
       
   166         /**
       
   167         * FindInboxL()
       
   168         */
       
   169         TMsvId  FindInboxL( CMsvEntry& aEntry );
       
   170 
       
   171         /**
       
   172         * RunError()
       
   173         */        
       
   174 		virtual TInt RunError(TInt aError);                       
       
   175 
       
   176     protected:
       
   177         /**
       
   178         *
       
   179         */
       
   180 
       
   181         CMsvOperation* DoPopulateL( CImImap4Settings& aSettings );
       
   182 
       
   183     private: //Data
       
   184         //
       
   185         CMsvOperation*                          iSubOperation;
       
   186         CMsvEmailConnectionProgressProvider*    iConnectionProgressProvider;
       
   187 
       
   188         TInt                                    iState;
       
   189         enum{EPopulateConstructing, EPopulating};
       
   190 
       
   191         TPckgBuf<TImap4SyncProgress>            iSyncProgress;
       
   192         TBool                                   iResetPassword;
       
   193         MMsvProgressReporter&                   iProgressReporter;
       
   194         CBaseMtmUi*                             iMtmUi;
       
   195         HBufC*                                  iTitleText;
       
   196         TMsvId                                  iRelatedServiceId;
       
   197         CCoeEnv*                                iCoeEnv;
       
   198 
       
   199         TBool                                   iPopulated;
       
   200 
       
   201       //  CMsvSingleOpWatcherArray                iOperations;//for more operations
       
   202     };
       
   203 
       
   204 #endif //__IMAPPOPULATEOP_H__