codhandler/codeng/src/CodEngBase.cpp
branchRCL_3
changeset 91 30342f40acbf
parent 58 220a17280356
child 93 79859ed3eea9
--- a/codhandler/codeng/src/CodEngBase.cpp	Mon Jun 21 16:54:17 2010 +0300
+++ b/codhandler/codeng/src/CodEngBase.cpp	Thu Jul 15 19:53:20 2010 +0300
@@ -1702,9 +1702,6 @@
     __ASSERT_DEBUG( iData->ActiveDownload(),CodPanic( ECodInternal ));
     // 1. Data type checking.
     TInt typeErr( KErrNone );    
-#ifdef __SYNCML_DM_FOTA
-    TBool fota( EFalse );
-#endif /*def __SYNCML_DM_FOTA */
     for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount() && !iContentTypeCheck; i++ )
         {
         const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
@@ -1745,7 +1742,6 @@
             {
             // Accept FOTA download. Special storage (not saved to FS).
             CLOG(( ECodEng, 4, _L8("  <%S> FOTA OK"), &mime ));
-            fota = ETrue;
             }
 #endif /*def __SYNCML_DM_FOTA */
         else 
@@ -1879,10 +1875,7 @@
             CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
             }
         iSaver = CFotaSaver::NewL( aType, pkgId );
-        iSaver->SetObserver( iObserver );
-        iSaver->SetParams( iParams );
-        iSaver->SetMaxSize( iData->Size() );
-        iSaver->OpenStoreL();   // TODO unneeded method, put to construction.
+        FotaSaverSettingL();
         }
 #endif /*def __SYNCML_DM_FOTA */
     else
@@ -1891,9 +1884,15 @@
         //__ASSERT_DEBUG( iFsUsed, CodPanic( ECodInternal ) );
 
         TBool contentTypeMisMatch ( ETrue );
+        TBool fotadownload(EFalse);
         for ( TInt i = 0; i < (*iData)[iData->ActiveDownload()]->Types().MdcaCount(); i++ )
             {
             const TDataType& type( (*iData)[iData->ActiveDownload()]->Types().MdcaPoint( i ) );
+            if( type.Des8().Find(KFotaPackageDataType) !=KErrNotFound )
+                {
+                 fotadownload = ETrue;
+                 break;
+                }
             if((aType.Find (type.Des8()) != KErrNotFound) || iDocHandler->CanOpenL(TDataType(aType)) || 
                             ( (type.Des8().Find(KOma1DrmMessageContentType)!= KErrNotFound) && (aType.Find(KOma1DcfContentType)!= KErrNotFound )  ))             
                 {
@@ -1901,7 +1900,18 @@
                 break;
                 }                
             }
-        if(contentTypeMisMatch)
+        if (fotadownload)
+            {
+             TInt pkgId( KCodDefaultFotaPkgId );
+             if ( iParams )
+                {
+                 CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
+                }
+             iSaver = CFotaSaver::NewL(KFotaPackageDataType(), pkgId );
+             FotaSaverSettingL();
+             return iSaver;
+           }
+       if(contentTypeMisMatch)
             {
             User::Leave(KErrCodAttributeMismatch);
             }
@@ -1957,6 +1967,18 @@
     }
 
 // ---------------------------------------------------------
+// CCodEngBase::FotaSaverSettingL
+// ---------------------------------------------------------
+//
+void CCodEngBase::FotaSaverSettingL()
+    {
+    iSaver->SetObserver( iObserver );
+    iSaver->SetParams( iParams );
+    iSaver->SetMaxSize( iData->Size() );
+    iSaver->OpenStoreL();   // TODO unneeded method, put to construction.
+    }
+
+// ---------------------------------------------------------
 // CCodEngBase::SetPathsL
 // ---------------------------------------------------------
 //