|
1 /* |
|
2 * Copyright (c) 2007-2008 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: plugin request handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CFSMAILREQUESTHANDLER_H |
|
20 #define CFSMAILREQUESTHANDLER_H |
|
21 |
|
22 // INCLUDES |
|
23 //<cmail> |
|
24 #include "CFSMailPlugin.h" |
|
25 //</cmail> |
|
26 #include "CFSMailPluginData.h" |
|
27 |
|
28 // <qmail> |
|
29 // Entire class is now exported |
|
30 #include "emailcommondef.h" |
|
31 // </qmail> |
|
32 |
|
33 // FORWARD DECLARATIONS |
|
34 class CFSMailRequestObserver; |
|
35 |
|
36 /** |
|
37 * asynchronous request progress indicator |
|
38 * |
|
39 * @lib FSFWCommonLib |
|
40 * @since S60 v3.1 |
|
41 */ |
|
42 class TFSPendingRequest |
|
43 { |
|
44 |
|
45 public: |
|
46 |
|
47 /** request status */ |
|
48 enum TFSRequestStatus |
|
49 { |
|
50 EFSRequestPending = 1, |
|
51 EFSRequestComplete, |
|
52 EFSRequestCancelled, |
|
53 }; |
|
54 |
|
55 public: // data |
|
56 |
|
57 /** request id */ |
|
58 TInt iRequestId; |
|
59 |
|
60 /** plugin uid */ |
|
61 TUid iPluginId; |
|
62 |
|
63 /** request status */ |
|
64 TFSRequestStatus iRequestStatus; |
|
65 |
|
66 /** request observer */ |
|
67 CFSMailRequestObserver* iObserver; |
|
68 }; |
|
69 |
|
70 /** |
|
71 * email framework asynchronous request handler |
|
72 * |
|
73 * @lib FSFWCommonLib |
|
74 * @since S60 v3.1 |
|
75 */ |
|
76 class EMAILCOMMON_EXPORT CFSMailRequestHandler : public CBase |
|
77 { |
|
78 |
|
79 public: |
|
80 |
|
81 /** |
|
82 * destructor. |
|
83 */ |
|
84 virtual ~CFSMailRequestHandler(); |
|
85 |
|
86 /** |
|
87 * two based constructor |
|
88 * |
|
89 * @param aPluginInfo plugin information table |
|
90 * @param aPlugins plugin instances table |
|
91 */ |
|
92 static CFSMailRequestHandler* NewL( RPointerArray<CImplementationInformation>& aPluginInfo, |
|
93 RPointerArray<CFSMailPlugin>& aPlugins ); |
|
94 /** |
|
95 * two based constructor |
|
96 * |
|
97 * @param aPluginInfo plugin information table |
|
98 * @param aPlugins plugin instances table |
|
99 */ |
|
100 static CFSMailRequestHandler* NewLC( RPointerArray<CImplementationInformation>& aPluginInfo, |
|
101 RPointerArray<CFSMailPlugin>& aPlugins ); |
|
102 /** |
|
103 * starts asynchronous request |
|
104 * |
|
105 * @param aPluginId id of the target plugin request is accessed to |
|
106 * @param aOperationObserver observer to forward request progress events |
|
107 * to user from plugin |
|
108 * |
|
109 * @return request data |
|
110 */ |
|
111 TFSPendingRequest InitAsyncRequestL( TUid aPluginId, |
|
112 MFSMailRequestObserver& aOperationObserver); |
|
113 |
|
114 /** |
|
115 * completes asynchronous request |
|
116 * |
|
117 * @param aRequestId id of the request to be completed |
|
118 */ |
|
119 void CompleteRequest( TInt aRequestId ); |
|
120 |
|
121 /** |
|
122 * cancels pending asynchronous request |
|
123 * |
|
124 * @param aRequestId id of the request to be cancelled |
|
125 */ |
|
126 void CancelRequestL( TInt aRequestId ); |
|
127 |
|
128 /** |
|
129 * cancels all pending asynchronous requests |
|
130 * |
|
131 */ |
|
132 void CancelAllRequestsL( ); |
|
133 |
|
134 /** |
|
135 * returns plugin pointer related to plugin id |
|
136 * |
|
137 * @param aPluginId plugin id |
|
138 * @return plugin pointer |
|
139 */ |
|
140 CFSMailPlugin* GetPluginByUid( TFSMailMsgId aPluginId ); |
|
141 |
|
142 /** |
|
143 * adds new plugin to plugin list |
|
144 * |
|
145 * @param aPluginId uid of the new plugin |
|
146 * @param aPlugin plugin instance |
|
147 */ |
|
148 void AddPluginL( TUid aPluginId, CFSMailPlugin* aPlugin ); |
|
149 |
|
150 /** |
|
151 * cleans temp dir |
|
152 * |
|
153 */ |
|
154 void CleanTempDirL( ); |
|
155 |
|
156 /** |
|
157 * returns temp dir path |
|
158 * |
|
159 */ |
|
160 TDesC& GetTempDirL( ); |
|
161 |
|
162 /** |
|
163 * opens or creates file |
|
164 * |
|
165 * @param aFileName file name |
|
166 */ |
|
167 // <qmail> |
|
168 RFile GetTempFileL( TFSMailMsgId aContentId,TFileName aFileName ); |
|
169 // </qmail> |
|
170 protected: |
|
171 |
|
172 /** |
|
173 * C++ default constructor. |
|
174 */ |
|
175 CFSMailRequestHandler(); |
|
176 |
|
177 /** |
|
178 * two based constructor |
|
179 */ |
|
180 void ConstructL( RPointerArray<CImplementationInformation> aPluginInfo, |
|
181 RPointerArray<CFSMailPlugin> aPlugins ); |
|
182 |
|
183 protected: // data |
|
184 |
|
185 /** list of loaded plugins */ |
|
186 RPointerArray<CFSMailPluginData> iPluginList; |
|
187 |
|
188 private: |
|
189 |
|
190 /** removes all asynchronous requests */ |
|
191 void RemoveAllRequests(); |
|
192 |
|
193 private: // data |
|
194 |
|
195 /** list of pending requests */ |
|
196 RArray<TFSPendingRequest> iPendingRequests; |
|
197 |
|
198 /** request id counter */ |
|
199 TUint iRequestId; |
|
200 |
|
201 /** temp directory files handling */ |
|
202 RFs iFs; |
|
203 HBufC *iTempDirName; |
|
204 }; |
|
205 |
|
206 #endif |
|
207 |
|
208 // End of File |