|
1 /* |
|
2 * Copyright (c) 2004 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 the License "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 * Declaration of class CRoapAppUi. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef ROAP_APP_UI_H |
|
22 #define ROAP_APP_UI_H |
|
23 |
|
24 // INCLUDES |
|
25 |
|
26 #include <e32base.h> |
|
27 #include <f32file.h> |
|
28 #include <AknAppUi.h> |
|
29 #include <AknServerApp.h> |
|
30 #include <RoapObserver.h> |
|
31 #include <DownloadMgrClient.h> |
|
32 #include "RoapAppWaitDialog.h" |
|
33 #include <CentralRepository.h> |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 class CRoapAppView; |
|
38 class CRoapAppDocument; |
|
39 class CRequestCompleteCallback; |
|
40 class CDocumentHandler; |
|
41 |
|
42 // CONSTANTS |
|
43 const TUid KDRMHelperUid = {0x101F85C7}; // KBrowserHelpUid = {0x10008D39} |
|
44 |
|
45 /** |
|
46 * ROAP Application UI. |
|
47 */ |
|
48 class CRoapAppUi |
|
49 : public CAknAppUi, |
|
50 public MRoapDialogCommandObserver, |
|
51 public Roap::MRoapObserver, |
|
52 public MAknServerAppExitObserver, |
|
53 public MHttpDownloadMgrObserver |
|
54 { |
|
55 |
|
56 public: // Constructors and destructor |
|
57 |
|
58 /** |
|
59 * Constructor. |
|
60 */ |
|
61 CRoapAppUi(); |
|
62 |
|
63 /** |
|
64 * Second phase constructor. Leaves on failure. |
|
65 */ |
|
66 void ConstructL(); |
|
67 |
|
68 /** |
|
69 * Destructor. |
|
70 */ |
|
71 virtual ~CRoapAppUi(); |
|
72 |
|
73 public: // from CAknAppUi |
|
74 |
|
75 /** |
|
76 * Open a file. |
|
77 * @param aFileName File name to open. |
|
78 */ |
|
79 virtual void OpenFileL( const TDesC& aFileName ); |
|
80 |
|
81 /** |
|
82 * Handle command. |
|
83 * @param aCommand Command id. |
|
84 */ |
|
85 virtual void HandleCommandL( TInt aCommand ); |
|
86 |
|
87 protected: // from CAknAppUi |
|
88 |
|
89 /** |
|
90 * Process command line parameters. |
|
91 * @param aCommand Command. |
|
92 * @param aDocumentName Document name. |
|
93 * @param aTail Don't know what; ignored. |
|
94 * @return EFalse. |
|
95 */ |
|
96 virtual TBool ProcessCommandParametersL |
|
97 ( |
|
98 TApaCommand aCommand, |
|
99 TFileName& aDocumentName, |
|
100 const TDesC8& aTail |
|
101 ); |
|
102 |
|
103 /** |
|
104 * Handle resource change. |
|
105 * @param aType Resource type. |
|
106 */ |
|
107 virtual void HandleResourceChangeL( TInt aType ); |
|
108 |
|
109 private: // from Roap::MRoapObserver |
|
110 |
|
111 /** |
|
112 * Confirm creating network connection. |
|
113 * @return ETrue if network connection confirmed. |
|
114 */ |
|
115 virtual TBool ConnectionConfL(); |
|
116 |
|
117 /** |
|
118 * Confirm contacting Rights Issuer. |
|
119 * @return ETrue if confirmed. |
|
120 */ |
|
121 virtual TBool ContactRiConfL(); |
|
122 |
|
123 /** |
|
124 * Confirm transaction ID tracking. |
|
125 * @return ETrue if transaction ID tracking confirmed. |
|
126 */ |
|
127 virtual TBool TransIdConfL(); |
|
128 |
|
129 /** |
|
130 * Handle right objects after a successful RoAcq. |
|
131 * @param aRightsList Received right objects. |
|
132 */ |
|
133 virtual void RightsObjectDetailsL |
|
134 ( const RPointerArray<CDRMRights>& aRightsList ); |
|
135 |
|
136 /** |
|
137 * ROAP response returned multipart response, return parameters |
|
138 * needed saving. |
|
139 * @param aTempFolder Folder for temp file returned here. |
|
140 * @param aContentName Name for content file returned here. |
|
141 * @param aMaxSize Safety size limit returned here. |
|
142 */ |
|
143 virtual void ContentDownloadInfoL |
|
144 ( TPath& aTempFolder, TFileName& aContentName, TInt& aMaxSize ); |
|
145 |
|
146 /** |
|
147 * Details of DCF file received in ROAP (saved by ROAP Engine). |
|
148 * @param aPath: The path and the filename of the saved DCF file. |
|
149 * @param aType: The plain MIME type of the saved DCF file. |
|
150 * @param aAppUid: The handler app UID of the saved DCF file. |
|
151 */ |
|
152 virtual void ContentDetailsL |
|
153 ( const TDesC& aPath, const TDesC8& aType, const TUid& aAppUid ); |
|
154 |
|
155 /** |
|
156 * Handle DCF file (received in multipart RO response). |
|
157 * @aFilename File name. |
|
158 */ |
|
159 virtual void HandleDCFPartL( const TDesC8& aFilename ); |
|
160 |
|
161 /** |
|
162 * Progress callback. |
|
163 * @param aProgressInfo Percentage completed. |
|
164 */ |
|
165 virtual void RoapProgressInfoL( const TInt aProgressInfo ); |
|
166 |
|
167 /** |
|
168 * ErrorUrl |
|
169 * @param aErrorUrl: The error URL |
|
170 * @return void |
|
171 */ |
|
172 virtual void ErrorUrlL( const TDesC8& aErrorUrl ); |
|
173 |
|
174 /** |
|
175 * PostResponseUrlL |
|
176 * @param aPrUrl: The PostResponseURL |
|
177 * @return void |
|
178 */ |
|
179 virtual void PostResponseUrlL( const TDesC8& aPrUrl ); |
|
180 |
|
181 private: //from MHttpDownloadMgrObserver |
|
182 /** |
|
183 * Indicates an event. |
|
184 * @param aDownload The download with which the event occured. |
|
185 * @param aEvent Event type. |
|
186 * @return None. |
|
187 */ |
|
188 virtual void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); |
|
189 |
|
190 |
|
191 private: // from MAknServerAppExitObserver |
|
192 |
|
193 /** |
|
194 * Handle exmbedded application exit. |
|
195 * @param aReason Exit reason. |
|
196 */ |
|
197 virtual void HandleServerAppExit( TInt aReason ); |
|
198 |
|
199 public: // new methods |
|
200 |
|
201 /** |
|
202 * Trigger parsed. |
|
203 */ |
|
204 void HandleTriggerParsedL(); |
|
205 |
|
206 /** |
|
207 * Call back function to launch the help |
|
208 */ |
|
209 static TInt ShowRoapCallback( TAny* aPtr ); |
|
210 |
|
211 /** |
|
212 * Handle One Pass RO |
|
213 */ |
|
214 void HandleOnePassRoL( TInt aError); |
|
215 |
|
216 private: // new methods |
|
217 |
|
218 /** |
|
219 * Start ROAP. |
|
220 */ |
|
221 void StartRoapL(); |
|
222 |
|
223 /** |
|
224 * Cancel ROAP. |
|
225 */ |
|
226 void CancelRoap(); |
|
227 |
|
228 /** |
|
229 * Handle ROAP completion. |
|
230 */ |
|
231 void RoapDone(); |
|
232 |
|
233 /** |
|
234 * Handle successful ROAP. |
|
235 * @return ETrue if application should exit. |
|
236 */ |
|
237 TBool RoapOkL(); |
|
238 |
|
239 /** |
|
240 * Handle successful RoAcq ROAP. |
|
241 * @return ETrue if application should exit. |
|
242 */ |
|
243 TBool RoAcqOkL(); |
|
244 |
|
245 /** |
|
246 * Handle failed ROAP. |
|
247 * @param aError ROAP error. |
|
248 * @return ETrue if application should exit. |
|
249 */ |
|
250 TBool RoapFailedL( TInt aError ); |
|
251 |
|
252 /** |
|
253 * Handle ROAP completion (static wrapper for TCallBack use). |
|
254 * @param aPtr Pointer passed to the callback (this object as TAny*). |
|
255 * @return EFalse (as TInt). |
|
256 */ |
|
257 static TInt StaticRoapDone( TAny* aPtr ); |
|
258 |
|
259 private: // new methods |
|
260 |
|
261 /** |
|
262 * Access the document (casted to its real type). |
|
263 * @return The document (casted to its real type). |
|
264 */ |
|
265 CRoapAppDocument* RoapDocument(); |
|
266 |
|
267 private: // from MRoapDialogCommandObserver |
|
268 |
|
269 /** |
|
270 * Handle dialog command (from wait note). |
|
271 * @param aCommand Dialog command id. |
|
272 */ |
|
273 void HandleDialogCommandL( TInt aCommand ); |
|
274 |
|
275 private: // new methods |
|
276 |
|
277 /** |
|
278 * Show an information note. |
|
279 * @param aPromptResourceId Resource id of prompt text (RESOURCE TBUF). |
|
280 */ |
|
281 void InfoNoteL( TInt aPromptResourceId ); |
|
282 |
|
283 /** |
|
284 * Show an information note. |
|
285 * @param aPrompt Prompt text. |
|
286 */ |
|
287 void InfoNoteL( const TDesC& aPrompt ); |
|
288 |
|
289 /** |
|
290 * Show an confirmation note. |
|
291 * @param aPromptResourceId Resource id of prompt text (RESOURCE TBUF). |
|
292 */ |
|
293 void ConfNoteL( TInt aPromptResourceId ); |
|
294 |
|
295 /** |
|
296 * Show an confirmation note. |
|
297 * @param aPrompt Prompt text. |
|
298 */ |
|
299 void ConfNoteL( const TDesC& aPrompt ); |
|
300 |
|
301 private: // new methods |
|
302 |
|
303 /** |
|
304 * Check if file can be opened (unprotected, or rights present). |
|
305 * @param aFile File. |
|
306 * @return ETrue if file can be opened. |
|
307 */ |
|
308 TBool CanOpenL( RFile& aFile ) const; |
|
309 |
|
310 /** |
|
311 * Launch help dialog |
|
312 * @param TDesC aContext |
|
313 * @return void |
|
314 */ |
|
315 void LaunchHelpL( const TDesC& aContext ); |
|
316 |
|
317 private: // data |
|
318 |
|
319 /// App's view (control). Owned. |
|
320 CRoapAppView* iView; |
|
321 /// Wait note. Owned. |
|
322 CRoapAppWaitDialog* iWaitNote; |
|
323 /// Callback object. Owned. |
|
324 CRequestCompleteCallback* iCallback; |
|
325 /// Document handler or NULL. Owned. |
|
326 CDocumentHandler* iDocHandler; |
|
327 /// File Server Session. |
|
328 RFs iFs; |
|
329 /// MO associated with the received RO. |
|
330 RFile iFile; |
|
331 /// Download manager |
|
332 RHttpDownloadMgr iDownloadMgr; |
|
333 /// Download status of PostResponse URL |
|
334 TBool iPostResponseURLDownLoad; |
|
335 }; |
|
336 |
|
337 #endif /* def ROAP_APP_UI_H */ |