codhandler/codeng/src/CodEngBase.cpp
branchRCL_3
changeset 48 79859ed3eea9
parent 46 30342f40acbf
child 49 919f36ff910f
--- a/codhandler/codeng/src/CodEngBase.cpp	Thu Aug 19 10:58:56 2010 +0300
+++ b/codhandler/codeng/src/CodEngBase.cpp	Tue Aug 31 16:17:46 2010 +0300
@@ -17,6 +17,7 @@
 *
 */
 
+
 // INCLUDE FILES
 
 #include "CodEngBase.h"
@@ -39,19 +40,19 @@
 
 #include <AiwGenericParam.h>
 #include <DocumentHandler.h>
-#include <ApmStd.h>
+#include <apmstd.h>
 #include <Oma2Agent.h>
 #include <RoapDef.h>
 #include <f32file.h>
 #include <bodypart.h>
-#include <SysUtil.h>
+#include <sysutil.h>
 #include <pathinfo.h>
 #include "CodDefs.h"
 #include <CodUi.rsg>
 #include <AknQueryDialog.h>
-#include <stringloader.h>
-#include <bautils.h>
-#include "FileExt.h"
+#include <StringLoader.h>
+#include  <bautils.h>
+#include    "FileExt.h"
 
 #ifdef __SYNCML_DM_FOTA
 #include <fotaengine.h>
@@ -65,7 +66,7 @@
 #ifdef RD_MULTIPLE_DRIVE
 #include <centralrepository.h>
 #include <driveinfo.h>
-#include <browseruisdkcrkeys.h>
+#include <BrowserUiSDKCRKeys.h>
 #endif //RD_MULTIPLE_DRIVE
 
 #include <bldvariant.hrh>
@@ -482,7 +483,7 @@
 //
 EXPORT_C TBool CCodEngBase::RemovableMedia() const
     {
-    return ( KDriveAttRemovable == iRemovableMediaStatus ) ? ETrue : EFalse ;
+    return iRemovableMedia;
     }
 
 // ---------------------------------------------------------
@@ -580,7 +581,7 @@
   iPhoneMemoryOk( EFalse ),
   iMmcOk( EFalse ),
 #endif
-  iRemovableMediaStatus( KDriveAttLocal ),
+  iRemovableMedia( EFalse ),
   iStatusCode( KHttp902UserCancelled ),
   iResult( KErrGeneral ),
   iContentTypeCheck ( EFalse ),
@@ -1702,6 +1703,9 @@
     __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 ) );
@@ -1742,6 +1746,7 @@
             {
             // 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 
@@ -1875,7 +1880,10 @@
             CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
             }
         iSaver = CFotaSaver::NewL( aType, pkgId );
-        FotaSaverSettingL();
+        iSaver->SetObserver( iObserver );
+        iSaver->SetParams( iParams );
+        iSaver->SetMaxSize( iData->Size() );
+        iSaver->OpenStoreL();   // TODO unneeded method, put to construction.
         }
 #endif /*def __SYNCML_DM_FOTA */
     else
@@ -1884,34 +1892,17 @@
         //__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)) || 
+            if( ( aType.Find (type.Des8()) != KErrNotFound ) || 
                             ( (type.Des8().Find(KOma1DrmMessageContentType)!= KErrNotFound) && (aType.Find(KOma1DcfContentType)!= KErrNotFound )  ))             
                 {
                 contentTypeMisMatch = EFalse;
                 break;
                 }                
             }
-        if (fotadownload)
-            {
-             TInt pkgId( KCodDefaultFotaPkgId );
-             if ( iParams )
-                {
-                 CodUtil::GetIntParam( pkgId, EGenericParamFotaPkgId, *iParams );
-                }
-             iSaver = CFotaSaver::NewL(KFotaPackageDataType(), pkgId );
-             FotaSaverSettingL();
-             return iSaver;
-           }
-       if(contentTypeMisMatch)
+        if(contentTypeMisMatch)
             {
             User::Leave(KErrCodAttributeMismatch);
             }
@@ -1967,18 +1958,6 @@
     }
 
 // ---------------------------------------------------------
-// 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
 // ---------------------------------------------------------
 //
@@ -2030,39 +2009,16 @@
     (*iData)[iData->ActiveDownload()]->iTempPath.Append(rootPath.Drive());
     (*iData)[iData->ActiveDownload()]->iTempPath.Append(tempBuf);
 
-
+    TDriveInfo info;
     TDriveUnit unit( rootPath.Drive() );
-
-#ifdef RD_MULTIPLE_DRIVE    
-    TUint aStatus ;
-    
-    if( KErrNone == DriveInfo::GetDriveStatus( iFs, unit , aStatus ))
-            {
-            iRemovableMediaStatus = (aStatus & DriveInfo::EDriveExternallyMountable) ? aStatus : 0 ;
-            if( iRemovableMediaStatus )
-                {
-                iRemovableMediaStatus = (aStatus & DriveInfo::EDriveRemovable) ? KDriveAttRemovable : KDriveAttInternal ;				
-                }
-            else
-                {
-                iRemovableMediaStatus = KDriveAttLocal ;
-                }
-            }    	
-#else
-    TDriveInfo info;
-    User::LeaveIfError( iFs.Drive( info, unit ) );	
+    User::LeaveIfError( iFs.Drive( info, unit ) );
+    // Create the temp directory earlier in case it's not created yet
+    iFs.MkDirAll( (*iData)[iData->ActiveDownload()]->iTempPath ); 
     if ( info.iDriveAtt & KDriveAttRemovable )
         {
-        iRemovableMediaStatus = KDriveAttRemovable;
+        iRemovableMedia = ETrue;
         }
-    else
-        {
-        iRemovableMediaStatus = KDriveAttLocal;
-        }
-#endif
-    // Create the temp directory earlier in case it's not created yet
-    iFs.MkDirAll( (*iData)[iData->ActiveDownload()]->iTempPath );
-    
+        
     CLOG(( ECodEng, 2, _L("<- CCodEngBase::SetPathsL root<%S> temp<%S>"), \
         &(*iData)[iData->ActiveDownload()]->iRootPath, &(*iData)[iData->ActiveDownload()]->iTempPath ));
     }
@@ -2083,8 +2039,7 @@
 #endif
     //(*iData)[iData->ActiveDownload()]->iTempPath = KNullDesC;
     //(*iData)[iData->ActiveDownload()]->iRootPath = KNullDesC;
-
-    iRemovableMediaStatus = KDriveAttLocal;
+    iRemovableMedia = EFalse;
     }
 
 #ifdef RD_MULTIPLE_DRIVE