31 #include "CodPanic.h" |
29 #include "CodPanic.h" |
32 #include "DrmHandler.h" |
30 #include "DrmHandler.h" |
33 #include "CodData.h" |
31 #include "CodData.h" |
34 |
32 |
35 #include <f32file.h> |
33 #include <f32file.h> |
36 #include <HttpDownloadMgrCommon.h> |
34 #include <httpdownloadmgrcommon.h> |
37 #include <DocumentHandler.h> |
35 #include <DocumentHandler.h> |
38 #include <pathinfo.h> |
36 #include <pathinfo.h> |
39 |
|
40 // following one line is temporary: AVKON dependency removal |
|
41 #undef BRDO_APP_GALLERY_SUPPORTED_FF |
|
42 |
37 |
43 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
38 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
44 #include <MGXFileManagerFactory.h> |
39 #include <MGXFileManagerFactory.h> |
45 #include <CMGXFileManager.h> |
40 #include <CMGXFileManager.h> |
46 #endif |
41 #endif |
47 |
42 |
48 #include <DcfEntry.h> |
43 #include <DcfEntry.h> |
49 #include <DcfRep.h> |
44 #include <DcfRep.h> |
|
45 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
|
46 #include <DownloadPathHandler.h> |
|
47 #endif |
50 |
48 |
51 const TInt KDefaultStorageBufferSize = 128 * 1024; |
49 const TInt KDefaultStorageBufferSize = 128 * 1024; |
52 const TInt KDefaultStorageBufferSizePD = 16 * 1024; |
50 const TInt KDefaultStorageBufferSizePD = 16 * 1024; |
53 |
|
54 |
51 |
55 // ================= MEMBER FUNCTIONS ======================= |
52 // ================= MEMBER FUNCTIONS ======================= |
56 |
53 |
57 // --------------------------------------------------------- |
54 // --------------------------------------------------------- |
58 // CFileSaver::NewL() |
55 // CFileSaver::NewL() |
129 // |
126 // |
130 void CFileSaver::OpenStoreL() |
127 void CFileSaver::OpenStoreL() |
131 { |
128 { |
132 CLOG(( ECodEng, 2, _L("CFileSaver::OpenStoreL") )); |
129 CLOG(( ECodEng, 2, _L("CFileSaver::OpenStoreL") )); |
133 __ASSERT_DEBUG( iState == EInit, CodPanic( ECodInternal ) ); |
130 __ASSERT_DEBUG( iState == EInit, CodPanic( ECodInternal ) ); |
134 |
131 |
135 // Store (temp file) is not opened now. |
132 // Store (temp file) is not opened now. |
136 // Opening is deferred until first data chunk arrives. |
133 // Opening is deferred until first data chunk arrives. |
137 |
134 |
138 TInt err = iFile.Open( iFs, |
135 TInt err = iFile.Open( iFs, |
139 iFname, |
136 iFname, |
140 EFileShareAny | |
137 EFileShareAny | |
141 EFileStream | |
138 EFileStream | |
142 #ifdef BRDO_RFILE_WRITE_DIRECT_IO_FF |
139 #ifdef BRDO_RFILE_WRITE_DIRECT_IO_FF |
143 EFileWrite | |
140 EFileWrite | |
144 EFileWriteDirectIO ); |
141 EFileWriteDirectIO ); |
145 #else |
142 #else |
146 EFileWrite ); |
143 EFileWrite ); |
147 #endif |
144 #endif |
148 |
145 |
149 if(err == KErrNotFound) |
146 if(err == KErrNotFound) |
150 { |
147 { |
151 err = iFile.Replace( iFs, |
148 err = iFile.Replace( iFs, |
152 iFname, |
149 iFname, |
153 EFileShareAny | |
150 EFileShareAny | |
154 EFileStream | |
151 EFileStream | |
155 #ifdef BRDO_RFILE_WRITE_DIRECT_IO_FF |
152 #ifdef BRDO_RFILE_WRITE_DIRECT_IO_FF |
156 EFileWrite | |
153 EFileWrite | |
157 EFileWriteDirectIO ); |
154 EFileWriteDirectIO ); |
158 #else |
155 #else |
159 EFileWrite ); |
156 EFileWrite ); |
160 #endif |
157 #endif |
161 |
158 |
162 } |
159 } |
163 |
160 |
164 if( !err ) |
161 if( !err ) |
165 { |
162 { |
326 CFileMan* file=CFileMan::NewL(fs); |
323 CFileMan* file=CFileMan::NewL(fs); |
327 CleanupStack::PushL(file); |
324 CleanupStack::PushL(file); |
328 TInt error = fs.MkDirAll(filenamePtr); |
325 TInt error = fs.MkDirAll(filenamePtr); |
329 if (error!=KErrNone && error!=KErrAlreadyExists) |
326 if (error!=KErrNone && error!=KErrAlreadyExists) |
330 { |
327 { |
331 User::Leave(error); |
328 User::Leave(error); |
332 } |
329 } |
333 |
330 |
334 // Find a unique name to avoid any conflict. |
331 // Find a unique name to avoid any conflict. |
335 // Here iFname has full path of current location of file |
332 // Here iFname has full path of current location of file |
336 // and filename has destination path. |
333 // and filename has destination path. |
337 FindUniqueDestinationFileNameL( iFname, filename ); |
334 FindUniqueDestinationFileNameL( iFname, filename ); |
338 |
335 |
339 filenamePtr = filename->Des(); |
336 filenamePtr = filename->Des(); |
340 |
337 |
341 err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
338 err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
342 |
339 |
343 if(err != KErrNone) |
340 if(err != KErrNone) |
344 { |
341 { |
345 User::Leave(err); |
342 User::Leave(err); |
346 } |
343 } |
347 |
344 |
348 iFname = filenamePtr; |
345 iFname = filenamePtr; |
349 NotifyMediaGalleryL( filenamePtr ); |
346 NotifyMediaGalleryL( filenamePtr ); |
350 CleanupStack::PopAndDestroy(file); |
347 CleanupStack::PopAndDestroy(file); |
351 CleanupStack::PopAndDestroy(&fs); |
348 CleanupStack::PopAndDestroy(&fs); |
352 CleanupStack::PopAndDestroy(filename); |
349 CleanupStack::PopAndDestroy(filename); |
353 #else |
350 #else |
354 RFs fs; |
351 RFs fs; |
355 User::LeaveIfError( fs.Connect() ); |
352 User::LeaveIfError( fs.Connect() ); |
356 CleanupClosePushL(fs); |
353 CleanupClosePushL(fs); |
357 CFileMan* file=CFileMan::NewL(fs); |
354 CFileMan* file=CFileMan::NewL(fs); |
358 CleanupStack::PushL(file); |
355 CleanupStack::PushL(file); |
359 |
356 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
360 |
357 CDownloadPathHandler* downloadPathPlugin = NULL; |
|
358 |
|
359 if ( aData.Count() ) |
|
360 { |
|
361 // Get the mime type of the first media object |
|
362 TPtrC8 mimeType = (*aData[1]).Type(); |
|
363 downloadPathPlugin = GetDownloadPathPluginInstanceL( mimeType ); |
|
364 |
|
365 if( downloadPathPlugin ) |
|
366 { |
|
367 CleanupStack::PushL( downloadPathPlugin ); |
|
368 } |
|
369 } |
|
370 #endif |
361 for( TInt i = 1; i <= aData.Count() ; ++i ) |
371 for( TInt i = 1; i <= aData.Count() ; ++i ) |
362 { |
372 { |
363 HBufC* filename = HBufC::NewLC(KMaxFileName); |
373 HBufC* filename = HBufC::NewLC(KMaxFileName); |
364 TPtr filenamePtr = filename->Des(); |
374 TPtr filenamePtr = filename->Des(); |
365 filenamePtr = (*aData[i]).iRootPath; |
375 filenamePtr = (*aData[i]).iRootPath; |
366 |
376 |
367 filenamePtr.Append(_L("download\\")); |
377 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
|
378 if( downloadPathPlugin ) |
|
379 { |
|
380 TFileName iTempFlName = (*aData[i]).iFullName->Des(); |
|
381 GetUpdatedPathFromPluginL( downloadPathPlugin,iTempFlName, filenamePtr ); |
|
382 } |
|
383 else |
|
384 { |
|
385 filenamePtr.Append( _L( "download\\" ) ); |
|
386 } |
|
387 #else |
|
388 filenamePtr.Append( _L( "download\\" ) ); |
|
389 |
|
390 #endif |
|
391 |
368 TInt error = fs.MkDirAll(filenamePtr); |
392 TInt error = fs.MkDirAll(filenamePtr); |
369 if (error!=KErrNone && error!=KErrAlreadyExists) |
393 if (error!=KErrNone && error!=KErrAlreadyExists) |
370 { |
394 { |
371 User::Leave(error); |
395 User::Leave(error); |
372 } |
396 } |
373 iFname = (*aData[i]).iFullName->Des(); |
397 iFname = (*aData[i]).iFullName->Des(); |
374 |
398 |
375 // Find a unique name to avoid any conflict. |
399 // Find a unique name to avoid any conflict. |
376 // Here iFname has full path of current location of file |
400 // Here iFname has full path of current location of file |
377 // and filename has destination path. |
401 // and filename has destination path. |
378 FindUniqueDestinationFileNameL( iFname, filename ); |
402 FindUniqueDestinationFileNameL( iFname, filename ); |
379 |
403 |
380 filenamePtr = filename->Des(); |
404 filenamePtr = filename->Des(); |
381 TInt err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
405 TInt err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
382 if(err != KErrNone) |
406 if(err != KErrNone) |
383 { |
407 { |
384 User::LeaveIfError(err); |
408 User::LeaveIfError(err); |
385 } |
409 } |
386 iFname = filenamePtr; |
410 iFname = filenamePtr; |
387 NotifyMediaGalleryL( filenamePtr ); |
411 NotifyMediaGalleryL( filenamePtr ); |
388 |
412 |
389 (*aData[i]).iFileName = iFname; |
413 (*aData[i]).iFileName = iFname; |
390 (*aData[i]).iFullName = NameL(); |
414 (*aData[i]).iFullName = NameL(); |
391 CleanupStack::PopAndDestroy(filename); |
415 CleanupStack::PopAndDestroy(filename); |
392 } |
416 } |
|
417 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
|
418 if( downloadPathPlugin ) |
|
419 { |
|
420 CleanupStack::PopAndDestroy( downloadPathPlugin ); |
|
421 } |
|
422 #endif |
393 CleanupStack::PopAndDestroy(file); |
423 CleanupStack::PopAndDestroy(file); |
394 CleanupStack::PopAndDestroy(&fs); |
424 CleanupStack::PopAndDestroy(&fs); |
395 |
425 |
396 #endif // RD_MULTIPLE_DRIVE |
426 #endif // RD_MULTIPLE_DRIVE |
397 // TODO set iType to that of the packaged object (??) |
427 // TODO set iType to that of the packaged object (??) |
423 /* check if the PD app has been started (PD appl is responsible for file moving after play is done) |
453 /* check if the PD app has been started (PD appl is responsible for file moving after play is done) |
424 In this case leave and go to the next state. |
454 In this case leave and go to the next state. |
425 */ |
455 */ |
426 if (!aAttached) |
456 if (!aAttached) |
427 { |
457 { |
428 #ifdef RD_MULTIPLE_DRIVE |
458 #ifdef RD_MULTIPLE_DRIVE |
429 RFs fs; |
459 RFs fs; |
430 TInt err( KErrNone ); |
460 TInt err( KErrNone ); |
431 HBufC* filename = HBufC::NewLC(KMaxFileName); |
461 HBufC* filename = HBufC::NewLC(KMaxFileName); |
432 TPtr filenamePtr = filename->Des(); |
462 TPtr filenamePtr = filename->Des(); |
433 filenamePtr = iRootPath; |
463 filenamePtr = iRootPath; |
434 filenamePtr.Append(_L("download\\")); |
464 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
|
465 // Get the mime type of the content |
|
466 TPtrC8 mimeType( iType.Des8() ); |
|
467 CDownloadPathHandler* downloadPathPlugin = NULL; |
|
468 downloadPathPlugin = GetDownloadPathPluginInstanceL( mimeType ); |
|
469 |
|
470 if( downloadPathPlugin ) |
|
471 { |
|
472 CleanupStack::PushL( downloadPathPlugin ); |
|
473 GetUpdatedPathFromPluginL( downloadPathPlugin,iFname, filenamePtr ); |
|
474 CleanupStack::PopAndDestroy( downloadPathPlugin ); |
|
475 } |
|
476 else |
|
477 { |
|
478 filenamePtr.Append( _L( "download\\" ) ); |
|
479 } |
|
480 #else |
|
481 filenamePtr.Append( _L( "download\\" ) ); |
|
482 |
|
483 #endif |
435 User::LeaveIfError( fs.Connect() ); |
484 User::LeaveIfError( fs.Connect() ); |
436 CleanupClosePushL(fs); |
485 CleanupClosePushL(fs); |
437 CFileMan* file=CFileMan::NewL(fs); |
486 CFileMan* file=CFileMan::NewL(fs); |
438 CleanupStack::PushL(file); |
487 CleanupStack::PushL(file); |
439 TInt error = fs.MkDirAll(filenamePtr); |
488 TInt error = fs.MkDirAll(filenamePtr); |
440 if (error!=KErrNone && error!=KErrAlreadyExists) |
489 if (error!=KErrNone && error!=KErrAlreadyExists) |
441 { |
490 { |
442 User::Leave(error); |
491 User::Leave(error); |
443 } |
492 } |
444 |
493 |
445 // Find a unique name to avoid any conflict. |
494 // Find a unique name to avoid any conflict. |
446 // Here iFname has full path of current location of file |
495 // Here iFname has full path of current location of file |
447 // and filename has destination path. |
496 // and filename has destination path. |
448 FindUniqueDestinationFileNameL( iFname, filename ); |
497 FindUniqueDestinationFileNameL( iFname, filename ); |
449 |
498 |
450 filenamePtr = filename->Des(); |
499 filenamePtr = filename->Des(); |
451 |
500 |
452 err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
501 err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
453 |
502 |
454 if(err != KErrNone) |
503 if(err != KErrNone) |
455 { |
504 { |
456 User::Leave(err); |
505 User::Leave(err); |
457 } |
506 } |
458 |
507 |
459 iFname = filenamePtr; |
508 iFname = filenamePtr; |
460 NotifyMediaGalleryL( filenamePtr ); |
509 NotifyMediaGalleryL( filenamePtr ); |
461 CleanupStack::PopAndDestroy(file); |
510 CleanupStack::PopAndDestroy(file); |
462 CleanupStack::PopAndDestroy(&fs); |
511 CleanupStack::PopAndDestroy(&fs); |
463 CleanupStack::PopAndDestroy(filename); |
512 CleanupStack::PopAndDestroy(filename); |
464 #else |
513 #else |
465 RFs fs; |
514 RFs fs; |
473 CFileMan* file=CFileMan::NewL(fs); |
522 CFileMan* file=CFileMan::NewL(fs); |
474 CleanupStack::PushL(file); |
523 CleanupStack::PushL(file); |
475 TInt error = fs.MkDirAll(filenamePtr); |
524 TInt error = fs.MkDirAll(filenamePtr); |
476 if (error!=KErrNone && error!=KErrAlreadyExists) |
525 if (error!=KErrNone && error!=KErrAlreadyExists) |
477 { |
526 { |
478 User::Leave(error); |
527 User::Leave(error); |
479 } |
528 } |
480 |
529 |
481 // Find a unique name to avoid any conflict. |
530 // Find a unique name to avoid any conflict. |
482 // Here iFname has full path of current location of file |
531 // Here iFname has full path of current location of file |
483 // and filename has destination path. |
532 // and filename has destination path. |
484 FindUniqueDestinationFileNameL( iFname, filename ); |
533 FindUniqueDestinationFileNameL( iFname, filename ); |
485 |
534 |
486 filenamePtr = filename->Des(); |
535 filenamePtr = filename->Des(); |
487 TInt err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
536 TInt err = file->Move(iFname, filenamePtr, CFileMan::EOverWrite); |
488 |
537 |
489 if(err != KErrNone) |
538 if(err != KErrNone) |
490 { |
539 { |
491 User::Leave(err); |
540 User::Leave(err); |
492 } |
541 } |
493 iFname = filenamePtr; |
542 iFname = filenamePtr; |
494 NotifyMediaGalleryL( filenamePtr ); |
543 NotifyMediaGalleryL( filenamePtr ); |
495 CleanupStack::PopAndDestroy(file); |
544 CleanupStack::PopAndDestroy(file); |
496 CleanupStack::PopAndDestroy(&fs); |
545 CleanupStack::PopAndDestroy(&fs); |
497 CleanupStack::PopAndDestroy(filename); |
546 CleanupStack::PopAndDestroy(filename); |
498 #endif // RD_MULTIPLE_DRIVE |
547 #endif // RD_MULTIPLE_DRIVE |
582 } |
631 } |
583 iState = EInit; |
632 iState = EInit; |
584 CLOG(( ECodEng, 2, _L("<- CFileSaver::Cleanup") )); |
633 CLOG(( ECodEng, 2, _L("<- CFileSaver::Cleanup") )); |
585 } |
634 } |
586 |
635 |
587 |
636 |
588 // --------------------------------------------------------- |
637 // --------------------------------------------------------- |
589 // CFileSaver::UpdateDCFRepositoryL() |
638 // CFileSaver::UpdateDCFRepositoryL() |
590 // Update saved file to DCFRepository |
639 // Update saved file to DCFRepository |
591 // --------------------------------------------------------- |
640 // --------------------------------------------------------- |
592 // |
641 // |
593 void CFileSaver::UpdateDCFRepositoryL( const TDesC& aFileName ) |
642 void CFileSaver::UpdateDCFRepositoryL( const TDesC& aFileName ) |
594 { |
643 { |
595 CDcfEntry* dcfEntry = NULL; |
644 CDcfEntry* dcfEntry = NULL; |
596 dcfEntry = CDcfEntry::NewL(); |
645 dcfEntry = CDcfEntry::NewL(); |
597 CleanupStack::PushL( dcfEntry ); |
646 CleanupStack::PushL( dcfEntry ); |
598 |
647 |
599 CDcfRep* dcfRep = NULL; |
648 CDcfRep* dcfRep = NULL; |
600 dcfRep = CDcfRep::NewL(); |
649 dcfRep = CDcfRep::NewL(); |
601 CleanupStack::PushL( dcfRep ); |
650 CleanupStack::PushL( dcfRep ); |
602 |
651 |
603 dcfEntry->SetLocationL( aFileName, 0 ); |
652 dcfEntry->SetLocationL( aFileName, 0 ); |
604 dcfRep->UpdateL( dcfEntry ); |
653 dcfRep->UpdateL( dcfEntry ); |
605 CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep |
654 CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep |
606 } |
655 } |
607 |
656 |
608 // --------------------------------------------------------- |
657 // --------------------------------------------------------- |
609 // CFileSaver::UpdateMediaGalleryIfNeededL() |
658 // CFileSaver::UpdateMediaGalleryIfNeededL() |
610 // Calls MediaGallery Update method so that media gallery |
659 // Calls MediaGallery Update method so that media gallery |
611 // knows update its view. |
660 // knows update its view. |
612 // --------------------------------------------------------- |
661 // --------------------------------------------------------- |
613 // |
662 // |
614 |
663 |
615 |
664 |
616 void CFileSaver::UpdateMediaGalleryIfNeededL( const TDesC& aFileName ) |
665 void CFileSaver::UpdateMediaGalleryIfNeededL( const TDesC& aFileName ) |
617 { |
666 { |
618 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
667 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
619 CMGXFileManager* fm = MGXFileManagerFactory::NewFileManagerL( iFs ); |
668 CMGXFileManager* fm = MGXFileManagerFactory::NewFileManagerL( iFs ); |
620 CleanupStack::PushL(fm); |
669 CleanupStack::PushL(fm); |
621 fm->UpdateL(aFileName); |
670 fm->UpdateL(aFileName); |
622 CleanupStack::PopAndDestroy(); // fm |
671 CleanupStack::PopAndDestroy(); // fm |
623 #endif |
672 #endif |
624 } |
673 } |
625 // --------------------------------------------------------- |
674 // --------------------------------------------------------- |
626 // CFileSaver::NotifyMediaGalleryL() |
675 // CFileSaver::NotifyMediaGalleryL() |
627 // Notify media gallery about the new file. |
676 // Notify media gallery about the new file. |
628 // --------------------------------------------------------- |
677 // --------------------------------------------------------- |
629 // |
678 // |
630 void CFileSaver::NotifyMediaGalleryL( const TDesC& aFileName ) |
679 void CFileSaver::NotifyMediaGalleryL( const TDesC& aFileName ) |
631 { |
680 { |
632 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
681 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF |
633 |
682 |
634 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( iFs ); |
683 CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL( iFs ); |
635 CleanupStack::PushL( mgFileManager ); |
684 CleanupStack::PushL( mgFileManager ); |
636 |
685 |
637 TRAP_IGNORE( mgFileManager->UpdateL() ); |
686 TRAP_IGNORE( mgFileManager->UpdateL() ); |
638 CleanupStack::PopAndDestroy( mgFileManager ); |
687 CleanupStack::PopAndDestroy( mgFileManager ); |
639 |
688 |
640 // Notify Media Gallery |
689 // Notify Media Gallery |
641 TRAP_IGNORE( UpdateMediaGalleryIfNeededL( aFileName ) ); |
690 TRAP_IGNORE( UpdateMediaGalleryIfNeededL( aFileName ) ); |
642 |
691 |
643 #endif |
692 #endif |
644 |
693 |
645 |
694 |
646 // Notify DCF repository |
695 // Notify DCF repository |
647 TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) ); |
696 TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) ); |
648 } |
697 } |
649 // --------------------------------------------------------- |
698 // --------------------------------------------------------- |
650 // CFileSaver::DownloadedFileSize() |
699 // CFileSaver::DownloadedFileSize() |
653 TInt CFileSaver::DownloadedFileSize() |
702 TInt CFileSaver::DownloadedFileSize() |
654 { |
703 { |
655 // check how many bytes are already persisted |
704 // check how many bytes are already persisted |
656 TInt DownloadedSize(0); |
705 TInt DownloadedSize(0); |
657 TInt err = iFile.Size( (TInt&)DownloadedSize ); |
706 TInt err = iFile.Size( (TInt&)DownloadedSize ); |
658 |
707 |
659 CLOG(( ECodStorage, 2, _L("CFileSaver::DownloadedFileSize Downloaded size = %d error = %d"), \ |
708 CLOG(( ECodStorage, 2, _L("CFileSaver::DownloadedFileSize Downloaded size = %d error = %d"), \ |
660 DownloadedSize,err )); |
709 DownloadedSize,err )); |
661 |
710 |
662 if(err != KErrNone) |
711 if(err != KErrNone) |
663 return err; |
712 return err; |
664 return DownloadedSize; |
713 return DownloadedSize; |
665 } |
714 } |
666 |
715 |
667 |
716 |
668 /** |
717 /** |
669 * Discard the old contents |
718 * Discard the old contents |
670 */ |
719 */ |
671 void CFileSaver::ResetL() |
720 void CFileSaver::ResetL() |
672 { |
721 { |
673 |
722 |
674 |
723 |
675 iFile.Close(); |
724 iFile.Close(); |
676 |
725 |
677 User::LeaveIfError( iFile.Replace( iFs, |
726 User::LeaveIfError( iFile.Replace( iFs, |
678 iFname, |
727 iFname, |
679 EFileShareAny | |
728 EFileShareAny | |
680 EFileStream | |
729 EFileStream | |
681 EFileWrite ) ); |
730 EFileWrite ) ); |
682 } |
731 } |
683 |
732 |
684 |
733 |
685 // ----------------------------------------------------------------------------- |
734 // ----------------------------------------------------------------------------- |
756 // --------------------------------------------------------- |
805 // --------------------------------------------------------- |
757 HBufC* CFileSaver::NameL() const |
806 HBufC* CFileSaver::NameL() const |
758 { |
807 { |
759 return iFname.AllocL(); |
808 return iFname.AllocL(); |
760 } |
809 } |
|
810 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF |
|
811 |
|
812 // --------------------------------------------------------- |
|
813 // CFileSaver::GetDownloadPathPluginInstanceL |
|
814 // --------------------------------------------------------- |
|
815 CDownloadPathHandler* CFileSaver::GetDownloadPathPluginInstanceL(TPtrC8& mimetype ) |
|
816 { |
|
817 CDownloadPathHandler* downloadPathPlugin = NULL; |
|
818 TRAPD( kErr, downloadPathPlugin = CDownloadPathHandler::NewL( mimetype ) ); |
|
819 if( kErr != KErrNone ) |
|
820 { |
|
821 downloadPathPlugin = NULL; |
|
822 } |
|
823 return downloadPathPlugin; |
|
824 } |
|
825 |
|
826 // --------------------------------------------------------- |
|
827 // CFileSaver::GetUpdatedPathFromPluginL |
|
828 // --------------------------------------------------------- |
|
829 void CFileSaver::GetUpdatedPathFromPluginL(CDownloadPathHandler* downloadPathPlugin,TFileName& fname, TPtr& fileNamePtr) |
|
830 { |
|
831 TRAPD( kErr, downloadPathPlugin->GetUpdatedPathL( fname, fileNamePtr ) ); |
|
832 if( kErr == KErrNone ) |
|
833 { |
|
834 fileNamePtr.Append( _L( "\\" ) ); |
|
835 } |
|
836 else |
|
837 { |
|
838 fileNamePtr.Append( _L( "download\\" ) ); |
|
839 } |
|
840 } |
|
841 #endif |
|
842 |
|
843 //EOF |