mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp
branchRCL_3
changeset 42 4aca42fa4eb1
parent 28 f56ec6ce2732
child 55 6c1dfe4da5dd
--- a/mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp	Wed Jun 09 10:13:45 2010 +0300
+++ b/mmappcomponents/harvester/filehandler/src/mpxharvesterdbmanager.cpp	Mon Jun 21 16:13:35 2010 +0300
@@ -48,7 +48,8 @@
 // ---------------------------------------------------------------------------
 //
 CMPXHarvesterDatabaseManager::CMPXHarvesterDatabaseManager( RFs& aFs ):
-        iFs( aFs )
+        iFs( aFs ),
+        iEMMC( EFalse )
 #ifdef __RAMDISK_PERF_ENABLE
         ,iRAMDiskPerfEnabled(EFalse),
         iMaximumAllowedRAMDiskSpaceToCopy(0),
@@ -70,6 +71,13 @@
     MPX_FUNC("CMPXHarvesterDatabaseManager::ConstructL");
     User::LeaveIfError( iDBSession.Connect() );
 
+    //Find out if the system has an internal drive (eMMC)
+    TDriveInfo driveInfo;
+    if( iFs.Drive( driveInfo, EDriveE ) == KErrNone )
+    	{
+        if ( driveInfo.iDriveAtt & KDriveAttInternal )
+        	iEMMC = ETrue;
+    	}
 #ifdef __RAMDISK_PERF_ENABLE
     TInt temp;
     CRepository* repository = CRepository::NewLC( KCRUIDMpxHarvesterFeatures );
@@ -162,7 +170,7 @@
                 {
                 MPX_DEBUG1("CMPXHarvesterDatabaseManager::OpenAllDatabasesL: re-creating database");
                 CMPXHarvesterDB* dB = CMPXHarvesterDB::NewL(
-                    static_cast<TDriveNumber>(driveNum), iFs );
+                    static_cast<TDriveNumber>(driveNum), iFs, iEMMC );
                 CleanupStack::PushL( dB );
                 TRAPD(openError, rtn |= dB->OpenL() );  //lint !e665
                 if(openError == KErrNone)
@@ -212,7 +220,7 @@
     if ( index == KErrNotFound )
         {
         index = iDatabases.Count();
-        db = CMPXHarvesterDB::NewL( aDrive, iFs );
+        db = CMPXHarvesterDB::NewL( aDrive, iFs, iEMMC );
         CleanupStack::PushL( db );
         iDatabases.AppendL( db );
         CleanupStack::Pop( db );
@@ -1000,13 +1008,23 @@
         {
         name.Append(iRAMFolder);
         name.Append(aDriveUnit.Name()[0]);
-        name.Append(KHarvesterDBName);
+
+        //Use different name for Dbs if the system has an internal drive vs. MMC-only.
+        //Since hard-coded drive letters in the Thumbnail URIs
+        //So Dbs are not interchangeable between an internal drive system and MMC-only system.
+        if ( iEMMC )
+            name.Append( KHarvesterDBNameEMMC );
+        else
+            name.Append( KHarvesterDBName );
         }
     else
         {
         name.Append(aDriveUnit.Name());
         name.Append(KHarvesterDBPath);
-        name.Append(KHarvesterDBName);
+        if ( iEMMC )
+            name.Append( KHarvesterDBNameEMMC );
+        else
+            name.Append( KHarvesterDBName );
         }
     
     MPX_DEBUG2("CMPXHarvesterDatabaseManager::GenerateHarvesterDbName name = %S", &name );