|
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: Class responsible for storing message part content asynchronously. |
|
15 * It can store text/plain and text/html body parts. |
|
16 * |
|
17 */ |
|
18 |
|
19 #include <e32std.h> |
|
20 #include <e32base.h> |
|
21 #include <msvapi.h> |
|
22 |
|
23 #ifndef IPSPLGMESSAGEPARTSTOREOPERATION_H_ |
|
24 #define IPSPLGMESSAGEPARTSTOREOPERATION_H_ |
|
25 |
|
26 class CFSMailPlugin; |
|
27 class CFSMailMessage; |
|
28 class CFSMailMessagePart; |
|
29 class MFSMailRequestObserver; |
|
30 |
|
31 NONSHARABLE_CLASS( CIpsPlgMessagePartStorerOperation ) : public CMsvOperation |
|
32 { |
|
33 public: |
|
34 /** |
|
35 * Symbian 2nd phase constructor |
|
36 * @param aMsvSession |
|
37 * @param aObserverRequestStatus |
|
38 * @param aPlugin |
|
39 * @param aMessageParts - ownership is taken from caller |
|
40 * @param aRequestId |
|
41 * @return CIpsPlgMessagePartStorerOperation* |
|
42 */ |
|
43 static CIpsPlgMessagePartStorerOperation* NewL(CMsvSession& aMsvSession, |
|
44 TRequestStatus& aObserverRequestStatus, CFSMailPlugin& aPlugin, |
|
45 RPointerArray<CFSMailMessagePart> &aMessageParts, |
|
46 MFSMailRequestObserver& aFSOperationObserver, |
|
47 const TInt aRequestId); |
|
48 |
|
49 /** |
|
50 * Symbian 2nd phase constructor |
|
51 * @param aMsvSession |
|
52 * @param aObserverRequestStatus |
|
53 * @param aPlugin |
|
54 * @param aMessageParts - ownership is taken from caller |
|
55 * @param aRequestId |
|
56 * @return CIpsPlgMessagePartStorerOperation* |
|
57 */ |
|
58 static CIpsPlgMessagePartStorerOperation* NewLC(CMsvSession& aMsvSession, |
|
59 TRequestStatus& aObserverRequestStatus, CFSMailPlugin& aPlugin, |
|
60 RPointerArray<CFSMailMessagePart> &aMessageParts, |
|
61 MFSMailRequestObserver& aFSOperationObserver, |
|
62 const TInt aRequestId); |
|
63 |
|
64 /** |
|
65 * Class destructor |
|
66 */ |
|
67 virtual ~CIpsPlgMessagePartStorerOperation(); |
|
68 |
|
69 /** |
|
70 * Implements cancellation of an outstanding request |
|
71 */ |
|
72 void DoCancel(); |
|
73 |
|
74 /** |
|
75 * From CMsvOperation |
|
76 */ |
|
77 virtual const TDesC8& ProgressL(); |
|
78 |
|
79 protected: |
|
80 |
|
81 /** |
|
82 * Default constructor |
|
83 * @param aMsvSession |
|
84 * @param aObserverRequestStatus |
|
85 * @param aPlugin |
|
86 * @param aMessageParts - ownership is taken from caller |
|
87 * @param aRequestId |
|
88 */ |
|
89 CIpsPlgMessagePartStorerOperation(CMsvSession& aMsvSession, |
|
90 TRequestStatus& aObserverRequestStatus, CFSMailPlugin& aPlugin, |
|
91 RPointerArray<CFSMailMessagePart> &aMessageParts, |
|
92 MFSMailRequestObserver& aFSOperationObserver, |
|
93 const TInt aRequestId); |
|
94 |
|
95 private: |
|
96 |
|
97 /** |
|
98 * Initialization and construction of all leaving members |
|
99 */ |
|
100 void ConstructL(); |
|
101 |
|
102 /** |
|
103 * Handles an active object's request completion event |
|
104 */ |
|
105 void RunL(); |
|
106 |
|
107 /** |
|
108 * Handles a leave occurring in the request completion event handler |
|
109 */ |
|
110 TInt RunError(TInt aError); |
|
111 |
|
112 /** |
|
113 * Stores next part content in message store |
|
114 * @return returns EFalse if there are none message parts |
|
115 */ |
|
116 TBool StoreNextPartL(); |
|
117 |
|
118 /** |
|
119 * Stores text plain content in message store |
|
120 * @param CFSMailMessagePart* aPart to be stored |
|
121 */ |
|
122 void StoreTextPlainPartL(CFSMailMessagePart* aPart); |
|
123 |
|
124 /** |
|
125 * Stores text html content in message store |
|
126 * @param CFSMailMessagePart* aPart to be stored |
|
127 */ |
|
128 void StoreTextHtmlPartL(CFSMailMessagePart* aPart); |
|
129 |
|
130 private: |
|
131 //data |
|
132 CFSMailPlugin& iPlugin; |
|
133 |
|
134 // Array of message parts to be stored |
|
135 RPointerArray<CFSMailMessagePart> iMessageParts; |
|
136 |
|
137 MFSMailRequestObserver& iFSOperationObserver; |
|
138 const TInt iRequestId; |
|
139 |
|
140 // Execution index stores current progres |
|
141 TInt iExecutionIndex; |
|
142 |
|
143 // Data buffer for async operations |
|
144 HBufC8* iDataBuffer; |
|
145 }; |
|
146 |
|
147 #endif /* IPSPLGMESSAGEPARTSTOREOPERATION_H_ */ |