browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp
branchRCL_3
changeset 94 919f36ff910f
parent 93 79859ed3eea9
child 103 be5f8c9adf67
--- a/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp	Tue Aug 31 16:17:46 2010 +0300
+++ b/browserutilities/downloadmgr/DownloadMgrServEng/Src/HttpDownload.cpp	Wed Sep 01 12:28:30 2010 +0100
@@ -18,8 +18,7 @@
 
 
 // INCLUDE FILES
-//#include <platform/mw/Browser_platform_variant.hrh>
-#include    <Browser_platform_variant.hrh>
+#include    <browser_platform_variant.hrh>
 #include    "HeaderField.h"
 #include    "HttpDownloadManagerServerEngine.h"
 #include    "HttpClientApp.h"
@@ -29,16 +28,13 @@
 #include    "HttpDownloadMgrLogger.h"
 #include    "bautils.h"
 
-#include    <commdbconnpref.h>
-#include    <uri16.h>
-#include    <f32file.h>
-#include    <escapeutils.h>
+#include    <CommDbConnPref.h>
+#include    <Uri16.h>
+#include    <F32FILE.H>
+#include    <EscapeUtils.h>
 #include    <httpfiltercommonstringsext.h>
 #include    <tinternetdate.h>
-#include    <sysutil.h>
-
-// following line is temporary: AVKON dependency removal
-#undef BRDO_APP_GALLERY_SUPPORTED_FF
+#include    <SysUtil.h>
 
 #ifdef BRDO_APP_GALLERY_SUPPORTED_FF
 #include    <MGXFileManagerFactory.h>
@@ -50,10 +46,13 @@
 
 #include    <pathinfo.h>
 
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+#include <DownloadPathHandler.h>
+#endif
 // EXTERNAL DATA STRUCTURES
 //extern  ?external_data;
 
-// EXTERNAL FUNCTION PROTOTYPES
+// EXTERNAL FUNCTION PROTOTYPES  
 //extern ?external_function( ?arg_type,?arg_type );
 
 // CONSTANTS
@@ -62,7 +61,7 @@
 const TInt   KUrlFixChar = '_';
 const TInt KMaxHeaderOfMultipart = 32000;
 const TInt KRespSizeForRecognition = 1024;  //for THttpProgressState EHttpContTypeRecognitionAvail
-const TInt KMinDataSizeToSend = (32*1024);  //for Browser Control to call NewDownloadL
+const TInt KMinDataSizeToSend = (32*1024);  //for Browser Control to call NewDownloadL     
 const TInt KErrCodHttpDownloadPaused = -20045;  //Error code set by the CodHandler if the download is paused by the client
 const TInt KHttp903LossOfService = 903; //Error code set by the CodHandler if connection is lost
 const TInt KHttp954LoaderError = 954; //Error code set by the CodHandler if Loader error is found
@@ -114,7 +113,7 @@
 // LOCAL CONSTANTS AND MACROS
 const TInt KDMHttpErrorBase = -25000;
 #define GLOBAL_HTTP_ERROR( err ) ( KDMHttpErrorBase - err )
-const TInt  KErrMultipeObjectDownloadFailed = -20046;
+const TInt  KErrMultipeObjectDownloadFailed = -20046;  
 
 // MODULE DATA STRUCTURES
 //enum ?declaration
@@ -206,16 +205,16 @@
             TRAPD(err, PauseL() );
 
             --iDontFireEvent;
-
+            
             User::LeaveIfError( err );
             }
         }
 
     if( !iStorage->CheckContentFileIntegrityL() )
         {
-        if (iStorage->ProgressiveDownload() &&
-             iStorage->Length() == iStorage->DownloadedSize() )
-            // If it was a progressive download
+        if (iStorage->ProgressiveDownload() && 
+             iStorage->Length() == iStorage->DownloadedSize() ) 
+            // If it was a progressive download 
             // and downloaded size = content length,
             // it means that download was not properly closed
             // in the previous session
@@ -227,8 +226,8 @@
             OnError( KErrUnknown, EContentFileIntegrity );
             }
         }
-
-        iMoveInProgress = EFalse;
+        
+        iMoveInProgress = EFalse;          
     }
 
 // -----------------------------------------------------------------------------
@@ -245,7 +244,7 @@
     CHttpDownload* self = new( ELeave ) CHttpDownload( aClientApp,
                                                        aId,
                                                        aClAppInstance );
-
+    
     CleanupStack::PushL( self );
     self->ConstructL( aUrl );
     CleanupStack::Pop();
@@ -253,7 +252,7 @@
     return self;
     }
 
-
+    
 // Destructor
 CHttpDownload::~CHttpDownload()
     {
@@ -272,13 +271,13 @@
     delete iHttpProxyUsername;
     delete iHttpProxyPassword;
     delete iContentType;
-    delete iDDType;
+    delete iDDType;    
     delete iMediaType;
     delete iDlName;
 	delete iDispositionType;
     delete iFileMan;
-
-
+    
+    
     delete iHashedMsgBody;
     delete iDownloadInfo;
     delete iAttachmentFileName;
@@ -315,9 +314,9 @@
     delete iStorage;
     iStorage = NULL;
     delete iHeaderOfMultipart;
-
+    
     iMoveInProgress = EFalse;
-
+    
     CLOG_CLOSE;
     }
 
@@ -330,7 +329,7 @@
 EXPORT_C void CHttpDownload::Attach( CHttpClientAppInstance* aClientAppInstance )
     {
     LOGGER_ENTERFN( "CHttpDownload::Attach" );
-
+    
     __ASSERT_DEBUG( !iPDClAppInstance, DMPanic( KErrInUse) );
     iPDClAppInstance = aClientAppInstance;
     }
@@ -380,7 +379,7 @@
             {
             TriggerEvent( EHttpDlAlreadyRunning );
             }
-
+            
         // This is the place where client already set every continue
         // download attribute
         StoreDownloadInfoL();
@@ -422,7 +421,7 @@
                 ParseDownloadNameL();
                 StoreDownloadInfoL();
                 SetDownloadStatus( EHttpStarted );
-
+                
                if( !iConnHandler )
                     // assign download to the connhandler
                     // connection is surely up because it was created from client side
@@ -460,7 +459,7 @@
                 return;
                 }
             else if( iRestartAction == ERestartForced )
-                // doesn't matter what we have.
+                // doesn't matter what we have. 
                 // Download must be restarted from the very beginning
                 {
                 ForcedRestartL();
@@ -522,7 +521,7 @@
         iPDClAppInstance = NULL;
         }
     if( iClAppInstance )
-        {
+        {        
         if( !iConnHandler )
             {
             iConnHandler = iClAppInstance->ConnHandler();
@@ -534,7 +533,7 @@
     iDlStartedByClient = ETrue;
 
     SetDownloadStatus( EHttpStarted );
-
+    
     }
 
 // -----------------------------------------------------------------------------
@@ -636,7 +635,7 @@
                     SetDownloadStatus( EHttpProgNone, EHttpDlDeleting );
                     return;
                     }
-                }
+                }        
             }
         }
 
@@ -644,7 +643,7 @@
     // This won't be reenabled at the end of this function so
     // don't call delete only from outside of this class.
     ++iDontFireEvent;
-
+    
     TPath folder;
     TFileName file;
 
@@ -660,18 +659,18 @@
     //delete main info file
     err = iClientApp->Engine()->Fs().Delete( file );
     CLOG_WRITE_2( "Delete info file: %S, err : %d", &file, err );
-
+    
     //delete subinfo file
     CFileMan* fileMan = CFileMan::NewL(iClientApp->Engine()->Fs() );
     file.Format( _L("%S%d_*"), &folder, iId );
     fileMan->Delete( file );
     delete fileMan;
-
+        
 
     // to make sure the CHttpStorage releases the content file
     // and deletes it.
     CHttpStorage::TFileCloseOperation closeOp = CHttpStorage::EDeleteFile;
-
+    
     if( iStorage->DestFNameSet() && iDlState == EHttpDlMultipleMOCompleted )
         // Do NOT delete the file: if the destination filename was
         // set by the client and download completed.
@@ -679,7 +678,7 @@
 	        CLOG_WRITE("Keep file");
 	        closeOp = CHttpStorage::EKeepFile;
 	        }
-
+	        
 	if( iStorage->RFileSetByClient())
 	    {
 	    TBool pausable;
@@ -689,7 +688,7 @@
             CLOG_WRITE("Keep file");
 	        closeOp = CHttpStorage::EKeepFile;
             }
-
+		
 	    }
     if( iCodDlData )
 	    {
@@ -700,36 +699,36 @@
 		    	{
 		    	TPtrC fullName = ((*iCodDlData)[i])->DestFilename();
 		    	ClientApp()->Engine()->Fs().Delete( fullName );
-		    	}
+		    	}	
 		    }
-		// For User Cancel to Cancel Multiple download, Current and Queued DLs will be delete, completed ones will be kept
+		// For User Cancel to Cancel Multiple download, Current and Queued DLs will be delete, completed ones will be kept    
 		else if( EHttpDlInprogress == iDlState || EHttpDlPaused == iDlState || EHttpDlDeleting == iDlState)
 			{
 			for(TInt i = 1; i <= iCodDlData->Count(); i++)
 		    	{
-		    	if( EInProgress == ((*iCodDlData)[i])->State() || EFailed == ((*iCodDlData)[i])->State() )	// OnGoing and Queued will be deleted
+		    	if( EInProgress == ((*iCodDlData)[i])->State() || EFailed == ((*iCodDlData)[i])->State() )	// OnGoing and Queued will be deleted	  
 			    	{
 			    	TPtrC fullName = ((*iCodDlData)[i])->DestFilename();
 			    	if(fullName.Length())
 			    	    {
-			    	    ClientApp()->Engine()->Fs().Delete( fullName );
+			    	    ClientApp()->Engine()->Fs().Delete( fullName );	    
 			    	    }
-			    	}
-		    	//else if( ESucceeded == ((*iCodDlData)[i])->State() )
+			    	}  
+		    	//else if( ESucceeded == ((*iCodDlData)[i])->State() ) 
 		    	// Completed ones will be kept and moved to Gallery
 		    	else if( ESucceeded == ((*iCodDlData)[i])->State() )
 			    	{
 			    	MoveInDelete(i);
 			    	}
-		    	}
-			}
+		    	}	
+			} 	
 	    }
     else
     	{
     	iStorage->CloseDestinationFile( closeOp );
     	}
     // when delete there's no store -> no leave
-    //  aClAppInstance->ClientApp()->UnregisterDownload( this );
+    //  aClAppInstance->ClientApp()->UnregisterDownload( this ); 
     }
 
 
@@ -742,12 +741,12 @@
 EXPORT_C void CHttpDownload::DeleteInfoFile( CHttpClientAppInstance* aClAppInstance )
     {
     CLOG_WRITE( "DeleteInfoFile()" );
-
+    
     // This should be called only after the completion of download
-	if( ! (EHttpDlMultipleMOCompleted == iDlState &&
-    		(
+	if( ! (EHttpDlMultipleMOCompleted == iDlState && 
+    		( 
     		EHttpProgContentFileMoved == iProgState ||
-    		EHttpProgContentFileMovedAndDestFNChanged == iProgState
+    		EHttpProgContentFileMovedAndDestFNChanged == iProgState 
     		)
     	))
 		{
@@ -758,7 +757,7 @@
     // This won't be reenabled at the end of this function so
     // don't call delete only from outside of this class.
     ++iDontFireEvent;
-
+    
     TPath folder;
     TFileName file;
 
@@ -772,19 +771,19 @@
     iClientApp->Engine()->CODDownloadInfoFolder( iClientApp, folder );
     file.Format( _L("%S%d"), &folder, iId );
     CLOG_WRITE_1( "Delete info file: %S", &file );
-    iClientApp->Engine()->Fs().Delete( file );
-
+    iClientApp->Engine()->Fs().Delete( file );    
+    
     //delete subinfo file
     CFileMan* fileMan = CFileMan::NewL(iClientApp->Engine()->Fs() );
     file.Format( _L("%S%d_*"), &folder, iId );
     fileMan->Delete( file );
     delete fileMan;
-
+    
 
     // to make sure the CHttpStorage releases the content file
     // and deletes it.
     CHttpStorage::TFileCloseOperation closeOp = CHttpStorage::EDeleteFile;
-
+    
     if( iStorage->DestFNameSet() && iDlState == EHttpDlMultipleMOCompleted )
         // Do NOT delete the file: if the destination filename was
         // set by the client and download completed.
@@ -792,11 +791,11 @@
         CLOG_WRITE("Keep file");
         closeOp = CHttpStorage::EKeepFile;
         }
-
+        
     iStorage->CloseDestinationFile( closeOp );
 
-    // when delete there's no store -> no leave
-    aClAppInstance->ClientApp()->UnregisterDownload( this );
+    // when delete there's no store -> no leave	
+    aClAppInstance->ClientApp()->UnregisterDownload( this ); 
     }
 
 
@@ -809,9 +808,9 @@
 EXPORT_C void CHttpDownload::MoveL()
     {
     LOGGER_ENTERFN( "MoveL" );
-
-
-    if(iMoveInProgress)
+    
+    
+    if(iMoveInProgress) 
     {
     	CLOG_WRITE(" return MoveL  ");
     	return;
@@ -833,18 +832,18 @@
         {
         User::Leave( KErrInUse );
         }
-
+        
         //File is already moved. Ignore the move
     if( iProgState == EHttpProgContentFileMovedAndDestFNChanged ||
-
+    
       	iProgState ==  EHttpProgContentFileMoved )
         {
         return;
         }
-
+        
     __ASSERT_DEBUG( !IsActive(), DMPanic( KErrInUse ) );
     //__ASSERT_DEBUG( !iFileMan, DMPanic( KErrInUse ) );
-
+    
     if(_OMADLOTA2_MULTI_DOWNLOAD)
         {
 		iMOMoved = 1;
@@ -857,7 +856,7 @@
 	RFs &rFs = iClientApp->Engine()->Fs();
 	if(!iFileMan)
 		{
-		iFileMan = CFileMan::NewL(rFs);
+		iFileMan = CFileMan::NewL(rFs);	
 		}
 
     CLOG_WRITE_1( "Src: %S", iStorage->LocalFilename() );
@@ -875,40 +874,40 @@
         CreateIndexedNameL(uniqueName , fileNamePtr , index);
         if( !BaflUtils::FileExists( rFs , *uniqueName ) )
         //Check if file name exist in Destination path
-        //Generate Unique name if exist
+        //Generate Unique name if exist 
             {
             bFound =ETrue;
             break;
             }
         iDlNameChanged = ETrue;
-
+            
         }while( !bFound );
-    CleanupStack::PopAndDestroy( fileName );
+    CleanupStack::PopAndDestroy( fileName );           
 
   	if( iDlNameChanged )
   	    {
   	    HBufC16* destFileName ;
-  	    destFileName = iStorage->DestFilename();
+  	    destFileName = iStorage->DestFilename();           
   	    TPtr destFileNamePtr = destFileName->Des();
-  	    destFileNamePtr.Replace(0, destFileNamePtr.Length() , *uniqueName);
+  	    destFileNamePtr.Replace(0, destFileNamePtr.Length() , *uniqueName);    
   	    TInt lastSlashPos = destFileNamePtr.LocateReverse( '\\' );
   	    TPtr dlName = destFileNamePtr.MidTPtr(lastSlashPos +1 );
         TInt dotPos = iDlName->LocateReverse( '.' );
         if( dotPos == KErrNotFound )
             {
-            //Remove Extension from dlName as it was not present in old iDlName
+            //Remove Extension from dlName as it was not present in old iDlName 
             dotPos = dlName.LocateReverse( '.' );
             if(dotPos != KErrNotFound )
                 {
                 dlName.Copy( dlName.Left(dotPos));
-                }
+                }            
             }
   	    //download name has changed
   	    ReallocateStringL( iDlName, dlName, KDownloadNameMaxSize );
-  	    }
-
-  	TInt err =iFileMan->Move( *iStorage->LocalFilename(),
-                                        *iStorage->DestFilename(),
+  	    }      
+  	    
+  	TInt err =iFileMan->Move( *iStorage->LocalFilename(), 
+                                        *iStorage->DestFilename(), 
                                         CFileMan::EOverWrite,
                                         iStatus );
     if(err != KErrNone)
@@ -916,8 +915,8 @@
     	iMoveInProgress = EFalse;
     	CLOG_WRITE("setting iMoveInProgress false when move fails");
     	}
-
-    User::LeaveIfError( err );
+    	
+    User::LeaveIfError( err ); 
     // waiting for move to complete
     SetActive();
     SetDownloadStatus( EHttpProgMovingContentFile, iDlState );
@@ -929,7 +928,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::GetIntAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::GetIntAttributeL( THttpDownloadAttrib aAttribute, 
 							                   TInt32& aValue )
     {
     LOGGER_ENTERFN( "GetIntAttributeL" );
@@ -978,7 +977,7 @@
             {
             if ( iCodDownload )
                 {
-                aValue = iMoLength;
+                aValue = iMoLength;    
                 }
             else
                 {
@@ -991,7 +990,7 @@
             {
             if( iCodDownload )
                 {
-                aValue = iStorage->MoDownloadedSize();
+                aValue = iStorage->MoDownloadedSize();    
                 }
             else
                 {
@@ -999,7 +998,7 @@
                 }
             }
             break;
-
+            
         case EDlAttrLength:
             {
             aValue = iStorage->Length();
@@ -1080,11 +1079,11 @@
             break;
 
         case EDlAttrFotaPckgId:
-            {
+            {     
             aValue = iFotaPckgId;
             }
             break;
-
+            
         case EDlAttrNumMediaObjects:
             {
             aValue = 1;
@@ -1104,7 +1103,13 @@
             aValue = iActivePlayedDownload;
             }
             break;
-
+            
+        case EDlAttrDestRemovable:
+            {
+            aValue = iStorage->RemovableDest();
+            }
+            break;            
+            
         default:
             {
             CLOG_WRITE_1( "Unknown int attrib: %d", aAttribute );
@@ -1116,23 +1121,23 @@
             }
             break;
         }
-
+    
     iNoRealError = EFalse;
     }
-
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::GetIntAttributeL
 // ?implementation_description
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::GetIntAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::GetIntAttributeL( THttpDownloadAttrib aAttribute, 
 							                   TInt32& aMoIndex,
 							                   TInt32& aValue )
     {
     LOGGER_ENTERFN( "GetIntAttributeL" );
     CLOG_WRITE_1( "Attr(%d)", aAttribute );
-
+    
     if (!iCodDlData)
     	{
     	aValue = 0;
@@ -1142,7 +1147,7 @@
     	{
     	User::Leave( KErrArgument );
     	}
-
+    
     CMediaDataBase* mediaData = (*iCodDlData)[aMoIndex];
     iNoRealError = ETrue;
 
@@ -1165,11 +1170,11 @@
             	if ((moData->State() == ESucceeded) || (moData->State() == EInProgress))
             		dlSize -= moData->DownloadedSize();
             	}
-
+            
             aValue = dlSize;
             }
             break;
-
+            
         case EDlAttrLength:
 	        {
 	        aValue = iStorage->Length();
@@ -1199,6 +1204,12 @@
             aValue = mediaData->Method();
             }
             break;
+            
+        case EDlAttrDestRemovable:
+            {
+            aValue = mediaData->DesRemovable();
+            }
+            break;
 
         default:
             {
@@ -1211,7 +1222,7 @@
             }
             break;
         }
-
+    
     iNoRealError = EFalse;
     }
 
@@ -1221,7 +1232,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::GetBoolAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::GetBoolAttributeL( THttpDownloadAttrib aAttribute, 
 								                TBool& aValue )
     {
     LOGGER_ENTERFN( "GetBoolAttributeL" );
@@ -1289,17 +1300,17 @@
             {
             aValue = iCodDownload;
             }
-            break;
-
+            break;            
+   
         case EDlAttrProgressive:
             {
             aValue = iStorage->ProgressiveMode();
             }
             break;
-
+   
         case EDlAttrDestRemovable:
             {
-            aValue = iStorage->RemovableDest();
+            aValue = (KDriveAttRemovable == iStorage->RemovableDest()) ? ETrue : EFalse ;
             }
             break;
 
@@ -1320,7 +1331,7 @@
             }
             break;
         }
-
+    
     iNoRealError = EFalse;
     }
 
@@ -1330,13 +1341,13 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::GetBoolAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::GetBoolAttributeL( THttpDownloadAttrib aAttribute, 
 								                TInt32& aMoIndex,
 								                TBool& aValue )
     {
     LOGGER_ENTERFN( "GetBoolAttributeL" );
     CLOG_WRITE_1( "Attr(%d): %d", aAttribute );
-
+    
     if (!iCodDlData)
     	{
     	aValue = 0;
@@ -1346,7 +1357,7 @@
     	{
     	User::Leave( KErrArgument );
     	}
-
+    	
     CMediaDataBase* mediaData = (*iCodDlData)[aMoIndex];
     iNoRealError = ETrue;
 
@@ -1369,10 +1380,10 @@
             aValue = mediaData->ProgressiveDownload();
             }
             break;
-
+   
         case EDlAttrDestRemovable:
             {
-            aValue = mediaData->DesRemovable();
+            aValue = (KDriveAttRemovable == mediaData->DesRemovable()) ? ETrue : EFalse ;
             }
             break;
 
@@ -1388,7 +1399,7 @@
             }
             break;
         }
-
+    
     iNoRealError = EFalse;
     }
 
@@ -1398,7 +1409,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C HBufC* CHttpDownload::GetStringAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C HBufC* CHttpDownload::GetStringAttributeL( THttpDownloadAttrib aAttribute, 
                                                     TBool& aDelete )
     {
     LOGGER_ENTERFN( "GetStringAttributeL" );
@@ -1440,7 +1451,7 @@
             {
             attr8 = iDDType;
             }
-            break;
+            break;            
 
         case EDlAttrRealm:
             {
@@ -1499,7 +1510,7 @@
             attr = iStorage->LocalFilename();
             }
             break;
-
+            
         case EDlAttrDdFileName:
         	{
         	attr = iStorage->DdFileName();
@@ -1609,7 +1620,7 @@
                 }
             }
             break;
-
+        
         case EDlAttrAlbumName:
             {
             if (iCodDlData && (iCodDlData->Name().Compare(KNullDesC)))
@@ -1623,7 +1634,7 @@
                 }
             }
             break;
-
+            
         default:
             {
                 {
@@ -1674,7 +1685,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C HBufC* CHttpDownload::GetStringAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C HBufC* CHttpDownload::GetStringAttributeL( THttpDownloadAttrib aAttribute, 
                                                     TInt32& aMoIndex,
                                                     TBool& aDelete )
     {
@@ -1689,7 +1700,7 @@
     	{
     	User::Leave( KErrArgument );
     	}
-
+    	
     CMediaDataBase* mediaData = (*iCodDlData)[aMoIndex];
     iNoRealError = ETrue;
     HBufC* attr = NULL;
@@ -1791,7 +1802,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C HBufC8* CHttpDownload::GetString8AttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C HBufC8* CHttpDownload::GetString8AttributeL( THttpDownloadAttrib aAttribute, 
                                                       TBool& aDelete )
     {
     LOGGER_ENTERFN( "GetString8AttributeL" );
@@ -1851,7 +1862,7 @@
             {
             attr = iDDType;
             }
-            break;
+            break;            
 
         case EDlAttrRequestHeaderAddon:
             {
@@ -1975,24 +1986,24 @@
             break;
 
         case EDlAttrHashedMsgBody:
-            {
+            { 
             attr = iHashedMsgBody;
             }
             break;
-
+   
         case EDlAttrMediaType:
             {
             attr = iMediaType;
             }
             break;
-
+            
         case EDlAttrMediaTypeBoundary:
             {
             attr = GetParamFromMediaTypeL( KBoundary() ).AllocL();
             aDelete = ETrue;
             }
             break;
-
+            
         default:
             {
                 {
@@ -2042,7 +2053,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C HBufC8* CHttpDownload::GetString8AttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C HBufC8* CHttpDownload::GetString8AttributeL( THttpDownloadAttrib aAttribute, 
                                                       TInt32& aMoIndex,
                                                       TBool& aDelete )
     {
@@ -2057,7 +2068,7 @@
     	{
     	User::Leave( KErrArgument );
     	}
-
+    	
     CMediaDataBase* mediaData = (*iCodDlData)[aMoIndex];
     iNoRealError = ETrue;
     HBufC8* attr = NULL;
@@ -2087,7 +2098,7 @@
             aDelete = ETrue;
             }
             break;
-
+            
         default:
             {
                 {
@@ -2140,7 +2151,7 @@
 EXPORT_C RFile* CHttpDownload::GetFileHandleAttributeL()
     {
     LOGGER_ENTERFN( "GetFileHandleAttributeL" );
-
+    
     if( !iStorage->File() )
         // destination file is not opened
         {
@@ -2156,7 +2167,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::SetIntAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::SetIntAttributeL( THttpDownloadAttrib aAttribute, 
                                                const TInt32 aValue )
     {
     LOGGER_ENTERFN( "SetIntAttributeL" );
@@ -2176,9 +2187,9 @@
         case EDlAttrAction:
         	{
             TBool PdSupported(EFalse);
-
+            
             iAction = (THttpDownloadMgrAction)aValue;
-
+            
             if(iClAppInstance)
             	{
             	TRAP_IGNORE(iClAppInstance->GetBoolAttributeL(EDlMgrProgressiveDownload, PdSupported));
@@ -2224,14 +2235,14 @@
 
         case EDlAttrMultipleMOLength:
             {
-            iMoLength = aValue;
-            }
-            break;
-
+            iMoLength = aValue;            
+            }
+            break;
+            
         case EDlAttrDownloadedSize:
             {
             if( (iCodDownload || iContinueDownload) && iDlState == EHttpDlInprogress )
-                {
+                {            
                 iStorage->SetDownloadedSize( aValue );
                 // Calculate downloaded size of current media object from
                 // album downloaded size.
@@ -2239,7 +2250,7 @@
                 if( iCodDlData )
                     {
                     for (TInt index = 0; index < iCodDlData->Count() ; ++index)
-                    	{
+                    	{               	
                     	if( iActiveDownload - 1 == index )
                     	    {
                     	    //the size of active download has already been taken into account
@@ -2249,8 +2260,8 @@
                     	if ((moData->State() == ESucceeded) || (moData->State() == EInProgress))
                     		dlSize += moData->DownloadedSize();
                     	}
-                    iStorage->SetMoDownloadedSize(dlSize);
-                    }
+                    iStorage->SetMoDownloadedSize(dlSize);                    	                
+                    }                
                 if( iStorage->Length() != KDefaultContentLength &&
                     iStorage->DownloadedSize() > iStorage->Length() )
                     // we don't know actually how many bytes will come down.
@@ -2258,10 +2269,10 @@
                     CLOG_WRITE( "Length modified" );
                     iStorage->SetLength( KDefaultContentLength );
                     StoreDownloadInfoL();
-                    }
+                    }                             
                 TriggerEvent( EHttpDlInprogress, EHttpProgResponseBodyReceived );
                 }
-
+                
             store = EFalse;
             }
             break;
@@ -2271,8 +2282,8 @@
             if(!aValue)
                 DownloadSucceededL();
             else
-                iMoDownloadCompleted = ETrue;//Download of MO has been Completed so change State ,But PD is on
-                                         //So MOVE will be issued by PD Client
+                iMoDownloadCompleted = ETrue;//Download of MO has been Completed so change State ,But PD is on           
+                                         //So MOVE will be issued by PD Client 
 
             store = EFalse;
             }
@@ -2291,7 +2302,7 @@
             {
             }
             break;
-
+            
         case EDlAttrMethod:
             {
             if( iContinueDownload && iDlState == EHttpDlMultipleMOStarted &&
@@ -2309,7 +2320,7 @@
             break;
 
         case EDlAttrFotaPckgId:
-            {
+            {     
             iFotaPckgId = aValue;
             store = EFalse;
             }
@@ -2317,17 +2328,34 @@
         case EDlAttrActiveDownload:
             {
             iActiveDownload = aValue;
-
+            
             // Active MO changed. Notify clients.
            	TriggerEvent( EHttpDlCreated, EHttpProgNone );
             }
             break;
-
+            
         case EDlAttrActivePlayedDownload:
             {
             iActivePlayedDownload = aValue;
             }
-
+            
+            break;
+            
+        case EDlAttrDestRemovable:
+            {
+            if( iCodDownload )
+                {
+                iStorage->SetRemovableDest( aValue );
+
+                if (iCodDlData)                
+                    {
+                    // Update for Active media object.
+                    TInt active = iActiveDownload;
+                    CMediaDataBase* mediaData = (*iCodDlData)[active];
+                    mediaData->SetDesRemovable( aValue );
+                    }
+                }
+            }
             break;
         default:
             {
@@ -2343,7 +2371,7 @@
     UpdatePausable();
 
     iNoRealError = EFalse;
-
+    
     if( store )
         {
         StoreDownloadInfoL();
@@ -2356,7 +2384,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::SetBoolAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::SetBoolAttributeL( THttpDownloadAttrib aAttribute, 
 								                const TBool aValue )
     {
     LOGGER_ENTERFN( "SetBoolAttributeL" );
@@ -2395,7 +2423,7 @@
                 {
                 User::Leave( KErrInUse );
                 }
-
+                
             store = EFalse;
             }
             break;
@@ -2417,11 +2445,11 @@
             SetCodFlag( aValue );
             }
             break;
-
+            
         case EDlAttrProgressive:
             {
             TBool PdSupported(EFalse);
-
+            
             if(iClAppInstance)
             	{
             	TRAP_IGNORE(iClAppInstance->GetBoolAttributeL(EDlMgrProgressiveDownload, PdSupported));
@@ -2429,34 +2457,34 @@
 
             if(PdSupported)
                 {
-                iStorage->SetProgressiveMode( aValue );
-
+                iStorage->SetProgressiveMode( aValue );	
+                
                 if(!aValue)
                     {
                     iActivePlayedDownload = 0;
                     }
 
-                if (iCodDlData)
+                if (iCodDlData)                
                 	{
                 	// Update for Active media object.
 	                TInt active = iActiveDownload;
 	                CMediaDataBase* mediaData = (*iCodDlData)[active];
 	                mediaData->SetProgressiveDownload( aValue );
                 	}
-
+                	
                 if( iProgState != EHttpProgMovingContentFile )
                     {
                     if (aValue && iDlState == EHttpDlMultipleMOCompleted )
                         {
-                        /*
+                        /* 
                         if the file size is small, by the time the music player is launched, DMgr already triggered EHttpDlCompleted.
                         So if the download state is EHttpDlMultipleMOCompleted, we need to trigger EHttpDlCompleted so that music player understands download is completed already
                         This is needed to ensure backward compatibility
                         */
                         TriggerEvent( EHttpDlCompleted, EHttpDlProgProgressive);
-                        }
+                        }   
                     else
-                        {
+                        {    
                         TriggerEvent( iDlState, aValue ? EHttpDlProgProgressive : EHttpDlProgNonProgressive);
                         }
                     }
@@ -2467,13 +2495,13 @@
 				}
             }
             break;
-
+            
         case EDlAttrCodDescriptorAccepted:
             {
             TriggerEvent( EHttpDlInprogress, EHttpProgCodDescriptorAccepted );
             }
             break;
-
+            
         case EDlAttrCodLoadEnd:
             {
             SetDownloadStatus(EHttpProgCodLoadEnd,EHttpDlInprogress);
@@ -2486,19 +2514,21 @@
             TriggerEvent( EHttpDlInprogress, EHttpProgCodPdAvailable );
             }
             break;
-
+            
         case EDlAttrDestRemovable:
             {
             if( iCodDownload )
                 {
-                iStorage->SetRemovableDest( aValue );
-
-                if (iCodDlData)
+                TInt32 removableDestStatus = (aValue) ? KDriveAttRemovable : KDriveAttLocal ;
+                
+                iStorage->SetRemovableDest( removableDestStatus );
+
+                if (iCodDlData)                
                 	{
 	                // Update for Active media object.
 	                TInt active = iActiveDownload;
 	                CMediaDataBase* mediaData = (*iCodDlData)[active];
-	                mediaData->SetDesRemovable( aValue );
+	                mediaData->SetDesRemovable( removableDestStatus );
                 	}
                 }
             }
@@ -2514,18 +2544,18 @@
         case EDlAttrCodPausable:
             {
             iPausable = aValue;
-
+			
 			// Update for Active media object.
             TInt active = iActiveDownload;
             CMediaDataBase* mediaData = (*iCodDlData)[active];
             mediaData->SetPausable( aValue );
-
+			
             // inform client about change
             TriggerEvent( iPausable ? EHttpDlPausable : EHttpDlNonPausable );
 			}
             break;
-
-
+            
+                    
         default:
 #ifdef __WINS__
             DMPanic( KErrArgument );
@@ -2536,7 +2566,7 @@
         }
 
     UpdatePausable();
-
+    
     iNoRealError = EFalse;
 
     if( store )
@@ -2568,11 +2598,11 @@
         case EDlAttrDestFilename:
             {
             TBool updateFName = EFalse;
-
+            
             if( iDlState == EHttpDlMultipleMOStarted ||
                 iDlState == EHttpDlMultipleMOCompleted ||
                 iCodDownload )
-                // cannot set this attribute while
+                // cannot set this attribute while 
                 // download is in progress
                 {
                 if( !aValue.Length() )
@@ -2592,7 +2622,7 @@
                         }
                     else
                         {
-                        User::Leave( KErrArgument );
+                        User::Leave( KErrArgument ); 
                         }
                     }
                 else
@@ -2605,11 +2635,11 @@
                 {
                 User::Leave( KErrInUse );
                 }
-
+            
             if (updateFName)
             	{
                 iStorage->UpdateDestinationFilenameL( aValue, ETrue );
-                if (iCodDlData)
+                if (iCodDlData)                
                 	{
 	            	CMediaDataBase* mediaData = (*iCodDlData)[aMOIndex];
 	            	mediaData->SetDestFilenameL( aValue );
@@ -2619,15 +2649,15 @@
             break;
         }
     }
-
-
+    
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::SetStringAttributeL
 // ?implementation_description
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::SetStringAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::SetStringAttributeL( THttpDownloadAttrib aAttribute, 
 								                  const TDesC16& aValue )
     {
     LOGGER_ENTERFN( "SetStringAttributeL" );
@@ -2659,12 +2689,12 @@
                 CLOG_WRITE( "EDlAttrContentType updated" );
                 ReallocateStringL( iContentType, aValue, KMaxContentTypeLength );
                 TriggerEvent( EHttpDlInprogress, EHttpProgContentTypeChanged );
-
+                
                 // Update for Active media object.
                 HBufC8* type8 = HBufC8::NewLC( aValue.Length() );
                 type8->Des().Copy( aValue );
 
-                if (iCodDlData)
+                if (iCodDlData)                
                 	{
 	                TInt active = iActiveDownload;
 	                CMediaDataBase* mediaData = (*iCodDlData)[active];
@@ -2681,7 +2711,7 @@
                 {
                 ReallocateStringL( iHttpRealm, aValue, KMaxRealmLength );
                 }
-
+                
             store = EFalse;
             }
             break;
@@ -2727,11 +2757,11 @@
         case EDlAttrDestFilename:
             {
             TBool updateFName = EFalse;
-
+            
             if( iDlState == EHttpDlMultipleMOStarted ||
                 iDlState == EHttpDlMultipleMOCompleted ||
                 iCodDownload )
-                // cannot set this attribute while
+                // cannot set this attribute while 
                 // download is in progress
                 {
                 if( !aValue.Length() )
@@ -2751,7 +2781,7 @@
                         }
                     else
                         {
-                        User::Leave( KErrArgument );
+                        User::Leave( KErrArgument ); 
                         }
                     }
                 else
@@ -2764,12 +2794,12 @@
                 {
                 User::Leave( KErrInUse );
                 }
-
+            
             if (updateFName)
             	{
             	iStorage->UpdateDestinationFilenameL( aValue, ETrue );
-
-                if (iCodDlData)
+            	
+                if (iCodDlData)                
                 	{
                     TInt moIndex(0);
                     if( iActiveDownload != iActivePlayedDownload && iStorage->ProgressiveDownload() )
@@ -2780,7 +2810,7 @@
                     else
                         {
                         // Update for Active media object.
-                    	moIndex = iActiveDownload;
+                    	moIndex = iActiveDownload;                        
                         }
 	            	CMediaDataBase* mediaData = (*iCodDlData)[moIndex];
 	            	mediaData->SetDestFilenameL( aValue );
@@ -2830,7 +2860,7 @@
                 SetDownloadNameL( aValue );
 
                 if (iCodDlData)
-	                {
+	                {                
 	                // Update for Active media object.
 	            	TInt active = iActiveDownload;
 	            	CMediaDataBase* mediaData = (*iCodDlData)[active];
@@ -2898,7 +2928,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-EXPORT_C void CHttpDownload::SetStringAttributeL( THttpDownloadAttrib aAttribute,
+EXPORT_C void CHttpDownload::SetStringAttributeL( THttpDownloadAttrib aAttribute, 
 								                  const TDesC8& aValue )
     {
     LOGGER_ENTERFN( "SetStringAttributeL(8)" );
@@ -2932,9 +2962,9 @@
                 }
             else if (iDlState == EHttpDlMultipleMOCompleted )//Allow to change content type even if state is completed
                 {
-                ReallocateStringL( iContentType, aValue, KMaxContentTypeLength );
+                ReallocateStringL( iContentType, aValue, KMaxContentTypeLength );                            
                 //No need to trigger any event
-                }
+                }                
             }
             break;
 
@@ -3034,13 +3064,13 @@
             ReallocateStringL( iHashedMsgBody, aValue, KHashLength );
             }
             break;
-
+   
         case EDlAttrRedirectedPermanently:
             {
             RedirectedPermanentlyL( aValue );
-
+            
             if (iCodDlData)
-	            {
+	            {                
 	            // Update for Active media object.
 	            TInt active = iActiveDownload;
 	            CMediaDataBase* mediaData = (*iCodDlData)[active];
@@ -3049,13 +3079,13 @@
 	            }
             }
             break;
-
+            
         case EDlAttrRedirectedTemporary:
             {
             RedirectedTemporaryL( aValue );
-
+            
             if (iCodDlData)
-	            {
+	            {                
 	            // Update for Active media object.
 	            TInt active = iActiveDownload;
 	            CMediaDataBase* mediaData = (*iCodDlData)[active];
@@ -3063,7 +3093,7 @@
 	            }
             }
             break;
-
+ 
         case EDlAttrContinueBody:
             {
             iNoRealError = EFalse;
@@ -3086,9 +3116,9 @@
 #endif
             break;
         }
-
+    
     UpdatePausable();
-
+    
     iNoRealError = EFalse;
 
     if( store )
@@ -3106,7 +3136,7 @@
 EXPORT_C void CHttpDownload::SetFileHandleAttributeL( RFile* aFile )
     {
     LOGGER_ENTERFN( "SetFileHandleAttributeL" );
-
+    
     iStorage->AdoptFileHandleL( aFile );
     }
 
@@ -3119,17 +3149,17 @@
 EXPORT_C void CHttpDownload::SetDownloadDataAttributeL( HBufC8* dlData )
 	{
     LOGGER_ENTERFN( "SetDownloadDataAttributeL" );
-
+    
     if (iCodDlData)
         {
-    	delete iCodDlData;
+    	delete iCodDlData;	
         iCodDlData = NULL;
         }
-
+    	
     iCodDlData = CDownloadDataServ::NewL(*dlData);
     TInt downloadedSize = 0 ;
     TBool activeDownloadChanged = EFalse;
-
+    
     iMoLength = 0 ;
     for ( TInt i = 1; i <= iCodDlData->Count() ; ++i )
         {
@@ -3146,7 +3176,7 @@
             activeDownloadChanged = ETrue;
             }
         }
-    iStorage->SetMoDownloadedSize( downloadedSize );
+    iStorage->SetMoDownloadedSize( downloadedSize );                
     }
 // -----------------------------------------------------------------------------
 // CHttpDownload::SetTrackDataAttributeL
@@ -3157,7 +3187,7 @@
 EXPORT_C void CHttpDownload::SetTrackDataAttributeL( TInt aIndex, HBufC8* dlData )
     {
     LOGGER_ENTERFN( "SetTrackDataAttributeL" );
-
+    
 	if (iCodDlData)
     	{
     	CMediaDataServ* updatedMediaData = CMediaDataServ::NewL(*dlData);
@@ -3173,7 +3203,7 @@
 	    mediaData->SetDownloadedSize( updatedMediaData->DownloadedSize() );
 	    mediaData->SetDestFilenameL( updatedMediaData->DestFilename() );
 	    mediaData->SetTempFilenameL( updatedMediaData->DestFilename() );
-
+	    	    
     	mediaData->ResetTypes();
     	for (TInt type = 0; type < updatedMediaData->TypesCount(); ++type)
         	mediaData->AddTypeL( updatedMediaData->Types().MdcaPoint(type) );
@@ -3206,10 +3236,10 @@
 	        	    iLastError = EGeneral;
 	           	    }
                 }
-
-            //if the client pauses the download, Codhandler sets error code to KErrCodHttpDownloadPaused. In that case, no need to trigger EHttpDlFailed Event
+            
+            //if the client pauses the download, Codhandler sets error code to KErrCodHttpDownloadPaused. In that case, no need to trigger EHttpDlFailed Event     
             if ( !( result == KErrCodHttpDownloadPaused || ( pausable && statusCode == KHttp903LossOfService ) || ( pausable && statusCode == KHttp954LoaderError ) ) )
-                {
+                {    
     	        TriggerEvent( EHttpDlFailed, EHttpProgNone );
                 }
             }
@@ -3246,8 +3276,8 @@
         iNoRealError = EFalse;
 
         return;
-        }
-
+        }    
+    
     if( iCodDlData && iCodDlData->Count() > 1 )
         {
         if( aDlError == KErrMultipeObjectDownloadFailed )
@@ -3257,17 +3287,17 @@
             SetDownloadStatus( EHttpProgNone,
                    EHttpDlMultipleMOFailed,
                    aDlError,
-                   aError );
-            return;
-            }
+                   aError );            
+            return;                       
+            } 
         else
             {
             SetDownloadStatus( EHttpProgNone,
                                EHttpDlPaused,
                                aDlError,
                                aError );
-            return;
-
+            return;                                           
+            
             }
         }
 
@@ -3280,8 +3310,8 @@
 
     //For COD Downloads, the error code may be set from COD handler
     //In that case if the download is paused just set the global and download error
-
-    if( iCodDownload && iDlState == EHttpDlPaused )
+    
+    if( iCodDownload && iDlState == EHttpDlPaused )  
         {
         iLastError = aDlError;
         iGlobalErrorId = aError;
@@ -3299,7 +3329,7 @@
         {
         closeOp = CHttpStorage::EReplaceFile;
         }
-
+        
     iStorage->CloseDestinationFile( closeOp );
     CLOG_WRITE_1( "OnError1 : iDlState : %d ", iDlState );
 
@@ -3319,18 +3349,18 @@
 
         if( aError == KErrHttpPartialResponseReceived )
             {
-            //Partial response has been received and connection has been disconnected. This error will be
+            //Partial response has been received and connection has been disconnected. This error will be 
             //propagated to the client only, if the HTTP:ENotifyOnDisconnect property is set with a value
             //HTTP::EEnableDisconnectNotification
-
+            
             //This error code was cancelling the pausable download. This error shud be ignored to keep the
             //paused download.
             //TSW Err ID : SXUU-77SRWL
-
+            
             SetDownloadStatus( EHttpProgNone,
                                EHttpDlPaused,
                                aDlError,
-                               aError );
+                               aError );            
 
             }
         else if( aDlError == EConnectionFailed && iPausable)
@@ -3340,7 +3370,7 @@
             SetDownloadStatus( EHttpProgNone,
                                EHttpDlPaused,
                                aDlError,
-                               aError );
+                               aError );               
             }
         else if ( aDlError == EMMCRemoved )
             {
@@ -3388,11 +3418,11 @@
         {
         iPDClAppInstance = NULL;
         }
-
+        
     return (iPDClAppInstance || iClAppInstance);
     }
-
-
+    
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::ClientApp
 // ?implementation_description
@@ -3479,9 +3509,9 @@
 void CHttpDownload::MediaRemoved( TUint aUid, TBool aDontCheckMediaUid )
     {
     LOGGER_ENTERFN( "MediaRemoved" );
-    CLOG_WRITE_3( "Uid: %d, dontCheck: %d, iNoMedia: %d",
-                        aUid,
-                        aDontCheckMediaUid,
+    CLOG_WRITE_3( "Uid: %d, dontCheck: %d, iNoMedia: %d", 
+                        aUid, 
+                        aDontCheckMediaUid, 
                         iNoMedia );
 
     if( iNoMedia )
@@ -3503,14 +3533,14 @@
     TRAP_IGNORE( InternalPauseL() );
 
     TriggerEvent( EHttpDlMediaRemoved );
-
+    
     if( iDlState == EHttpDlInprogress )
         // it's happened during the download process
         // in case of e.g completed download it's not error
         {
         OnError( KErrGeneral, EMMCRemoved );
         }
-
+    
     TRAP_IGNORE( StoreDownloadInfoL() );
     }
 
@@ -3533,7 +3563,7 @@
     iNoMedia = EFalse;
     TriggerEvent( EHttpDlMediaInserted );
     }
-
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::GetDestinationDriveID
 // ?implementation_description
@@ -3544,7 +3574,7 @@
     {
     return (TInt)iStorage->GetDestinationDriveId();
     }
-
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::SetClientInstance
 // ?implementation_description
@@ -3607,11 +3637,11 @@
 void CHttpDownload::SetDownloadNameL( const TDesC& aNewName )
     {
     CLOG_WRITE_1( "New download name: [%S]", &aNewName );
-
+    
     ReallocateStringL( iDlName, aNewName, KDownloadNameMaxSize );
-
+    
     FixDownloadNameL();
-
+    
     TriggerEvent( EHttpDlInprogress, EHttpProgDlNameChanged );
     }
 
@@ -3621,7 +3651,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::MHFRunL( RHTTPTransaction /*aTransaction*/,
+void CHttpDownload::MHFRunL( RHTTPTransaction /*aTransaction*/, 
                              const THTTPEvent& aEvent )
     {
     switch ( aEvent.iStatus )
@@ -3630,7 +3660,7 @@
             {
             CLOG_WRITE( "Response header received" );
             ResponseHeaderReceivedL();
-            }
+            } 
             break;
 
         case THTTPEvent::EGotResponseBodyData:
@@ -3643,21 +3673,21 @@
             ResponseBodyReceivedL( buf );
 
             respBody->ReleaseData();
-            }
+            } 
             break;
 
         case THTTPEvent::EResponseComplete:
             {
             CLOG_WRITE( "Response complete" );
-            }
+            } 
             break;
 
         case THTTPEvent::ESucceeded:
             {
             CLOG_WRITE( "Transaction succeeded" );
-
+            
             DownloadSucceededL();
-            }
+            } 
             break;
 
         case THTTPEvent::EFailed:
@@ -3672,19 +3702,19 @@
                 iTransValid = EFalse;
                 }
             iDlStartedByClient = EFalse;
-            }
+            } 
             break;
 
         case THTTPEvent::ERedirectedPermanently:
             {
             RedirectedPermanentlyL( iTrans.Request().URI().UriDes() );
-            }
+            } 
             break;
 
         case THTTPEvent::ERedirectedTemporarily:
             {
             RedirectedTemporaryL( iTrans.Request().URI().UriDes() );
-            }
+            } 
             break;
 
         default:
@@ -3695,7 +3725,7 @@
                 {
                 User::Leave( aEvent.iStatus );
                 }
-            }
+            } 
             break;
         }
     }
@@ -3706,8 +3736,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-TInt CHttpDownload::MHFRunError( TInt aError,
-                                 RHTTPTransaction /*aTransaction*/,
+TInt CHttpDownload::MHFRunError( TInt aError, 
+                                 RHTTPTransaction /*aTransaction*/, 
                                  const THTTPEvent& /*aEvent*/ )
     {
     CLOG_WRITE_1( "MHFRunError: %d", aError );
@@ -3771,15 +3801,15 @@
                 else
                     {
                     RequestContentL();
-                    }
+                    }                
                 }
-
+                
             }
             break;
 
         case EHttpProgMovingContentFile:
             // Move completed
-            // State remains in completed
+            // State remains in completed 
             // and move result stored in error attribs
             {
             CLOG_WRITE_1( "Move result: %d", iStatus.Int() );
@@ -3787,42 +3817,52 @@
 			// So, the download status should be changed after that
 			//but we again send the progress state as EHttpProgContentFileMoved because we need to display
 			//where file is saved(saved to gallery)
-			//Change Dl State to Download Completed if not already
-
-		    if(_OMADLOTA2_MULTI_DOWNLOAD)
-				{
-				TPtrC fileNamePtr = ((*iCodDlData)[iMOMoved])->DestFilename();
-				NotifyMediaGalleryL(fileNamePtr);
-
-				// Initiate async move for the next media object
-				iMOMoved++;
-				if(iMOMoved <= iCodDlData->Count())
-					{
-					MoveDownloadedMediaObjectL(iMOMoved);
-					break;
-					}
-				}
-
-            SetDownloadStatus( iDlNameChanged ? EHttpProgContentFileMovedAndDestFNChanged : EHttpProgContentFileMoved,
-                               iDlState = EHttpDlMultipleMOCompleted,
+			//Change Dl State to Download Completed if not already           
+          
+            if( iStatus ==KErrNone )
+                {
+		          if(_OMADLOTA2_MULTI_DOWNLOAD)
+				     {
+				      TPtrC fileNamePtr = ((*iCodDlData)[iMOMoved])->DestFilename();
+				      NotifyMediaGalleryL(fileNamePtr);
+
+             	      // Initiate async move for the next media object
+				      iMOMoved++;
+				      if(iMOMoved <= iCodDlData->Count())
+					     {
+					      MoveDownloadedMediaObjectL(iMOMoved);
+					      break;
+					     }
+				      }
+
+                  SetDownloadStatus( iDlNameChanged ? EHttpProgContentFileMovedAndDestFNChanged : EHttpProgContentFileMoved, 
+                               iDlState = EHttpDlMultipleMOCompleted, 
                                iStatus == KErrNone ? ENoError : EMoveFailed,
                                iStatus.Int() );
-
-            if(iStatus == KErrNone)
-            	{
-            	iMoveInProgress = EFalse;
-            	CLOG_WRITE("setting iMoveInProgress false when move is completed");
-            	}
-
-
-            delete iFileMan; iFileMan = NULL;
-
-			if( !_OMADLOTA2_MULTI_DOWNLOAD)
-				{
-				TPtr fileNamePtr(iStorage->DestFilename()->Des());
-				NotifyMediaGalleryL(fileNamePtr);
-				}
-            }
+            
+                  if(iStatus == KErrNone)
+            	      {
+            	       iMoveInProgress = EFalse;	
+            	       CLOG_WRITE("setting iMoveInProgress false when move is completed");
+            	      }
+            
+                  delete iFileMan; iFileMan = NULL;
+            
+                  if( !_OMADLOTA2_MULTI_DOWNLOAD)
+				     {
+				      TPtr fileNamePtr(iStorage->DestFilename()->Des());
+				      NotifyMediaGalleryL(fileNamePtr);
+				     }
+                }
+            else
+                {
+                CLOG_WRITE("Move Operation Failed ");
+                CLOG_WRITE("setting progress state to EHttpProgNone when move is Failing");
+                SetDownloadStatus( EHttpProgNone, iDlState );
+                CLOG_WRITE("setting iMoveInProgress false when move is Failing");
+                iMoveInProgress = EFalse;
+                }
+            } 
             break;
 
         default:
@@ -3900,10 +3940,10 @@
         {
         return;
         }
-
-    //Set the errors
+        
+    //Set the errors 
     TRAP_IGNORE( PauseL( ETrue ) );
-
+    
     iLastError = EConnectionFailed;
     iGlobalErrorId = KErrCommsLineFail;
     }
@@ -3960,7 +4000,7 @@
 
     // content type is unknown -> download might be pausable again
     UpdatePausable();
-
+    
     if( !aOnDelete )
         {
         TRAP_IGNORE( StoreDownloadInfoL() );
@@ -3980,7 +4020,7 @@
 void CHttpDownload::StoreDownloadInfoL()
     {
     LOGGER_ENTERFN( "StoreDownloadInfoL" );
-    TInt bufSz = KDownloadInfoIncrSize +
+    TInt bufSz = KDownloadInfoIncrSize + 
                  (iDownloadInfo ? iDownloadInfo->Length(): 0);
     HBufC8* newInfo = HBufC8::NewLC( bufSz );
     TPtr8 newInfoPtr = newInfo->Des();
@@ -4022,27 +4062,27 @@
 
     CLOG_WRITE("5");
 
-
+    
     TInt size = GetHttpHeadersSize(iResponseHeaders)+ GetHttpHeadersSize(iRequestHeaders)+
                 GetHttpHeadersSize(iEntityHeaders)+ GetHttpHeadersSize(iGeneralHeaders) + newInfoPtr.Size();
-
-
+    
+    
     if(size >= bufSz)
         {
     	User::LeaveIfError( KErrArgument );
         }
-
+    
     AppendHeadersL( newInfoPtr, iResponseHeaders );
     AppendHeadersL( newInfoPtr, iRequestHeaders );
     AppendHeadersL( newInfoPtr, iEntityHeaders );
     AppendHeadersL( newInfoPtr, iGeneralHeaders );
 
     CLOG_WRITE("6");
-
+    
     APPEND_BUF_INT( newInfoPtr, iFotaPckgId );
-
+    
     CLOG_WRITE("7");
-
+    
     // check if download info is unchanged from previous update
     if( iDownloadInfo && ( iDownloadInfo->Compare(*newInfo) == 0 ))
         {
@@ -4064,13 +4104,13 @@
         iClientApp->Engine()->DownloadInfoFolder( iClientApp, folder );
         fileName.Format( _L("%S%d"), &folder, iId );
         CLOG_WRITE_1( "info: %S", &fileName );
-
+    
         RFile outFile;
         CleanupClosePushL<RFile>( outFile );
-        User::LeaveIfError( outFile.Replace( iClientApp->Engine()->Fs(),
-                                             fileName,
-                                             EFileShareExclusive |
-                                             EFileStream |
+        User::LeaveIfError( outFile.Replace( iClientApp->Engine()->Fs(), 
+                                             fileName, 
+                                             EFileShareExclusive | 
+                                             EFileStream | 
                                              EFileWrite ) );
 
         outFile.Write( newInfoPtr );
@@ -4102,9 +4142,9 @@
     CLOG_WRITE_1( "info: %S", &fileName );
 
     RFile inFile;
-    User::LeaveIfError( inFile.Open( iClientApp->Engine()->Fs(),
-                                     fileName,
-                                     EFileShareReadersOnly |
+    User::LeaveIfError( inFile.Open( iClientApp->Engine()->Fs(), 
+                                     fileName, 
+                                     EFileShareReadersOnly | 
                                      EFileRead ) );
 
     CLOG_WRITE("1");
@@ -4153,7 +4193,7 @@
     ReadHBufCL( inFile, iHashedMsgBody );
     READ_INT_L( inFile, iCodDownload );
     READ_INT_L( inFile, iNoMedia );
-
+    
 
     CLOG_WRITE("3");
     READ_INT_L( inFile, iPreferencies );
@@ -4173,16 +4213,16 @@
     LoadHeadersL( inFile, iRequestHeaders );
     LoadHeadersL( inFile, iEntityHeaders );
     LoadHeadersL( inFile, iGeneralHeaders );
-
+    
     CLOG_WRITE("6");
-
+    
     READ_INT_L( inFile, iFotaPckgId );
 
     CleanupStack::PopAndDestroy(); // inFile
     CleanupStack::PopAndDestroy( 2, folderBuf ); // also fileNameBuf
 
     CLOG_WRITE("9");
-
+    
     UpdatePausable();
     }
 
@@ -4231,18 +4271,18 @@
 
 TBool CHttpDownload::IsContentFileStorageType()
     {
-
-
-     if( iCodDownload
-         && iContentType->Compare( KRoapMimeType )
-         && iContentType->Compare( KRoapPduMimeType )
+    
+     
+     if( iCodDownload 
+         && iContentType->Compare( KRoapMimeType ) 
+         && iContentType->Compare( KRoapPduMimeType ) 
          && iContentType->Compare( KFotaPackageDataType)  )
          {
      	 return ETrue;
          }
-
+            
      return EFalse;
-
+     
     }
 
 // -----------------------------------------------------------------------------
@@ -4269,7 +4309,7 @@
             TriggerEvent( EHttpDlInprogress, EHttpContTypeRecognitionAvail );
             iContTypeRecognitionAvailSent = ETrue;
             }
-        //for correct display of string in download list for COD download we set progress state to moved
+        //for correct display of string in download list for COD download we set progress state to moved            
         if(IsContentFileStorageType())
             {
            // Retrieve the file name from the whole paths
@@ -4285,19 +4325,19 @@
             TInt findDot = iDlName->LocateReverse( '.' );
             if( findDot == KErrNotFound )
                 {
-                //if Name displayed does not have Extension then
+                //if Name displayed does not have Extension then 
                 // Remove extention from retrieved name
                 TInt dotInd = namePtr.LocateReverse( '.' );
                  if( dotInd == KErrNotFound )
                     dotInd = namePtr.Length();
-                namePtr.Copy( namePtr.Left( dotInd ) );
-
+                namePtr.Copy( namePtr.Left( dotInd ) );       
+            
                 }
 
             //we never get file moved and Download complete for Cod download becuase move is inherent
             //to Install() state i.e  Download is in progress so display in download list is incorrect.
-            //related to bug  HCHA-753D6G
-
+            //related to bug  HCHA-753D6G  
+             
             if(namePtr.Compare(*iDlName))
                 {
                 ReallocateStringL( iDlName, namePtr, KDownloadNameMaxSize );
@@ -4307,10 +4347,10 @@
                 {
                 SetDownloadStatus( EHttpProgContentFileMoved, EHttpDlMultipleMOCompleted );
                 }
-           CleanupStack::PopAndDestroy( name );
-
-            }
-        else
+           CleanupStack::PopAndDestroy( name );          
+           
+            }
+        else            
             {
             TriggerEvent( EHttpDlCompleted, EHttpProgNone );
             SetDownloadStatus( EHttpProgNone, EHttpDlMultipleMOCompleted );
@@ -4323,8 +4363,8 @@
     Disconnect();
 
     iStorage->OnComplete();
-
-    // this is a special case because transaction don't need to be
+    
+    // this is a special case because transaction don't need to be 
     // canceled, only deleted
     iContinueDownload = EFalse;
     if( iTransValid )
@@ -4358,7 +4398,7 @@
     TInt end = iMediaType->Des().Mid( start, length-start ).Locate( KSemiColon );
     TInt boundaryLength = ( KErrNotFound == end ) ? length - start : end;
     TPtrC8 ptr = iMediaType->Des().Mid( start, boundaryLength );
-    return ptr;
+    return ptr;    
     }
 
 // -----------------------------------------------------------------------------
@@ -4403,7 +4443,7 @@
         {
         TriggerEvent( EHttpDlCancelTransaction );
         }
-
+        
     iContinueDownload = EFalse;
 
     iDlStartedByClient = EFalse;
@@ -4519,7 +4559,7 @@
             DMPanic( KErrArgument );
             }
         }
-
+        
     TRAP_IGNORE( StoreDownloadInfoL() ); //saving the state
 
     if( !eventTriggered )
@@ -4588,12 +4628,12 @@
                 OnError( KErrUnknown, EObjectNotFound );
                 }
                 break;
-
+                
             default:
                 {
-                SetDownloadStatus( EHttpProgNone,
-                                   EHttpDlFailed,
-                                   EHttpUnhandled,
+                SetDownloadStatus( EHttpProgNone, 
+                                   EHttpDlFailed, 
+                                   EHttpUnhandled, 
                                    GLOBAL_HTTP_ERROR( iStatusCode ) );
                 }
             }
@@ -4712,7 +4752,7 @@
 // -----------------------------------------------------------------------------
 //
 void CHttpDownload::ResponseBodyReceivedL( const TDesC8& aBuf )
-    {
+    {    
     if( iMultiPart && !iCodDownload )
         {
         TBool isSupportedMultiPart( EFalse );
@@ -4723,10 +4763,10 @@
             SetCodFlag( ETrue );
             TriggerEvent( EHttpDlInprogress, EHttpProgSupportedMultiPart );
             }
-        }
-
+        }          
+      
     TBool ret(ETrue);
-
+    
     if( iStorage->BufferingEnabled() )
     	{
     	// Buffering is enabled, just pass on the data
@@ -4737,7 +4777,7 @@
     	// Buffering not yet enabled, see how much data we still have to write without buffering
     	TInt bytesToWrite = aBuf.Length();
     	TInt downloadedSize = iStorage->DownloadedSize();
-
+    	
     	if(bytesToWrite + downloadedSize < KMinDataSizeToSend)
     		{
     		// Just dump non-buffered write
@@ -4746,28 +4786,28 @@
     	else
     		{
     		// Necessary to switch to buffered writing
-
+    		
     		TInt leftPartSize = KMinDataSizeToSend - downloadedSize;
     		TInt rightPartSize = bytesToWrite - leftPartSize;
-
+    		
     		TBool ret1 = ETrue;
     		TBool ret2 = ETrue;
-
+    		
     		if(leftPartSize > 0)
     			{
     			// Write left side of the block to get alignment matched
     			ret1 = iStorage->WriteOutNextBodyDataL( aBuf.Left(leftPartSize) );
     			}
-
+    		
     		// Enable buffering
     		iStorage->EnableBufferingL();
-
+    		
     		// And push the rest of this data block
     		if(rightPartSize > 0)
     			{
     			ret2 = iStorage->WriteOutNextBodyDataL( aBuf.Right(rightPartSize) );
     			}
-
+    		
     		if(!ret1 || !ret2)
     			{
     			ret = EFalse;
@@ -4783,9 +4823,9 @@
     if( !iContTypeRecognitionAvailSent && (iStorage->DownloadedSize() >= KRespSizeForRecognition) )
         {
         TriggerEvent( EHttpDlInprogress, EHttpContTypeRecognitionAvail );
-        iContTypeRecognitionAvailSent = ETrue;
-        }
-
+        iContTypeRecognitionAvailSent = ETrue;        
+        }
+        
     TriggerEvent( EHttpDlInprogress, EHttpProgResponseBodyReceived );
     }
 
@@ -4798,7 +4838,7 @@
 TBool CHttpDownload::IsMultipartSupportedL( const TDesC8& aBuf )
     {
     TBool ret( EFalse );
-
+    
     if( !iHeaderOfMultipart )
         {
         iHeaderOfMultipart = HBufC8::NewL( KMaxHeaderOfMultipart );
@@ -4813,16 +4853,16 @@
         ret = EFalse;
         return ret;
         }
-
+    
     TInt pos = iHeaderOfMultipart->Des().Find( KContentType() );
 
     User::LeaveIfError( pos );
 
-    pos = pos + KContentType().Length();
-
-    TPtrC8 p = iHeaderOfMultipart->Des().Mid( pos );
+    pos = pos + KContentType().Length();    
+
+    TPtrC8 p = iHeaderOfMultipart->Des().Mid( pos );    
     TInt temp = p.Find( KDoubleEOL() );
-
+    
     TInt posEol = pos + temp;
 
     TPtrC8 ptr = iHeaderOfMultipart->Des().Mid( pos, ( posEol - pos ) );
@@ -4833,10 +4873,10 @@
         ret = ETrue;
         delete iHeaderOfMultipart;
         iHeaderOfMultipart = NULL;
-        return ret;
-        }
-
-    return ret;
+        return ret;            
+        }
+        
+    return ret;  
     }
 
 // -----------------------------------------------------------------------------
@@ -4918,7 +4958,7 @@
     SetCredentialsInfoL( aStringPool );
 
     // Find ETag in response header
-    RStringF etag = aStringPool.StringF(HTTP::EETag,
+    RStringF etag = aStringPool.StringF(HTTP::EETag, 
                                         RHTTPSession::GetTable());
     TInt fieldInd = FindHeaderField( iResponseHeaders, etag.DesC() );
     if( fieldInd != KErrNotFound )
@@ -4926,11 +4966,11 @@
         // that if it's changed, or a redirection goes to another url.
         // Server will respond with 412 on error.
         {
-        RStringF ifMatch = aStringPool.StringF(HTTP::EIfMatch,
+        RStringF ifMatch = aStringPool.StringF(HTTP::EIfMatch, 
                                         RHTTPSession::GetTable());
         aHeaders.RemoveField( ifMatch );
-        aHeaders.SetRawFieldL( ifMatch,
-                               *(*iResponseHeaders)[fieldInd]->FieldRawData(),
+        aHeaders.SetRawFieldL( ifMatch, 
+                               *(*iResponseHeaders)[fieldInd]->FieldRawData(), 
                                KHttpFieldSeparator );
         CLOG_WRITE8_1( "ETag: %S", (*iResponseHeaders)[fieldInd]->FieldRawData() );
         }
@@ -4955,7 +4995,7 @@
         if( iStorage->DownloadedSize() != iStorage->Length() )
             // download from previous point only if the content is unmodified
             {
-            field = aStringPool.StringF(HTTP::EIfUnmodifiedSince,
+            field = aStringPool.StringF(HTTP::EIfUnmodifiedSince, 
                                         RHTTPSession::GetTable());
 
             SetExpireToFieldL( field, aStringPool, aHeaders );
@@ -5010,7 +5050,7 @@
 // -----------------------------------------------------------------------------
 //
 void CHttpDownload::SetPropertyL( RStringPool& aStringPool,
-                                  RStringF aPropertyName,
+                                  RStringF aPropertyName, 
                                   const TDesC8& aToken )
     {
     RString tokenStr = aStringPool.OpenStringL( aToken );
@@ -5029,7 +5069,7 @@
 // Set property of the transaction
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::SetPropertyL( RStringF aPropertyName,
+void CHttpDownload::SetPropertyL( RStringF aPropertyName, 
                                   const TInt aValue )
     {
     THTTPHdrVal tokenVal = aValue;
@@ -5100,7 +5140,7 @@
 
     if( iHttpUsername )
         {
-        RStringF username = aStringPool.StringF( HTTP::EUsername,
+        RStringF username = aStringPool.StringF( HTTP::EUsername, 
                                                     RHTTPSession::GetTable() );
 
         SetPropertyL( aStringPool, username, *iHttpUsername );
@@ -5108,7 +5148,7 @@
 
     if( iHttpPassword )
         {
-        RStringF password = aStringPool.StringF( HTTP::EPassword,
+        RStringF password = aStringPool.StringF( HTTP::EPassword, 
                                                     RHTTPSession::GetTable() );
 
         SetPropertyL( aStringPool, password, *iHttpPassword );
@@ -5116,38 +5156,38 @@
 
     if( iHttpRealm )
         {
-        RStringF realm = aStringPool.StringF( HTTP::ERealm,
+        RStringF realm = aStringPool.StringF( HTTP::ERealm, 
                                                     RHTTPSession::GetTable() );
         SetPropertyL( aStringPool, realm, *iHttpRealm );
         }
 
     if( iHttpProxyRealm )
         {
-        RStringF proxyRealmStr = aStringPool.StringF(
-                                        HttpFilterCommonStringsExt::EProxyRealm,
+        RStringF proxyRealmStr = aStringPool.StringF( 
+                                        HttpFilterCommonStringsExt::EProxyRealm, 
                                         HttpFilterCommonStringsExt::GetTable() );
         SetPropertyL( aStringPool, proxyRealmStr, *iHttpProxyRealm );
         }
 
     if( iHttpProxyUsername )
         {
-        RStringF proxyUsernameStr = aStringPool.StringF(
-                                    HttpFilterCommonStringsExt::EProxyUsername,
+        RStringF proxyUsernameStr = aStringPool.StringF( 
+                                    HttpFilterCommonStringsExt::EProxyUsername, 
                                     HttpFilterCommonStringsExt::GetTable() );
         SetPropertyL( aStringPool, proxyUsernameStr, *iHttpProxyUsername );
         }
 
     if( iHttpProxyPassword )
         {
-        RStringF proxyPasswordStr = aStringPool.StringF(
-                                        HttpFilterCommonStringsExt::EProxyPassword,
+        RStringF proxyPasswordStr = aStringPool.StringF( 
+                                        HttpFilterCommonStringsExt::EProxyPassword, 
                                         HttpFilterCommonStringsExt::GetTable() );
         SetPropertyL( aStringPool, proxyPasswordStr, *iHttpProxyPassword );
         }
 
     if( iHttpNonce )
         {
-        RStringF nonce = aStringPool.StringF( HTTP::ENonce,
+        RStringF nonce = aStringPool.StringF( HTTP::ENonce, 
                                                     RHTTPSession::GetTable() );
 
         SetPropertyL( aStringPool, nonce, *iHttpNonce );
@@ -5189,7 +5229,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::SetExpireToFieldL( RStringF& aField,
+void CHttpDownload::SetExpireToFieldL( RStringF& aField, 
                                        RStringPool& aStringPool,
                                        RHTTPHeaders& aHeaders )
     {
@@ -5202,7 +5242,7 @@
     TInt modInd( KErrNotFound );
 
     for( TInt i = 0; i < iResponseHeaders->Count(); ++i )
-        // FindHeaderField, because this is double search for fieldnames
+        // FindHeaderField, because this is double search for fieldnames 
         {
         if( *(*iResponseHeaders)[i]->FieldName() == expires.DesC() )
             {
@@ -5221,8 +5261,8 @@
         CLOG_WRITE8_1( "Expire: %S", (*iResponseHeaders)[expInd]->FieldRawData() );
 
         aHeaders.RemoveField( aField );
-        aHeaders.SetRawFieldL( aField,
-                               *(*iResponseHeaders)[expInd]->FieldRawData(),
+        aHeaders.SetRawFieldL( aField, 
+                               *(*iResponseHeaders)[expInd]->FieldRawData(), 
                                KHttpFieldSeparator );
         }
     else if( modInd != KErrNotFound )
@@ -5230,8 +5270,8 @@
         CLOG_WRITE8_1( "LastMod: %S", (*iResponseHeaders)[modInd]->FieldRawData() );
 
         aHeaders.RemoveField( aField );
-        aHeaders.SetRawFieldL( aField,
-                               *(*iResponseHeaders)[modInd]->FieldRawData(),
+        aHeaders.SetRawFieldL( aField, 
+                               *(*iResponseHeaders)[modInd]->FieldRawData(), 
                                KHttpFieldSeparator );
         }
     }
@@ -5248,7 +5288,7 @@
 
     __ASSERT_DEBUG( iUrl->Length(), DMPanic( KErrArgument ) );
 
-    TUriParser8 uri;
+    TUriParser8 uri; 
     uri.Parse( *iUrl );
 
     TPtrC8 scheme( uri.Extract( EUriScheme ) );
@@ -5258,8 +5298,8 @@
         // unsupported or no scheme in url.
         // Insert 'http://' to the beginning of it.
         {
-        HBufC8* tempBuf = HBufC8::NewL( KHttpScheme().Length() +
-                                        KSchemeAddon().Length() +
+        HBufC8* tempBuf = HBufC8::NewL( KHttpScheme().Length() + 
+                                        KSchemeAddon().Length() + 
                                         iUrl->Length() );
 
         tempBuf->Des().Append( KHttpScheme );
@@ -5281,7 +5321,7 @@
     url->SetComponentL( uri.Extract( EUriUserinfo ), EUriUserinfo );
     url->SetComponentL( uri.Extract( EUriQuery ), EUriQuery );
     url->SetComponentL( uri.Extract( EUriFragment ), EUriFragment );
-
+    
     if( uri.IsPresent( EUriPort ) )
         {
         url->SetComponentL( uri.Extract( EUriPort ), EUriPort );
@@ -5320,8 +5360,8 @@
     // Calculate the download name from the requested URL
     HBufC8* parsedUrl = EscapeUtils::EscapeDecodeL( *iCurrentUrl );
     CleanupStack::PushL( parsedUrl );
-
-    TUriParser8 uri;
+    
+    TUriParser8 uri; 
     uri.Parse( *parsedUrl );
 
     TPtrC8 path;
@@ -5342,7 +5382,7 @@
             {
             slash = path.LocateReverse( '\\' );
             }
-
+            
         if( slash != KErrNotFound && slash != path.Length() )
             // from the last slash this is the filename
             {
@@ -5415,9 +5455,9 @@
 
         CLOG_WRITE8_2("%S:%S", &fieldNameStr.DesC(), &rawData);
         iResponseHeaders->AppendL( field );
-
+        
         CleanupStack::Pop( field );
-
+        
         CHeaderField* entityField = CHeaderField::NewL( &fieldNameStr.DesC(), &rawData );
         CleanupStack::PushL( entityField );
 
@@ -5427,10 +5467,10 @@
         CleanupStack::Pop( entityField );
 
         ++it;
-        }
+        }    
 
     ParseContentTypeL( strPool );
-
+    
     ParseContentDispositionL( strPool);
     if (!iCodDownload)
         {
@@ -5458,17 +5498,17 @@
             //This is a partial response as Length is already set so save this new length as partial Length that needs to be Downloaded.
             {
             iStorage->SetPartialContentLength( value );
-            }
-        }
-
+            }    
+        }
+        
     CheckRealDRMContentType();
     if( !iDrmContentLengthValid )
         // Content was original encoded -> we don't know the actual content size.
         {
         iStorage->SetLength( KDefaultContentLength );
         }
-
-
+        
+        
     iMaxAge = 0;
     TInt parts( 0 );
     // this leave is trapped because we can still go on
@@ -5547,7 +5587,7 @@
 
     iPausableDRM = ETrue;
     iDrmContentLengthValid = ETrue;
-
+    
     TInt index = FindHeaderField( iResponseHeaders, KDRMOldContentType );
     if( index != KErrNotFound )
         // this is an old DRM protected content
@@ -5559,9 +5599,9 @@
 //            iDrmContentLengthValid = EFalse;
             }
         }
-
+        
     UpdatePausable();
-
+            
     CLOG_WRITE_2( "Pausable: [%d], Length: [%d]", iPausableDRM, iDrmContentLengthValid );
     }
 
@@ -5575,13 +5615,13 @@
     {
     LOGGER_ENTERFN( "SaveCredentialsL" );
 
-    RStringF username = aStringPool.StringF( HTTP::EUsername,
+    RStringF username = aStringPool.StringF( HTTP::EUsername, 
                                                 RHTTPSession::GetTable() );
-    RStringF password = aStringPool.StringF( HTTP::EPassword,
+    RStringF password = aStringPool.StringF( HTTP::EPassword, 
                                                 RHTTPSession::GetTable() );
-    RStringF realm = aStringPool.StringF( HTTP::ERealm,
+    RStringF realm = aStringPool.StringF( HTTP::ERealm, 
                                                 RHTTPSession::GetTable() );
-    RStringF nonce = aStringPool.StringF( HTTP::ENonce,
+    RStringF nonce = aStringPool.StringF( HTTP::ENonce, 
                                                 RHTTPSession::GetTable() );
 
     THTTPHdrVal hdrValue;
@@ -5609,9 +5649,9 @@
                 CLOG_WRITE8_1( "pwd: [%S]", iHttpPassword );
                 }
 
-            if( !iTrans.PropertySet().Property(
-                                    aStringPool.StringF( HTTP::EBasic,
-                                    RHTTPSession::GetTable() ),
+            if( !iTrans.PropertySet().Property( 
+                                    aStringPool.StringF( HTTP::EBasic, 
+                                    RHTTPSession::GetTable() ), 
                                     hdrValue ) )
                 // this is a digest authentication response
                 // store nonce value
@@ -5639,7 +5679,7 @@
     RStringPool strPool = iConnHandler->Session().StringPool();
     RStringF method;
     TBool aHead = ETrue;
-
+    
     if( (iContentType && iContentType->Length()) ||
         iNoContentTypeCheck ||
         iSilentMode )
@@ -5655,7 +5695,7 @@
         method = strPool.StringF( HTTP::EHEAD,RHTTPSession::GetTable() );
         }
 
-    TUriParser8 uri;
+    TUriParser8 uri; 
     uri.Parse( *iCurrentUrl );
 
     CLOG_WRITE8_1( "Req URL: %S", iCurrentUrl );
@@ -5717,8 +5757,8 @@
     RStringPool strPool = iConnHandler->Session().StringPool();
 
     // Check authentication scheme
-    TBool basic = iTrans.PropertySet().Property( strPool.StringF( HTTP::EBasic,
-                                                 RHTTPSession::GetTable() ),
+    TBool basic = iTrans.PropertySet().Property( strPool.StringF( HTTP::EBasic, 
+                                                 RHTTPSession::GetTable() ), 
                                                  hdrValue );
 
     if( basic )
@@ -5765,8 +5805,8 @@
     THTTPHdrVal hdrValue;
 
     RStringPool strPool = iConnHandler->Session().StringPool();
-    TInt err = iTrans.PropertySet().Property( strPool.StringF( HTTP::EBasic,
-                                               RHTTPSession::GetTable() ),
+    TInt err = iTrans.PropertySet().Property( strPool.StringF( HTTP::EBasic, 
+                                               RHTTPSession::GetTable() ), 
                                                hdrValue );
 
     if( !err )
@@ -5865,8 +5905,8 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::CreateIndexedNameL( HBufC* &aUniqueName,
-                                        TDesC& aOrgName,
+void CHttpDownload::CreateIndexedNameL( HBufC* &aUniqueName, 
+                                        TDesC& aOrgName, 
                                         TInt& aIndex )
     {
     LOGGER_ENTERFN( "CreateIndexedNameL" );
@@ -5905,7 +5945,7 @@
         }
 
     aUniqueName = HBufC::NewL( fullLength );
-    aUniqueName->Des().Format( _L("%S%S%S"), &left,
+    aUniqueName->Des().Format( _L("%S%S%S"), &left, 
                                              &indexStr,
                                              &extension );
 
@@ -5918,7 +5958,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::ContinueDownloadStoreResponseHeaderL(
+void CHttpDownload::ContinueDownloadStoreResponseHeaderL( 
                                                 const TDesC8& aResponseHeader )
     {
     LOGGER_ENTERFN( "ContinueDownloadStoreResponseHeaderL" );
@@ -5970,7 +6010,7 @@
             iResponseHeaders->AppendL( newField );
 
             CleanupStack::Pop( newField );
-
+            
             CHeaderField* newentField = CHeaderField::NewL( &fieldName, &fieldValue );
             CleanupStack::PushL( newentField );
 
@@ -6050,8 +6090,8 @@
         ReallocateStringL( iDDType, rawData, KMaxContentTypeLength );
         ReallocateStringL( iMediaType, mediaType, KMaxContentTypeLength );
         }
-
-#ifdef __SYNCML_DM_FOTA
+        
+#ifdef __SYNCML_DM_FOTA        
     if( !iContentType->Des().CompareF( KFotaMimeType ) )
         {
         iStorage->SetStorageMethod( CHttpStorage::EStoreFota );
@@ -6064,12 +6104,12 @@
         {
         SetCodFlag( ETrue );
         }
-
+        
     if( 0 == iContentType->Des().Compare( KMultiPartMimeType() ) )
         {
         iMultiPart = ETrue;
         }
-
+        
     }
 
 // -----------------------------------------------------------------------------
@@ -6166,7 +6206,7 @@
 			ReallocateStringL( iAttachmentFileName, fileNameParm );
 			iUseInlineFileName = ETrue;
 			}
-        }
+        }                        
     }
 
 // -----------------------------------------------------------------------------
@@ -6227,7 +6267,7 @@
         {
         pausable = EFalse;
         }
-
+        
     if( iMethod == EMethodPOST )
         {
         pausable = EFalse;
@@ -6235,10 +6275,10 @@
 
     if( pausable != iPausable )
         {
-        if( !iCodDownload )
+        if( !iCodDownload )	
             {
         	iPausable = pausable;
-
+        	
         	// inform client about change
             TriggerEvent( iPausable ? EHttpDlPausable : EHttpDlNonPausable );
 
@@ -6335,7 +6375,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::CheckAttribMaxLengthL( THttpDownloadAttrib aAttribute,
+void CHttpDownload::CheckAttribMaxLengthL( THttpDownloadAttrib aAttribute, 
 	                                       const TDesC16& aValue )
     {
     for( TInt i = 0; KStringAttribMaxLengths[i][0]; ++i )
@@ -6344,7 +6384,7 @@
             {
             if( aValue.Length() > KStringAttribMaxLengths[i][1] )
                 {
-                CLOG_WRITE_2( "Overflow length: %d, max-length: %d", aValue.Length(),
+                CLOG_WRITE_2( "Overflow length: %d, max-length: %d", aValue.Length(), 
                                                     KStringAttribMaxLengths[i][1] );
                 User::Leave( KErrOverflow );
                 }
@@ -6358,7 +6398,7 @@
 // (other items were commented in a header).
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::CheckAttribMaxLengthL( THttpDownloadAttrib aAttribute,
+void CHttpDownload::CheckAttribMaxLengthL( THttpDownloadAttrib aAttribute, 
 	                                       const TDesC8& aValue )
     {
     for( TInt i = 0; KStringAttribMaxLengths[i][0]; ++i )
@@ -6367,7 +6407,7 @@
             {
             if( aValue.Length() > KStringAttribMaxLengths[i][1] )
                 {
-                CLOG_WRITE_2( "Overflow length: %d, max-length: %d", aValue.Length(),
+                CLOG_WRITE_2( "Overflow length: %d, max-length: %d", aValue.Length(), 
                                                     KStringAttribMaxLengths[i][1] );
                 User::Leave( KErrOverflow );
                 }
@@ -6470,7 +6510,7 @@
         // If not, fieldInd is KErrNotFound
         for( TInt i = 0; KRequestHeaderConvTable[i][0]; ++i )
             {
-            RStringF fieldNameStr = strPool.StringF( KRequestHeaderConvTable[i][1],
+            RStringF fieldNameStr = strPool.StringF( KRequestHeaderConvTable[i][1], 
                                                      RHTTPSession::GetTable() );
 
             if( !fieldName.CompareF( fieldNameStr.DesC() ) )
@@ -6495,7 +6535,7 @@
 // CHttpDownload::LoadHeadersL
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::LoadHeadersL( RFile& aFile,
+void CHttpDownload::LoadHeadersL( RFile& aFile, 
                                   CArrayPtrFlat<CHeaderField>* aHeaders )
     {
     TInt headers;
@@ -6521,7 +6561,7 @@
             {
             CLOG_WRITE8( "Empty field" );
             }
-*/
+*/    
         CleanupStack::Pop( field );
         }
     }
@@ -6561,36 +6601,36 @@
 
     HBufC8* fieldName = NULL;
     HBufC8* fieldRawData = NULL;
-
+    
     TInt size  = 0;
 
     for( TInt i = 0; i < headers; ++i )
         {
         fieldName = (*aHeaders)[i]->FieldName();
         fieldRawData = (*aHeaders)[i]->FieldRawData();
-
+        
         size = size + fieldName->Size() +  fieldRawData->Size();
-
+        
         CLOG_WRITE8_1( "Size = %d:", size );
         }
 
     return size;
-
+    
     }
-
-
+    
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::AddHeaderL
 // -----------------------------------------------------------------------------
 //
-void CHttpDownload::AddHeaderL( THttpDownloadAttrib aAttribute,
+void CHttpDownload::AddHeaderL( THttpDownloadAttrib aAttribute, 
 								const TDesC8& aValue,
                                 const TInt aConversionTable[][2],
                                 CArrayPtrFlat<CHeaderField>* aHeaders )
     {
     TInt index( KErrNotFound );
 
-    // search for if this field is already in the
+    // search for if this field is already in the 
     for( index = 0; aConversionTable[index][0]; ++index )
         {
         if( aConversionTable[index][0] == aAttribute )
@@ -6602,7 +6642,7 @@
     __ASSERT_DEBUG( index != KErrNotFound, DMPanic( KErrCorrupt ) );
 
     RStringPool strPool = iClAppInstance->ConnHandler()->Session().StringPool();
-    RStringF fieldName = strPool.StringF( aConversionTable[index][1],
+    RStringF fieldName = strPool.StringF( aConversionTable[index][1], 
                                           RHTTPSession::GetTable() );
     CleanupClosePushL( fieldName );
 
@@ -6619,7 +6659,7 @@
 
     CleanupStack::Pop( 2 ); // newField, fieldName
     }
-
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::RedirectedPermanentlyL
 // -----------------------------------------------------------------------------
@@ -6635,7 +6675,7 @@
         }
     else
         // there has already been a temporary redirection
-        // this permanent is not used on next submitted request
+        // this permanent is not used on next submitted request 
         {
         ReallocateStringL( iCurrentUrl, aNewUrl, KMaxUrlLength );
         }
@@ -6659,7 +6699,7 @@
 
     TriggerEvent( EHttpDlInprogress, EHttpProgRedirectedTemporarily );
     }
-
+    
 // -----------------------------------------------------------------------------
 // CHttpDownload::FixDownloadNameL
 // -----------------------------------------------------------------------------
@@ -6669,13 +6709,13 @@
     if( !iCodDownload )
         {
         TPtr name( iDlName->Des() );
-
+        
         for( TInt i = 0; i < name.Length(); ++i )
             {
             TChar currChar = (*iDlName)[i];
-
+            
             if( currChar.IsAlphaDigit() ||
-                currChar.IsGraph() ||
+                currChar.IsGraph() || 
                 currChar == 0x20 )  // space
                 {
                 continue;
@@ -6685,7 +6725,7 @@
                 name[i] = KUrlFixChar;
                 }
             }
-
+            
         ConvertDownloadNameUniqueL();
         }
     }
@@ -6698,7 +6738,7 @@
     {
     if( aValue && iCodDownload )
         {
-        // this case we will not overwrite
+        // this case we will not overwrite 
         // the value of iCodDownload. iCodDownload might be > 1
         return;
         }
@@ -6744,9 +6784,17 @@
     TBool needToUpdatePath( ETrue );
 
     CLOG_WRITE_1( " entering fileName: %S", fileName );
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+    CDownloadPathHandler* downloadPathPlugin = NULL;
+    downloadPathPlugin = GetDownloadPathPluginInstanceL();
+    if( downloadPathPlugin )
+       {
+        CleanupStack::PushL( downloadPathPlugin );
+       }
+#endif
 #ifdef RD_MULTIPLE_DRIVE
     HBufC8* drivesDynList = iClientApp->Engine()->QueryDynDriveListLC();
-    TPtrC8 drives( *drivesDynList );
+    TPtrC8 drives( *drivesDynList ); 
 #else
     TPtrC drives( iClientApp->Engine()->iDriveLettersCenRep );
 #endif
@@ -6757,9 +6805,16 @@
             {
             continue;
             }
-        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
-            {
+        if( drive == currentDrive || iStorage->DestFNameSet())//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
+            {
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+            if( !downloadPathPlugin )
+                {
+                needToUpdatePath = EFalse;
+                }
+#else
             needToUpdatePath = EFalse;
+#endif 
             break;
             }
         else
@@ -6767,10 +6822,10 @@
             TInt bytesToWrite = downloadedSize;
             if (bytesToWrite < 0)
                 bytesToWrite = 0;
-
+            
             TRAP( err, criticalSpace = !SysUtil::DiskSpaceBelowCriticalLevelL(
                                                              &fs, bytesToWrite, drive ));
-            }
+            }             
         }
     if( needToUpdatePath )
         {
@@ -6792,11 +6847,25 @@
                 fileNamePtr.Delete( 0, lastSlashPos );
                 }
             }
-
+    
         // Setting RootPath for new Destination file
         fileNamePtr.Insert( 0, rootPath );
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+        if( downloadPathPlugin )
+            {
+             GetUpdatedPathFromPluginL(downloadPathPlugin,rootPath,fileNamePtr);
+            }
+         else 
+           {
+           // Setting KDownloadPath
+           fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
+           }   
+#else
         // Setting KDownloadPath
         fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
+          
+#endif
+        
 #else
         TChar driveChar;
         fs.DriveToChar(drive, driveChar);
@@ -6812,35 +6881,42 @@
         }
     CLOG_WRITE_1( " exiting fileName: %S", fileName );
 #ifdef RD_MULTIPLE_DRIVE
-    CleanupStack::PopAndDestroy( drivesDynList );
+    CleanupStack::PopAndDestroy( drivesDynList ); 
+#endif
+
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+    if(downloadPathPlugin)
+    {
+     CleanupStack::PopAndDestroy( downloadPathPlugin );
+    }
 #endif
     CleanupStack::PopAndDestroy( &fs );
-    }
+    }    
 
 // ---------------------------------------------------------
 // CHttpDownload::UpdateDCFRepositoryL()
-// Update saved file to DCFRepository
+// Update saved file to DCFRepository  
 // ---------------------------------------------------------
-//
+// 
 void CHttpDownload::UpdateDCFRepositoryL(
     const TDesC& aFileName )
     {
     LOGGER_ENTERFN( "UpdateDCFRepositoryL" );
     CLOG_WRITE_1( " :UpdateDCFRepositoryL() for: %S", &aFileName );
     CDcfEntry* dcfEntry = NULL;
-    dcfEntry = CDcfEntry::NewL();
+    dcfEntry = CDcfEntry::NewL();    
     CleanupStack::PushL( dcfEntry );
-
+    
     CDcfRep* dcfRep = NULL;
     dcfRep = CDcfRep::NewL();
     CleanupStack::PushL( dcfRep );
 
-    dcfEntry->SetLocationL( aFileName, 0 );
+    dcfEntry->SetLocationL( aFileName, 0 );    
     CLOG_WRITE(" : SetLocationL OK");
     dcfRep->UpdateL( dcfEntry );
     CLOG_WRITE(" :UpdateL OK");
     CleanupStack::PopAndDestroy(2); // dcfEntry, dcfRep
-    }
+    }                 
 
 // -----------------------------------------------------------------------------
 // CHttpDownload::MoveInDeleteL
@@ -6860,7 +6936,7 @@
 		TPtrC filenamePtr = ((*iCodDlData)[mediaObjectIndex])->DestFilename();
 		if(filenamePtr.Length())
     		{
-    		TRAP_IGNORE(NotifyMediaGalleryL( filenamePtr ));
+    		TRAP_IGNORE(NotifyMediaGalleryL( filenamePtr ));    
     		}
 		}
 	return err;
@@ -6879,7 +6955,7 @@
 
     if( iDlState != EHttpDlMultipleMOCompleted && !iMoDownloadCompleted )
         {
-        iStorage->SetProgressiveMode( EFalse );
+        iStorage->SetProgressiveMode( EFalse );	
         TriggerEvent( iDlState, EHttpDlProgNonProgressive);
         return;//Move will be Done by COD as MO Completed has not happened
         }
@@ -6888,16 +6964,16 @@
     //__ASSERT_DEBUG( !iFileMan, DMPanic( KErrInUse ) );
 
 #if 0
-
+    
 #else
 
     HBufC* filename = HBufC::NewLC(KMaxFileName);
 	TPtr filenamePtr1 = filename->Des();
-
+	
     RFs &fs = iClientApp->Engine()->Fs();
 	if(!iFileMan)
 		{
-		iFileMan = CFileMan::NewL(fs);
+		iFileMan = CFileMan::NewL(fs);	
 		}
 
     TPtrC filenamePtr2 = ((*iCodDlData)[mediaObjectIndex])->DestFilename();
@@ -6906,18 +6982,18 @@
         CleanupStack::PopAndDestroy(filename);
         return;
     	}
-
+    
     TInt firstSlashPos = filenamePtr2.Locate( '\\' );
 
     if(firstSlashPos < 0)
 	    {
 	    CleanupStack::PopAndDestroy(filename);
-	    return;
+	    return;	
 	    }
   	TPtrC dlName = filenamePtr2.Left(firstSlashPos);
 
     TInt drive;
-
+    
     User::LeaveIfError( fs.CharToDrive( dlName[0], drive ));
 
 
@@ -6934,24 +7010,24 @@
     TInt error = fs.MkDirAll(filenamePtr1);
     if (error!=KErrNone && error!=KErrAlreadyExists)
        {
-        User::Leave(error);
+        User::Leave(error);   
        }
 	if( mediaObjectIndex == iActivePlayedDownload )
-	    {
-
+	    {	    
+	           	
 	    iFname = ((*iCodDlData)[mediaObjectIndex])->TempFilename();
 	    }
 
 	else
-		{
-
+		{	    
+	    
 	    iFname = ((*iCodDlData)[mediaObjectIndex])->DestFilename();
-		}
+		}   
     // Find a unique name to avoid any conflict.
     // Here iFname has full path of current location of file
     // and filename has destination path.
     FindUniqueDestinationFileNameL( iFname, filename );
-
+    
     filenamePtr1 = filename->Des();
 
     User::LeaveIfError( iFileMan->Move( iFname, filenamePtr1, CFileMan::EOverWrite, iStatus ) );
@@ -6961,7 +7037,7 @@
     ((*iCodDlData)[mediaObjectIndex])->SetDestFilenameL(filenamePtr1);
 
     CleanupStack::PopAndDestroy(filename);
-
+ 
 #endif
     }
 
@@ -6984,26 +7060,26 @@
     //__ASSERT_DEBUG( !iFileMan, DMPanic( KErrInUse ) );
 
 
-
+    
 	RFs &fs = iClientApp->Engine()->Fs();
 	if(!iFileMan)
 		{
-		iFileMan = CFileMan::NewL(fs);
+		iFileMan = CFileMan::NewL(fs);	
 		}
 
     HBufC* filename = HBufC::NewLC(KMaxFileName);
     TPtr filenamePtr = filename->Des();
-
+    
     TPtrC fileNamePtr = ((*iCodDlData)[mediaObjectIndex])->DestFilename();
     TInt firstSlashPos = fileNamePtr.Locate( '\\' );
     if(firstSlashPos < 0)
 	    {
 	    CleanupStack::PopAndDestroy(filename);
-	    return;
+	    return;	
 	    }
   	TPtrC dlName = fileNamePtr.Left(firstSlashPos);
     TInt drive;
-
+    
     User::LeaveIfError( fs.CharToDrive( dlName[0], drive ));
 
 
@@ -7016,19 +7092,19 @@
 
     filenamePtr.Copy(rootPath);
     filenamePtr.Append(_L("\\"));
-
+    
     TInt error = fs.MkDirAll(filenamePtr);
     if (error!=KErrNone && error!=KErrAlreadyExists)
        {
-        User::Leave(error);
+        User::Leave(error);   
        }
     iFname = ((*iCodDlData)[mediaObjectIndex])->DestFilename();
-
+    
     // Find a unique name to avoid any conflict.
     // Here iFname has full path of current location of file
     // and filename has destination path.
     FindUniqueDestinationFileNameL( iFname, filename );
-
+    
     filenamePtr = filename->Des();
 
     TInt err = iFileMan->Move(iFname, filenamePtr, CFileMan::EOverWrite);
@@ -7040,7 +7116,7 @@
     ((*iCodDlData)[mediaObjectIndex])->SetDestFilenameL(filenamePtr);
 
     CleanupStack::PopAndDestroy(filename);
-
+ 
 
     }
 
@@ -7082,21 +7158,21 @@
         CleanupStack::PopAndDestroy( fileName );
         CleanupStack::PopAndDestroy( fileExtention );
     }
-
-
+    
+ 
 // ---------------------------------------------------------
 // CHttpDownload::NotifyMediaGalleryL()
 // Notify media gallery about the new file.
 // ---------------------------------------------------------
-//
+// 
 void CHttpDownload::NotifyMediaGalleryL( const TDesC& aFileName )
     {
 
 	LOGGER_ENTERFN( "CHttpDownload::NotifyMediaGalleryL" );
     CLOG_WRITE_1(" notifying Gallery and DcfReposory about move for: %S",&aFileName);
 
-#ifdef BRDO_APP_GALLERY_SUPPORTED_FF
-
+#ifdef BRDO_APP_GALLERY_SUPPORTED_FF    
+    
     //
     // Notify Media Gallery about new media file
     CMGXFileManager* mgFileManager = MGXFileManagerFactory::NewFileManagerL(
@@ -7111,8 +7187,8 @@
         TRAP_IGNORE( mgFileManager->UpdateL() );
         }
     CleanupStack::PopAndDestroy( mgFileManager );
-
-#endif
+    
+#endif    
     //
     // Notify DCF repository
     TRAP_IGNORE( UpdateDCFRepositoryL( aFileName ) );
@@ -7156,11 +7232,50 @@
 
     CleanupStack::PopAndDestroy(&rFs);
     CleanupStack::PopAndDestroy(fullNameTemp);
-
+    
     // This is the unique name that we were looking for.
     CleanupStack::PopAndDestroy(fileName);
     fileName = uniqueName;
     CleanupStack::PushL(fileName);
     }
 
+#ifdef DOWNLOADMGR_PATH_PLUGIN_ENABLED_FF
+
+// -----------------------------------------------------------------------------
+// CHttpDownload::GetDownloadPathPluginInstanceL
+// -----------------------------------------------------------------------------
+//
+CDownloadPathHandler* CHttpDownload::GetDownloadPathPluginInstanceL()
+    {
+    CDownloadPathHandler* downloadPathPlugin = NULL;
+    if ( iContentType )
+        {
+        TRAPD( kErr, downloadPathPlugin = CDownloadPathHandler::NewL( *iContentType ) );
+        if( kErr != KErrNone )
+            {
+            downloadPathPlugin = NULL;
+            }
+        }
+    return downloadPathPlugin;    
+
+    }
+
+// -----------------------------------------------------------------------------
+// CHttpDownload::GetUpdatedPathFromPluginL
+// -----------------------------------------------------------------------------
+//
+void CHttpDownload::GetUpdatedPathFromPluginL(CDownloadPathHandler* downloadPathPlugin,TFileName& rootPath, TPtr& fileNamePtr)
+    {
+    HBufC16* locFileName ;
+    locFileName = iStorage->LocalFilename();
+    
+    // Gets the updated path for the music content from Plugin
+    TRAPD( kErr, downloadPathPlugin->GetUpdatedPathL( *locFileName, fileNamePtr ) );
+    if( kErr != KErrNone )
+        {
+        // Setting to KDownloadPath
+        fileNamePtr.Insert( rootPath.Length(), KDownloadPath );
+        }
+    }
+#endif
 //  End of File