17 |
17 |
18 |
18 |
19 #ifndef C_CATALOGSHTTPDOWNLOAD_H |
19 #ifndef C_CATALOGSHTTPDOWNLOAD_H |
20 #define C_CATALOGSHTTPDOWNLOAD_H |
20 #define C_CATALOGSHTTPDOWNLOAD_H |
21 |
21 |
22 // HLA: #include <DownloadMgrClient.h> |
22 #include <downloadmgrclient.h> |
23 #include <download.h> |
23 |
24 #include <downloadevent.h> |
|
25 #include <s32file.h> |
24 #include <s32file.h> |
26 |
25 |
27 #include "catalogshttpoperation.h" |
26 #include "catalogshttpoperation.h" |
28 #include "catalogstransportoperationid.h" |
27 #include "catalogstransportoperationid.h" |
29 #include "catalogshttpconfigobserver.h" |
28 #include "catalogshttpconfigobserver.h" |
32 class MCatalogsHttpConfig; |
31 class MCatalogsHttpConfig; |
33 class CCatalogsHttpConfig; |
32 class CCatalogsHttpConfig; |
34 class CCatalogsHttpHeaders; |
33 class CCatalogsHttpHeaders; |
35 class CCatalogsKeyValuePair; |
34 class CCatalogsKeyValuePair; |
36 class CCatalogsHttpDownloadManager; |
35 class CCatalogsHttpDownloadManager; |
37 class CCatalogsHttpQTDownload; |
36 |
38 using namespace WRT; |
|
39 /** |
37 /** |
40 * HTTP file download implementation |
38 * HTTP file download implementation |
41 * |
39 * |
42 * @note Due to insufficient access to HTTP response headers through the |
40 * @note Due to insufficient access to HTTP response headers through the |
43 * Download manager, Download uses CCatalogsHttpTransaction with HTTP HEAD |
41 * Download manager, Download uses CCatalogsHttpTransaction with HTTP HEAD |
77 * @param aConfig Configuration |
75 * @param aConfig Configuration |
78 * @return A new HTTP download |
76 * @return A new HTTP download |
79 */ |
77 */ |
80 static CCatalogsHttpDownload* NewLC( |
78 static CCatalogsHttpDownload* NewLC( |
81 CCatalogsHttpDownloadManager& aOwner, |
79 CCatalogsHttpDownloadManager& aOwner, |
82 Download* aDownload, |
80 RHttpDownload* aDownload, |
83 const CCatalogsHttpConfig& aConfig ); |
81 const CCatalogsHttpConfig& aConfig ); |
84 |
82 |
85 |
83 |
86 /** |
84 /** |
87 * Destructor |
85 * Destructor |
238 * Not supported |
236 * Not supported |
239 * @see MCatalogsHttpOperation::StatusCode() |
237 * @see MCatalogsHttpOperation::StatusCode() |
240 */ |
238 */ |
241 TInt StatusCode() const; |
239 TInt StatusCode() const; |
242 |
240 |
243 TDownloadDeleteState GetStatusState(); |
241 |
244 Download* GetDownload(); |
|
245 /** |
242 /** |
246 * Not supported |
243 * Not supported |
247 * @see MCatalogsHttpOperation::StatusText() |
244 * @see MCatalogsHttpOperation::StatusText() |
248 */ |
245 */ |
249 const TDesC8& StatusText() const; |
246 const TDesC8& StatusText() const; |
283 void HandleHttpEventL( MCatalogsHttpOperation& aOperation, |
280 void HandleHttpEventL( MCatalogsHttpOperation& aOperation, |
284 TCatalogsHttpEvent aEvent ); |
281 TCatalogsHttpEvent aEvent ); |
285 |
282 |
286 TBool HandleHttpError( MCatalogsHttpOperation& aOperation, |
283 TBool HandleHttpError( MCatalogsHttpOperation& aOperation, |
287 TCatalogsHttpError aError ); |
284 TCatalogsHttpError aError ); |
288 |
285 |
289 void HandledownloadEventL(DownloadEvent& aEvent); |
|
290 |
|
291 public: |
286 public: |
292 |
287 |
293 /** |
288 /** |
294 * Handles events from Download Manager |
289 * Handles events from Download Manager |
295 * |
290 * |
296 * @param aEvent Download Manager event |
291 * @param aEvent Download Manager event |
297 */ |
292 */ |
298 /* HLa |
|
299 void HandleEventL( THttpDownloadEvent aEvent ); |
293 void HandleEventL( THttpDownloadEvent aEvent ); |
300 */ |
294 |
301 |
295 |
302 /** |
296 /** |
303 * Set file server session |
297 * Set file server session |
304 * |
298 * |
305 * @param aFs File server session |
299 * @param aFs File server session |
325 /** |
319 /** |
326 * Constructor |
320 * Constructor |
327 */ |
321 */ |
328 CCatalogsHttpDownload( |
322 CCatalogsHttpDownload( |
329 CCatalogsHttpDownloadManager& aOwner, |
323 CCatalogsHttpDownloadManager& aOwner, |
330 Download* aDownload ); |
324 RHttpDownload* aDownload ); |
331 |
325 |
332 /** |
326 /** |
333 * 2nd phase constructor |
327 * 2nd phase constructor |
334 */ |
328 */ |
335 void ConstructL( const CCatalogsHttpConfig* aConfig ); |
329 void ConstructL( const CCatalogsHttpConfig* aConfig ); |
348 private: // New methods |
342 private: // New methods |
349 |
343 |
350 /** |
344 /** |
351 * Handles event progress |
345 * Handles event progress |
352 * @param aEvent The event that has progressed |
346 * @param aEvent The event that has progressed |
353 */ |
347 */ |
354 /* HLa |
|
355 void HandleEventProgressL( const THttpDownloadEvent& aEvent ); |
348 void HandleEventProgressL( const THttpDownloadEvent& aEvent ); |
356 */ |
349 |
357 |
350 |
358 /** |
351 /** |
359 * Updates the target filename from Content-Disposition -header |
352 * Updates the target filename from Content-Disposition -header |
360 * @throw KErrNotFound if the header doesn't exist |
353 * @throw KErrNotFound if the header doesn't exist |
361 */ |
354 */ |
487 void UpdateExtensionL(); |
480 void UpdateExtensionL(); |
488 |
481 |
489 /** |
482 /** |
490 * Replace current extension at aName with extension given (eExt). |
483 * Replace current extension at aName with extension given (eExt). |
491 */ |
484 */ |
492 void ReplaceExtension( TDes& aName, const TDesC& aExt ); |
485 void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt ); |
493 |
486 |
494 /** |
487 /** |
495 * Checks the preset content-type and forces HEAD request if |
488 * Checks the preset content-type and forces HEAD request if |
496 * content is OMA DD, JAD or some DRM file |
489 * content is OMA DD, JAD or some DRM file |
497 */ |
490 */ |
514 |
507 |
515 private: |
508 private: |
516 |
509 |
517 CCatalogsHttpDownloadManager& iOwner; |
510 CCatalogsHttpDownloadManager& iOwner; |
518 TCatalogsTransportOperationId iId; // Operation id |
511 TCatalogsTransportOperationId iId; // Operation id |
519 Download* iDownload; // Platform download |
512 RHttpDownload* iDownload; // Platform download |
520 CCatalogsHttpConfig* iConfig; // Configuration |
513 CCatalogsHttpConfig* iConfig; // Configuration |
521 MCatalogsHttpObserver* iObserver; // Observer |
514 MCatalogsHttpObserver* iObserver; // Observer |
522 TCatalogsHttpEvent iState; // State of the download |
515 TCatalogsHttpEvent iState; // State of the download |
523 HBufC8* iUri; // Current URI |
516 HBufC8* iUri; // Current URI |
524 HBufC8* iEncodedUri; // Current URI as encoded |
517 HBufC8* iEncodedUri; // Current URI as encoded |
525 CCatalogsHttpHeaders* iResponseHeaders; // Headers from HTTP response |
518 CCatalogsHttpHeaders* iResponseHeaders; // Headers from HTTP response |
526 CCatalogsHttpQTDownload* iQTDownload; |
|
527 |
519 |
528 // added request headers not supported by DL man |
520 // added request headers not supported by DL man |
529 HBufC8* iAddedRequestHeaders; |
521 HBufC8* iAddedRequestHeaders; |
530 TInt iRefCount; |
522 TInt iRefCount; |
531 TBool iNormalDelete; |
523 TBool iNormalDelete; |
532 |
524 TBuf8<KMaxContentTypeLength> iContentType; |
533 // HLa: TBuf8<KMaxContentTypeLength> iContentType; |
|
534 TBuf8<256> iContentType; |
|
535 |
525 |
536 // Transaction for retrieving all of the response headers |
526 // Transaction for retrieving all of the response headers |
537 MCatalogsHttpOperation* iTransaction; |
527 MCatalogsHttpOperation* iTransaction; |
538 TCatalogsHttpHeaderMode iMode; |
528 TCatalogsHttpHeaderMode iMode; |
539 |
529 |
563 #endif |
553 #endif |
564 |
554 |
565 // For managing async pause with dlmgr. |
555 // For managing async pause with dlmgr. |
566 TBool iPausePending; |
556 TBool iPausePending; |
567 TBool iQueuedResume; |
557 TBool iQueuedResume; |
568 TDownloadDeleteState iStatus; |
558 |
569 protected: |
559 protected: |
570 |
560 |
571 // Grant access to UpdateContentType |
561 // Grant access to UpdateContentType |
572 friend class CCatalogsHttpDownloadManager; |
562 friend class CCatalogsHttpDownloadManager; |
573 |
563 |
574 }; |
564 }; |
575 |
565 |
576 class CCatalogsHttpQTDownload: public QObject |
|
577 { |
|
578 Q_OBJECT |
|
579 public: |
|
580 CCatalogsHttpQTDownload(CCatalogsHttpDownload* aHttpDownload,Download* aDownload); |
|
581 public slots: |
|
582 void downloadEventHandler(DownloadEvent*); |
|
583 void downloadErrorHandler(Error); |
|
584 public: |
|
585 CCatalogsHttpDownload* iCatalogsHttpDownload; |
|
586 Download* iDownload; // Platform download |
|
587 }; |
|
588 |
|
589 |
|
590 #endif // C_CATALOGSHTTPDOWNLOAD_H |
566 #endif // C_CATALOGSHTTPDOWNLOAD_H |