idlehomescreen/xmluirendering/uiengine/src/xnrootdata.cpp
branchRCL_3
changeset 102 ba63c83f4716
parent 93 b01126ce0bec
equal deleted inserted replaced
93:b01126ce0bec 102:ba63c83f4716
    43 
    43 
    44 #include "debug.h"
    44 #include "debug.h"
    45 
    45 
    46 // Constants
    46 // Constants
    47 const TInt KScheduleInterval( 2000000 );
    47 const TInt KScheduleInterval( 2000000 );
    48 _LIT8( KTemplateViewUID, "0x20026f50" );
       
    49 
    48 
    50 // ============================ LOCAL FUNCTIONS ================================
    49 // ============================ LOCAL FUNCTIONS ================================
    51 
    50 
    52 // ============================ MEMBER FUNCTIONS ===============================
    51 // ============================ MEMBER FUNCTIONS ===============================
    53 // -----------------------------------------------------------------------------
    52 // -----------------------------------------------------------------------------
    93 // C++ default destructor.
    92 // C++ default destructor.
    94 // -----------------------------------------------------------------------------
    93 // -----------------------------------------------------------------------------
    95 //
    94 //
    96 CXnRootData::~CXnRootData()
    95 CXnRootData::~CXnRootData()
    97     {
    96     {
    98     delete iTemplateViewUid;
       
    99     iTemplateViewUid = NULL;
       
   100     
       
   101     if ( iLoadTimer )
    97     if ( iLoadTimer )
   102         {
    98         {
   103         iLoadTimer->Cancel();
    99         iLoadTimer->Cancel();
   104         }
   100         }
   105     
   101     
   252 // -----------------------------------------------------------------------------
   248 // -----------------------------------------------------------------------------
   253 // CXnRootData::LoadRemainingViews()
   249 // CXnRootData::LoadRemainingViews()
   254 // 
   250 // 
   255 // -----------------------------------------------------------------------------
   251 // -----------------------------------------------------------------------------
   256 //
   252 //
   257 void CXnRootData::LoadRemainingViewsL()
   253 void CXnRootData::LoadRemainingViews()
   258     {
   254     {
   259     if ( iFlags.IsClear( EIsDispose ) )
   255     if ( iFlags.IsClear( EIsDispose ) )
   260         {
   256         {
   261         if ( !AllViewsLoaded() )
   257         if ( !AllViewsLoaded() )
   262             {
   258             {
   424         return static_cast< CXnViewData& >( *iPluginsData[ 0 ] );        
   420         return static_cast< CXnViewData& >( *iPluginsData[ 0 ] );        
   425         }
   421         }
   426     }
   422     }
   427 
   423 
   428 // -----------------------------------------------------------------------------
   424 // -----------------------------------------------------------------------------
   429 // CXnRootData::ViewData()
       
   430 // -----------------------------------------------------------------------------
       
   431 //
       
   432 CXnViewData* CXnRootData::ViewData( CXnNode& aNode ) const
       
   433     {
       
   434     CXnNode* tmp( &aNode );
       
   435     CXnNode* viewNode( NULL );
       
   436     while( tmp )
       
   437         {
       
   438         if ( tmp->ViewNodeImpl() )
       
   439             {
       
   440             viewNode = tmp;
       
   441             break;
       
   442             }
       
   443         else
       
   444             {
       
   445             tmp = tmp->Parent();
       
   446             }
       
   447         }
       
   448     if( !viewNode )
       
   449         {
       
   450         return NULL;
       
   451         }
       
   452 
       
   453     CXnViewData* viewData( NULL );
       
   454     for ( TInt i = 0; i < iPluginsData.Count(); i++ )
       
   455         {
       
   456         CXnViewData* tmpViewdata( static_cast< CXnViewData* >( iPluginsData[i] ) );
       
   457         if( tmpViewdata->ViewNode() == viewNode )
       
   458             {
       
   459             viewData = tmpViewdata;
       
   460             break;
       
   461             }
       
   462         }
       
   463     
       
   464     return viewData;
       
   465     }
       
   466 
       
   467     
       
   468 // -----------------------------------------------------------------------------
       
   469 // CXnRootData::DestroyViewData()
   425 // CXnRootData::DestroyViewData()
   470 // Sets view data to be destroyed
   426 // Sets view data to be destroyed
   471 // -----------------------------------------------------------------------------
   427 // -----------------------------------------------------------------------------
   472 //
   428 //
   473 void CXnRootData::DestroyViewData( CXnViewData* aViewData )
   429 void CXnRootData::DestroyViewData( CXnViewData* aViewData )
   476     
   432     
   477     if ( index != KErrNotFound )
   433     if ( index != KErrNotFound )
   478         {
   434         {
   479         iPluginsData.Remove( index );
   435         iPluginsData.Remove( index );
   480                 
   436                 
   481         if ( iViewsToDestroy.Find( aViewData ) == KErrNotFound && 
   437         if ( iViewsToDestroy.Find( aViewData ) == KErrNotFound )
   482            iViewsToDestroy.Append( aViewData ) == KErrNone )
   438             {
   483             {
   439             iViewsToDestroy.Append( aViewData );
       
   440             
   484             iDestroyTimer->Cancel();
   441             iDestroyTimer->Cancel();
   485             
   442             
   486             iDestroyTimer->Start( TTimeIntervalMicroSeconds32( 0 ),
   443             iDestroyTimer->Start( TTimeIntervalMicroSeconds32( 0 ),
   487                                   TTimeIntervalMicroSeconds32( 0 ),
   444                                   TTimeIntervalMicroSeconds32( 0 ),
   488                                   TCallBack( RunDestroyL, this ) );                       
   445                                   TCallBack( RunDestroyL, this ) );                       
   640 //
   597 //
   641 TInt32 CXnRootData::MaxPages()
   598 TInt32 CXnRootData::MaxPages()
   642     {
   599     {
   643     return iMaxPages;
   600     return iMaxPages;
   644     }
   601     }
   645 
       
   646 // ---------------------------------------------------------------------------
       
   647 // Returns TemplateViewUid
       
   648 // ---------------------------------------------------------------------------
       
   649 //
       
   650 const TDesC8& CXnRootData::TemplateViewUid() const
       
   651     {
       
   652     const TDesC8& templateViewUid = KTemplateViewUID;
       
   653     return iTemplateViewUid ? *iTemplateViewUid : templateViewUid; // qhd uid
       
   654     };
       
   655 
       
   656 // ---------------------------------------------------------------------------
       
   657 // Sets TemplateViewUid
       
   658 // ---------------------------------------------------------------------------
       
   659 //
       
   660 void CXnRootData::SetTemplateViewUidL( const TDesC8& aTemplateViewUid )
       
   661     {
       
   662     delete iTemplateViewUid;
       
   663     iTemplateViewUid = NULL;
       
   664 
       
   665     iTemplateViewUid = aTemplateViewUid.AllocL();
       
   666     };
       
   667 
   602 
   668 // -----------------------------------------------------------------------------
   603 // -----------------------------------------------------------------------------
   669 // CXnRootData::RunDestroyL()
   604 // CXnRootData::RunDestroyL()
   670 // 
   605 // 
   671 // -----------------------------------------------------------------------------
   606 // -----------------------------------------------------------------------------