voipplugins/voipadapters/voipxmlprovisioning/voipxmlprocessor/src/voipxmliaphandler.cpp
branchRCL_3
changeset 20 65a3ef1d5bd0
parent 18 8c9c07ad8b6b
equal deleted inserted replaced
18:8c9c07ad8b6b 20:65a3ef1d5bd0
   520         {
   520         {
   521         RArray<TUint32> destinationIds;
   521         RArray<TUint32> destinationIds;
   522         // Get destination ID's for checking if name to be set is reserved.
   522         // Get destination ID's for checking if name to be set is reserved.
   523         CleanupClosePushL( destinationIds ); // CS:3
   523         CleanupClosePushL( destinationIds ); // CS:3
   524         cmm.AllDestinationsL( destinationIds );
   524         cmm.AllDestinationsL( destinationIds );
   525         HBufC* newName = HBufC::NewLC( KMaxNodeNameLength ); // CS:4
   525         HBufC* newName = HBufC::NewLC( KMaxDestinationNameLength + KSpaceForParenthesis ); // CS:4
   526         newName->Des().Copy( iDestinationName->Des() );
   526         if( iDestinationName->Des().Length() >= KMaxDestinationNameLength )
   527 
   527             {
       
   528             newName->Des().Copy( iDestinationName->Left( KMaxDestinationNameLength ) );
       
   529             }
       
   530         else
       
   531             {
       
   532             newName->Des().Copy( iDestinationName->Des() );
       
   533             }
       
   534         
   528         // Check that name is unique.
   535         // Check that name is unique.
   529         const TInt destinationCount = destinationIds.Count();
   536         const TInt destinationCount = destinationIds.Count();
   530         for ( TInt counter = 0; counter < destinationCount; counter++ )
   537         for ( TInt counter = 0; counter < destinationCount; counter++ )
   531             {
   538             {
   532             RCmDestinationExt destination = cmm.DestinationL( 
   539             RCmDestinationExt destination = cmm.DestinationL( 
   536             TUint i( 1 ); // Add number to the name if name already in use.
   543             TUint i( 1 ); // Add number to the name if name already in use.
   537             if ( 0 == newName->Des().Compare( settingsName->Des() ) )
   544             if ( 0 == newName->Des().Compare( settingsName->Des() ) )
   538                 {
   545                 {
   539                 // If the name is changed we need to begin the comparison
   546                 // If the name is changed we need to begin the comparison
   540                 // again from the first profile.
   547                 // again from the first profile.
   541                 newName->Des().Copy( iDestinationName->Des() );
   548                 if ( iDestinationName->Des().Length() >= KMaxDestinationNameLength )
       
   549                     {
       
   550                     newName->Des().Copy( iDestinationName->Left( KMaxDestinationNameLength ) );
       
   551                     }
       
   552                 else
       
   553                     {
       
   554                     newName->Des().Copy( iDestinationName->Des() );
       
   555                     }
   542                 newName->Des().Append( KOpenParenthesis() );
   556                 newName->Des().Append( KOpenParenthesis() );
   543                 newName->Des().AppendNum( i );
   557                 newName->Des().AppendNum( i );
   544                 newName->Des().Append( KClosedParenthesis() );  
   558                 newName->Des().Append( KClosedParenthesis() );  
   545                 counter = 0;
   559                 counter = 0;
   546                 i++;
   560                 i++;
   569         newDestination.UpdateL();
   583         newDestination.UpdateL();
   570 
   584 
   571         // &newDestination, newName, &destinationIds
   585         // &newDestination, newName, &destinationIds
   572         CleanupStack::PopAndDestroy( 3, &destinationIds ); // CS:2
   586         CleanupStack::PopAndDestroy( 3, &destinationIds ); // CS:2
   573         }
   587         }
       
   588     
       
   589     // no destination name is defined.
       
   590     else 
       
   591         {
       
   592         RArray<TUint32> destinationIds;
       
   593         CleanupClosePushL( destinationIds ); // CS:3
       
   594         cmm.AllDestinationsL( destinationIds );
       
   595         const TInt count = destinationIds.Count();
       
   596         for (TInt counter = 0; counter < count ; counter ++)     
       
   597             {
       
   598             RCmDestinationExt destination = cmm.DestinationL( destinationIds[counter] );
       
   599             CleanupClosePushL( destination ); // CS:4
       
   600             if ( destination.MetadataL(
       
   601                     CMManager::ESnapMetadataPurpose) == CMManager::ESnapPurposeInternet )
       
   602                {
       
   603                const TInt cmCount = iapIds.Count();
       
   604                for ( TInt i = 0; i < cmCount; i++ ) 
       
   605                    {
       
   606                    RCmConnectionMethodExt connection = cmm.ConnectionMethodL(iapIds[i] );
       
   607                    CleanupClosePushL( connection );
       
   608                    destination.AddConnectionMethodL(connection );
       
   609                    CleanupStack::PopAndDestroy( &connection );
       
   610                }
       
   611            } 
       
   612            destination.UpdateL();
       
   613            CleanupStack::PopAndDestroy( &destination ); // CS:3
       
   614            CleanupStack::PopAndDestroy( &destinationIds ); // CS:2
       
   615            break;
       
   616            }
       
   617         }
       
   618     
   574     // &iapIds, &cmm
   619     // &iapIds, &cmm
   575     CleanupStack::PopAndDestroy( 2, &cmm ); // CS:0
   620     CleanupStack::PopAndDestroy( 2, &cmm ); // CS:0
   576     }
   621     }
   577 
   622 
   578 // ---------------------------------------------------------------------------
   623 // ---------------------------------------------------------------------------