cmmanager/cmmgr/cmmserver/src/cmmdestinationinstance.cpp
changeset 53 4af712113915
parent 46 95d45f234cf3
child 61 8b0c979bbe8c
equal deleted inserted replaced
47:cb7afde124a3 53:4af712113915
   467             break;
   467             break;
   468         default:
   468         default:
   469             break;
   469             break;
   470         }
   470         }
   471 
   471 
   472     // Not Internet, operator or intranet, or something went wrong. 
   472     // Not Internet, operator or intranet, or something went wrong.
   473     if ( !isLocalised || ( isLocalised && !resolvedText ) )
   473     if ( !isLocalised || ( isLocalised && !resolvedText ) )
   474         {
   474         {
   475         resolvedText = TPtrC( iNetworkRecord->iRecordName ).AllocL();
   475         resolvedText = TPtrC( iNetworkRecord->iRecordName ).AllocL();
   476         }
   476         }
   477 
   477 
   708 
   708 
   709     OstTraceFunctionExit0( CCMMDESTINATIONINSTANCE_SETPROTECTIONL_EXIT );
   709     OstTraceFunctionExit0( CCMMDESTINATIONINSTANCE_SETPROTECTIONL_EXIT );
   710     }
   710     }
   711 
   711 
   712 // ---------------------------------------------------------------------------
   712 // ---------------------------------------------------------------------------
   713 // Return true if protection level has been changed. 
   713 // Return true if protection level has been changed.
   714 // ---------------------------------------------------------------------------
   714 // ---------------------------------------------------------------------------
   715 //
   715 //
   716 TBool CCmmDestinationInstance::ProtectionChanged()
   716 TBool CCmmDestinationInstance::ProtectionChanged()
   717     {
   717     {
   718     return iProtectionChanged;
   718     return iProtectionChanged;
   811         relevantCount--;
   811         relevantCount--;
   812         }
   812         }
   813     // The final position will be between 0 and relevantCount.
   813     // The final position will be between 0 and relevantCount.
   814     TInt index( relevantCount );
   814     TInt index( relevantCount );
   815 
   815 
   816     // If this is a virtual IAP that doesn't point to an IAP, position it at
   816     TBool positionFound( EFalse );
   817     // the end of the list.
       
   818     TBool connMethodIsVirtual = aConnMethodInstance.GetBoolAttributeL( CMManager::ECmVirtual );
   817     TBool connMethodIsVirtual = aConnMethodInstance.GetBoolAttributeL( CMManager::ECmVirtual );
   819     TUint32 linkedIapId( 0 );
       
   820     if ( connMethodIsVirtual )
   818     if ( connMethodIsVirtual )
   821         {
   819         {
   822         // Ask link information only if this is a virtual IAP.
   820         // Ask link information only if this is a virtual IAP.
   823         linkedIapId = aConnMethodInstance.GetIntAttributeL( CMManager::ECmNextLayerIapId );
   821         TUint32 linkedIapId = aConnMethodInstance.GetIntAttributeL( CMManager::ECmNextLayerIapId );
   824         if ( linkedIapId == 0 )
   822         if ( linkedIapId == 0 )
   825             {
   823             {
       
   824             // If this is a virtual IAP that doesn't point to an IAP, position it at
       
   825             // the end of the list.
   826             item.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard;
   826             item.iPriority = CMManager::KDataMobilitySelectionPolicyPriorityWildCard;
   827             index = relevantCount;
   827             index = relevantCount;
   828             }
   828             positionFound = ETrue;
   829         }
   829             }
   830     else
   830         else
   831         {
       
   832         TBool positionFound( EFalse );
       
   833         if ( connMethodIsVirtual )
       
   834             {
   831             {
   835             // If this is a virtual IAP that links to another IAP, position it
   832             // If this is a virtual IAP that links to another IAP, position it
   836             // as if it was that IAP.
   833             // as if it was that IAP.
   837             TCmmConnMethodItem linkedItem;
   834             TCmmConnMethodItem linkedItem;
   838             TInt err = iCache->GetConnMethodItem( linkedIapId, linkedItem );
   835             TInt err = iCache->GetConnMethodItem( linkedIapId, linkedItem );
   847                 positionFound = ETrue;
   844                 positionFound = ETrue;
   848                 }
   845                 }
   849             bearerType = linkedItem.iBearerType;
   846             bearerType = linkedItem.iBearerType;
   850             bearerPriority = linkedItem.iBearerPriority;
   847             bearerPriority = linkedItem.iBearerPriority;
   851             }
   848             }
   852 
   849         }
   853         if ( !positionFound )
   850 
   854             {
   851     if ( !positionFound )
   855             // Search for any connection methods with the same bearer type.
   852         {
   856             for ( TInt i = 0; i < relevantCount; i++ )
   853         // Search for any connection methods with the same bearer type.
       
   854         for ( TInt i = 0; i < relevantCount; i++ )
       
   855             {
       
   856             if ( iConnMethodItemArray[i].iBearerType == bearerType )
   857                 {
   857                 {
   858                 if ( iConnMethodItemArray[i].iBearerType == bearerType )
   858                 index = i + 1;
   859                     {
   859                 positionFound = ETrue;
   860                     index = i + 1;
   860                 // Don't break, need find last item.
   861                     positionFound = ETrue;
       
   862                     // Don't break, need find last item.
       
   863                     }
       
   864                 }
   861                 }
   865             }
   862             }
   866         if ( !positionFound )
   863         }
   867             {
   864     if ( !positionFound )
   868             // No connection method found with the same bearer type. Position
   865         {
   869             // the connection method according to bearer priority.
   866         // No connection method found with the same bearer type. Position
   870             for ( TInt i = 0; i < relevantCount; i++ )
   867         // the connection method according to bearer priority.
       
   868         for ( TInt i = 0; i < relevantCount; i++ )
       
   869             {
       
   870             if ( iConnMethodItemArray[i].iBearerPriority >= bearerPriority )
   871                 {
   871                 {
   872                 if ( iConnMethodItemArray[i].iBearerPriority >= bearerPriority )
   872                 index = i;
   873                     {
   873                 break;
   874                     index = i;
       
   875                     break;
       
   876                     }
       
   877                 }
   874                 }
   878             }
   875             }
   879         }
   876         }
   880 
   877 
   881     // Add the connection method item into this destination at the correct
   878     // Add the connection method item into this destination at the correct