browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp
changeset 1 7c90e6132015
parent 0 dd21522fd290
child 5 10e98eab6f85
equal deleted inserted replaced
0:dd21522fd290 1:7c90e6132015
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 // INCLUDE FILES
    20 // INCLUDE FILES
       
    21 #include <platform/mw/Browser_platform_variant.hrh>
    21 #include    "HeaderField.h"
    22 #include    "HeaderField.h"
    22 #include    "HttpDownloadManagerServerEngine.h"
    23 #include    "HttpDownloadManagerServerEngine.h"
    23 #include    "HttpClientApp.h"
    24 #include    "HttpClientApp.h"
    24 #include    "FileExt.h"
    25 #include    "FileExt.h"
    25 #include    "HttpDownload.h"
    26 #include    "HttpDownload.h"
    32 #include    <F32FILE.H>
    33 #include    <F32FILE.H>
    33 #include    <EscapeUtils.h>
    34 #include    <EscapeUtils.h>
    34 #include    <HttpFilterCommonStringsExt.h>
    35 #include    <HttpFilterCommonStringsExt.h>
    35 #include    <tinternetdate.h>
    36 #include    <tinternetdate.h>
    36 #include    <SysUtil.h>
    37 #include    <SysUtil.h>
       
    38 
       
    39 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
    37 #include    <MGXFileManagerFactory.h>
    40 #include    <MGXFileManagerFactory.h>
    38 #include    <CMGXFileManager.h>
    41 #include    <CMGXFileManager.h>
       
    42 #endif
       
    43 
    39 #include    <DcfEntry.h>
    44 #include    <DcfEntry.h>
    40 #include    <DcfRep.h>
    45 #include    <DcfRep.h>
    41 
    46 
    42 #include    <pathinfo.h>
    47 #include    <pathinfo.h>
    43 
    48 
   612                     return;//This Attribute tells if Delete is called from MP when Exiting from Browser
   617                     return;//This Attribute tells if Delete is called from MP when Exiting from Browser
   613                     }
   618                     }
   614                 if( iClAppInstance )
   619                 if( iClAppInstance )
   615                     {
   620                     {
   616                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
   621                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
   617                     //Deref Attach Download instance
       
   618                     aClAppInstance->ClientApp()->UnregisterDownload( this ); 
       
   619                     return;
   622                     return;
   620                     }
   623                     }
   621                 }
   624                 }
   622             else if( iClAppInstance == aClAppInstance )
   625             else if( iClAppInstance == aClAppInstance )
   623                 {
   626                 {
   624                 iClAppInstance = NULL;
   627                 iClAppInstance = NULL;
   625                 if( iPDClAppInstance )
   628                 if( iPDClAppInstance )
   626                     {
   629                     {
   627                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
   630                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
   628                     //Deref Master Client Instance
       
   629                     aClAppInstance->ClientApp()->UnregisterDownload( this );                    
       
   630                     return;
   631                     return;
   631                     }
   632                     }
   632                 }        
   633                 }        
   633             }
   634             }
   634         }
   635         }
   670         // set by the client and download completed.
   671         // set by the client and download completed.
   671 	        {
   672 	        {
   672 	        CLOG_WRITE("Keep file");
   673 	        CLOG_WRITE("Keep file");
   673 	        closeOp = CHttpStorage::EKeepFile;
   674 	        closeOp = CHttpStorage::EKeepFile;
   674 	        }
   675 	        }
   675     
   676 	        
   676 	if( iStorage->RFileSetByClient())
   677 	if( iStorage->RFileSetByClient())
   677 	    {
   678 	    {
   678 	    TBool pausable;
   679 	    TBool pausable;
   679         GetBoolAttributeL( EDlAttrPausable, pausable );
   680         GetBoolAttributeL( EDlAttrPausable, pausable );
   680         if( iDlState == EHttpDlMultipleMOCompleted || ( iDlState == EHttpDlInprogress && pausable ) )
   681         if( iDlState == EHttpDlMultipleMOCompleted || ( iDlState == EHttpDlInprogress && pausable ) )
   681             {
   682             {
   682             CLOG_WRITE("Keep file");
   683             CLOG_WRITE("Keep file");
   683 	        closeOp = CHttpStorage::EKeepFile;
   684 	        closeOp = CHttpStorage::EKeepFile;
   684             }
   685             }
       
   686 		
   685 	    }
   687 	    }
   686     if( iCodDlData )
   688     if( iCodDlData )
   687 	    {
   689 	    {
   688 	    // For User Delete when all the Downloads are moved to gallery
   690 	    // For User Delete when all the Downloads are moved to gallery
   689 	    if( EHttpDlMultipleMOCompleted == iDlState && closeOp == CHttpStorage::EDeleteFile )
   691 	    if( EHttpDlMultipleMOCompleted == iDlState && closeOp == CHttpStorage::EDeleteFile )
   719     else
   721     else
   720     	{
   722     	{
   721     	iStorage->CloseDestinationFile( closeOp );
   723     	iStorage->CloseDestinationFile( closeOp );
   722     	}
   724     	}
   723     // when delete there's no store -> no leave
   725     // when delete there's no store -> no leave
   724     aClAppInstance->ClientApp()->UnregisterDownload( this ); 
   726     //  aClAppInstance->ClientApp()->UnregisterDownload( this ); 
   725     }
   727     }
   726 
   728 
   727 
   729 
   728 // -----------------------------------------------------------------------------
   730 // -----------------------------------------------------------------------------
   729 // CHttpDownload::DeleteInfoFile
   731 // CHttpDownload::DeleteInfoFile
  7023 void CHttpDownload::NotifyMediaGalleryL( const TDesC& aFileName )
  7025 void CHttpDownload::NotifyMediaGalleryL( const TDesC& aFileName )
  7024     {
  7026     {
  7025 
  7027 
  7026 	LOGGER_ENTERFN( "CHttpDownload::NotifyMediaGalleryL" );
  7028 	LOGGER_ENTERFN( "CHttpDownload::NotifyMediaGalleryL" );
  7027     CLOG_WRITE_1(" notifying Gallery and DcfReposory about move for: %S",&aFileName);
  7029     CLOG_WRITE_1(" notifying Gallery and DcfReposory about move for: %S",&aFileName);
       
  7030 
       
  7031 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF    
       
  7032     
  7028     //
  7033     //
  7029     // Notify Media Gallery about new media file
  7034     // Notify Media Gallery about new media file
  7030     CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
  7035     CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
  7031         iClientApp->Engine()->Fs() );
  7036         iClientApp->Engine()->Fs() );
  7032     CleanupStack::PushL( mgFileManager );
  7037     CleanupStack::PushL( mgFileManager );
  7037     else
  7042     else
  7038         {
  7043         {
  7039         TRAP_IGNORE( mgFileManager->UpdateL() );
  7044         TRAP_IGNORE( mgFileManager->UpdateL() );
  7040         }
  7045         }
  7041     CleanupStack::PopAndDestroy( mgFileManager );
  7046     CleanupStack::PopAndDestroy( mgFileManager );
       
  7047     
       
  7048 #endif    
  7042     //
  7049     //
  7043     // Notify DCF repository
  7050     // Notify DCF repository
  7044     TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) );
  7051     TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) );
  7045 	}
  7052 	}
  7046 // -----------------------------------------------------------------------------
  7053 // -----------------------------------------------------------------------------