idlehomescreen/xmluirendering/uiengine/src/xncomposer.cpp
changeset 2 08c6ee43b396
parent 0 f72a12da539e
child 5 c743ef5928ba
equal deleted inserted replaced
1:5315654608de 2:08c6ee43b396
    30 #include "xndomnode.h"
    30 #include "xndomnode.h"
    31 #include "xndomlist.h"
    31 #include "xndomlist.h"
    32 #include "xndomattribute.h"
    32 #include "xndomattribute.h"
    33 #include "xnpanic.h"
    33 #include "xnpanic.h"
    34 #include "xnplugindefs.h"
    34 #include "xnplugindefs.h"
       
    35 #include "xnviewmanager.h"
       
    36 #include "xneditor.h"
       
    37 #include "xnbackgroundmanager.h"
    35 
    38 
    36 // Constants
    39 // Constants
    37 _LIT8( KStateWaitConfirmation, "WaitForConfirmation" );
    40 _LIT8( KStateWaitConfirmation, "WaitForConfirmation" );
    38 _LIT8( KStateError, "Error" );
    41 _LIT8( KStateError, "Error" );
    39 
    42 
    50 _LIT8( KTagXuikon, "xuikon" );
    53 _LIT8( KTagXuikon, "xuikon" );
    51 
    54 
    52 using namespace hspswrapper;
    55 using namespace hspswrapper;
    53 
    56 
    54 // ======== LOCAL FUNCTIONS ========
    57 // ======== LOCAL FUNCTIONS ========
       
    58 // --------------------------------------------------------------------------
       
    59 // ItemValueL
       
    60 // Get property value from configuration.
       
    61 // --------------------------------------------------------------------------
       
    62 //
       
    63 static HBufC* ItemValueL( CHspsConfiguration& aConfiguration, const TDesC8& aItemId, const TDesC8& aName  )
       
    64     {
       
    65     HBufC* ret = NULL;
       
    66 
       
    67     RPointerArray<CItemMap>& settingsList = aConfiguration.Settings();    
       
    68     for( TInt i = 0; i < settingsList.Count(); i++ )
       
    69         {
       
    70         CItemMap* setting = settingsList[i];
       
    71         if( !setting )
       
    72             {
       
    73             continue;
       
    74             }
       
    75         
       
    76         if( setting->ItemId() == aItemId )
       
    77             {
       
    78             RPointerArray<CPropertyMap>& properties = setting->Properties();
       
    79             for( TInt j = 0; j < properties.Count(); j++ )
       
    80                 {
       
    81                 CPropertyMap* property = properties[j];
       
    82                 if( !property )
       
    83                     {
       
    84                     continue;
       
    85                     }
       
    86                 
       
    87                 if( property->Name() == aName )
       
    88                     {
       
    89                     ret = HBufC::NewL( property->Value().Length() );
       
    90                     ret->Des().Copy( property->Value() );
       
    91                     break;
       
    92                     }
       
    93                 }            
       
    94             break;
       
    95             }    
       
    96         }        
       
    97     return ret;
       
    98     }
       
    99 
    55 // ---------------------------------------------------------------------------
   100 // ---------------------------------------------------------------------------
    56 // Finds recursively node by name
   101 // Finds recursively node by name
    57 // @return    returns pointer to desired node, NULL if nothing found 
   102 // @return    returns pointer to desired node, NULL if nothing found 
    58 // ---------------------------------------------------------------------------
   103 // ---------------------------------------------------------------------------
    59 //
   104 //
   162     if( !node )
   207     if( !node )
   163         {
   208         {
   164         return;
   209         return;
   165         }
   210         }
   166 
   211 
   167     CXnDomStringPool& sp( node->StringPool() );
   212     CXnDomStringPool* sp( node->StringPool() );
   168 
   213 
   169     for ( TInt i = 0; i < aProperties.Count(); i++ )
   214     for ( TInt i = 0; i < aProperties.Count(); i++ )
   170         {
   215         {
   171         CPropertyMap* property( aProperties[i] );
   216         CPropertyMap* property( aProperties[i] );
   172 
   217 
   449         {
   494         {
   450         CleanupStack::PopAndDestroy( 2, configuration );
   495         CleanupStack::PopAndDestroy( 2, configuration );
   451         
   496         
   452         return NULL;
   497         return NULL;
   453         }
   498         }
   454     
   499 
   455     RPointerArray< CXnPluginData >& array( aRootData.PluginData() );
   500     RPointerArray< CXnPluginData >& array( aRootData.PluginData() );
   456     
   501     
   457     TInt index( 0 );
   502     TInt index( 0 );
   458     
   503     
   459     for ( TInt i = 0; ( i < plugins.Count() ) && ( i < aRootData.MaxPages() );
   504     for ( TInt i = 0; ( i < plugins.Count() ) && ( i < aRootData.MaxPages() );
   559         CXnDomNode* pluginNode( FindNodeByName( viewRoot, KPlugin ) );
   604         CXnDomNode* pluginNode( FindNodeByName( viewRoot, KPlugin ) );
   560 
   605 
   561         UpdatePluginFromSettingsL( *configuration, *viewRoot );
   606         UpdatePluginFromSettingsL( *configuration, *viewRoot );
   562                 
   607                 
   563         aViewData.SetUseEmptyWidget( UseEmptyWidget( *viewRoot )  );   
   608         aViewData.SetUseEmptyWidget( UseEmptyWidget( *viewRoot )  );   
   564         
   609 
       
   610         // Read wallpaper image path from HSPS
       
   611         CXnBackgroundManager& bgManager = aViewData.ViewManager().
       
   612             Editor().BgManager();
       
   613         
       
   614         // if page specific wallpaper feature is enabled
       
   615         if( bgManager.ActivatedL() )
       
   616             {
       
   617             HBufC* bgImage = ItemValueL( *configuration, KWallpaper, KPath );
       
   618             CleanupStack::PushL( bgImage );
       
   619             if( bgImage && bgImage->Length() > 0 )
       
   620                 {
       
   621                 bgManager.CacheWallpaperL( bgImage->Des(), aViewData );
       
   622                 }
       
   623             CleanupStack::PopAndDestroy( bgImage );
       
   624             }
   565         if ( pluginNode )
   625         if ( pluginNode )
   566             {            
   626             {            
   567             // This assumes all <plugin> elements are siblings
   627             // This assumes all <plugin> elements are siblings
   568             CXnDomNode* pluginParent( pluginNode->Parent() );   
   628             CXnDomNode* pluginParent( pluginNode->Parent() );   
   569             
   629