convergedcallengine/spsettings/src/spproperty.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
   164     {
   164     {
   165     TLex convert( iPropertyValue );
   165     TLex convert( iPropertyValue );
   166     TInt value;
   166     TInt value;
   167     TInt err = convert.Val( value );
   167     TInt err = convert.Val( value );
   168     if( err == KErrNone )
   168     if( err == KErrNone )
   169         {
   169     	{
   170         if( value != EOONotSet && value != EOff && value != EOn )
   170     	if( value != EOONotSet && value != EOff && value != EOn )
   171             {
   171     		{
   172             return KErrOverflow;
   172     		return KErrOverflow;
   173             }
   173     		}
   174         else
   174     	else
   175             {
   175     		{
   176             aValue = static_cast<TOnOff>( value );
   176     		aValue = static_cast<TOnOff>( value );
   177             return KErrNone;
   177     		return KErrNone;
   178             }
   178     		}
   179         }
   179     	}
   180     else 
   180     else 
   181         {
   181     	{
   182         return err;
   182     	return err;
   183         }
   183     	}
   184     }
   184     }
   185 
   185 
   186 
   186 
   187 // ---------------------------------------------------------------------------
   187 // ---------------------------------------------------------------------------
   188 // Sets value of property. Value must match to datatype.
   188 // Sets value of property. Value must match to datatype.
   251 // ---------------------------------------------------------------------------
   251 // ---------------------------------------------------------------------------
   252 //
   252 //
   253 EXPORT_C void CSPProperty::CopyL( const CSPProperty& aSource )
   253 EXPORT_C void CSPProperty::CopyL( const CSPProperty& aSource )
   254     {
   254     {
   255     if( this != &aSource )
   255     if( this != &aSource )
   256         {
   256     	{
   257         User::LeaveIfError( SetName( aSource.GetName() ) );
   257     	User::LeaveIfError( SetName( aSource.GetName() ) );
   258         SetDataType( aSource.GetDataType() );
   258 	    SetDataType( aSource.GetDataType() );
   259         SetPropertyType( aSource.GetPropertyType() );
   259 	    SetPropertyType( aSource.GetPropertyType() );
   260 
   260 
   261         iPropertyValue.Close();
   261 	    iPropertyValue.Close();
   262         User::LeaveIfError( iPropertyValue.Create( KSPMaxDesLength ) );
   262 	    User::LeaveIfError( iPropertyValue.Create( KSPMaxDesLength ) );
   263         User::LeaveIfError( aSource.GetValue( iPropertyValue ) );
   263 	    User::LeaveIfError( aSource.GetValue( iPropertyValue ) );
   264         }
   264     	}
   265     }
   265     }
   266 
   266 
   267 
   267 
   268 // ---------------------------------------------------------------------------
   268 // ---------------------------------------------------------------------------
   269 // Sets value of property without checking the datatype
   269 // Sets value of property without checking the datatype
   315 // ---------------------------------------------------------------------------
   315 // ---------------------------------------------------------------------------
   316 //
   316 //
   317 EXPORT_C TSPItemType CSPProperty::PropertyType( TServicePropertyName aProperty )
   317 EXPORT_C TSPItemType CSPProperty::PropertyType( TServicePropertyName aProperty )
   318     {
   318     {
   319     if ( ( aProperty >= ESubPropertyVoIPSettingsId && aProperty <= ESubPropertyVoIPTemporaryIAPId ) ||
   319     if ( ( aProperty >= ESubPropertyVoIPSettingsId && aProperty <= ESubPropertyVoIPTemporaryIAPId ) ||
   320             ( aProperty >= ESubPropertyVoIPRelNumber && aProperty <= ESubPropertyVoIPAddrScheme  ) ||
   320     		( aProperty >= ESubPropertyVoIPRelNumber && aProperty <= ESubPropertyVoIPAddrScheme  ) ||
   321             ( aProperty >= ESubPropertyVoIPEnabled && aProperty <= ESubPropertyVoIPEnabled  ) )
   321     		( aProperty >= ESubPropertyVoIPEnabled && aProperty <= ESubPropertyVoIPEnabled  ) )
   322         {
   322         {
   323         return EItemTypeVoIPSubProperty;
   323         return EItemTypeVoIPSubProperty;
   324         }
   324         }
   325     else if ( ( aProperty >= ESubPropertyPresenceSettingsId && aProperty <= ESubPropertyPresenceLaunchUid ) ||
   325     else if ( ( aProperty >= ESubPropertyPresenceSettingsId && aProperty <= ESubPropertyPresenceLaunchUid ) ||
   326             ( aProperty >= ESubPropertyPresenceAddrScheme && aProperty <= ESubPropertyPresenceAddrScheme ) ||
   326     		( aProperty >= ESubPropertyPresenceAddrScheme && aProperty <= ESubPropertyPresenceAddrScheme ) ||
   327             ( aProperty >= ESubPropertyPresenceEnabled && aProperty <= ESubPropertyPresenceRequestPreference ) )
   327     		( aProperty >= ESubPropertyPresenceEnabled && aProperty <= ESubPropertyPresenceRequestPreference ) )
   328         {
   328         {
   329         return EItemTypePresenceSubProperty;
   329         return EItemTypePresenceSubProperty;
   330         }
   330         }
   331     else if ( ( aProperty >= ESubPropertyIMSettingsId && aProperty <= ESubPropertyIMLaunchUid ) ||
   331     else if ( ( aProperty >= ESubPropertyIMSettingsId && aProperty <= ESubPropertyIMLaunchUid ) ||
   332             ( aProperty >= ESubPropertyIMAddrScheme && aProperty <= ESubPropertyIMAddrScheme ) ||
   332     		( aProperty >= ESubPropertyIMAddrScheme && aProperty <= ESubPropertyIMAddrScheme ) ||
   333             ( aProperty >= ESubPropertyIMEnabled && aProperty <= ESubPropertyIMEnabled ) )
   333     		( aProperty >= ESubPropertyIMEnabled && aProperty <= ESubPropertyIMEnabled ) )
   334         {
   334         {
   335         return EItemTypeIMSubProperty;
   335         return EItemTypeIMSubProperty;
   336         }
   336         }
   337     else if ( ( aProperty >= ESubPropertyVMBXSettingsId && aProperty <= ESubPropertyVMBXLaunchUid ) ||
   337     else if ( ( aProperty >= ESubPropertyVMBXSettingsId && aProperty <= ESubPropertyVMBXLaunchUid ) ||
   338             ( aProperty >= ESubPropertyVMBXListenAddress && aProperty <= ESubPropertyVMBXAddrScheme ) ||
   338     		( aProperty >= ESubPropertyVMBXListenAddress && aProperty <= ESubPropertyVMBXAddrScheme ) ||
   339             ( aProperty >= ESubPropertyVMBXListenRegister && aProperty <= ESubPropertyVMBXEnabled ) )
   339     		( aProperty >= ESubPropertyVMBXListenRegister && aProperty <= ESubPropertyVMBXEnabled ) )
   340         {
   340         {
   341         return EItemTypeVMBXSubProperty;
   341         return EItemTypeVMBXSubProperty;
   342         }
   342         }
   343     else if( ( aProperty >= EPropertyServiceAttributeMask && aProperty <= EPropertyRingtoneTimeout ) ||
   343     else if( ( aProperty >= EPropertyServiceAttributeMask && aProperty <= EPropertyRingtoneTimeout ) ||
   344              ( aProperty >= EPropertyBrandId && aProperty <= EPropertyIncomingEmailserver ) )
   344     		 ( aProperty >= EPropertyBrandId && aProperty <= EPropertyIncomingEmailserver ) )
   345         {
   345         {
   346         return EItemTypeProperty;
   346         return EItemTypeProperty;
   347         }
   347         }
   348     else
   348     else
   349         {
   349     	{
   350         return EItemTypeNotDefined;
   350     	return EItemTypeNotDefined;
   351         }
   351     	}
   352     }
   352     }
   353 
   353 
   354 
   354 
   355 // ---------------------------------------------------------------------------
   355 // ---------------------------------------------------------------------------
   356 // Compare operator
   356 // Compare operator
   361     TBool result( EFalse );
   361     TBool result( EFalse );
   362 
   362 
   363     RBuf tmp;
   363     RBuf tmp;
   364     TInt err = tmp.Create( KSPMaxDesLength );
   364     TInt err = tmp.Create( KSPMaxDesLength );
   365     if( err != KErrNone )
   365     if( err != KErrNone )
   366         {
   366     	{
   367         return EFalse;
   367     	return EFalse;
   368         }
   368     	}
   369     err = aProperty.GetValue( tmp );
   369     err = aProperty.GetValue( tmp );
   370     if( err != KErrNone )
   370     if( err != KErrNone )
   371         {
   371     	{
   372         return EFalse;
   372     	return EFalse;
   373         }
   373     	}
   374     
   374     
   375     result = ( iPropertyType == aProperty.GetPropertyType() &&
   375     result = ( iPropertyType == aProperty.GetPropertyType() &&
   376                iPropertyName == aProperty.GetName() &&
   376     		   iPropertyName == aProperty.GetName() &&
   377                iDataType == aProperty.GetDataType() &&
   377                iDataType == aProperty.GetDataType() &&
   378                0 == iPropertyValue.Compare( tmp ) );
   378                0 == iPropertyValue.Compare( tmp ) );
   379     tmp.Close();
   379     tmp.Close();
   380 
   380 
   381     return result;
   381     return result;
   385 // ---------------------------------------------------------------------------
   385 // ---------------------------------------------------------------------------
   386 // Get property type
   386 // Get property type
   387 // ---------------------------------------------------------------------------
   387 // ---------------------------------------------------------------------------
   388 //
   388 //
   389 EXPORT_C TSPItemType CSPProperty::GetPropertyType() const
   389 EXPORT_C TSPItemType CSPProperty::GetPropertyType() const
   390     {
   390 	{
   391     return iPropertyType;
   391 	return iPropertyType;
   392     }
   392 	}
   393 
   393 
   394 // ---------------------------------------------------------------------------
   394 // ---------------------------------------------------------------------------
   395 // Set default value for property
   395 // Set default value for property
   396 // ---------------------------------------------------------------------------
   396 // ---------------------------------------------------------------------------
   397 //
   397 //
   398 TInt CSPProperty::SetPropertyType( TSPItemType aPropertyType )
   398 TInt CSPProperty::SetPropertyType( TSPItemType aPropertyType )
   399     {
   399 	{
   400     iPropertyType = aPropertyType;
   400 	iPropertyType = aPropertyType;
   401     
   401 	
   402     return KErrNone;
   402 	return KErrNone;
   403     }
   403 	}
   404     
   404 	
   405 
   405