metadataengine/server/src/mdsmaintenanceengine.cpp
changeset 2 b73a2e62868f
parent 0 c53acadfccc6
child 6 646a02f170b9
equal deleted inserted replaced
1:acef663c1218 2:b73a2e62868f
    14 * Description:  Class for database import/export and maintenance
    14 * Description:  Class for database import/export and maintenance
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 // INCLUDE FILES
    18 // INCLUDE FILES
       
    19 #include <driveinfo.h>
       
    20 
    19 #include "mdsmaintenanceengine.h"
    21 #include "mdsmaintenanceengine.h"
    20 #include "mdslogger.h"
    22 #include "mdslogger.h"
    21 #include "mdsmanipulationengine.h"
    23 #include "mdsmanipulationengine.h"
    22 #include "mdcserializationbuffer.h"
    24 #include "mdcserializationbuffer.h"
    23 #include "mdsimportexport.h"
    25 #include "mdsimportexport.h"
   151        		// if default import file is not found, try to read from rom (Z) drive
   153        		// if default import file is not found, try to read from rom (Z) drive
   152        		// and ignore errors
   154        		// and ignore errors
   153        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   155        		TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) );
   154        		}
   156        		}
   155        	
   157        	
   156        	StoreCDriveMediaIdL();
   158        	StoreDriveMediaIdsL();
   157         }
   159         }
   158     else
   160     else
   159         {
   161         {
   160         TRAPD( err, LoadSchemaL( aSchema ) );
   162         TRAPD( err, LoadSchemaL( aSchema ) );
   161 
   163 
   224 	exporter->ExportMetadataL( aSchema, aFileName, aItems );
   226 	exporter->ExportMetadataL( aSchema, aFileName, aItems );
   225 	CleanupStack::PopAndDestroy( exporter );
   227 	CleanupStack::PopAndDestroy( exporter );
   226     }
   228     }
   227 
   229 
   228 // ------------------------------------------------
   230 // ------------------------------------------------
   229 // StoreCDriveMediaIdL
   231 // StoreDriveMediaIdsL
   230 // ------------------------------------------------
   232 // ------------------------------------------------
   231 //
   233 //
   232 void CMdSMaintenanceEngine::StoreCDriveMediaIdL()
   234 void CMdSMaintenanceEngine::StoreDriveMediaIdsL()
   233 	{
   235 	{
   234 	RFs fs;
   236 	RFs fs;
   235     User::LeaveIfError( fs.Connect() );
   237     User::LeaveIfError( fs.Connect() );
   236     CleanupClosePushL( fs );
   238     CleanupClosePushL( fs );
   237     TVolumeInfo volumeInfo;
   239     TVolumeInfo volumeInfo;
   238     fs.Volume( volumeInfo, EDriveC );
   240     fs.Volume( volumeInfo, EDriveC );
   239     MMdsPreferences::InsertL( KCMediaIdKey, MMdsPreferences::EPreferenceValueSet,
   241     MMdsPreferences::InsertL( KCMediaIdKey, MMdsPreferences::EPreferenceValueSet,
   240     		(TUint32) volumeInfo.iUniqueID );
   242     		(TUint32) volumeInfo.iUniqueID );
       
   243 
       
   244     TInt drive( -1 );
       
   245     TInt massStorageError( DriveInfo::GetDefaultDrive( DriveInfo::EDefaultMassStorage, drive ) );
       
   246     if( massStorageError == KErrNone )
       
   247         {
       
   248         TVolumeInfo massStorageVolumeInfo;
       
   249         fs.Volume( massStorageVolumeInfo, drive );
       
   250         const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID );
       
   251         massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive );
       
   252         if( massStorageError == KErrNone )
       
   253             {
       
   254             fs.Volume( massStorageVolumeInfo, drive );
       
   255             // Update mass storage media id if the mass storage is not memory card
       
   256             if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 )
       
   257                 {
       
   258                 MMdsPreferences::InsertL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet,
       
   259                         (TUint32) massStorageMediaId );
       
   260                 }
       
   261             }
       
   262         }
   241     
   263     
   242     CleanupStack::PopAndDestroy( &fs );
   264     CleanupStack::PopAndDestroy( &fs );
   243 	}
   265 	}
   244 
   266