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