1 /* |
1 /* |
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
17 |
17 |
18 |
18 |
19 #ifndef C_CATALOGSHTTPDOWNLOADMANAGER_H |
19 #ifndef C_CATALOGSHTTPDOWNLOADMANAGER_H |
20 #define C_CATALOGSHTTPDOWNLOADMANAGER_H |
20 #define C_CATALOGSHTTPDOWNLOADMANAGER_H |
21 |
21 |
22 #include <downloadmgrclient.h> |
22 // #include <DownloadMgrClient.h> |
23 |
23 |
24 #include "catalogstransportoperationid.h" |
24 #include "catalogstransportoperationid.h" |
25 #include "catalogshttpsession.h" // RCatalogsHttpOperationArray |
25 #include "catalogshttpsession.h" // RCatalogsHttpOperationArray |
26 #include "catalogshttpsessionmanager.h" |
26 #include "catalogshttpsessionmanager.h" |
|
27 |
27 #include "catalogsconnectionmethod.h" |
28 #include "catalogsconnectionmethod.h" |
28 #include "catalogsaccesspointobserver.h" |
29 #include "catalogsaccesspointobserver.h" |
|
30 #include <download.h> |
|
31 #include <downloadmanager.h> |
|
32 #include <QObject> |
|
33 |
|
34 #include <f32file.h> //HLa |
29 |
35 |
30 class MCatalogsHttpConfig; |
36 class MCatalogsHttpConfig; |
31 class CCatalogsHttpConfig; |
37 class CCatalogsHttpConfig; |
32 class CCatalogsHttpDownload; |
38 class CCatalogsHttpDownload; |
33 class MCatalogsHttpOperation; |
39 class MCatalogsHttpOperation; |
36 class MCatalogsHttpTransactionManager; |
42 class MCatalogsHttpTransactionManager; |
37 class CCatalogsHttpConnectionManager; |
43 class CCatalogsHttpConnectionManager; |
38 class CCatalogsHttpSession; |
44 class CCatalogsHttpSession; |
39 class CCatalogsConnection; |
45 class CCatalogsConnection; |
40 class CCatalogsNetworkManager; |
46 class CCatalogsNetworkManager; |
|
47 class CCatalogsHttpQTDownloadManager; |
|
48 using namespace WRT; |
|
49 |
|
50 const TInt KNCDEngineAppID = 0X2002E685; |
|
51 |
41 |
52 |
42 /** |
53 /** |
43 * HTTP file download manager |
54 * HTTP file download manager |
44 * |
55 * |
45 */ |
56 */ |
46 class CCatalogsHttpDownloadManager : |
57 class CCatalogsHttpDownloadManager : |
|
58 |
47 public CActive, |
59 public CActive, |
48 public MHttpDownloadMgrObserver, |
|
49 public MCatalogsAccessPointObserver |
60 public MCatalogsAccessPointObserver |
50 { |
61 { |
|
62 |
51 public: // Constructors and destructor |
63 public: // Constructors and destructor |
52 |
64 |
53 /** |
65 /** |
54 * Creator |
66 * Creator |
55 * |
67 * |
200 |
212 |
201 CDocumentHandler& DocumentHandler(); |
213 CDocumentHandler& DocumentHandler(); |
202 |
214 |
203 TInt NewDownloadId(); |
215 TInt NewDownloadId(); |
204 |
216 |
205 RHttpDownload& CreatePlatformDownloadL( const TDesC8& aUrl ); |
217 WRT::Download& CreatePlatformDownloadL( const TDesC8& aUrl ); |
206 |
218 void downloadMgrEventRecieved(DownloadManagerEvent* dlmEvent); |
207 public: // From MHttpDownloadMngrObserver |
219 |
208 |
|
209 /** |
|
210 * Handles events from Download manager |
|
211 */ |
|
212 virtual void HandleDMgrEventL( RHttpDownload& aDownload, |
|
213 THttpDownloadEvent aEvent ); |
|
214 |
220 |
215 |
221 |
216 public: // from MCatalogsAccessPointObserver |
222 public: // from MCatalogsAccessPointObserver |
217 |
223 |
218 virtual void HandleAccessPointEventL( |
224 virtual void HandleAccessPointEventL( |
257 * an index to it or KErrNotFound. |
263 * an index to it or KErrNotFound. |
258 * |
264 * |
259 * @param aArray Array to search from |
265 * @param aArray Array to search from |
260 * @param aDownload Download to find |
266 * @param aDownload Download to find |
261 * @return Index to the download in iDownloads |
267 * @return Index to the download in iDownloads |
262 */ |
268 */ |
|
269 /* HLa |
263 TInt FindInDownloads( |
270 TInt FindInDownloads( |
264 const RCatalogsHttpOperationArray& aArray, |
271 const RCatalogsHttpOperationArray& aArray, |
265 RHttpDownload* aDownload ) const; |
272 RHttpDownload* aDownload ) const; |
266 |
273 */ |
267 |
274 |
268 /** |
275 /** |
269 * Searches for the given download from the given array and returns |
276 * Searches for the given download from the given array and returns |
270 * an index to it or KErrNotFound. |
277 * an index to it or KErrNotFound. |
271 * |
278 * |
293 THttpDownloadEvent& aEvent ) : |
301 THttpDownloadEvent& aEvent ) : |
294 iDownload( &aDownload ), iEvent( aEvent ) |
302 iDownload( &aDownload ), iEvent( aEvent ) |
295 { |
303 { |
296 } |
304 } |
297 }; |
305 }; |
298 |
306 */ |
299 |
307 |
300 /** |
308 /** |
301 * Sets this object active if event queue has unhandled events |
309 * Sets this object active if event queue has unhandled events |
302 */ |
310 */ |
303 void ContinueEventHandling(); |
311 void ContinueEventHandling(); |
304 |
312 |
305 /** |
313 /** |
306 * Removes events from event queue that belong to the same |
314 * Removes events from event queue that belong to the same |
307 * RHttpDownload as aEvent |
315 * RHttpDownload as aEvent |
308 */ |
316 */ |
|
317 /* |
309 void RemoveUnhandledEvents( |
318 void RemoveUnhandledEvents( |
310 const TDownloadEvent& aEvent ); |
319 const TDownloadEvent& aEvent ); |
311 |
320 |
312 void RemoveUnhandledProgressEvents( |
321 void RemoveUnhandledProgressEvents( |
313 const TDownloadEvent& aEvent ); |
322 const TDownloadEvent& aEvent ); |
314 |
323 */ |
|
324 |
315 /** |
325 /** |
316 * Deletes downloads that have not been paused by the user |
326 * Deletes downloads that have not been paused by the user |
317 */ |
327 */ |
318 void DeleteHangingDownloads(); |
328 void DeleteHangingDownloads(); |
319 |
329 |
320 |
|
321 private: |
330 private: |
322 |
331 |
323 MCatalogsHttpSessionManager& iManager; |
332 MCatalogsHttpSessionManager& iManager; |
324 CCatalogsHttpSession& iSession; |
333 CCatalogsHttpSession& iSession; |
325 MCatalogsHttpTransactionManager& iTrManager; |
334 MCatalogsHttpTransactionManager& iTrManager; |
326 CCatalogsHttpConnectionManager& iConnectionManager; |
335 CCatalogsHttpConnectionManager& iConnectionManager; |
327 CCatalogsNetworkManager* iNetworkManager; // Not owned |
336 CCatalogsNetworkManager* iNetworkManager; // Not owned |
328 TInt32 iSessionId; |
337 TInt32 iSessionId; |
329 RHttpDownloadMgr iDmgr; |
338 DownloadManager *iDmgr; |
330 |
339 CCatalogsHttpQTDownloadManager* iQTmgr; |
|
340 WRT::Download* iDownload; // Platform download |
331 // All downloads except those that are in Restored |
341 // All downloads except those that are in Restored |
332 RCatalogsHttpOperationArray iDownloads; |
342 RCatalogsHttpOperationArray iDownloads; |
333 RCatalogsHttpOperationArray iRestoredDownloads; |
343 RCatalogsHttpOperationArray iRestoredDownloads; |
334 |
344 |
335 CCatalogsHttpConfig* iDefaultConfig; // owned |
345 CCatalogsHttpConfig* iDefaultConfig; // owned |
338 TInt iRefCount; |
348 TInt iRefCount; |
339 |
349 |
340 RFs iFs; |
350 RFs iFs; |
341 TCatalogsConnectionMethod iCurrentAp; |
351 TCatalogsConnectionMethod iCurrentAp; |
342 |
352 |
343 RArray<TDownloadEvent> iEventQueue; |
353 // RArray<TDownloadEvent> iEventQueue; //HLa |
344 TInt iCurrentDlId; // id of the last created download |
354 TInt iCurrentDlId; // id of the last created download |
345 }; |
355 }; |
346 |
356 |
347 #endif // C_CATALOGSHTTPDOWNLOADMANAGER_H |
357 |
|
358 |
|
359 class CCatalogsHttpQTDownloadManager: public QObject |
|
360 { |
|
361 Q_OBJECT |
|
362 public: |
|
363 CCatalogsHttpQTDownloadManager(CCatalogsHttpDownloadManager* aDownloadManager,DownloadManager* aDmgr); |
|
364 public slots: |
|
365 void downloadMgrEventRecieved(DownloadManagerEvent*); |
|
366 public: |
|
367 CCatalogsHttpDownloadManager* iDownloadManager; |
|
368 DownloadManager* iDmgr ; |
|
369 }; |
|
370 |
|
371 #endif // C_CATALOGSHTTPDOWNLOADMANAGER_H |