codhandler/codeng/src/CodEngBase.cpp
branchRCL_3
changeset 91 30342f40acbf
parent 58 220a17280356
child 93 79859ed3eea9
equal deleted inserted replaced
84:800203832575 91:30342f40acbf
  1700     {
  1700     {
  1701     CLOG(( ECodEng, 2, _L("-> CCodEngBase::CapabilityCheckL") ));
  1701     CLOG(( ECodEng, 2, _L("-> CCodEngBase::CapabilityCheckL") ));
  1702     __ASSERT_DEBUG( iData->ActiveDownload(),CodPanic( ECodInternal ));
  1702     __ASSERT_DEBUG( iData->ActiveDownload(),CodPanic( ECodInternal ));
  1703     // 1. Data type checking.
  1703     // 1. Data type checking.
  1704     TInt typeErr( KErrNone );    
  1704     TInt typeErr( KErrNone );    
  1705 #ifdef __SYNCML_DM_FOTA
       
  1706     TBool fota( EFalse );
       
  1707 #endif /*def __SYNCML_DM_FOTA */
       
  1708     for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount() && !iContentTypeCheck; i++ )
  1705     for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount() && !iContentTypeCheck; i++ )
  1709         {
  1706         {
  1710         const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
  1707         const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
  1711 #ifdef __TEST_COD_LOG
  1708 #ifdef __TEST_COD_LOG
  1712         TPtrC8 mime( type.Des8() );
  1709         TPtrC8 mime( type.Des8() );
  1743 #ifdef __SYNCML_DM_FOTA
  1740 #ifdef __SYNCML_DM_FOTA
  1744         else if ( type == TDataType( KFotaPackageDataType ) )
  1741         else if ( type == TDataType( KFotaPackageDataType ) )
  1745             {
  1742             {
  1746             // Accept FOTA download. Special storage (not saved to FS).
  1743             // Accept FOTA download. Special storage (not saved to FS).
  1747             CLOG(( ECodEng, 4, _L8("  <%S> FOTA OK"), &mime ));
  1744             CLOG(( ECodEng, 4, _L8("  <%S> FOTA OK"), &mime ));
  1748             fota = ETrue;
       
  1749             }
  1745             }
  1750 #endif /*def __SYNCML_DM_FOTA */
  1746 #endif /*def __SYNCML_DM_FOTA */
  1751         else 
  1747         else 
  1752             {
  1748             {
  1753             CLOG(( ECodEng, 4, _L8("  <%S> DocHandler check"), &mime ));
  1749             CLOG(( ECodEng, 4, _L8("  <%S> DocHandler check"), &mime ));
  1877         if ( iParams )
  1873         if ( iParams )
  1878             {
  1874             {
  1879             CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
  1875             CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
  1880             }
  1876             }
  1881         iSaver = CFotaSaver::NewL( aType, pkgId );
  1877         iSaver = CFotaSaver::NewL( aType, pkgId );
  1882         iSaver->SetObserver( iObserver );
  1878         FotaSaverSettingL();
  1883         iSaver->SetParams( iParams );
       
  1884         iSaver->SetMaxSize( iData->Size() );
       
  1885         iSaver->OpenStoreL();   // TODO unneeded method, put to construction.
       
  1886         }
  1879         }
  1887 #endif /*def __SYNCML_DM_FOTA */
  1880 #endif /*def __SYNCML_DM_FOTA */
  1888     else
  1881     else
  1889         {
  1882         {
  1890         // TODO the assert below crashes without early reject!
  1883         // TODO the assert below crashes without early reject!
  1891         //__ASSERT_DEBUG( iFsUsed, CodPanic( ECodInternal ) );
  1884         //__ASSERT_DEBUG( iFsUsed, CodPanic( ECodInternal ) );
  1892 
  1885 
  1893         TBool contentTypeMisMatch ( ETrue );
  1886         TBool contentTypeMisMatch ( ETrue );
       
  1887         TBool fotadownload(EFalse);
  1894         for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount(); i++ )
  1888         for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount(); i++ )
  1895             {
  1889             {
  1896             const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
  1890             const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
       
  1891             if( type.Des8().Find(KFotaPackageDataType) !=KErrNotFound )
       
  1892                 {
       
  1893                  fotadownload = ETrue;
       
  1894                  break;
       
  1895                 }
  1897             if((aType.Find (type.Des8()) != KErrNotFound) || iDocHandler->CanOpenL(TDataType(aType)) || 
  1896             if((aType.Find (type.Des8()) != KErrNotFound) || iDocHandler->CanOpenL(TDataType(aType)) || 
  1898                             ( (type.Des8().Find(KOma1DrmMessageContentType)!= KErrNotFound) && (aType.Find(KOma1DcfContentType)!= KErrNotFound )  ))             
  1897                             ( (type.Des8().Find(KOma1DrmMessageContentType)!= KErrNotFound) && (aType.Find(KOma1DcfContentType)!= KErrNotFound )  ))             
  1899                 {
  1898                 {
  1900                 contentTypeMisMatch = EFalse;
  1899                 contentTypeMisMatch = EFalse;
  1901                 break;
  1900                 break;
  1902                 }                
  1901                 }                
  1903             }
  1902             }
  1904         if(contentTypeMisMatch)
  1903         if (fotadownload)
       
  1904             {
       
  1905              TInt pkgId( KCodDefaultFotaPkgId );
       
  1906              if ( iParams )
       
  1907                 {
       
  1908                  CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
       
  1909                 }
       
  1910              iSaver = CFotaSaver::NewL(KFotaPackageDataType(), pkgId );
       
  1911              FotaSaverSettingL();
       
  1912              return iSaver;
       
  1913            }
       
  1914        if(contentTypeMisMatch)
  1905             {
  1915             {
  1906             User::Leave(KErrCodAttributeMismatch);
  1916             User::Leave(KErrCodAttributeMismatch);
  1907             }
  1917             }
  1908         
  1918         
  1909         // Do this only if Unique filename check has never been performed earlier for this file.
  1919         // Do this only if Unique filename check has never been performed earlier for this file.
  1952 		  }
  1962 		  }
  1953         }
  1963         }
  1954 
  1964 
  1955     CLOG(( ECodEng, 2, _L("<- CCodEngBase::CreateSaverL") ));
  1965     CLOG(( ECodEng, 2, _L("<- CCodEngBase::CreateSaverL") ));
  1956     return iSaver;
  1966     return iSaver;
       
  1967     }
       
  1968 
       
  1969 // ---------------------------------------------------------
       
  1970 // CCodEngBase::FotaSaverSettingL
       
  1971 // ---------------------------------------------------------
       
  1972 //
       
  1973 void CCodEngBase::FotaSaverSettingL()
       
  1974     {
       
  1975     iSaver->SetObserver( iObserver );
       
  1976     iSaver->SetParams( iParams );
       
  1977     iSaver->SetMaxSize( iData->Size() );
       
  1978     iSaver->OpenStoreL();   // TODO unneeded method, put to construction.
  1957     }
  1979     }
  1958 
  1980 
  1959 // ---------------------------------------------------------
  1981 // ---------------------------------------------------------
  1960 // CCodEngBase::SetPathsL
  1982 // CCodEngBase::SetPathsL
  1961 // ---------------------------------------------------------
  1983 // ---------------------------------------------------------