idlehomescreen/xmluirendering/uiengine/src/xnviewdata.cpp
branchRCL_3
changeset 31 89165693e770
parent 28 d721605b30d0
equal deleted inserted replaced
28:d721605b30d0 31:89165693e770
    30 #include "xndomnode.h"
    30 #include "xndomnode.h"
    31 #include "xnnode.h"
    31 #include "xnnode.h"
    32 #include "xnoomsyshandler.h"
    32 #include "xnoomsyshandler.h"
    33 #include "ainativeuiplugins.h"
    33 #include "ainativeuiplugins.h"
    34 #include "xnpanic.h"
    34 #include "xnpanic.h"
       
    35 
    35 
    36 
    36 #include "debug.h"
    37 #include "debug.h"
    37 
    38 
    38 // Constants
    39 // Constants
    39 _LIT8( KNs, "namespace" );
    40 _LIT8( KNs, "namespace" );
   160 // CXnViewData::Load()
   161 // CXnViewData::Load()
   161 
   162 
   162 // -----------------------------------------------------------------------------
   163 // -----------------------------------------------------------------------------
   163 //
   164 //
   164 TInt CXnViewData::Load()
   165 TInt CXnViewData::Load()
   165     {   
   166     {
   166     iLoadError = KErrNone;
   167     TInt err( KErrNone );
   167     
   168             
   168     if ( Occupied() )
   169     if ( Occupied() )
   169         {
   170         {
   170         iLoadError = KErrInUse;
   171         err = KErrInUse;
   171         }      
   172         }      
   172     else if ( !CXnOomSysHandler::HeapAvailable( VIEW_MIN_MEM ) )
   173     else if ( !CXnOomSysHandler::HeapAvailable( VIEW_MIN_MEM ) )
   173         {                                
   174         {                                
   174         iLoadError = KErrNoMemory;
   175         err = KErrNoMemory;
   175         }
   176         }
   176     else
   177     else
   177         {
   178         {                
   178         TInt err( KErrNone );
       
   179         
       
   180         TRAP( err, err = iManager.Composer().ComposeViewL( *this ) );
   179         TRAP( err, err = iManager.Composer().ComposeViewL( *this ) );
   181     
   180     
   182         if ( err == KErrNone )
   181         if ( err == KErrNone )
   183             {
   182             {
   184             TRAP( err, iManager.Parser().LoadViewL( *this ) );
   183             TRAP( err, iManager.Parser().LoadViewL( *this ) );
   191                 {
   190                 {
   192                 if ( iPluginsData[i]->PluginId() != KNullDesC8 )
   191                 if ( iPluginsData[i]->PluginId() != KNullDesC8 )
   193                     {                    
   192                     {                    
   194                     TInt err2( iPluginsData[i]->Load() );
   193                     TInt err2( iPluginsData[i]->Load() );
   195                     
   194                     
   196                     if ( err2 == KXnErrPluginFailure )
   195                     if ( err2 == KXnErrWidgetPluginFailure )
   197                         {
   196                         {
   198                         err = err2;                                        
   197                         err = err2;                                        
   199                         }          
   198                         }          
   200                     else if ( err2 == KErrNoMemory )
   199                     else if ( err2 == KErrNoMemory )
   201                         {                                          
   200                         {                                          
   205                     }
   204                     }
   206                 }
   205                 }
   207                            
   206                            
   208             // Succesfully enough composed, publishers 
   207             // Succesfully enough composed, publishers 
   209             // will be loaded when view is activated
   208             // will be loaded when view is activated
   210             }    
   209             }                   
   211         
   210         }
   212         iLoadError = err;
   211     
   213         }
   212     iLoadError = err;
   214                        
   213                 
   215     return iLoadError;
   214     return iLoadError;
   216     }
   215     }
   217 
   216 
   218 // -----------------------------------------------------------------------------
   217 // -----------------------------------------------------------------------------
   219 // CXnViewData::Destroy()
   218 // CXnViewData::Destroy()
   575                 
   574                 
   576                 if ( plugin != this && plugin->Removable() )
   575                 if ( plugin != this && plugin->Removable() )
   577                     {
   576                     {
   578                     iManager.UnloadWidgetFromPluginL( *plugin, ETrue );
   577                     iManager.UnloadWidgetFromPluginL( *plugin, ETrue );
   579                     
   578                     
   580                     result = KXnErrPluginFailure;
   579                     result = KXnErrWidgetPluginFailure;
   581                     }                              
   580                     }                              
   582                 }
   581                 }
   583             }
   582             }
   584         
   583         
   585         TRAP_IGNORE( iManager.PublishersReadyL( *this, result ) );        
   584         TRAP_IGNORE( iManager.PublishersReadyL( *this, result ) );