idlehomescreen/xmluicontroller/src/contentrenderer.cpp
changeset 4 4d54b72983ae
parent 0 f72a12da539e
child 9 f966699dea19
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
   670         // Not targeted to this content renderer
   670         // Not targeted to this content renderer
   671         return EFalse;
   671         return EFalse;
   672         }
   672         }
   673         
   673         
   674     return ETrue;
   674     return ETrue;
       
   675     }
       
   676 
       
   677 TInt CContentRenderer::SetProperty( MAiPropertyExtension& aPlugin,
       
   678         const TDesC8& aElementId,
       
   679         const TDesC8& aPropertyName,
       
   680         const TDesC8& aPropertyValue ) 
       
   681     {
       
   682    return ( SetProperty( aPlugin, aElementId, 
       
   683                aPropertyName, aPropertyValue,
       
   684                MAiContentObserver::EValueString ) );
       
   685     }
       
   686 
       
   687 TInt CContentRenderer::SetProperty( MAiPropertyExtension& aPlugin,
       
   688         const TDesC8& aElementId,
       
   689         const TDesC8& aPropertyName,
       
   690         const TDesC8& aPropertyValue,
       
   691         MAiContentObserver::TValueType aValueType) 
       
   692     {
       
   693     TInt error( KErrNone );
       
   694     TInt retval( KErrNone );
       
   695 
       
   696     TRAP( error, retval = SetPropertyL( aPlugin, aElementId, aPropertyName,
       
   697             aPropertyValue, aValueType ) );
       
   698     
       
   699     if( !error && retval )
       
   700      {
       
   701      error = retval;
       
   702      }
       
   703     
       
   704     return error;
       
   705     }
       
   706 
       
   707 TInt CContentRenderer::SetPropertyL( MAiPropertyExtension& aPlugin,
       
   708         const TDesC8& aElementId,
       
   709         const TDesC8& aPropertyName,
       
   710         const TDesC8& aPropertyValue,
       
   711         MAiContentObserver::TValueType aValueType) 
       
   712     {
       
   713     TInt err = KErrNone;
       
   714     // Find node
       
   715     CXnNodeAppIf* targetNode = FindNodeByIdL( aElementId, aPlugin.PublisherInfoL()->iNamespace );
       
   716     if ( targetNode )
       
   717        {
       
   718        CXnDomStringPool& sp( targetNode->UiEngineL()->StringPool() );
       
   719               
       
   720        CXnProperty* prop = CXnProperty::NewL( 
       
   721                aPropertyName,
       
   722                aPropertyValue,
       
   723                DomPropertyValueType(aValueType), sp );
       
   724                       
       
   725        CleanupStack::PushL( prop );
       
   726     
       
   727        targetNode->SetPropertyL( prop );
       
   728       
       
   729        CleanupStack::Pop( prop );
       
   730        }
       
   731     else
       
   732        {
       
   733        err = KErrNotFound;
       
   734        }
       
   735     return err;
       
   736     }
       
   737 
       
   738 
       
   739 CXnDomPropertyValue::TPrimitiveValueType 
       
   740     CContentRenderer::DomPropertyValueType(
       
   741             MAiContentObserver::TValueType aValueType)
       
   742     {
       
   743     CXnDomPropertyValue::TPrimitiveValueType type = 
       
   744             CXnDomPropertyValue::EUnknown;
       
   745     switch ( aValueType )
       
   746         {
       
   747         case MAiContentObserver::EValueNumber :
       
   748             {
       
   749             type = CXnDomPropertyValue::ENumber;
       
   750             }
       
   751             break;
       
   752         case MAiContentObserver::EValuePercentage :
       
   753             {
       
   754             type = CXnDomPropertyValue::EPercentage;
       
   755             }
       
   756             break;
       
   757         case MAiContentObserver::EValuePx :
       
   758             {
       
   759             type = CXnDomPropertyValue::EPx;
       
   760             }
       
   761             break;
       
   762         case MAiContentObserver::EValueString :
       
   763             {
       
   764             type = CXnDomPropertyValue::EString;
       
   765             }
       
   766             break;
       
   767         case MAiContentObserver::EValueRgbColor :
       
   768             {
       
   769             type = CXnDomPropertyValue::ERgbColor;
       
   770             }
       
   771             break;
       
   772         case MAiContentObserver::EValueUnitValue :
       
   773             {
       
   774             type = CXnDomPropertyValue::EUnitValue;
       
   775             }
       
   776             break;
       
   777         default:
       
   778             {
       
   779             type = CXnDomPropertyValue::EUnknown;
       
   780             }
       
   781         }
       
   782     return type;
   675     }
   783     }
   676 
   784 
   677 void CContentRenderer::DoStartTransactionL( TInt aTxId )
   785 void CContentRenderer::DoStartTransactionL( TInt aTxId )
   678     {
   786     {
   679     MTransaction* tr = iFactory->CreateTransactionL( aTxId );
   787     MTransaction* tr = iFactory->CreateTransactionL( aTxId );