cmmanager/cmmgr/Framework/Src/ccmpluginbaseeng.cpp
branchRCL_3
changeset 55 fc7b30ed2058
parent 0 5a93021fdf25
equal deleted inserted replaced
54:984e13af52c4 55:fc7b30ed2058
   708     {
   708     {
   709     LOGGER_ENTERFN( "CCmPluginBaseEng::GetString8AttributeL" );
   709     LOGGER_ENTERFN( "CCmPluginBaseEng::GetString8AttributeL" );
   710 
   710 
   711     HBufC8* retVal = NULL;
   711     HBufC8* retVal = NULL;
   712     
   712     
   713     switch ( aAttribute )
   713     TUint32 attribute = CheckForCommonAttribute( aAttribute );
   714         {
   714     CMDBField<TDesC8>* field;
   715         default:
   715                 
   716             {
   716     FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
   717             TUint32 attribute = CheckForCommonAttribute( aAttribute );
   717 
   718             CMDBField<TDesC8>* field;
   718     if ( !field->IsNull() )
   719                         
   719         {
   720             FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
   720         retVal = field->GetL().AllocL();
   721 
   721         }
   722             if ( !field->IsNull() )
   722     else
   723                 {
   723         {
   724                 retVal = field->GetL().AllocL();
   724         retVal = KNullDesC8().AllocL();
   725                 }
       
   726             else
       
   727                 {
       
   728                 retVal = KNullDesC8().AllocL();
       
   729                 }
       
   730             }
       
   731         }
   725         }
   732         
   726         
   733     return retVal;
   727     return retVal;
   734     }
   728     }
   735     
   729     
   948 EXPORT_C void CCmPluginBaseEng::SetString8AttributeL( const TUint32 aAttribute, 
   942 EXPORT_C void CCmPluginBaseEng::SetString8AttributeL( const TUint32 aAttribute, 
   949                                                       const TDesC8& aValue )
   943                                                       const TDesC8& aValue )
   950     {
   944     {
   951     LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" );
   945     LOGGER_ENTERFN( "CCmPluginBaseEng::SetString8AttributeL" );
   952 
   946 
   953     switch ( aAttribute )
   947     TUint32 attribute = CheckForCommonAttribute( aAttribute );
   954         {
   948     CMDBField<TDesC8>* field;
   955         default:
   949 
   956             {
   950     TValidationFunctionL func = FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
   957             TUint32 attribute = CheckForCommonAttribute( aAttribute );
   951 
   958             CMDBField<TDesC8>* field;
   952     if( func )
   959             
   953         {
   960             TValidationFunctionL func = 
   954         func( this, attribute, (const TAny*)&aValue );
   961                         FindFieldL( attribute, ECmText8, (CMDBElement*&)field );
   955         }
   962             
   956 
   963             if( func )
   957     field->SetL( aValue );
   964                 {
       
   965                 func( this, attribute, (const TAny*)&aValue );
       
   966                 }
       
   967 
       
   968             field->SetL( aValue );
       
   969             }
       
   970         }
       
   971     }
   958     }
   972     
   959     
   973 // ---------------------------------------------------------------------------
   960 // ---------------------------------------------------------------------------
   974 // CCmPluginBaseEng::RestoreAttributeL
   961 // CCmPluginBaseEng::RestoreAttributeL
   975 // ---------------------------------------------------------------------------
   962 // ---------------------------------------------------------------------------
  2425             pf = postfix;
  2412             pf = postfix;
  2426             for (i=1; i<10; i++)
  2413             for (i=1; i<10; i++)
  2427                 {
  2414                 {
  2428                 pf /= 10;
  2415                 pf /= 10;
  2429                 if ( !pf )
  2416                 if ( !pf )
       
  2417                     {
  2430                     break;
  2418                     break;
       
  2419                     }
  2431                 }
  2420                 }
  2432             TPtr sgdptr( temp->Des() );
  2421             TPtr sgdptr( temp->Des() );
  2433             TPtr sgdptr2( temp2->Des() );
  2422             TPtr sgdptr2( temp2->Des() );
  2434             if ( postfix )
  2423             if ( postfix )
  2435                 {
  2424                 {
  2781     
  2770     
  2782     iPriv->iConvTblArray->AppendL( item );
  2771     iPriv->iConvTblArray->AppendL( item );
  2783     }
  2772     }
  2784     
  2773     
  2785 // ---------------------------------------------------------------------------
  2774 // ---------------------------------------------------------------------------
  2786 // CCmPluginBaseEng::AddConverstionTableL
  2775 // CCmPluginBaseEng::AddCommonConversionTableL
  2787 // ---------------------------------------------------------------------------
  2776 // ---------------------------------------------------------------------------
  2788 //
  2777 //
  2789 EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( 
  2778 EXPORT_C void CCmPluginBaseEng::AddCommonConversionTableL( 
  2790                                 const TCmCommonAttrConvArrayItem* aConvTable )
  2779                                 const TCmCommonAttrConvArrayItem* aConvTable )
  2791     {
  2780     {
  2820 EXPORT_C void CCmPluginBaseEng::RemoveCommonConversionTable( 
  2809 EXPORT_C void CCmPluginBaseEng::RemoveCommonConversionTable( 
  2821                                  const TCmCommonAttrConvArrayItem* aConvTable )
  2810                                  const TCmCommonAttrConvArrayItem* aConvTable )
  2822     {
  2811     {
  2823     LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" );
  2812     LOGGER_ENTERFN( "CCmPluginBaseEng::RemoveCommonConversionTable" );
  2824 
  2813 
  2825     for ( TInt i = 0; i < iPriv->iCommonConvTblArray.Count(); ++i )
  2814     // When calling Remove(), it's safer to loop starting from end.
       
  2815     for ( TInt i = iPriv->iCommonConvTblArray.Count()-1; i >= 0; i-- )
  2826         {
  2816         {
  2827         if ( iPriv->iCommonConvTblArray[i] == aConvTable )
  2817         if ( iPriv->iCommonConvTblArray[i] == aConvTable )
  2828             {
  2818             {
  2829             iPriv->iCommonConvTblArray.Remove( i );
  2819             iPriv->iCommonConvTblArray.Remove( i );
  2830             }
  2820             }
  2874             {
  2864             {
  2875             if ( aType == ECmText )
  2865             if ( aType == ECmText )
  2876                 {
  2866                 {
  2877                 aElement = &field;
  2867                 aElement = &field;
  2878                 }
  2868                 }
  2879             else
       
  2880                 {
       
  2881                 User::Leave( KErrNotSupported );
       
  2882                 }
       
  2883             }
  2869             }
  2884             break;
  2870             break;
  2885 
  2871 
  2886         case EDesC8:
  2872         case EDesC8:
  2887             {
  2873             {
  2888             if ( aType == ECmText8 )
  2874             if ( aType == ECmText8 )
  2889                 {
  2875                 {
  2890                 aElement = &field;
  2876                 aElement = &field;
  2891                 }
       
  2892             else
       
  2893                 {
       
  2894                 User::Leave( KErrNotSupported );
       
  2895                 }
  2877                 }
  2896             }
  2878             }
  2897             break;
  2879             break;
  2898             
  2880             
  2899         case EUint32:
  2881         case EUint32:
  2902             {
  2884             {
  2903             if ( aType == ECmInt ||
  2885             if ( aType == ECmInt ||
  2904                  aType == ECmBool )
  2886                  aType == ECmBool )
  2905                 {
  2887                 {
  2906                 aElement = &field;
  2888                 aElement = &field;
  2907                 }
       
  2908             else
       
  2909                 {
       
  2910                 User::Leave( KErrNotSupported );
       
  2911                 }
  2889                 }
  2912             }
  2890             }
  2913             break;
  2891             break;
  2914             
  2892             
  2915         default:
  2893         default: