idlehomescreen/hscontentcontrol/src/hscontentcontrolfactory.cpp
branchRCL_3
changeset 17 b8fae6b8a148
parent 11 ff572dfe6d86
equal deleted inserted replaced
12:9674c1a575e9 17:b8fae6b8a148
    22 
    22 
    23 // User include files
    23 // User include files
    24 #include "xnappuiadapter.h"
    24 #include "xnappuiadapter.h"
    25 #include "hscontentcontrolfactory.h"
    25 #include "hscontentcontrolfactory.h"
    26 #include "hscontentcontrolecomlistener.h"
    26 #include "hscontentcontrolecomlistener.h"
    27 #include "hscontentcontroluninstallmonitor.h"
    27 #include "hscontentcontrolswilistener.h"
    28 
    28 
    29 // Local constants
    29 // Local constants
    30 
    30 
    31 // Content controller ECom interface UID
    31 // Content controller ECom interface UID
    32 const TUid KInterfaceUidContentController = { 0x20026F51 };
    32 const TUid KInterfaceUidContentController = { 0x20026F51 };
    79 //
    79 //
    80 void CHsContentControlFactory::ConstructL()
    80 void CHsContentControlFactory::ConstructL()
    81     {
    81     {
    82     iHsContentControlEComListener = 
    82     iHsContentControlEComListener = 
    83             CHsContentControlEComListener::NewL( *this );
    83             CHsContentControlEComListener::NewL( *this );
       
    84     iHsContentControlSwiListener = 
       
    85             CHsContentControlSwiListener::NewL( *this );
       
    86 
    84     REComSession::ListImplementationsL( 
    87     REComSession::ListImplementationsL( 
    85             KInterfaceUidContentController, iImplArray );
    88         KInterfaceUidContentController, iImplArray );
    86     
       
    87     iHsContentControlUninstallMonitor = 
       
    88             CHsContentControlUninstallMonitor::NewL( *this );
       
    89     }
    89     }
    90 
    90 
    91 // ----------------------------------------------------------------------------
    91 // ----------------------------------------------------------------------------
    92 // CHsContentControlFactory::CHsContentControlFactory()
    92 // CHsContentControlFactory::CHsContentControlFactory()
    93 // ----------------------------------------------------------------------------
    93 // ----------------------------------------------------------------------------
   100 // ----------------------------------------------------------------------------
   100 // ----------------------------------------------------------------------------
   101 // CHsContentControlFactory::~CHsContentControlFactory()
   101 // CHsContentControlFactory::~CHsContentControlFactory()
   102 // ----------------------------------------------------------------------------
   102 // ----------------------------------------------------------------------------
   103 //
   103 //
   104 EXPORT_C CHsContentControlFactory::~CHsContentControlFactory()
   104 EXPORT_C CHsContentControlFactory::~CHsContentControlFactory()
   105     {
   105     {    
   106     delete iHsContentControlEComListener;
   106 	delete iHsContentControlEComListener;
   107     delete iHsContentControlUninstallMonitor;
   107     delete iHsContentControlSwiListener;
   108     
   108     
   109     iImplArray.ResetAndDestroy();
   109     iImplArray.ResetAndDestroy();
   110     iImplArray.Close();
   110     iImplArray.Close();
   111     
   111 
   112     iHsContentControlUis.ResetAndDestroy();
   112     iHsContentControlUis.ResetAndDestroy();
   113     }
   113     }
   114 
   114 
   115 // ---------------------------------------------------------------------------------
   115 // ---------------------------------------------------------------------------------
   116 // CHsContentControlFactory::GetHsContentController()
   116 // CHsContentControlFactory::GetHsContentController()
   206         TRAP_IGNORE( CheckPluginChangesL(); );
   206         TRAP_IGNORE( CheckPluginChangesL(); );
   207         }
   207         }
   208     }
   208     }
   209 
   209 
   210 // ----------------------------------------------------------------------------
   210 // ----------------------------------------------------------------------------
   211 // CHsContentControlFactory::HandleUninstallEvent()
   211 // CHsContentControlFactory::HandleSwiEvent()
   212 // ----------------------------------------------------------------------------
   212 // ----------------------------------------------------------------------------
   213 //
   213 //
   214 void CHsContentControlFactory::HandleUninstallEvent( const TUid& aPkgUid )
   214 void CHsContentControlFactory::HandleSwiEvent( const RArray<TUid>& aUidList )
   215     {
   215     {
   216     // ignore event if no plugin loaded.
   216     // ignore event if no plugin loaded.
   217     if ( iHsContentControlUis.Count() > 0 )
   217     if ( iHsContentControlUis.Count() > 0 && aUidList.Count() > 0 )
   218         {
   218         {
   219         for( TInt index( iHsContentControlUis.Count() - 1 ); index >= 0; --index )
   219         for( TInt index( iHsContentControlUis.Count() - 1 ); index >= 0; --index )
   220             {
   220             {
   221             CHsContentControlUi* cc( iHsContentControlUis[ index ] );
   221             CHsContentControlUi* cc( iHsContentControlUis[ index ] );
   222             // ImplUid of plugin must match Sis pkg uid
   222             for( TInt uidIndex( aUidList.Count() - 1 ); uidIndex >= 0 && cc; --uidIndex )
   223             if ( cc && cc->ImplUid() == aPkgUid )
       
   224                 {
   223                 {
   225                 ReleaseHsCcUi( cc );
   224                 // ImplUid of plugin must match Sis pkg uid            
   226                 iHsContentControlUis.Remove( index );
   225                 if ( cc->ImplUid() == aUidList[uidIndex] )
   227                 delete cc;
   226                     {
   228                 cc = NULL;
   227                     // release ui and keep checking, multiple package might be being
   229                 break;
   228                     // processed by SWI, this events comes once for all packages. 
       
   229                     ReleaseHsCcUi( cc );
       
   230                     iHsContentControlUis.Remove( index );
       
   231                     delete cc;
       
   232                     cc = NULL;                    
       
   233                     }                
   230                 }
   234                 }
   231             }
   235             }
   232         }
   236         }
   233     }
   237     }
   234 
   238