browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp
branchRCL_3
changeset 62 c711bdda59f4
parent 38 6297cdf66332
child 67 4917f9bf7995
equal deleted inserted replaced
59:1f3c3f2f5b0a 62:c711bdda59f4
    44 #include    <DcfEntry.h>
    44 #include    <DcfEntry.h>
    45 #include    <DcfRep.h>
    45 #include    <DcfRep.h>
    46 
    46 
    47 #include    <pathinfo.h>
    47 #include    <pathinfo.h>
    48 
    48 
       
    49 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
       
    50 #include <DownloadPathHandler.h>
       
    51 #endif
    49 // EXTERNAL DATA STRUCTURES
    52 // EXTERNAL DATA STRUCTURES
    50 //extern  ?external_data;
    53 //extern  ?external_data;
    51 
    54 
    52 // EXTERNAL FUNCTION PROTOTYPES  
    55 // EXTERNAL FUNCTION PROTOTYPES  
    53 //extern ?external_function( ?arg_type,?arg_type );
    56 //extern ?external_function( ?arg_type,?arg_type );
  6769     TInt drive( EDriveC );
  6772     TInt drive( EDriveC );
  6770     TBool criticalSpace( EFalse );
  6773     TBool criticalSpace( EFalse );
  6771     TBool needToUpdatePath( ETrue );
  6774     TBool needToUpdatePath( ETrue );
  6772 
  6775 
  6773     CLOG_WRITE_1( " entering fileName: %S", fileName );
  6776     CLOG_WRITE_1( " entering fileName: %S", fileName );
       
  6777 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
       
  6778     CDownloadPathHandler* downloadPathPlugin = NULL;
       
  6779     downloadPathPlugin = GetDownloadPathPluginInstanceL();
       
  6780     if( downloadPathPlugin )
       
  6781        {
       
  6782         CleanupStack::PushL( downloadPathPlugin );
       
  6783        }
       
  6784 #endif
  6774 #ifdef RD_MULTIPLE_DRIVE
  6785 #ifdef RD_MULTIPLE_DRIVE
  6775     HBufC8* drivesDynList = iClientApp->Engine()->QueryDynDriveListLC();
  6786     HBufC8* drivesDynList = iClientApp->Engine()->QueryDynDriveListLC();
  6776     TPtrC8 drives( *drivesDynList ); 
  6787     TPtrC8 drives( *drivesDynList ); 
  6777 #else
  6788 #else
  6778     TPtrC drives( iClientApp->Engine()->iDriveLettersCenRep );
  6789     TPtrC drives( iClientApp->Engine()->iDriveLettersCenRep );
  6784             {
  6795             {
  6785             continue;
  6796             continue;
  6786             }
  6797             }
  6787         if( drive == currentDrive )//if the current path is same as the path in cenrep then no need to update.The diff is because we must have not known size before hand
  6798         if( drive == currentDrive )//if the current path is same as the path in cenrep then no need to update.The diff is because we must have not known size before hand
  6788             {
  6799             {
       
  6800 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
       
  6801             if( !downloadPathPlugin )
       
  6802                 {
       
  6803                 needToUpdatePath = EFalse;
       
  6804                 }
       
  6805 #else
  6789             needToUpdatePath = EFalse;
  6806             needToUpdatePath = EFalse;
       
  6807 #endif 
  6790             break;
  6808             break;
  6791             }
  6809             }
  6792         else
  6810         else
  6793             {
  6811             {
  6794             TInt bytesToWrite = downloadedSize;
  6812             TInt bytesToWrite = downloadedSize;
  6820                 }
  6838                 }
  6821             }
  6839             }
  6822     
  6840     
  6823         // Setting RootPath for new Destination file
  6841         // Setting RootPath for new Destination file
  6824         fileNamePtr.Insert( 0, rootPath );
  6842         fileNamePtr.Insert( 0, rootPath );
       
  6843 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
       
  6844         if( downloadPathPlugin )
       
  6845             {
       
  6846              GetUpdatedPathFromPluginL(downloadPathPlugin,rootPath,fileNamePtr);
       
  6847              CleanupStack::PopAndDestroy( downloadPathPlugin );
       
  6848             }
       
  6849          else 
       
  6850            {
       
  6851            // Setting KDownloadPath
       
  6852            fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
       
  6853            }   
       
  6854 #else
  6825         // Setting KDownloadPath
  6855         // Setting KDownloadPath
  6826         fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
  6856         fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
       
  6857           
       
  6858 #endif
       
  6859         
  6827 #else
  6860 #else
  6828         TChar driveChar;
  6861         TChar driveChar;
  6829         fs.DriveToChar(drive, driveChar);
  6862         fs.DriveToChar(drive, driveChar);
  6830         TBuf<2> buf;
  6863         TBuf<2> buf;
  6831         buf.Append(driveChar);
  6864         buf.Append(driveChar);
  7188     CleanupStack::PopAndDestroy(fileName);
  7221     CleanupStack::PopAndDestroy(fileName);
  7189     fileName = uniqueName;
  7222     fileName = uniqueName;
  7190     CleanupStack::PushL(fileName);
  7223     CleanupStack::PushL(fileName);
  7191     }
  7224     }
  7192 
  7225 
       
  7226 #ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
       
  7227 
       
  7228 // -----------------------------------------------------------------------------
       
  7229 // CHttpDownload::GetDownloadPathPluginInstanceL
       
  7230 // -----------------------------------------------------------------------------
       
  7231 //
       
  7232 CDownloadPathHandler* CHttpDownload::GetDownloadPathPluginInstanceL()
       
  7233     {
       
  7234     CDownloadPathHandler* downloadPathPlugin = NULL;
       
  7235     if ( iContentType )
       
  7236         {
       
  7237         TRAPD( kErr, downloadPathPlugin = CDownloadPathHandler::NewL( *iContentType ) );
       
  7238         if( kErr != KErrNone )
       
  7239             {
       
  7240             downloadPathPlugin = NULL;
       
  7241             }
       
  7242         }
       
  7243     return downloadPathPlugin;    
       
  7244 
       
  7245     }
       
  7246 
       
  7247 // -----------------------------------------------------------------------------
       
  7248 // CHttpDownload::GetUpdatedPathFromPluginL
       
  7249 // -----------------------------------------------------------------------------
       
  7250 //
       
  7251 void CHttpDownload::GetUpdatedPathFromPluginL(CDownloadPathHandler* downloadPathPlugin,TFileName& rootPath, TPtr& fileNamePtr)
       
  7252     {
       
  7253     HBufC16* locFileName ;
       
  7254     locFileName = iStorage->LocalFilename();
       
  7255     
       
  7256     // Gets the updated path for the music content from Plugin
       
  7257     TRAPD( kErr, downloadPathPlugin->GetUpdatedPathL( *locFileName, fileNamePtr ) );
       
  7258     if( kErr != KErrNone )
       
  7259         {
       
  7260         // Setting to KDownloadPath
       
  7261         fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
       
  7262         }
       
  7263     }
       
  7264 #endif
  7193 //  End of File
  7265 //  End of File