metadataengine/server/src/mdssqlobjectmanipulate.cpp
changeset 2 b73a2e62868f
parent 0 c53acadfccc6
child 6 646a02f170b9
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Tue Jan 26 12:13:20 2010 +0200
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Tue Feb 02 00:24:33 2010 +0200
@@ -1020,6 +1020,27 @@
 	CleanupStack::PopAndDestroy( &clauseOne );
 	}
 
+void CMdSSqlObjectManipulate::CheckMassStorageMediaIdL( const TUint32 aMediaId )
+    {
+    TUint32 oldMediaId( 0 );
+    const TInt rowCount = MMdsPreferences::GetL( KMassStorageMediaIdKey, 
+                                                                 MMdsPreferences::EPreferenceValueGet, oldMediaId );
+    if( rowCount == 0 )
+        {
+        MMdsPreferences::InsertL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, (TUint32) aMediaId );
+        }
+    else if( aMediaId != oldMediaId )
+        {
+        RArray<TItemId> objectIds;
+        CleanupClosePushL( objectIds );
+        MMdsPreferences::UpdateL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, (TUint32) aMediaId );
+        SetFilesToNotPresentL( oldMediaId, EFalse, objectIds );
+        objectIds.Reset();
+        RemoveFilesNotPresentL( oldMediaId, &objectIds );
+        CleanupStack::PopAndDestroy( &objectIds );
+        }
+    }
+
 const CMdsPropertyDef& CMdSSqlObjectManipulate::ReadPropertyL( 
 		CMdCSerializationBuffer& aBuffer, const CMdsObjectDef& aObjectDef,
 		CMdsClauseBuffer& aBaseObjectClause, CMdsClauseBuffer& aObjectClause,