convergedconnectionhandler/cchclientapi/cchuinotif/src/cchuinotifierimpl.cpp
branchRCL_3
changeset 16 df4dfb214df5
parent 15 43658d24f35d
child 20 65a3ef1d5bd0
equal deleted inserted replaced
15:43658d24f35d 16:df4dfb214df5
   297     if ( KErrNotFound != result )
   297     if ( KErrNotFound != result )
   298         {
   298         {
   299         iResultParams.iDialogMode = currentType;
   299         iResultParams.iDialogMode = currentType;
   300         iResultParams.iServiceId = aServiceId;
   300         iResultParams.iServiceId = aServiceId;
   301         iResultParams.iOperationCommand = commandArray[ result ];        
   301         iResultParams.iOperationCommand = commandArray[ result ];        
   302           
   302         TInt error = KErrNone;  
   303         if ( ECchUiCommandCopyGprs == commandArray[ result ] )
   303         if ( ECchUiCommandCopyGprs == commandArray[ result ] )
   304             {
   304             {
   305             ShowGprsSelectionL( aServiceId );
   305             error = ShowGprsSelectionL( aServiceId );
   306             }
   306             }
   307         CCHUIDEBUG( "ShowNoConnectionsQueryL - write and complete" );   
   307         if ( !error )
   308         iMessage.WriteL( iReplySlot, 
   308             {
   309             TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
   309             CCHUIDEBUG( "ShowNoConnectionsQueryL - write and complete" );   
   310         CompleteMessage( KErrNone );    
   310             iMessage.WriteL( iReplySlot, 
       
   311                 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
       
   312             CompleteMessage( KErrNone );  
       
   313             }
       
   314         else
       
   315             {
       
   316             CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); 
       
   317             CompleteMessage( error );
       
   318             }
   311         }
   319         }
   312     else
   320     else
   313         {
   321         {
   314         CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); 
   322         CCHUIDEBUG( "ShowNoConnectionsQueryL - complete with cancel" ); 
   315         CompleteMessage( KErrCancel );
   323         CompleteMessage( KErrCancel );
   450         if ( KErrNotFound != result )
   458         if ( KErrNotFound != result )
   451             {
   459             {
   452             iResultParams.iDialogMode = type;
   460             iResultParams.iDialogMode = type;
   453             iResultParams.iServiceId = aServiceId;
   461             iResultParams.iServiceId = aServiceId;
   454             iResultParams.iOperationCommand = commandArray[ result ];    
   462             iResultParams.iOperationCommand = commandArray[ result ];    
   455             
   463             TInt error = KErrNone;
   456             if ( ECchUiCommandCopyGprs == commandArray[ result ] )
   464             if ( ECchUiCommandCopyGprs == commandArray[ result ] )
   457                 {
   465                 {
   458                 ShowGprsSelectionL( aServiceId );
   466                 error = ShowGprsSelectionL( aServiceId );
   459                 }
   467                 }
   460             CCHUIDEBUG( "ShowChangeConnectionQueryL - write and complete" );  
   468             if ( !error )
   461             iMessage.WriteL( iReplySlot, 
   469                 {
   462                 TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
   470                 CCHUIDEBUG( "ShowChangeConnectionQueryL - write and complete" );  
   463             CompleteMessage( KErrNone );    
   471                 iMessage.WriteL( iReplySlot, 
       
   472                     TPckgBuf<TCCHUiNotifierParams>( iResultParams ) );
       
   473                 CompleteMessage( KErrNone );    
       
   474                 }
       
   475             else
       
   476                 {
       
   477                 CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); 
       
   478                 CompleteMessage( error );
       
   479                 }
   464             }
   480             }
   465         else
   481         else
   466             {
   482             {
   467             CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); 
   483             CCHUIDEBUG( "ShowChangeConnectionQueryL - complete with cancel" ); 
   468             CompleteMessage( KErrCancel );
   484             CompleteMessage( KErrCancel );
   715 
   731 
   716 // ---------------------------------------------------------------------------
   732 // ---------------------------------------------------------------------------
   717 // Shows gprs iap selection.
   733 // Shows gprs iap selection.
   718 // ---------------------------------------------------------------------------
   734 // ---------------------------------------------------------------------------
   719 //
   735 //
   720 void CCCHUiNotifierImpl::ShowGprsSelectionL( TUint aServiceId )
   736 TInt CCCHUiNotifierImpl::ShowGprsSelectionL( TUint aServiceId )
   721 	{ 
   737 	{ 
   722 	CCHUIDEBUG( "CCCHUiNotifierImpl::ShowGprsSelectionL - IN" );	
   738 	CCHUIDEBUG( "CCCHUiNotifierImpl::ShowGprsSelectionL - IN" );	
   723 
   739 	
       
   740 	TInt error = KErrNone;
   724     RArray<TUint32> iapIds;
   741     RArray<TUint32> iapIds;
   725     CleanupClosePushL( iapIds );
   742     CleanupClosePushL( iapIds );
   726 
   743 
   727     CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 );
   744     CDesCArray* arrayforDialog = new (ELeave) CDesCArrayFlat( 3 );
   728     CleanupStack::PushL( arrayforDialog );            
   745     CleanupStack::PushL( arrayforDialog );            
   740 	    
   757 	    
   741     CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
   758     CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
   742     
   759     
   743     TUint sourceSnap = KErrNone;
   760     TUint sourceSnap = KErrNone;
   744     // Fill array here
   761     // Fill array here
   745     CCchUiNotifConnectionHandler* connHandler = 
   762     sourceSnap = InternetGprsApsMissingFromServiceSnapL(
   746         CCchUiNotifConnectionHandler::NewLC();
   763         *arrayforDialog, iapIds );
   747     sourceSnap = connHandler->GetGprsAccessPointsL( *arrayforDialog, iapIds ); 
       
   748     CleanupStack::PopAndDestroy( connHandler );    
       
   749     
   764     
   750     CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
   765     CCHUIDEBUG( "ShowGprsSelectionL - set item array" );	
   751     dialog->SetItemTextArray( arrayforDialog );
   766     dialog->SetItemTextArray( arrayforDialog );
   752     dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
   767     dialog->SetOwnershipType( ELbmDoesNotOwnItemArray );
   753       
   768       
   754     // Block application key while showing query
   769     // Block application key while showing query
   755     (void) ((CAknNotifierAppServerAppUi*)
   770     (void) ((CAknNotifierAppServerAppUi*)
   756         iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
   771         iEikEnv->EikAppUi())->SuppressAppSwitching(ETrue); 
   757     iAppKeyBlocked = ETrue;
   772     iAppKeyBlocked = ETrue;
   758     
   773     
   759     CCHUIDEBUG( "ShowGprsSelectionL - run dialog" );	
   774     CCHUIDEBUG( "ShowGprsSelectionL - run dialog" );
       
   775     
   760     dialog->RunLD();
   776     dialog->RunLD();
   761 
   777 
   762     // write result, result now holds the item number
   778     // write result, result now holds the item number
   763     if ( KErrNotFound != result )
   779     if ( KErrNotFound != result )
   764         {
   780         {
   766         iResultParams.iGprsSourceSnap = sourceSnap;
   782         iResultParams.iGprsSourceSnap = sourceSnap;
   767         iResultParams.iGprsIapId = iapIds[ result ];
   783         iResultParams.iGprsIapId = iapIds[ result ];
   768         }
   784         }
   769     else
   785     else
   770         {
   786         {
   771         User::Leave( KErrCancel );
   787         error = KErrCancel;
   772         }
   788         }
   773     
   789     
   774     // Remove application key blocking
   790     // Remove application key blocking
   775     (void) ((CAknNotifierAppServerAppUi*)
   791     (void) ((CAknNotifierAppServerAppUi*)
   776         iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
   792         iEikEnv->EikAppUi())->SuppressAppSwitching(EFalse);    
   778 
   794 
   779     CleanupStack::PopAndDestroy( string );
   795     CleanupStack::PopAndDestroy( string );
   780     CleanupStack::PopAndDestroy( arrayforDialog );     
   796     CleanupStack::PopAndDestroy( arrayforDialog );     
   781     CleanupStack::PopAndDestroy( &iapIds );
   797     CleanupStack::PopAndDestroy( &iapIds );
   782 
   798 
   783     CCHUIDEBUG( "CCCHUiNotifierImpl::ShowGprsSelectionL - OUT" );
   799     CCHUIDEBUG2( "CCCHUiNotifierImpl::ShowGprsSelectionL -return %d", error );
       
   800     return error;
   784 	}   	
   801 	}   	
   785 
   802 
   786 // ---------------------------------------------------------------------------
   803 // ---------------------------------------------------------------------------
   787 // Returns handle to branding handler.
   804 // Returns handle to branding handler.
   788 // ---------------------------------------------------------------------------
   805 // ---------------------------------------------------------------------------
   873         aCommandArray.AppendL( ECchUiCommandCopyGprs );    
   890         aCommandArray.AppendL( ECchUiCommandCopyGprs );    
   874         }
   891         }
   875 
   892 
   876     CleanupStack::PopAndDestroy( useGprs );	
   893     CleanupStack::PopAndDestroy( useGprs );	
   877     CleanupStack::PopAndDestroy( searchWlan );	
   894     CleanupStack::PopAndDestroy( searchWlan );	
   878     CleanupStack::Pop();
   895     CleanupStack::Pop( &aCommandArray );
   879     
   896     
   880     CCHUIDEBUG( 
   897     CCHUIDEBUG( 
   881         "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - OUT" );  	    
   898         "CCCHUiNotifierImpl::FillNoConnectionsDefinedListboxL - OUT" );  	    
   882 	}
   899 	}
   883 	
   900 	
   931     HBufC* useGprs = StringLoader::LoadLC( 
   948     HBufC* useGprs = StringLoader::LoadLC( 
   932         R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CURRENT_CONNECTION_TEXT ); 
   949         R_QTN_CCHUINOTIF_USE_GPRS_CHANGE_CURRENT_CONNECTION_TEXT ); 
   933         
   950         
   934     aListItems.AppendL( *searchWlan );
   951     aListItems.AppendL( *searchWlan );
   935     aCommandArray.AppendL( ECchUiCommandSearchWlan );
   952     aCommandArray.AppendL( ECchUiCommandSearchWlan );
   936 
   953     
   937     if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() 
   954     if ( !IsPhoneOfflineL() && IsGprsIapsAvailableL() &&
   938             && IsVoIPOverWCDMAAllowedL() )
   955         IsVoIPOverWCDMAAllowedL() &&
       
   956         IsServiceSnapMissingInternetGprsApsL() )
   939         {
   957         {
   940         aListItems.AppendL( *useGprs ); 
   958         aListItems.AppendL( *useGprs ); 
   941         aCommandArray.AppendL( ECchUiCommandCopyGprs ); 
   959         aCommandArray.AppendL( ECchUiCommandCopyGprs ); 
   942         }
   960         }
   943 
   961 
   946     
   964     
   947     CCHUIDEBUG( 
   965     CCHUIDEBUG( 
   948             "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - OUT" );
   966             "CCCHUiNotifierImpl::FillChangeCurrentConnectionListboxL - OUT" );
   949     }
   967     }
   950 
   968 
       
   969 // ---------------------------------------------------------------------------
       
   970 // CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL
       
   971 // ---------------------------------------------------------------------------
       
   972 //
       
   973 TBool CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL() const
       
   974     {
       
   975     CCHUIDEBUG( 
       
   976         "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - IN" );
       
   977     
       
   978     TBool isMissingGPRSIap = EFalse;
       
   979     
       
   980     RArray<TUint32> iapIds;
       
   981     CleanupClosePushL( iapIds );
       
   982     
       
   983     CDesCArray* iaps = new (ELeave) CDesCArrayFlat( 1 );
       
   984     CleanupStack::PushL( iaps );
       
   985     
       
   986     InternetGprsApsMissingFromServiceSnapL( *iaps, iapIds );
       
   987     
       
   988     if ( iapIds.Count() )
       
   989         {
       
   990         isMissingGPRSIap = ETrue;
       
   991         }
       
   992     CleanupStack::PopAndDestroy( iaps );
       
   993     CleanupStack::PopAndDestroy( &iapIds );
       
   994     
       
   995     CCHUIDEBUG2( 
       
   996         "CCCHUiNotifierImpl::IsServiceSnapMissingInternetGprsApsL - return: %d", isMissingGPRSIap );
       
   997     
       
   998     return isMissingGPRSIap;
       
   999     }
       
  1000 
       
  1001 // ---------------------------------------------------------------------------
       
  1002 // CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL
       
  1003 // ---------------------------------------------------------------------------
       
  1004 //
       
  1005 TUint32 CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL(
       
  1006     CDesCArray& aIaps, RArray<TUint32>& aIapIds ) const
       
  1007     {
       
  1008     CCHUIDEBUG( 
       
  1009         "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - IN" );
       
  1010     
       
  1011     TUint32 internetSnapId = KErrNone;
       
  1012     
       
  1013     CCchUiNotifConnectionHandler* connHandler = 
       
  1014         CCchUiNotifConnectionHandler::NewLC();
       
  1015     
       
  1016     CDesCArray* voipGprsIaps = new (ELeave) CDesCArrayFlat( 1 );
       
  1017     CleanupStack::PushL( voipGprsIaps );
       
  1018     
       
  1019     RArray<TUint32> voipGprsIapIds;
       
  1020     CleanupClosePushL( voipGprsIapIds );
       
  1021 
       
  1022     connHandler->GetGprsAccessPointsSetToServiceSnapL(
       
  1023         *voipGprsIaps, voipGprsIapIds, iCurrentConnectionIapId );
       
  1024 
       
  1025     CDesCArray* internetGprsIapNames = new (ELeave) CDesCArrayFlat( 2 );
       
  1026     CleanupStack::PushL( internetGprsIapNames );
       
  1027     
       
  1028     RArray<TUint32> internetGprsIapIds;
       
  1029     CleanupClosePushL( internetGprsIapIds );
       
  1030     
       
  1031     TRAPD( err, internetSnapId = connHandler->GetGprsAccessPointsL(
       
  1032         *internetGprsIapNames, internetGprsIapIds ) );
       
  1033     CCHUIDEBUG2( "-GetGprsAccessPointsL -Trap err = %d", err );
       
  1034     
       
  1035     if ( !KErrNone == err && !KErrNotFound == err )
       
  1036         {
       
  1037         User::Leave( err );
       
  1038         }
       
  1039     
       
  1040     for ( TInt i( 0 ); i < internetGprsIapIds.Count(); i++ )
       
  1041         {
       
  1042         TBool found = EFalse;
       
  1043         for ( TInt j( 0 ); j < voipGprsIapIds.Count() && !found; j++ )
       
  1044             {
       
  1045             found = connHandler->IsConnectionMethodSimilarL(
       
  1046                 internetGprsIapIds[ i ], voipGprsIapIds[ j ] ); 
       
  1047             }
       
  1048         if ( !found )
       
  1049             {
       
  1050             CCHUIDEBUG2(
       
  1051                 "IsVoIPSNAPMissingInternetGPRSAp -missing GPRS AP id: %d", internetGprsIapIds[ i ] );
       
  1052             aIapIds.AppendL( internetGprsIapIds[ i ] );
       
  1053             aIaps.AppendL( internetGprsIapNames->MdcaPoint( i ) );
       
  1054             }
       
  1055         }
       
  1056 
       
  1057     CleanupStack::PopAndDestroy( &internetGprsIapIds );
       
  1058     CleanupStack::PopAndDestroy( internetGprsIapNames );
       
  1059     CleanupStack::PopAndDestroy( &voipGprsIapIds );
       
  1060     CleanupStack::PopAndDestroy( voipGprsIaps );
       
  1061     CleanupStack::PopAndDestroy( connHandler );
       
  1062     
       
  1063     CCHUIDEBUG( "CCCHUiNotifierImpl::InternetGprsApsMissingFromServiceSnapL - OUT" );
       
  1064     
       
  1065     return internetSnapId;
       
  1066     }
   951 
  1067 
   952 // ---------------------------------------------------------------------------
  1068 // ---------------------------------------------------------------------------
   953 // Fills list items and commands for change connection dialog.
  1069 // Fills list items and commands for change connection dialog.
   954 // ---------------------------------------------------------------------------
  1070 // ---------------------------------------------------------------------------
   955 //
  1071 //
  1046     pckg.Set( aBuffer );
  1162     pckg.Set( aBuffer );
  1047 
  1163 
  1048     CCCHUiNotifierBase::StartL( aBuffer, aReplySlot, aMessage );    
  1164     CCCHUiNotifierBase::StartL( aBuffer, aReplySlot, aMessage );    
  1049     iDialogMode = pckg().iDialogMode;
  1165     iDialogMode = pckg().iDialogMode;
  1050     iServiceId = pckg().iServiceId;
  1166     iServiceId = pckg().iServiceId;
       
  1167     iCurrentConnectionIapId = pckg().iCurrentConnectionIapId;
  1051     
  1168     
  1052     switch( pckg().iDialogMode )
  1169     switch( pckg().iDialogMode )
  1053         {
  1170         {
  1054         case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
  1171         case MCchUiObserver::ECchUiDialogTypeUsernamePasswordFailed:
  1055             {
  1172             {