idlefw/plugins/sapidataplugin/src/sapidataplugin.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 12 502e5d91ad42
child 15 a0713522ab97
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
    32 #include <aicontentobserver.h>
    32 #include <aicontentobserver.h>
    33 #include <aiutility.h>
    33 #include <aiutility.h>
    34 #include <aipspropertyobserver.h>
    34 #include <aipspropertyobserver.h>
    35 #include <aipluginsettings.h>
    35 #include <aipluginsettings.h>
    36 #include <activeidle2domainpskeys.h>
    36 #include <activeidle2domainpskeys.h>
       
    37 #include <debug.h>
    37 
    38 
    38 #include "sapidatapluginconst.h"
    39 #include "sapidatapluginconst.h"
    39 #include "sapidatapluginuids.hrh"
    40 #include "sapidatapluginuids.hrh"
    40 #include "sapidataplugin.h"
    41 #include "sapidataplugin.h"
    41 #include "sapidata.h"
    42 #include "sapidata.h"
    76 // ---------------------------------------------------------------------------
    77 // ---------------------------------------------------------------------------
    77 // Default constructor
    78 // Default constructor
    78 // ---------------------------------------------------------------------------
    79 // ---------------------------------------------------------------------------
    79 //
    80 //
    80 CSapiDataPlugin::CSapiDataPlugin()
    81 CSapiDataPlugin::CSapiDataPlugin()
    81     : iNetworkStatus( EUnknown ), iPluginState( ENone ) 
    82     : iNetworkStatus( EUnknown ), iPluginState( ENone )
    82     {
    83     {
    83     }
    84     }
    84     
    85     
    85 // ---------------------------------------------------------------------------
    86 // ---------------------------------------------------------------------------
    86 // Symbian 2nd phase constructor can leave
    87 // Symbian 2nd phase constructor can leave
    99 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
   100 //
   101 //
   101 CSapiDataPlugin::~CSapiDataPlugin()
   102 CSapiDataPlugin::~CSapiDataPlugin()
   102     {
   103     {
   103     // deactivate the publishers
   104     // deactivate the publishers
   104     if ( iData )
   105     delete iData;
   105         {
       
   106         TRAP_IGNORE( iData->ChangePublisherStatusL( KDeActive ));
       
   107         
       
   108         delete iData;
       
   109         }
       
   110     
       
   111     iObservers.Close();
   106     iObservers.Close();
   112     Release( iContent );
   107     Release( iContent );
   113 
       
   114     iDataArray.ResetAndDestroy();
   108     iDataArray.ResetAndDestroy();
   115 
   109 
   116     if ( iContentModel )
   110     if ( iContentModel )
   117         {
   111         {
   118         for ( TInt i = iDataCount - 1; i >= 0  ; i-- )
   112         for ( TInt i = iDataCount - 1; i >= 0  ; i-- )
   122         
   116         
   123         delete [] iContentModel;
   117         delete [] iContentModel;
   124         }
   118         }
   125     
   119     
   126     iIconArray.Reset();
   120     iIconArray.Reset();
   127     
       
   128     iRfs.Close();
   121     iRfs.Close();
   129     }
   122     }
   130 
   123 
   131 
   124 
   132 // ---------------------------------------------------------------------------
   125 // ---------------------------------------------------------------------------
   150             }
   143             }
   151 
   144 
   152 		// Release memory of the published text
   145 		// Release memory of the published text
   153         iDataArray.ResetAndDestroy();
   146         iDataArray.ResetAndDestroy();
   154         // Release memory of the published icons
   147         // Release memory of the published icons
   155         iIconArray.Reset();
   148         iIconArray.Reset();        
   156         
   149         }        
   157         }    
       
   158     }
   150     }
   159 
   151 
   160 // ---------------------------------------------------------------------------
   152 // ---------------------------------------------------------------------------
   161 // Publish a specific text of the widget  
   153 // Publish a specific text of the widget  
   162 // ---------------------------------------------------------------------------
   154 // ---------------------------------------------------------------------------
   357 	
   349 	
   358 	return KNullDesC();
   350 	return KNullDesC();
   359 	}
   351 	}
   360 
   352 
   361 // ---------------------------------------------------------------------------
   353 // ---------------------------------------------------------------------------
   362 //Refresh a specific image of text in the widget
   354 //Refresh a specific image or text in the widget
   363 // ---------------------------------------------------------------------------
   355 // ---------------------------------------------------------------------------
   364 //
   356 //
   365 void CSapiDataPlugin::RefreshL( TDesC& aContentType,
   357 void CSapiDataPlugin::RefreshL( TDesC& aContentType,
   366                                 TDesC& aOperation,
   358                                 TDesC& aOperation,
   367                                 CLiwDefaultMap* aDataMap )
   359                                 CLiwDefaultMap* aDataMap )
   368     {    
   360     {
       
   361     __PRINTS("*** CSapiDataPlugin::RefreshL ***");
       
   362     
       
   363     __PRINT( __DBG_FORMAT( "* Publisher name: %S, uid: 0x%x, content type: %S, operation: %S" ),          
       
   364         &PublisherInfo().Name(), PublisherInfo().Uid().iUid, &aContentType, &aOperation ); 
       
   365         
   369     const TInt observerCount( iObservers.Count() );    
   366     const TInt observerCount( iObservers.Count() );    
   370     const TInt transactionId = reinterpret_cast<TInt>( this );
   367     const TInt transactionId = reinterpret_cast<TInt>( this );
   371     
   368     
   372     for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ )
   369     for( TInt obsIndex = 0; obsIndex < observerCount; obsIndex++ )
   373         {
   370         {
   396     
   393     
   397         // Relese memory of the published text
   394         // Relese memory of the published text
   398         iDataArray.ResetAndDestroy();
   395         iDataArray.ResetAndDestroy();
   399         iIconArray.Reset();
   396         iIconArray.Reset();
   400         }
   397         }
       
   398     
       
   399     __PRINTS("*** CSapiDataPlugin::RefreshL - done ***");
   401     }
   400     }
   402 
   401 
   403 // ---------------------------------------------------------------------------
   402 // ---------------------------------------------------------------------------
   404 // Cleans a data from the widget
   403 // Cleans a data from the widget
   405 // ---------------------------------------------------------------------------
   404 // ---------------------------------------------------------------------------
   452         TRAP_IGNORE( iData->ChangePublisherStatusL( KPageShutdown ));
   451         TRAP_IGNORE( iData->ChangePublisherStatusL( KPageShutdown ));
   453         }
   452         }
   454     else if( aReason == EPluginShutdown )
   453     else if( aReason == EPluginShutdown )
   455         {
   454         {
   456         TRAP_IGNORE( iData->ChangePublisherStatusL( KPluginShutdown ));
   455         TRAP_IGNORE( iData->ChangePublisherStatusL( KPluginShutdown ));
       
   456         }
       
   457 
       
   458     if ( iData )
       
   459         {
       
   460         TRAP_IGNORE( iData->ChangePublisherStatusL( KDeActive ));
   457         }
   461         }
   458     }
   462     }
   459 
   463 
   460 // ----------------------------------------------------------------------------
   464 // ----------------------------------------------------------------------------
   461 // CSapiDataPlugin::Resume
   465 // CSapiDataPlugin::Resume
   631     // We own the array so destroy it
   635     // We own the array so destroy it
   632     aSettings.ResetAndDestroy();    
   636     aSettings.ResetAndDestroy();    
   633     }
   637     }
   634 
   638 
   635 // ----------------------------------------------------------------------------
   639 // ----------------------------------------------------------------------------
       
   640 // CSapiDataPlugin::SetProperty
       
   641 //
       
   642 // ----------------------------------------------------------------------------
       
   643 //
       
   644 void CSapiDataPlugin::SetProperty( TProperty aProperty, TAny* aAny )
       
   645     {
       
   646     if (aProperty == ECpsCmdBuffer )
       
   647         {
       
   648         iData->SetCommandBuffer( aAny );
       
   649         }
       
   650     }
       
   651 // ----------------------------------------------------------------------------
   636 // CSapiDataPlugin::GetProperty
   652 // CSapiDataPlugin::GetProperty
   637 //
   653 //
   638 // ----------------------------------------------------------------------------
   654 // ----------------------------------------------------------------------------
   639 //
   655 //
   640 TAny* CSapiDataPlugin::GetProperty( TProperty aProperty )
   656 TAny* CSapiDataPlugin::GetProperty( TProperty aProperty )