idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp
branchRCL_3
changeset 19 502e5d91ad42
parent 18 bd874ee5e5e2
child 51 15e4dd19031c
equal deleted inserted replaced
18:bd874ee5e5e2 19:502e5d91ad42
   360 
   360 
   361 // ---------------------------------------------------------------------------
   361 // ---------------------------------------------------------------------------
   362 //Refresh a specific image of text in the widget
   362 //Refresh a specific image of text in the widget
   363 // ---------------------------------------------------------------------------
   363 // ---------------------------------------------------------------------------
   364 //
   364 //
   365 void CSapiDataPlugin::RefreshL(TDesC& aContentType, TDesC& aOperation)
   365 void CSapiDataPlugin::RefreshL( TDesC& aContentType,
   366     {     
   366                                 TDesC& aOperation,
   367 	 TInt observers( iObservers.Count() );        
   367                                 CLiwDefaultMap* aDataMap )
   368 	 TInt transactionId = reinterpret_cast<TInt>( this );
   368     {    
   369 	 
   369     const TInt observerCount( iObservers.Count() );    
   370 	 for ( TInt obsIndex = 0; obsIndex < observers; obsIndex++ )
   370     const TInt transactionId = reinterpret_cast<TInt>( this );
   371 		{
   371     
   372 		MAiContentObserver* observer = iObservers[obsIndex];
   372     for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ )
   373 		
   373         {
   374 		if ( observer->StartTransaction( transactionId ) == KErrNone ) 				
   374         MAiContentObserver* observer = iObservers[obsIndex];
   375 			{
   375     
   376 			if ( aOperation != KOperationDelete )
   376         if( observer->StartTransaction( transactionId ) == KErrNone ) 				
   377 				{
   377             {
   378 				iData->PublishL( observer, aContentType );
   378             if ( aOperation != KOperationDelete )
   379 				}
   379                 {
   380 			else
   380                 if( aDataMap )
   381 				{
   381                     {
   382 				iData->RemoveL( observer, aContentType  );	
   382                     iData->PublishDataL( observer, aDataMap );
   383 				}
   383                     }
   384 			
   384                 else
   385 			observer->Commit( transactionId );
   385                     {
   386 			}
   386                     iData->PublishL( observer, aContentType );
   387 		
   387                     }            
   388 		 // Relese memory of the published text
   388                 }
   389          iDataArray.ResetAndDestroy();
   389             else
   390 		 iIconArray.Reset();
   390                 {
   391 		}	 
   391                 iData->RemoveL( observer, aContentType  );
       
   392                 }
       
   393     
       
   394             observer->Commit( transactionId );
       
   395             }
       
   396     
       
   397         // Relese memory of the published text
       
   398         iDataArray.ResetAndDestroy();
       
   399         iIconArray.Reset();
       
   400         }
   392     }
   401     }
   393 
   402 
   394 // ---------------------------------------------------------------------------
   403 // ---------------------------------------------------------------------------
   395 // Cleans a data from the widget
   404 // Cleans a data from the widget
   396 // ---------------------------------------------------------------------------
   405 // ---------------------------------------------------------------------------
   411 //
   420 //
   412 void CSapiDataPlugin::Start( TStartReason aReason )
   421 void CSapiDataPlugin::Start( TStartReason aReason )
   413     {
   422     {
   414     if( aReason == ESystemStartup )
   423     if( aReason == ESystemStartup )
   415         {
   424         {
       
   425         TRAP_IGNORE( PublishL() );
   416         TRAP_IGNORE( iData->SetStartupReasonL( KSystemStartup ));
   426         TRAP_IGNORE( iData->SetStartupReasonL( KSystemStartup ));
   417         }
   427         }
   418     else if( aReason == EPageStartup )
   428     else if( aReason == EPageStartup )
   419         {
   429         {
   420         TRAP_IGNORE( iData->SetStartupReasonL( KPageStartup ));
   430         TRAP_IGNORE( iData->SetStartupReasonL( KPageStartup ));
   421         }
   431         }
   422     else if( aReason == EPluginStartup )
   432     else if( aReason == EPluginStartup )
   423         {
   433         {
       
   434         TRAP_IGNORE( PublishL() );
   424         TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup));
   435         TRAP_IGNORE( iData->SetStartupReasonL( KPluginStartup));
   425         }
   436         }
   426     }
   437     }
   427 
   438 
   428 // ----------------------------------------------------------------------------
   439 // ----------------------------------------------------------------------------
   598         iData->SetContentIdL( PublisherInfo().Namespace() );
   609         iData->SetContentIdL( PublisherInfo().Namespace() );
   599         
   610         
   600         // Configurations 
   611         // Configurations 
   601         iData->ConfigureL( configurationItemsArr );
   612         iData->ConfigureL( configurationItemsArr );
   602         
   613         
       
   614         iPluginState = ESuspend;
       
   615         
   603         // Activate the publisher
   616         // Activate the publisher
   604         iData->ChangePublisherStatusL( KActive );
   617         iData->ChangePublisherStatusL( KActive );
   605         iData->TriggerActiveL();
       
   606                 
       
   607         // Register for notifications
   618         // Register for notifications
   608         iData->RegisterPublisherObserverL();
   619         iData->RegisterPublisherObserverL();
   609         
   620         // Execute the active trigger 
   610         PublishL();
   621         iData->TriggerActiveL();
   611         
   622         // There must be at least 1 milli second delay 
   612         iPluginState = ESuspend;
   623         // to register the second observer as both are using the 
   613         
   624         // same MLiwInterface object
   614         iData->RegisterContentObserverL();
   625         iData->RegisterContentObserverL();
   615         }
   626         }
   616     
   627     
   617     contentItemsArr.Reset();
   628     contentItemsArr.Reset();
   618     configurationItemsArr.Reset();
   629     configurationItemsArr.Reset();