mpx/collectionframework/collectionengine/src/mpxcollectionengine.cpp
changeset 27 cbb1bfb7ebfb
parent 25 d881023c13eb
child 48 b7b49303d0c0
child 51 e61a04404bdf
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
   192     MPX_FUNC("CMPXCollectionEngine::NotifyL");
   192     MPX_FUNC("CMPXCollectionEngine::NotifyL");
   193 
   193 
   194     TInt command = KErrNotSupported;
   194     TInt command = KErrNotSupported;
   195     TInt data = 0;
   195     TInt data = 0;
   196     TBool clearCache ( EFalse );
   196     TBool clearCache ( EFalse );
       
   197     TBool notify( ETrue );
       
   198     TInt count = iContexts.Count();
       
   199     CMPXCollectionClientContext* context( NULL );
   197     switch( aMsg )
   200     switch( aMsg )
   198         {
   201         {
   199         case EMcMsgFormatStart:
   202         case EMcMsgFormatStart:
   200         case EMcMsgDiskRemoved:
   203         case EMcMsgDiskRemoved:
   201         case EMcMsgUSBMassStorageStart:
   204         case EMcMsgUSBMassStorageStart:
   205 
   208 
   206             // Clear the cache
   209             // Clear the cache
   207             clearCache = ETrue;
   210             clearCache = ETrue;
   208             break;
   211             break;
   209             }
   212             }
       
   213         case EMcMsgDiskInserted:        	
       
   214             for( TInt i=0; i<count; ++i )
       
   215                 {
       
   216                 context = iContexts[i];
       
   217                 context->NotifyL( aMsg, aData );
       
   218                 }
       
   219             notify = EFalse;
   210         case EMcMsgFormatEnd:
   220         case EMcMsgFormatEnd:
   211         case EMcMsgDiskInserted:
       
   212         case EMcMsgUSBMassStorageEnd:
   221         case EMcMsgUSBMassStorageEnd:
   213             {
   222             {
   214             command = EMcReOpenCollection;
   223             command = EMcReOpenCollection;
   215             data = aData;
   224             data = aData;
   216             
   225             
   251         default:
   260         default:
   252             break;
   261             break;
   253         }
   262         }
   254     if( command != KErrNotSupported )
   263     if( command != KErrNotSupported )
   255         {
   264         {
   256         TArray<CMPXCollectionPlugin*> plugins = iPluginHandler->LoadedPlugins();
   265         Command( (TMPXCollectionCommand)command, data );
   257         for( TInt i=0; i<plugins.Count(); ++i )
       
   258             {
       
   259             CMPXCollectionPlugin* plugin = plugins[i];
       
   260             TRAP_IGNORE(plugin->CommandL( (TMPXCollectionCommand)command, data));
       
   261             }
       
   262         }
   266         }
   263 
   267 
   264     if( clearCache )
   268     if( clearCache )
   265     	{
   269     	{
   266         RFs rfs;
   270         RFs rfs;
   284         	iCache->Reset();
   288         	iCache->Reset();
   285         	}
   289         	}
   286         rfs.Close();
   290         rfs.Close();
   287     	}
   291     	}
   288     
   292     
   289     TInt count = iContexts.Count();
   293     if ( notify )
   290     for( TInt i=0; i<count; ++i )
   294     	{
   291         {
   295 		for( TInt i=0; i<count; ++i )
   292         CMPXCollectionClientContext* context;
   296 			{
   293         context = iContexts[i];
   297 			context = iContexts[i];
   294         context->NotifyL( aMsg, aData );
   298 			context->NotifyL( aMsg, aData );
       
   299 			}
       
   300     	}
       
   301     }
       
   302 void CMPXCollectionEngine::Command( TMPXCollectionCommand aCmd, TInt aData )
       
   303     {
       
   304     TArray<CMPXCollectionPlugin*> plugins = iPluginHandler->LoadedPlugins();
       
   305     for( TInt i=0; i<plugins.Count(); ++i )
       
   306         {
       
   307         CMPXCollectionPlugin* plugin = plugins[i];
       
   308         TRAP_IGNORE(plugin->CommandL( aCmd, aData));
   295         }
   309         }
   296     }
   310     }
   297 
   311 
   298 // ----------------------------------------------------------------------------
   312 // ----------------------------------------------------------------------------
   299 // Retrieves all of the supported types in the collection
   313 // Retrieves all of the supported types in the collection