|
1 /* |
|
2 * Copyright (c) 2007-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: ESMR imap email fetcher definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CESMRIMAPMAILFETCHER_H |
|
20 #define CESMRIMAPMAILFETCHER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 //<cmail> |
|
24 #include "MFSMailRequestObserver.h" |
|
25 #include "mesmricalviewerobserver.h" |
|
26 //</cmail> |
|
27 #include "cesmricalviewerasynccommand.h" |
|
28 |
|
29 class CFSMailMessage; |
|
30 class CFSMailClient; |
|
31 |
|
32 /** |
|
33 * CESMRImapMailFetcher is responsible for receiving imap mail |
|
34 * to device. |
|
35 */ |
|
36 NONSHARABLE_CLASS( CESMRImapMailFetcherCmd ) : |
|
37 public CESMRIcalViewerAsyncCommand, |
|
38 public MFSMailRequestObserver |
|
39 { |
|
40 public: // Construction and destruction |
|
41 /** |
|
42 * Creates and initializes new CESMRImapMailFetcher object. Ownership |
|
43 * is transferred to caller. |
|
44 * @param aMailClient Reference to mail client |
|
45 * @param aCalSession Reference to calendar session |
|
46 * @return Pointer to CESMRImapMailFetcher object. |
|
47 */ |
|
48 static CESMRImapMailFetcherCmd* NewL( |
|
49 CFSMailClient& aMailClient, |
|
50 CCalSession& aCalSession ); |
|
51 |
|
52 /** |
|
53 * C++ destructor. |
|
54 */ |
|
55 ~CESMRImapMailFetcherCmd(); |
|
56 |
|
57 public: // From MFSMailRequestObserver |
|
58 void RequestResponseL( |
|
59 TFSProgress aEvent, |
|
60 TInt aRequestId ); |
|
61 |
|
62 private: // From MESMRIcalViewerAsyncCommand |
|
63 void ExecuteAsyncCommandL(); |
|
64 void CancelAsyncCommand(); |
|
65 |
|
66 private: // Implementation |
|
67 CESMRImapMailFetcherCmd( |
|
68 CFSMailClient& aMailClient, |
|
69 CCalSession& aCalSession ); |
|
70 void ConstructL(); |
|
71 void FetchMessageStructureL(); |
|
72 TBool FetchMessageContentsL(); |
|
73 void HandleRequestResponseL( |
|
74 TFSProgress aEvent, |
|
75 TInt aRequestId ); |
|
76 void NotifyCompletion(); |
|
77 |
|
78 private: |
|
79 /** Enumeration for object internal state */ |
|
80 enum TESMRImapMailFetcherState |
|
81 { |
|
82 // Idle |
|
83 EIdle, |
|
84 // Fetching message structure |
|
85 EFetchingStructure, |
|
86 // Fetching message contents |
|
87 EFetchingContents |
|
88 }; |
|
89 |
|
90 private: // Data |
|
91 /// Own: Fetch operation request id |
|
92 TInt iStructureRequestId; |
|
93 /// Own: Fetch operation request id |
|
94 TInt iMessagePartRequestId; |
|
95 // Own: Current state |
|
96 TESMRImapMailFetcherState iState; |
|
97 /// Ref: Reference to mail client object |
|
98 CFSMailClient& iMailClient; |
|
99 /// Ref: Reference to messageobject |
|
100 CFSMailMessage* iMailMessage; |
|
101 /// Own: Operation result |
|
102 MESMRIcalViewerObserver::TIcalViewerOperationResult iResult; |
|
103 }; |
|
104 |
|
105 #endif // CESMRIMAPMAILFETCHER_H |
|
106 |
|
107 // EOF |