172 // --------------------------------------------------------------------------- |
172 // --------------------------------------------------------------------------- |
173 // |
173 // |
174 void CVoipXmlXdmHandler::CreateProviderNameL( TDes& aName ) |
174 void CVoipXmlXdmHandler::CreateProviderNameL( TDes& aName ) |
175 { |
175 { |
176 DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL begin" ); |
176 DBG_PRINT( "CVoipXmlXdmHandler::CreateProviderNameL begin" ); |
177 |
177 |
|
178 const TInt maxModifyLength = |
|
179 KMaxNodeNameLength - KMaxProfileNameAppendLength; |
178 RArray<TInt> settingIds; |
180 RArray<TInt> settingIds; |
179 CleanupClosePushL( settingIds ); // CS:1 |
181 CleanupClosePushL( settingIds ); // CS:1 |
180 // CS:2 |
182 // CS:2 |
181 CDesCArray* names = TXdmSettingsApi::CollectionNamesLC( settingIds ); |
183 CDesCArray* names = TXdmSettingsApi::CollectionNamesLC( settingIds ); |
182 |
184 |
183 HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 |
185 HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:3 |
184 newName->Des().Copy( aName ); |
186 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
185 const TInt count( names->MdcaCount() ); |
187 const TInt count( names->MdcaCount() ); |
186 TUint i( 1 ); // Add number to the name if name already in use. |
188 TUint i( 1 ); // Add number to the name if name already in use. |
187 |
189 |
188 // Go through each profile and see if the name of the new profile |
190 // Go through each profile and see if the name of the new profile |
189 // matches one of the existing names. If it does change it and |
191 // matches one of the existing names. If it does change it and |
194 loadedName.Copy( names->MdcaPoint( counter )); |
196 loadedName.Copy( names->MdcaPoint( counter )); |
195 if ( 0 == newName->Des().Compare( loadedName ) ) |
197 if ( 0 == newName->Des().Compare( loadedName ) ) |
196 { |
198 { |
197 // If the name is changed we need to begin the comparison |
199 // If the name is changed we need to begin the comparison |
198 // again from the first profile. |
200 // again from the first profile. |
199 newName->Des().Copy( aName ); |
201 newName->Des().Copy( aName.Left( maxModifyLength ) ); |
200 newName->Des().Append( KOpenParenthesis() ); |
202 newName->Des().Append( KOpenParenthesis() ); |
201 newName->Des().AppendNum( i ); |
203 newName->Des().AppendNum( i ); |
202 newName->Des().Append( KClosedParenthesis() ); |
204 newName->Des().Append( KClosedParenthesis() ); |
203 counter = 0; |
205 counter = 0; |
204 i++; |
206 i++; |