codhandler/codeng/src/CodEngBase.cpp
changeset 65 5bfc169077b2
parent 38 6297cdf66332
child 68 92a765b5b3e7
equal deleted inserted replaced
42:d39add9822e2 65:5bfc169077b2
    15 *      Implementation of class CCodEngBase.   
    15 *      Implementation of class CCodEngBase.   
    16 *      
    16 *      
    17 *
    17 *
    18 */
    18 */
    19 
    19 
       
    20 
    20 // INCLUDE FILES
    21 // INCLUDE FILES
    21 
    22 
    22 #include "CodEngBase.h"
    23 #include "CodEngBase.h"
    23 #include "Connection.h"
    24 #include "Connection.h"
    24 #include "HttpLoader.h"
    25 #include "HttpLoader.h"
    41 #include <DocumentHandler.h>
    42 #include <DocumentHandler.h>
    42 #include <ApmStd.h>
    43 #include <ApmStd.h>
    43 #include <Oma2Agent.h>
    44 #include <Oma2Agent.h>
    44 #include <RoapDef.h>
    45 #include <RoapDef.h>
    45 #include <f32file.h>
    46 #include <f32file.h>
    46 #include <bodypart.h>
    47 #include <BodyPart.h>
    47 #include <SysUtil.h>
    48 #include <SysUtil.h>
    48 #include <pathinfo.h>
    49 #include <pathinfo.h>
    49 #include "CodDefs.h"
    50 #include "CodDefs.h"
    50 #include <CodUi.rsg>
    51 #include <CodUi.rsg>
    51 #include <AknQueryDialog.h>
    52 #include <AknQueryDialog.h>
    52 #include <stringloader.h>
    53 #include <stringloader.h>
    53 #include <bautils.h>
    54 #include  <bautils.h>
    54 #include "FileExt.h"
    55 #include    "FileExt.h"
    55 
    56 
    56 #ifdef __SYNCML_DM_FOTA
    57 #ifdef __SYNCML_DM_FOTA
    57 #include <fotaengine.h>
    58 #include <fotaengine.h>
    58 #include "FotaSaver.h"
    59 #include "FotaSaver.h"
    59 /// FOTA Update Package type.
    60 /// FOTA Update Package type.
    63 #endif /*def __SYNCML_DM_FOTA */
    64 #endif /*def __SYNCML_DM_FOTA */
    64 
    65 
    65 #ifdef RD_MULTIPLE_DRIVE
    66 #ifdef RD_MULTIPLE_DRIVE
    66 #include <centralrepository.h>
    67 #include <centralrepository.h>
    67 #include <driveinfo.h>
    68 #include <driveinfo.h>
    68 #include <browseruisdkcrkeys.h>
    69 #include <BrowserUiSDKCRKeys.h>
    69 #endif //RD_MULTIPLE_DRIVE
    70 #endif //RD_MULTIPLE_DRIVE
    70 
    71 
    71 #include <bldvariant.hrh>
    72 #include <bldvariant.hrh>
    72 
    73 
    73 // ================= CONSTANTS =======================
    74 // ================= CONSTANTS =======================
   480 // CCodEngBase::RemovableMedia()
   481 // CCodEngBase::RemovableMedia()
   481 // ---------------------------------------------------------
   482 // ---------------------------------------------------------
   482 //
   483 //
   483 EXPORT_C TBool CCodEngBase::RemovableMedia() const
   484 EXPORT_C TBool CCodEngBase::RemovableMedia() const
   484     {
   485     {
   485     return ( KDriveAttRemovable == iRemovableMediaStatus ) ? ETrue : EFalse ;
   486     return iRemovableMedia;
   486     }
   487     }
   487 
   488 
   488 // ---------------------------------------------------------
   489 // ---------------------------------------------------------
   489 // CCodEngBase::GetPath()
   490 // CCodEngBase::GetPath()
   490 // ---------------------------------------------------------
   491 // ---------------------------------------------------------
   578   iAvailDriveSpace( -1 ),
   579   iAvailDriveSpace( -1 ),
   579 #else
   580 #else
   580   iPhoneMemoryOk( EFalse ),
   581   iPhoneMemoryOk( EFalse ),
   581   iMmcOk( EFalse ),
   582   iMmcOk( EFalse ),
   582 #endif
   583 #endif
   583   iRemovableMediaStatus( KDriveAttLocal ),
   584   iRemovableMedia( EFalse ),
   584   iStatusCode( KHttp902UserCancelled ),
   585   iStatusCode( KHttp902UserCancelled ),
   585   iResult( KErrGeneral ),
   586   iResult( KErrGeneral ),
   586   iContentTypeCheck ( EFalse ),
   587   iContentTypeCheck ( EFalse ),
   587   iResumedDownload ( EFalse )  
   588   iResumedDownload ( EFalse )  
   588     {
   589     {
  2006                     &KTempFilesCodDirName );      
  2007                     &KTempFilesCodDirName );      
  2007 
  2008 
  2008     (*iData)[iData->ActiveDownload()]->iTempPath.Append(rootPath.Drive());
  2009     (*iData)[iData->ActiveDownload()]->iTempPath.Append(rootPath.Drive());
  2009     (*iData)[iData->ActiveDownload()]->iTempPath.Append(tempBuf);
  2010     (*iData)[iData->ActiveDownload()]->iTempPath.Append(tempBuf);
  2010 
  2011 
  2011 
  2012     TDriveInfo info;
  2012     TDriveUnit unit( rootPath.Drive() );
  2013     TDriveUnit unit( rootPath.Drive() );
  2013 
  2014     User::LeaveIfError( iFs.Drive( info, unit ) );
  2014 #ifdef RD_MULTIPLE_DRIVE    
  2015     // Create the temp directory earlier in case it's not created yet
  2015     TUint aStatus ;
  2016     iFs.MkDirAll( (*iData)[iData->ActiveDownload()]->iTempPath ); 
  2016     
       
  2017     if( KErrNone == DriveInfo::GetDriveStatus( iFs, unit , aStatus ))
       
  2018             {
       
  2019             iRemovableMediaStatus = (aStatus & DriveInfo::EDriveExternallyMountable) ? aStatus : 0 ;
       
  2020             if( iRemovableMediaStatus )
       
  2021                 {
       
  2022                 iRemovableMediaStatus = (aStatus & DriveInfo::EDriveRemovable) ? KDriveAttRemovable : KDriveAttInternal ;				
       
  2023                 }
       
  2024             else
       
  2025                 {
       
  2026                 iRemovableMediaStatus = KDriveAttLocal ;
       
  2027                 }
       
  2028             }    	
       
  2029 #else
       
  2030     TDriveInfo info;
       
  2031     User::LeaveIfError( iFs.Drive( info, unit ) );	
       
  2032     if ( info.iDriveAtt & KDriveAttRemovable )
  2017     if ( info.iDriveAtt & KDriveAttRemovable )
  2033         {
  2018         {
  2034         iRemovableMediaStatus = KDriveAttRemovable;
  2019         iRemovableMedia = ETrue;
  2035         }
  2020         }
  2036     else
  2021         
  2037         {
       
  2038         iRemovableMediaStatus = KDriveAttLocal;
       
  2039         }
       
  2040 #endif
       
  2041     // Create the temp directory earlier in case it's not created yet
       
  2042     iFs.MkDirAll( (*iData)[iData->ActiveDownload()]->iTempPath );
       
  2043     
       
  2044     CLOG(( ECodEng, 2, _L("<- CCodEngBase::SetPathsL root<%S> temp<%S>"), \
  2022     CLOG(( ECodEng, 2, _L("<- CCodEngBase::SetPathsL root<%S> temp<%S>"), \
  2045         &(*iData)[iData->ActiveDownload()]->iRootPath, &(*iData)[iData->ActiveDownload()]->iTempPath ));
  2023         &(*iData)[iData->ActiveDownload()]->iRootPath, &(*iData)[iData->ActiveDownload()]->iTempPath ));
  2046     }
  2024     }
  2047 
  2025 
  2048 // ---------------------------------------------------------
  2026 // ---------------------------------------------------------
  2059     iPhoneMemoryOk = EFalse;
  2037     iPhoneMemoryOk = EFalse;
  2060     iMmcOk = EFalse;
  2038     iMmcOk = EFalse;
  2061 #endif
  2039 #endif
  2062     //(*iData)[iData->ActiveDownload()]->iTempPath = KNullDesC;
  2040     //(*iData)[iData->ActiveDownload()]->iTempPath = KNullDesC;
  2063     //(*iData)[iData->ActiveDownload()]->iRootPath = KNullDesC;
  2041     //(*iData)[iData->ActiveDownload()]->iRootPath = KNullDesC;
  2064 
  2042     iRemovableMedia = EFalse;
  2065     iRemovableMediaStatus = KDriveAttLocal;
       
  2066     }
  2043     }
  2067 
  2044 
  2068 #ifdef RD_MULTIPLE_DRIVE
  2045 #ifdef RD_MULTIPLE_DRIVE
  2069 //------------------------------------------------------------------------
  2046 //------------------------------------------------------------------------
  2070 //CCodEngBase::QueryDynDriveListLC
  2047 //CCodEngBase::QueryDynDriveListLC