16 */ |
16 */ |
17 |
17 |
18 |
18 |
19 |
19 |
20 // INCLUDE FILES |
20 // INCLUDE FILES |
|
21 #include <platform/mw/Browser_platform_variant.hrh> |
21 #include "CDownloadsListArray.h" |
22 #include "CDownloadsListArray.h" |
22 #include "ProgressInfoCreator.h" |
23 #include "ProgressInfoCreator.h" |
23 #include "DMgrUiLibPanic.h" |
24 #include "DMgrUiLibPanic.h" |
24 #include "UiLibLogger.h" |
25 #include "UiLibLogger.h" |
25 #include <DownloadMgrUiLib.rsg> |
26 #include <DownloadMgrUiLib.rsg> |
30 #include <apgicnfl.h> |
31 #include <apgicnfl.h> |
31 #include <data_caging_path_literals.hrh> |
32 #include <data_caging_path_literals.hrh> |
32 #include <f32file.h> |
33 #include <f32file.h> |
33 #include <AknsUtils.h> |
34 #include <AknsUtils.h> |
34 #include <DocumentHandler.h> |
35 #include <DocumentHandler.h> |
|
36 |
|
37 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
35 #include <MediaGalleryUid.h> |
38 #include <MediaGalleryUid.h> |
|
39 #endif |
|
40 |
36 #include "CDownloadUtils.h" |
41 #include "CDownloadUtils.h" |
37 #include <HttpDownloadMgrCommon.h> |
42 #include <HttpDownloadMgrCommon.h> |
38 #include "CUserInteractionsUtils.h" |
43 #include "CUserInteractionsUtils.h" |
39 |
44 |
40 |
45 |
73 // CDownloadsListArray::CDownloadsListArray |
78 // CDownloadsListArray::CDownloadsListArray |
74 // ----------------------------------------------------------------------------- |
79 // ----------------------------------------------------------------------------- |
75 // |
80 // |
76 CDownloadsListArray::CDownloadsListArray() |
81 CDownloadsListArray::CDownloadsListArray() |
77 : iCoeEnv( *CCoeEnv::Static() ), |
82 : iCoeEnv( *CCoeEnv::Static() ), |
78 iOwnedExt( EFalse ) |
83 iOwnedExt( EFalse ), |
|
84 iPlatformSupportsGallery ( EFalse ) |
79 { |
85 { |
80 } |
86 } |
81 |
87 |
82 // ----------------------------------------------------------------------------- |
88 // ----------------------------------------------------------------------------- |
83 // CDownloadsListArray::ConstructL |
89 // CDownloadsListArray::ConstructL |
101 CLOG_WRITE(" iCompletedString OK"); |
107 CLOG_WRITE(" iCompletedString OK"); |
102 iSavedToGalleryString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_CONTENT_SAVED_TO_GALLERY ); |
108 iSavedToGalleryString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_CONTENT_SAVED_TO_GALLERY ); |
103 CLOG_WRITE(" iSavedToGalleryString OK"); |
109 CLOG_WRITE(" iSavedToGalleryString OK"); |
104 iSavedToDownloadsFolderString= iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_CONTENT_SAVED_TO_DOWNLOADS_FOLDER); |
110 iSavedToDownloadsFolderString= iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_CONTENT_SAVED_TO_DOWNLOADS_FOLDER); |
105 CLOG_WRITE(" iSavedToGalleryDownload OK"); |
111 CLOG_WRITE(" iSavedToGalleryDownload OK"); |
|
112 iFileSavedString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_FILE_SAVED ); |
|
113 iFilesSavedString = iCoeEnv.AllocReadResourceL( R_DMUL_DOWNLOAD_FILES_SAVED ); |
|
114 |
|
115 |
106 iNullDesC = KNullDesC().AllocL(); |
116 iNullDesC = KNullDesC().AllocL(); |
107 CLOG_WRITE(" iNullDesC OK"); |
117 CLOG_WRITE(" iNullDesC OK"); |
108 User::LeaveIfError( iApaLsSess.Connect() ); |
118 User::LeaveIfError( iApaLsSess.Connect() ); |
109 CLOG_WRITE(" iApaLsSess OK"); |
119 CLOG_WRITE(" iApaLsSess OK"); |
|
120 |
|
121 |
|
122 //whether the platform supports gallery app or not; defined in browser_platfrom_variant.hrh |
|
123 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
124 iPlatformSupportsGallery = ETrue; |
|
125 #endif |
110 |
126 |
111 |
127 |
112 // Initialize the UiLib' mbm file name: |
128 // Initialize the UiLib' mbm file name: |
113 TParse* fileParser = new (ELeave) TParse; |
129 TParse* fileParser = new (ELeave) TParse; |
114 CleanupStack::PushL( fileParser ); |
130 CleanupStack::PushL( fileParser ); |
170 iCompletedString = 0; |
186 iCompletedString = 0; |
171 delete iSavedToGalleryString; |
187 delete iSavedToGalleryString; |
172 iSavedToGalleryString = 0; |
188 iSavedToGalleryString = 0; |
173 delete iSavedToDownloadsFolderString; |
189 delete iSavedToDownloadsFolderString; |
174 iSavedToDownloadsFolderString=0; |
190 iSavedToDownloadsFolderString=0; |
|
191 delete iFileSavedString; |
|
192 iFileSavedString = 0; |
|
193 delete iFilesSavedString; |
|
194 iFilesSavedString = 0; |
175 delete iNullDesC; |
195 delete iNullDesC; |
176 iNullDesC = 0; |
196 iNullDesC = 0; |
177 iApaLsSess.Close(); |
197 iApaLsSess.Close(); |
178 CLOG_WRITE(" iApaLsSess.Close"); |
198 CLOG_WRITE(" iApaLsSess.Close"); |
179 delete iMbmResourceFileName; |
199 delete iMbmResourceFileName; |
367 indexStr.Format( KIndexString, aDownloadUiData.iActiveMoIndex, aDownloadUiData.iNumMediaObjects ); |
387 indexStr.Format( KIndexString, aDownloadUiData.iActiveMoIndex, aDownloadUiData.iNumMediaObjects ); |
368 newItemTextPtr.Append( indexStr ); |
388 newItemTextPtr.Append( indexStr ); |
369 } |
389 } |
370 |
390 |
371 iProgressInfoRes.Zero(); |
391 iProgressInfoRes.Zero(); |
372 TBool supported( EFalse ); |
|
373 TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData)); |
|
374 |
392 |
375 if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) |
393 if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) |
376 { |
394 { |
377 if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
395 if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
378 { |
396 { |
379 if( supported ) |
397 if ( iPlatformSupportsGallery ) |
380 { |
398 { |
381 iProgressInfoRes.Copy |
399 TBool supported( EFalse ); |
382 ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) ); |
400 TRAP_IGNORE(supported = IsSupportedL(aDownloadUiData)); |
383 } |
401 if( supported ) |
384 else |
402 { |
385 { |
403 iProgressInfoRes.Copy |
386 iProgressInfoRes.Copy |
404 ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) ); |
387 ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) ); |
405 } |
388 } |
406 else |
389 } |
407 { |
390 else |
408 iProgressInfoRes.Copy |
391 { |
409 ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) ); |
392 |
410 } |
393 iProgressInfoRes.Copy |
411 } |
394 ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) ); |
412 else |
395 |
413 { |
|
414 if (aDownloadUiData.iNumMediaObjects > 1) |
|
415 { |
|
416 iProgressInfoRes.Copy |
|
417 ( iFilesSavedString->Left( KMaxDownloadItemTextPartLength ) ); |
|
418 } |
|
419 else |
|
420 { |
|
421 iProgressInfoRes.Copy |
|
422 ( iFileSavedString->Left( KMaxDownloadItemTextPartLength ) ); |
|
423 } |
|
424 } |
|
425 } |
|
426 else |
|
427 { |
|
428 iProgressInfoRes.Copy |
|
429 ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) ); |
396 } |
430 } |
397 } |
431 } |
398 else |
432 else |
399 { |
433 { |
400 if ( aDownloadUiData.iFullSize <= 0 ) |
434 if ( aDownloadUiData.iFullSize <= 0 ) |
455 { |
489 { |
456 TBuf<KMaxIndexStringLength> indexStr; |
490 TBuf<KMaxIndexStringLength> indexStr; |
457 indexStr.Format( KIndexString, aDownloadUiData.iActiveMoIndex, aDownloadUiData.iNumMediaObjects ); |
491 indexStr.Format( KIndexString, aDownloadUiData.iActiveMoIndex, aDownloadUiData.iNumMediaObjects ); |
458 ret += indexStr.Length(); |
492 ret += indexStr.Length(); |
459 } |
493 } |
460 |
|
461 TBool supported( EFalse ); |
|
462 TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData)); |
|
463 |
494 |
464 iProgressInfoRes.Zero(); |
495 iProgressInfoRes.Zero(); |
465 if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) |
496 if ( aDownloadUiData.iDownloadState == EHttpDlMultipleMOCompleted ) |
466 { |
497 { |
467 if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
498 if ( aDownloadUiData.iProgressState == EHttpProgContentFileMoved || aDownloadUiData.iProgressState == EHttpProgContentFileMovedAndDestFNChanged ) |
468 { |
499 { |
469 if( supported ) |
500 if ( iPlatformSupportsGallery ) |
470 { |
501 { |
471 iProgressInfoRes.Copy |
502 TBool supported( EFalse ); |
472 ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) ); |
503 TRAP_IGNORE(supported=IsSupportedL(aDownloadUiData)); |
|
504 if( supported ) |
|
505 { |
|
506 iProgressInfoRes.Copy |
|
507 ( iSavedToGalleryString->Left( KMaxDownloadItemTextPartLength ) ); |
|
508 } |
|
509 else |
|
510 { |
|
511 iProgressInfoRes.Copy |
|
512 ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) ); |
|
513 } |
473 } |
514 } |
474 else |
515 else |
475 { |
516 { |
476 iProgressInfoRes.Copy |
517 if (aDownloadUiData.iNumMediaObjects > 1) |
477 ( iSavedToDownloadsFolderString->Left( KMaxDownloadItemTextPartLength ) ); |
518 { |
478 } |
519 iProgressInfoRes.Copy |
|
520 ( iFilesSavedString->Left( KMaxDownloadItemTextPartLength ) ); |
|
521 } |
|
522 else |
|
523 { |
|
524 iProgressInfoRes.Copy |
|
525 ( iFileSavedString->Left( KMaxDownloadItemTextPartLength ) ); |
|
526 } |
|
527 } |
479 } |
528 } |
480 else |
529 else |
481 { |
530 { |
482 iProgressInfoRes.Copy |
531 iProgressInfoRes.Copy |
483 ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) ); |
532 ( iCompletedString->Left( KMaxDownloadItemTextPartLength ) ); |
484 } |
533 } |
485 } |
534 } |
486 //finished here |
535 //finished here |
487 else |
536 else |
488 { |
537 { |
489 if ( aDownloadUiData.iFullSize <= 0 ) |
538 if ( aDownloadUiData.iFullSize <= 0 ) |
574 TBool appFound = FindHandlerApp( aContentType, appUid ); |
623 TBool appFound = FindHandlerApp( aContentType, appUid ); |
575 CLOG_WRITE_FORMAT(" appFound: %d",appFound); |
624 CLOG_WRITE_FORMAT(" appFound: %d",appFound); |
576 |
625 |
577 // Use Media Gallery's icon instead of Image Viewer, because IV's icon |
626 // Use Media Gallery's icon instead of Image Viewer, because IV's icon |
578 // does not support skins, but MG's icon does support it. |
627 // does not support skins, but MG's icon does support it. |
|
628 |
|
629 |
|
630 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
|
631 |
579 if ( appFound && appUid == TUid::Uid(KImageViewerHandler) ) |
632 if ( appFound && appUid == TUid::Uid(KImageViewerHandler) ) |
580 { |
633 { |
581 appUid = TUid::Uid(KMediaGalleryUID3); |
634 appUid = TUid::Uid(KMediaGalleryUID3); |
582 } |
635 } |
583 |
636 #endif |
|
637 |
584 // Load the proper icon. |
638 // Load the proper icon. |
585 CFbsBitmap* bitmap = 0; |
639 CFbsBitmap* bitmap = 0; |
586 CFbsBitmap* mask = 0; |
640 CFbsBitmap* mask = 0; |
587 LoadAppIconLC( (appFound ? appUid : TUid::Uid(0)), bitmap, mask ); |
641 LoadAppIconLC( (appFound ? appUid : TUid::Uid(0)), bitmap, mask ); |
588 // Do append. |
642 // Do append. |