mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp
changeset 27 cbb1bfb7ebfb
parent 25 d881023c13eb
child 48 b7b49303d0c0
child 51 e61a04404bdf
--- a/mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp	Mon May 03 12:58:40 2010 +0300
+++ b/mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp	Fri May 14 16:21:14 2010 +0300
@@ -194,6 +194,9 @@
     TInt command = KErrNotSupported;
     TInt data = 0;
     TBool clearCache ( EFalse );
+    TBool notify( ETrue );
+    TInt count = iContexts.Count();
+    CMPXCollectionClientContext* context( NULL );
     switch( aMsg )
         {
         case EMcMsgFormatStart:
@@ -207,8 +210,14 @@
             clearCache = ETrue;
             break;
             }
+        case EMcMsgDiskInserted:        	
+            for( TInt i=0; i<count; ++i )
+                {
+                context = iContexts[i];
+                context->NotifyL( aMsg, aData );
+                }
+            notify = EFalse;
         case EMcMsgFormatEnd:
-        case EMcMsgDiskInserted:
         case EMcMsgUSBMassStorageEnd:
             {
             command = EMcReOpenCollection;
@@ -253,12 +262,7 @@
         }
     if( command != KErrNotSupported )
         {
-        TArray<CMPXCollectionPlugin*> plugins = iPluginHandler->LoadedPlugins();
-        for( TInt i=0; i<plugins.Count(); ++i )
-            {
-            CMPXCollectionPlugin* plugin = plugins[i];
-            TRAP_IGNORE(plugin->CommandL( (TMPXCollectionCommand)command, data));
-            }
+        Command( (TMPXCollectionCommand)command, data );
         }
 
     if( clearCache )
@@ -286,12 +290,22 @@
         rfs.Close();
     	}
     
-    TInt count = iContexts.Count();
-    for( TInt i=0; i<count; ++i )
+    if ( notify )
+    	{
+		for( TInt i=0; i<count; ++i )
+			{
+			context = iContexts[i];
+			context->NotifyL( aMsg, aData );
+			}
+    	}
+    }
+void CMPXCollectionEngine::Command( TMPXCollectionCommand aCmd, TInt aData )
+    {
+    TArray<CMPXCollectionPlugin*> plugins = iPluginHandler->LoadedPlugins();
+    for( TInt i=0; i<plugins.Count(); ++i )
         {
-        CMPXCollectionClientContext* context;
-        context = iContexts[i];
-        context->NotifyL( aMsg, aData );
+        CMPXCollectionPlugin* plugin = plugins[i];
+        TRAP_IGNORE(plugin->CommandL( aCmd, aData));
         }
     }