32 #include "wsfmainviewmodel.h" |
32 #include "wsfmainviewmodel.h" |
33 #include "wsfmainviewcontainer.h" |
33 #include "wsfmainviewcontainer.h" |
34 #include "wsfmainapplication.hrh" |
34 #include "wsfmainapplication.hrh" |
35 #include "wsfactivewaiter.h" |
35 #include "wsfactivewaiter.h" |
36 #include "wsfappui.h" |
36 #include "wsfappui.h" |
|
37 #include "wsfmodel.h" |
37 |
38 |
38 #include "wsflogger.h" |
39 #include "wsflogger.h" |
39 |
40 |
40 |
41 |
41 // Standard construction sequence |
42 // Standard construction sequence |
69 |
70 |
70 // --------------------------------------------------------------------------- |
71 // --------------------------------------------------------------------------- |
71 // CWsfMainView::CWsfMainView |
72 // CWsfMainView::CWsfMainView |
72 // --------------------------------------------------------------------------- |
73 // --------------------------------------------------------------------------- |
73 // |
74 // |
74 CWsfMainView::CWsfMainView() |
75 CWsfMainView::CWsfMainView(): iBrowserIapId( KErrNotFound ) |
75 { |
76 { |
76 // no implementation required |
77 // no implementation required |
77 } |
78 } |
78 |
79 |
79 |
80 |
146 break; |
147 break; |
147 } |
148 } |
148 case EAknSoftkeyContextOptions: |
149 case EAknSoftkeyContextOptions: |
149 { |
150 { |
150 LOG_WRITE( "CWsfMainView::HandleCommandL, Options" ); |
151 LOG_WRITE( "CWsfMainView::HandleCommandL, Options" ); |
151 UpdateBrowserUsageInfoL(); |
|
152 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); |
152 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); |
153 MenuBar()->SetMenuType( CEikMenuBar::EMenuContext ); |
153 MenuBar()->SetMenuType( CEikMenuBar::EMenuContext ); |
154 MenuBar()->TryDisplayMenuBarL(); |
154 MenuBar()->TryDisplayMenuBarL(); |
155 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_MENUBAR ); |
155 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_MENUBAR ); |
156 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
156 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
236 AppUi()->Document() ); |
236 AppUi()->Document() ); |
237 TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); |
237 TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); |
238 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
238 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
239 CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); |
239 CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); |
240 |
240 |
241 CWsfAppUi* appui = static_cast<CWsfAppUi*>( AppUi() ); |
241 TBool connecting( doc->Model().IsConnecting() ); |
242 TBool connecting( appui->SuppressingKeyEvents() ); |
|
243 |
242 |
244 if ( !selectedItem ) |
243 if ( !selectedItem ) |
245 { |
244 { |
246 // no real items available, but hidden item is present |
245 // no real items available, but hidden item is present |
247 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, EFalse ); |
246 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, EFalse ); |
266 return; |
265 return; |
267 } |
266 } |
268 |
267 |
269 TBool connected( selectedItem->Connected() ); |
268 TBool connected( selectedItem->Connected() ); |
270 TBool connectedAndUsed( EFalse ); |
269 TBool connectedAndUsed( EFalse ); |
271 if ( connected ) |
270 if ( connected && iBrowserIapId == selectedItem->iIapId ) |
272 { |
271 { |
273 connectedAndUsed = iIsBrowserUsingWlan; |
272 connectedAndUsed = ETrue; |
274 } |
273 } |
275 TBool known( selectedItem->Known() ); |
274 TBool known( selectedItem->Known() ); |
276 |
275 |
277 TBool selectedItemConnecting ( |
276 TBool selectedItemConnecting ( |
278 selectedItem->ConnectionStatus() == EConnecting ); |
277 selectedItem->ConnectionStatus() == EConnecting ); |
322 TBool connectedAndUsed( EFalse ); |
321 TBool connectedAndUsed( EFalse ); |
323 TBool connected( EFalse ); |
322 TBool connected( EFalse ); |
324 TBool known( EFalse ); |
323 TBool known( EFalse ); |
325 TBool hidden( ETrue ); |
324 TBool hidden( ETrue ); |
326 |
325 |
327 CWsfAppUi* appui = static_cast<CWsfAppUi*>( AppUi() ); |
326 const CWsfDocument* doc = static_cast<const CWsfDocument*>( |
328 TBool connecting( appui->SuppressingKeyEvents() ); |
327 AppUi()->Document() ); |
|
328 |
|
329 TBool connecting( doc->Model().IsConnecting() ); |
329 TBool selectedItemConnecting( EFalse ); |
330 TBool selectedItemConnecting( EFalse ); |
330 |
331 |
331 |
332 |
332 if ( selectedItem ) |
333 if ( selectedItem ) |
333 { |
334 { |
334 // workaround: even if the model reports no elements, we know that |
335 // workaround: even if the model reports no elements, we know that |
335 // the hidden item must always be there |
336 // the hidden item must always be there |
336 connected = selectedItem->Connected(); |
337 connected = selectedItem->Connected(); |
337 if ( connected ) |
338 if ( connected && iBrowserIapId == selectedItem->iIapId ) |
338 { |
339 { |
339 connectedAndUsed = iIsBrowserUsingWlan; |
340 connectedAndUsed = ETrue; |
340 } |
341 } |
341 known = selectedItem->Known(); |
342 known = selectedItem->Known(); |
342 hidden = selectedItem->Hidden(); |
343 hidden = selectedItem->Hidden(); |
343 selectedItemConnecting = |
344 selectedItemConnecting = |
344 ( selectedItem->ConnectionStatus() == EConnecting ); |
345 ( selectedItem->ConnectionStatus() == EConnecting ); |
403 // --------------------------------------------------------------------------- |
404 // --------------------------------------------------------------------------- |
404 // |
405 // |
405 void CWsfMainView::UpdateBrowserUsageInfoL() |
406 void CWsfMainView::UpdateBrowserUsageInfoL() |
406 { |
407 { |
407 LOG_ENTERFN( "CWsfMainView::UpdateBrowserUsageInfoL" ); |
408 LOG_ENTERFN( "CWsfMainView::UpdateBrowserUsageInfoL" ); |
408 iIsBrowserUsingWlan = IsBrowserUsingWlanL(); |
409 iBrowserIapId = BrowserIapIdL(); |
409 } |
410 } |
410 |
411 |
411 |
412 |
412 // --------------------------------------------------------------------------- |
413 // --------------------------------------------------------------------------- |
413 // CWsfMainView::IsBrowserUsingWlanL |
414 // CWsfMainView::BrowserIapIdL |
414 // --------------------------------------------------------------------------- |
415 // --------------------------------------------------------------------------- |
415 // |
416 // |
416 TBool CWsfMainView::IsBrowserUsingWlanL() |
417 TInt CWsfMainView::BrowserIapIdL() |
417 { |
418 { |
418 LOG_ENTERFN( "CWsfMainView::IsBrowserUsingWlanL" ); |
419 LOG_ENTERFN( "CWsfMainView::BrowserIapIdL" ); |
419 |
420 |
420 const TInt KBrowserUid = 0x10008D39; |
421 const TInt KBrowserUid = 0x10008D39; |
421 TUid id( TUid::Uid( KBrowserUid ) ); |
422 TUid id( TUid::Uid( KBrowserUid ) ); |
422 |
423 |
423 // Check if the Browser application is already running. |
424 // Check if the Browser application is already running. |
424 TApaTaskList taskList( iEikonEnv->WsSession() ); |
425 TApaTaskList taskList( iEikonEnv->WsSession() ); |
425 TApaTask task = taskList.FindApp( id ); |
426 TApaTask task = taskList.FindApp( id ); |
426 TBool isBrowserRunning( EFalse ); |
427 TInt browserIapId( KErrNotFound ); |
427 |
428 |
428 #ifndef __WINS__ |
429 #ifndef __WINS__ |
429 |
430 |
430 if ( task.Exists() ) |
431 if ( task.Exists() ) |
431 { |
432 { |
432 LOG_WRITE( "The Browser is running." ); |
433 LOG_WRITE( "The Browser is running." ); |
433 // The Browser is already running. |
434 // The Browser is already running. |
434 // Check if the selected WLAN is connected. |
435 TWsfWlanInfo* firstItem = NULL; |
435 iController.UpdateSelectedItemL(); |
436 |
436 TWsfWlanInfo* selectedItem = iController.SelectedItem(); |
437 CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); |
|
438 if ( infoArray ) |
|
439 { |
|
440 firstItem = infoArray->At( 0 ); |
|
441 } |
|
442 |
437 TBool connected( EFalse ); |
443 TBool connected( EFalse ); |
438 if( selectedItem ) |
444 if( firstItem ) |
439 { |
445 { |
440 connected = selectedItem->Connected(); |
446 // first item always holds the connected network |
441 } |
447 connected = firstItem->Connected(); |
|
448 } |
442 LOG_WRITEF("Selected network Connected? %d", connected); |
449 LOG_WRITEF("Selected network Connected? %d", connected); |
443 |
450 |
444 if ( connected ) |
451 if ( connected ) |
445 { |
452 { |
446 RConnectionMonitor connectionMonitor; |
453 RConnectionMonitor connectionMonitor; |
517 LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", |
524 LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", |
518 clientBuf().iUid[i].iUid ); |
525 clientBuf().iUid[i].iUid ); |
519 |
526 |
520 if ( clientBuf().iUid[i].iUid == KBrowserUid ) |
527 if ( clientBuf().iUid[i].iUid == KBrowserUid ) |
521 { |
528 { |
522 isBrowserRunning = ETrue; |
529 browserIapId = firstItem->iIapId; |
523 } |
530 } |
524 } |
531 } |
525 appSess.Close(); |
532 appSess.Close(); |
526 |
533 |
527 CleanupStack::PopAndDestroy( waiter ); |
534 CleanupStack::PopAndDestroy( waiter ); |