wlanutilities/wlansniffer/mainapplication/src/wsfmainview.cpp
branchRCL_3
changeset 16 8b0eae1b1d71
parent 8 c2bc3f8c7777
child 18 981afc7d3841
equal deleted inserted replaced
15:dff6ebfd236f 16:8b0eae1b1d71
   246             // no real items available, but hidden item is present
   246             // no real items available, but hidden item is present
   247             aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, EFalse );
   247             aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, EFalse );
   248             aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, ETrue );
   248             aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, ETrue );
   249             aMenuPane->SetItemDimmed( ESnifferCmdConnect, EFalse );
   249             aMenuPane->SetItemDimmed( ESnifferCmdConnect, EFalse );
   250             aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, ETrue );
   250             aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, ETrue );
   251             aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting ); 
   251             aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting );
       
   252 			 
       
   253             // dim filtering if connecting or there are no WLAN networks 
       
   254 			// in coverage or there is only one network which is connected, 
       
   255 			// and the filtering list does not contain any networks marked
       
   256 			// to be filtered out.
   252             aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, 
   257             aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, 
   253                                   connecting || !infoArray || blacklistEmpty );
   258                                       connecting ||
       
   259                                       !infoArray ||
       
   260                                       ( blacklistEmpty && 
       
   261                                         ( !infoArray->Count() || 
       
   262                                           ( infoArray->Count() == 1 && 
       
   263                                           (*infoArray)[0]->Connected() ) ) ) );
   254             aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue );
   264             aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue );
   255             aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting );
   265             aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting );
   256             return;
   266             return;
   257             }
   267             }
   258 
   268 
   284         aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, 
   294         aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, 
   285                                   !connected && !selectedItemConnecting); 
   295                                   !connected && !selectedItemConnecting); 
   286         
   296         
   287         aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting ); 
   297         aMenuPane->SetItemDimmed( ESnifferCmdRefresh, connecting ); 
   288       
   298       
   289         // dim filtering if no scan has been performed 
   299         // dim filtering if connecting or there are no WLAN networks 
   290         // or there is nothing to filter
   300 		// in coverage or there is only one network which is connected, 
       
   301 		// and the filtering list does not contain any networks marked
       
   302 		// to be filtered out.
   291         aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, 
   303         aMenuPane->SetItemDimmed( ESnifferCmdFilterWlans, 
   292                                   connecting ||
   304                                   connecting ||
   293                                   !infoArray ||
   305                                   !infoArray ||
   294                                   ( blacklistEmpty && 
   306                                   ( blacklistEmpty && 
   295                                     ( !infoArray->Count() || 
   307                                     ( !infoArray->Count() || 
   349         aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, 
   361         aMenuPane->SetItemDimmed( ESnifferCmdDisconnect, 
   350                                   !connected && !selectedItemConnecting );  
   362                                   !connected && !selectedItemConnecting );  
   351         aMenuPane->SetItemDimmed( ESnifferCmdDetails, 
   363         aMenuPane->SetItemDimmed( ESnifferCmdDetails, 
   352                                   connecting || hidden && !known );
   364                                   connecting || hidden && !known );
   353         }
   365         }
   354     
       
   355     }
   366     }
   356 
   367 
   357 
   368 
   358 // ---------------------------------------------------------------------------
   369 // ---------------------------------------------------------------------------
   359 // CWsfMainView::HandleListBoxEventL
   370 // CWsfMainView::HandleListBoxEventL
   432 
   443 
   433         if ( connected )
   444         if ( connected )
   434             {
   445             {
   435             RConnectionMonitor connectionMonitor;
   446             RConnectionMonitor connectionMonitor;
   436             connectionMonitor.ConnectL();
   447             connectionMonitor.ConnectL();
       
   448             CleanupClosePushL( connectionMonitor );
   437             // We have to check if the Browser using the selected 
   449             // We have to check if the Browser using the selected 
   438             // connection.
   450             // connection.
   439             // We have get the connectiond ID first.
   451             // We have get the connectiond ID first.
   440             CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL();
   452             CWsfActiveWaiter* waiter = CWsfActiveWaiter::NewL();
   441             CleanupStack::PushL( waiter );
   453             CleanupStack::PushL( waiter );
   472                     }
   484                     }
   473                 }
   485                 }
   474             // Now we have the connectiond ID.
   486             // Now we have the connectiond ID.
   475             LOG_WRITEF( "connectionId: %d", connectionId );
   487             LOG_WRITEF( "connectionId: %d", connectionId );
   476             
   488             
   477             TInt count( 0 );
       
   478             TConnMonClientEnumBuf clientBuf;
   489             TConnMonClientEnumBuf clientBuf;
   479                 
   490                 
   480             connectionMonitor.GetPckgAttribute( connectionId,
   491             connectionMonitor.GetPckgAttribute( connectionId,
   481                                                 0,
   492                                                 0,
   482                                                 KClientInfo,
   493                                                 KClientInfo,
   483                                                 clientBuf,
   494                                                 clientBuf,
   484                                                 waiter->iStatus );
   495                                                 waiter->iStatus );
   485             waiter->WaitForRequest();
   496             waiter->WaitForRequest();
       
   497             TInt count( 0 );
   486             if ( !waiter->iStatus.Int() )
   498             if ( !waiter->iStatus.Int() )
   487                 {
   499                 {
   488                 count = clientBuf().iCount;
   500                 count = clientBuf().iCount;
   489                 }
   501                 }
   490             
   502 
   491             RApaLsSession appSess;
   503             RApaLsSession appSess;
   492             TApaAppInfo appInfo;
   504             TApaAppInfo appInfo;
   493             
   505 
   494             // The connection could be shared by several applications
   506             // The connection could be shared by several applications
   495             User::LeaveIfError( appSess.Connect() );
   507             User::LeaveIfError( appSess.Connect() );
   496             
   508             // No need for CleanupClosePushL(appSess) cause nothing leaves.
   497             TUint i;
   509 
   498             for ( i = 0; i < count; i++ )
   510             for ( TInt i = 0; i < count; i++ )
   499                 {
   511                 {
   500                 appInfo.iCaption.Zero();
   512                 appInfo.iCaption.Zero();
   501                 TInt result = appSess.GetAppInfo( appInfo, 
   513                 TInt result = appSess.GetAppInfo( appInfo, 
   502                                                   clientBuf().iUid[i] );
   514                                                   clientBuf().iUid[i] );
   503                 
   515                 
   507                 
   519                 
   508                 if ( clientBuf().iUid[i].iUid == KBrowserUid )
   520                 if ( clientBuf().iUid[i].iUid == KBrowserUid )
   509                     {
   521                     {
   510                     isBrowserRunning = ETrue;
   522                     isBrowserRunning = ETrue;
   511                     }
   523                     }
   512                 }
   524                 }           
       
   525             appSess.Close();
       
   526             
   513             CleanupStack::PopAndDestroy( waiter );
   527             CleanupStack::PopAndDestroy( waiter );
   514             appSess.Close();
   528             CleanupStack::PopAndDestroy( &connectionMonitor );
   515             connectionMonitor.Close();
       
   516             }                
   529             }                
   517         }
   530         }
   518     else 
   531     else 
   519         {
   532         {
   520         LOG_WRITE( "No Browser running." );
   533         LOG_WRITE( "No Browser running." );