212 // --------------------------------------------------------------------------- |
212 // --------------------------------------------------------------------------- |
213 // |
213 // |
214 void CVoipXmlPresenceHandler::CreateProviderNameL( TDes& aName ) |
214 void CVoipXmlPresenceHandler::CreateProviderNameL( TDes& aName ) |
215 { |
215 { |
216 DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL begin" ); |
216 DBG_PRINT( "CVoipXmlPresenceHandler::CreateProviderNameL begin" ); |
217 |
217 |
|
218 const TInt maxModifyLength = |
|
219 KMaxNodeNameLength - KMaxProfileNameAppendLength; |
218 RArray<TInt> settingIds; |
220 RArray<TInt> settingIds; |
219 CleanupClosePushL( settingIds ); // CS:1 |
221 CleanupClosePushL( settingIds ); // CS:1 |
220 // CS:2 |
222 // CS:2 |
221 CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC( settingIds ); |
223 CDesCArray* names = PresSettingsApi::GetAllSetsNamesLC( settingIds ); |
222 |
224 |
223 HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 |
225 HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 |
224 newName->Des().Copy( aName ); |
226 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
225 const TInt count( names->MdcaCount() ); |
227 const TInt count( names->MdcaCount() ); |
226 TUint i( 1 ); // Add number to the name if name already in use. |
228 TUint i( 1 ); // Add number to the name if name already in use. |
227 |
229 |
228 // Go through each profile and see if the name of the new profile |
230 // Go through each profile and see if the name of the new profile |
229 // matches one of the existing names. If it does change it and |
231 // matches one of the existing names. If it does change it and |
234 loadedName.Copy( names->MdcaPoint( counter )); |
236 loadedName.Copy( names->MdcaPoint( counter )); |
235 if ( 0 == newName->Des().Compare( loadedName ) ) |
237 if ( 0 == newName->Des().Compare( loadedName ) ) |
236 { |
238 { |
237 // If the name is changed we need to begin the comparison |
239 // If the name is changed we need to begin the comparison |
238 // again from the first profile. |
240 // again from the first profile. |
239 newName->Des().Copy( aName ); |
241 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
240 newName->Des().Append( KOpenParenthesis() ); |
242 newName->Des().Append( KOpenParenthesis() ); |
241 newName->Des().AppendNum( i ); |
243 newName->Des().AppendNum( i ); |
242 newName->Des().Append( KClosedParenthesis() ); |
244 newName->Des().Append( KClosedParenthesis() ); |
243 counter = 0; |
245 counter = 0; |
244 i++; |
246 i++; |