idlehomescreen/xmluirendering/uiengine/src/xnviewdata.cpp
branchRCL_3
changeset 11 ff572dfe6d86
parent 9 f966699dea19
child 12 9674c1a575e9
equal deleted inserted replaced
9:f966699dea19 11:ff572dfe6d86
    29 #include "xndomnode.h"
    29 #include "xndomnode.h"
    30 #include "xnnode.h"
    30 #include "xnnode.h"
    31 #include "xnoomsyshandler.h"
    31 #include "xnoomsyshandler.h"
    32 #include "xnpanic.h"
    32 #include "xnpanic.h"
    33 
    33 
       
    34 #include "debug.h"
       
    35 
    34 // Constants
    36 // Constants
    35 _LIT8( KLockingStatusLocked, "locked" );
    37 const TInt KInterval( 10000 );
    36 
    38 
    37 // ============================ LOCAL FUNCTIONS ================================
    39 // ============================ LOCAL FUNCTIONS ================================
    38 
    40 
    39 // ============================ MEMBER FUNCTIONS ===============================
    41 // ============================ MEMBER FUNCTIONS ===============================
    40 // -----------------------------------------------------------------------------
    42 // -----------------------------------------------------------------------------
   211 // -----------------------------------------------------------------------------
   213 // -----------------------------------------------------------------------------
   212 // CXnViewData::Plugin()
   214 // CXnViewData::Plugin()
   213 // Finds plugin or view data based on node
   215 // Finds plugin or view data based on node
   214 // -----------------------------------------------------------------------------
   216 // -----------------------------------------------------------------------------
   215 //
   217 //
   216 CXnPluginData& CXnViewData::Plugin( CXnNode* aNode )
   218 CXnPluginData* CXnViewData::Plugin( CXnNode* aNode )
   217     {    
   219     {
       
   220     if ( !aNode ) { return NULL; }
       
   221 
   218     if ( aNode->ViewNodeImpl() )
   222     if ( aNode->ViewNodeImpl() )
   219         {
   223         {
   220         // Reached view, return self
   224         // Reached view, return self
   221         if ( Node()->LayoutNode() == aNode )
   225         if ( Node()->LayoutNode() == aNode )
   222             {
   226             {
   223             return *this;
   227             return this;
   224             }
   228             }
   225         }
   229         }
   226 
   230 
   227     for ( TInt i = 0; i < iPluginsData.Count(); i++ )
   231     for ( TInt i = 0; i < iPluginsData.Count(); i++ )
   228         {
   232         {
   229         if ( iPluginsData[i]->Owner()->LayoutNode() == aNode )
   233         if ( iPluginsData[i]->Owner()->LayoutNode() == aNode )
   230             {
   234             {
   231             return *iPluginsData[i];
   235             return iPluginsData[i];
   232             }
   236             }
   233         }
   237         }
   234 
   238 
   235     // Not found, try parent
   239     // Not found, try parent
   236     CXnNode* parent( aNode->Parent() );
   240     CXnNode* parent( aNode->Parent() );
   379         iPluginsData[i]->AppearanceNodesL( aList );
   383         iPluginsData[i]->AppearanceNodesL( aList );
   380         }
   384         }
   381     }
   385     }
   382 
   386 
   383 // -----------------------------------------------------------------------------
   387 // -----------------------------------------------------------------------------
       
   388 // CXnViewData::PopupNodesL()
       
   389 // Gets this view data's popup nodes
       
   390 // -----------------------------------------------------------------------------
       
   391 //
       
   392 void CXnViewData::PopupNodesL( RPointerArray< CXnNode >& aList ) const
       
   393     {
       
   394     // Get my Popup nodes
       
   395     CXnPluginData::PopupNodesL( aList );
       
   396 
       
   397     for ( TInt i = 0; i < iPluginsData.Count(); i++ )
       
   398         {
       
   399         // And Popup nodes which my plugin holds
       
   400         iPluginsData[i]->PopupNodesL( aList );
       
   401         }
       
   402     }
       
   403 
       
   404 // -----------------------------------------------------------------------------
   384 // CXnViewData::InitialFocusNodesL()
   405 // CXnViewData::InitialFocusNodesL()
   385 // Gets this view data's initial focus nodes
   406 // Gets this view data's initial focus nodes
   386 // -----------------------------------------------------------------------------
   407 // -----------------------------------------------------------------------------
   387 //
   408 //
   388 void CXnViewData::InitialFocusNodesL( RPointerArray< CXnNode >& aList ) const
   409 void CXnViewData::InitialFocusNodesL( RPointerArray< CXnNode >& aList ) const
   442         }
   463         }
   443     
   464     
   444     iLoader->Cancel();
   465     iLoader->Cancel();
   445     
   466     
   446     iLoadIndex = 0;
   467     iLoadIndex = 0;
   447             
   468                                 
   448     iLoader->Start( TTimeIntervalMicroSeconds32( 50 ),
   469     iLoader->Start( TTimeIntervalMicroSeconds32( KInterval ),
   449                     TTimeIntervalMicroSeconds32( 50 ),
   470                     TTimeIntervalMicroSeconds32( KInterval ),
   450                     TCallBack( DoLoadPublishersL, this ) );           
   471                     TCallBack( DoLoadPublishersL, this ) );           
   451     }
   472     }
   452 
   473 
   453 // -----------------------------------------------------------------------------
   474 // -----------------------------------------------------------------------------
   454 // CXnViewData::DoLoadPublishersL()
   475 // CXnViewData::DoLoadPublishersL()
   455 // 
   476 // 
   456 // -----------------------------------------------------------------------------
   477 // -----------------------------------------------------------------------------
   457 //
   478 //
   458 /* static */ TInt CXnViewData::DoLoadPublishersL( TAny* aAny )
   479 /* static */ TInt CXnViewData::DoLoadPublishersL( TAny* aAny )
   459     {
   480     {
       
   481     __PRINTS( "*** CXnViewData::DoLoadPublishersL" );
       
   482     
   460     CXnViewData* self = static_cast< CXnViewData* >( aAny );
   483     CXnViewData* self = static_cast< CXnViewData* >( aAny );
   461     
   484     
   462     RPointerArray< CXnPluginData >& plugins( self->PluginData() );
   485     RPointerArray< CXnPluginData >& plugins( self->PluginData() );
   463     
   486     
   464     for ( TInt i = self->iLoadIndex; i < plugins.Count(); i++ )
   487     for ( TInt i = self->iLoadIndex; i < plugins.Count(); i++ )
   510                              
   533                              
   511         if ( self->iShowContentRemoved )
   534         if ( self->iShowContentRemoved )
   512             {
   535             {
   513             self->ShowContentRemovedError();
   536             self->ShowContentRemovedError();
   514             self->iShowContentRemoved = EFalse;
   537             self->iShowContentRemoved = EFalse;
   515             }              
   538             }           
   516         }                  
   539         }                  
   517             
   540             
       
   541     __PRINTS( "*** CXnViewData::DoLoadPublishersL - done" );
       
   542     
   518     return KErrNone;       
   543     return KErrNone;       
   519     }
   544     }
   520 
   545 
   521 // -----------------------------------------------------------------------------
   546 // -----------------------------------------------------------------------------
   522 // CXnViewData::DestroyPublishers
   547 // CXnViewData::DestroyPublishers
   523 // Remove data plugins associated to the plugin
   548 // Remove data plugins associated to the plugin
   524 // -----------------------------------------------------------------------------
   549 // -----------------------------------------------------------------------------
   525 //
   550 //
   526 void CXnViewData::DestroyPublishers( TInt aReason )
   551 void CXnViewData::DestroyPublishers( TInt aReason )
   527     {
   552     {
       
   553     __PRINTS( "*** CXnViewData::DestroyPublishers" );
       
   554     
   528     if ( Occupied() )
   555     if ( Occupied() )
   529         {
   556         {
   530         // If not all plugins loaded yet               
   557         // If not all plugins loaded yet               
   531         iLoader->Cancel();                                  
   558         iLoader->Cancel();                                  
   532         
   559         
   533         TRAP_IGNORE( DoDestroyPublishersL( aReason ) );
   560         TRAP_IGNORE( DoDestroyPublishersL( aReason ) );
   534         
   561         
   535         User::Heap().Compress();        
   562         User::Heap().Compress();        
   536         }
   563         }
       
   564     
       
   565     __PRINTS( "*** CXnViewData::DestroyPublishers - done" );
   537     }
   566     }
   538 
   567 
   539 // -----------------------------------------------------------------------------
   568 // -----------------------------------------------------------------------------
   540 // CXnPluginData::DoDestroyPublishersL
   569 // CXnPluginData::DoDestroyPublishersL
   541 // Remove data plugins associated to the plugin
   570 // Remove data plugins associated to the plugin
   542 // -----------------------------------------------------------------------------
   571 // -----------------------------------------------------------------------------
   543 //
   572 //
   544 void CXnViewData::DoDestroyPublishersL( TInt aReason )
   573 void CXnViewData::DoDestroyPublishersL( TInt aReason )
   545     {
   574     {
       
   575     __TIME_MARK( time );
       
   576     
   546     // Create list of data plugins to be removed    
   577     // Create list of data plugins to be removed    
   547     RPointerArray< CXnNode > publishers;
   578     RPointerArray< CXnNode > publishers;
   548     CleanupClosePushL( publishers );
   579     CleanupClosePushL( publishers );
   549     
   580     
   550     TRAP_IGNORE( ContentSourceNodesL( publishers ) );
   581     TRAP_IGNORE( ContentSourceNodesL( publishers ) );
   554         // Destruction is synchronous
   585         // Destruction is synchronous
   555         iManager.AppUiAdapter().DestroyPublisher( 
   586         iManager.AppUiAdapter().DestroyPublisher( 
   556             publishers[i]->AppIfL(), aReason );        
   587             publishers[i]->AppIfL(), aReason );        
   557         }
   588         }
   558         
   589         
   559     CleanupStack::PopAndDestroy( &publishers );    
   590     CleanupStack::PopAndDestroy( &publishers );
   560     }
   591     
   561 
   592     __TIME_ENDMARK( "CXnViewData::DoDestroyPublishersL, done", time );
   562 // -----------------------------------------------------------------------------
       
   563 // CXnViewData::SetLockingStatus
       
   564 // Sets view's locking_status attribute ("locked"/"none")
       
   565 // -----------------------------------------------------------------------------
       
   566 //
       
   567 void CXnViewData::SetLockingStatus( const TDesC8& aLockingStatusString )
       
   568     {
       
   569     if( ( aLockingStatusString != KNullDesC8 ) && 
       
   570         ( aLockingStatusString.Match( KLockingStatusLocked ) == 0 ) )
       
   571         {
       
   572         iFlags.Clear( EIsRemovable );
       
   573         }
       
   574     else
       
   575         {
       
   576         iFlags.Set( EIsRemovable );
       
   577         }
       
   578     }
   593     }
   579 
   594 
   580 // End of file
   595 // End of file