145 AppUi()->HandleCommandL( EAknCmdExit ); |
145 AppUi()->HandleCommandL( EAknCmdExit ); |
146 break; |
146 break; |
147 } |
147 } |
148 case EAknSoftkeyContextOptions: |
148 case EAknSoftkeyContextOptions: |
149 { |
149 { |
|
150 LOG_WRITE( "CWsfMainView::HandleCommandL, Options" ); |
|
151 UpdateBrowserUsageInfoL(); |
150 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); |
152 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_CONTEXT_MENUBAR ); |
151 MenuBar()->SetMenuType( CEikMenuBar::EMenuContext ); |
153 MenuBar()->SetMenuType( CEikMenuBar::EMenuContext ); |
152 MenuBar()->TryDisplayMenuBarL(); |
154 MenuBar()->TryDisplayMenuBarL(); |
153 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_MENUBAR ); |
155 MenuBar()->SetMenuTitleResourceId( R_SNIFFER_MENUBAR ); |
154 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
156 MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions ); |
155 break; |
157 break; |
156 } |
158 } |
172 const TDesC8& /*aCustomMessage*/) |
174 const TDesC8& /*aCustomMessage*/) |
173 { |
175 { |
174 LOG_ENTERFN( "CWsfMainView::DoActivateL" ); |
176 LOG_ENTERFN( "CWsfMainView::DoActivateL" ); |
175 if ( !iContainer ) |
177 if ( !iContainer ) |
176 { |
178 { |
177 iContainer = CWsfMainViewContainer::NewL( ClientRect() ); |
179 iContainer = CWsfMainViewContainer::NewL( ClientRect(), this ); |
178 // set icons array to list |
180 // set icons array to list |
179 iContainer->SetMopParent( this ); |
181 iContainer->SetMopParent( this ); |
180 iContainer->SetPartner( iController ); |
182 iContainer->SetPartner( iController ); |
181 iContainer->ListBox()->SetListBoxObserver( this ); |
183 iContainer->ListBox()->SetListBoxObserver( this ); |
182 AppUi()->AddToViewStackL( *this, iContainer ); |
184 AppUi()->AddToViewStackL( *this, iContainer ); |
221 // --------------------------------------------------------------------------- |
223 // --------------------------------------------------------------------------- |
222 // |
224 // |
223 void CWsfMainView::DynInitMenuPaneL( TInt aResourceId, |
225 void CWsfMainView::DynInitMenuPaneL( TInt aResourceId, |
224 CEikMenuPane* aMenuPane ) |
226 CEikMenuPane* aMenuPane ) |
225 { |
227 { |
|
228 LOG_ENTERFN( "CWsfMainView::DynInitMenuPaneL" ); |
|
229 LOG_WRITEF( "resource id = %d", aResourceId ); |
226 iController.UpdateSelectedItemL(); |
230 iController.UpdateSelectedItemL(); |
227 |
231 |
228 if ( aResourceId == R_SNIFFER_MENU ) |
232 if ( aResourceId == R_SNIFFER_MENU ) |
229 { |
233 { |
230 LOG_ENTERFN( "CWsfMainView::DynInitMenuPaneL" ); |
234 LOG_WRITE( "CWsfMainView::DynInitMenuPaneL, R_SNIFFER_MENU" ); |
231 const CWsfDocument* doc = static_cast<const CWsfDocument*>( |
235 const CWsfDocument* doc = static_cast<const CWsfDocument*>( |
232 AppUi()->Document() ); |
236 AppUi()->Document() ); |
233 TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); |
237 TBool blacklistEmpty( !doc->WlanInfoBranding().BlackListItemCount() ); |
234 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
238 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
235 CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); |
239 CWsfWlanInfoArray *infoArray = iModel->GetInfoArray(); |
250 aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue ); |
254 aMenuPane->SetItemDimmed( ESnifferCmdDetails, ETrue ); |
251 aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); |
255 aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); |
252 return; |
256 return; |
253 } |
257 } |
254 |
258 |
255 TBool connectedAndUsed( StartWebBrowsingVisibleL() ); |
|
256 TBool connected( selectedItem->Connected() ); |
259 TBool connected( selectedItem->Connected() ); |
|
260 TBool connectedAndUsed( EFalse ); |
|
261 if ( connected ) |
|
262 { |
|
263 connectedAndUsed = iIsBrowserUsingWlan; |
|
264 } |
257 TBool known( selectedItem->Known() ); |
265 TBool known( selectedItem->Known() ); |
258 |
266 |
259 TBool selectedItemConnecting ( |
267 TBool selectedItemConnecting ( |
260 selectedItem->ConnectionStatus() == EConnecting ); |
268 selectedItem->ConnectionStatus() == EConnecting ); |
261 |
269 |
|
270 LOG_WRITEF( "connectedAndUsed = %d", connectedAndUsed ); |
|
271 LOG_WRITEF( "connected = %d", connected ); |
|
272 LOG_WRITEF( "known = %d", known ); |
|
273 LOG_WRITEF( "selectedItemConnecting = %d", selectedItemConnecting ); |
|
274 LOG_WRITEF( "connecting = %d", connecting ); |
|
275 |
262 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, |
276 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, |
263 connectedAndUsed || selectedItemConnecting ); |
277 connectedAndUsed || selectedItemConnecting ); |
264 aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, |
278 aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, |
265 !connectedAndUsed || selectedItemConnecting ); |
279 !connectedAndUsed || selectedItemConnecting ); |
266 |
280 |
287 selectedItem->Hidden() && !known ); |
301 selectedItem->Hidden() && !known ); |
288 aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); |
302 aMenuPane->SetItemDimmed( ESnifferCmdSettings, connecting ); |
289 } |
303 } |
290 else if ( aResourceId == R_SNIFFER_CONTEXT_MENU ) |
304 else if ( aResourceId == R_SNIFFER_CONTEXT_MENU ) |
291 { |
305 { |
|
306 LOG_WRITE( "CWsfMainView::DynInitMenuPaneL, R_SNIFFER_CONTEXT_MENU" ); |
292 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
307 TWsfWlanInfo *selectedItem = iController.SelectedItem(); |
293 |
308 |
294 // there must be always at least one item: "Other (unlisted)..." |
309 // there must be always at least one item: "Other (unlisted)..." |
295 TBool connectedAndUsed( StartWebBrowsingVisibleL() ); |
310 TBool connectedAndUsed( EFalse ); |
296 TBool connected( EFalse ); |
311 TBool connected( EFalse ); |
297 TBool known( EFalse ); |
312 TBool known( EFalse ); |
298 TBool hidden( ETrue ); |
313 TBool hidden( ETrue ); |
299 |
314 |
300 CWsfAppUi* appui = static_cast<CWsfAppUi*>( AppUi() ); |
315 CWsfAppUi* appui = static_cast<CWsfAppUi*>( AppUi() ); |
301 TBool connecting( appui->SuppressingKeyEvents() ); |
316 TBool connecting( appui->SuppressingKeyEvents() ); |
302 TBool selectedItemConnecting( EFalse ); |
317 TBool selectedItemConnecting( EFalse ); |
|
318 |
303 |
319 |
304 if ( selectedItem ) |
320 if ( selectedItem ) |
305 { |
321 { |
306 // workaround: even if the model reports no elements, we know that |
322 // workaround: even if the model reports no elements, we know that |
307 // the hidden item must always be there |
323 // the hidden item must always be there |
308 connected = selectedItem->Connected(); |
324 connected = selectedItem->Connected(); |
|
325 if ( connected ) |
|
326 { |
|
327 connectedAndUsed = iIsBrowserUsingWlan; |
|
328 } |
309 known = selectedItem->Known(); |
329 known = selectedItem->Known(); |
310 hidden = selectedItem->Hidden(); |
330 hidden = selectedItem->Hidden(); |
311 selectedItemConnecting = |
331 selectedItemConnecting = |
312 ( selectedItem->ConnectionStatus() == EConnecting ); |
332 ( selectedItem->ConnectionStatus() == EConnecting ); |
313 } |
333 } |
314 |
334 |
|
335 LOG_WRITEF( "connectedAndUsed = %d", connectedAndUsed ); |
|
336 LOG_WRITEF( "connected = %d", connected ); |
|
337 LOG_WRITEF( "known = %d", known ); |
|
338 LOG_WRITEF( "selectedItemConnecting = %d", selectedItemConnecting ); |
|
339 LOG_WRITEF( "connecting = %d", connecting ); |
|
340 |
|
341 |
315 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, |
342 aMenuPane->SetItemDimmed( ESnifferCmdStartBrowsing, |
316 connectedAndUsed || selectedItemConnecting ); |
343 connectedAndUsed || selectedItemConnecting ); |
317 aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, |
344 aMenuPane->SetItemDimmed( ESnifferCmdContinueBrowsing, |
318 !connectedAndUsed || selectedItemConnecting ); |
345 !connectedAndUsed || selectedItemConnecting ); |
319 |
346 |
333 // --------------------------------------------------------------------------- |
360 // --------------------------------------------------------------------------- |
334 // |
361 // |
335 void CWsfMainView::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
362 void CWsfMainView::HandleListBoxEventL( CEikListBox* /*aListBox*/, |
336 TListBoxEvent aEventType ) |
363 TListBoxEvent aEventType ) |
337 { |
364 { |
|
365 LOG_ENTERFN( "CWsfMainView::HandleListBoxEventL" ); |
|
366 LOG_WRITEF( "aEventType = %d", aEventType ); |
338 switch ( aEventType ) |
367 switch ( aEventType ) |
339 { |
368 { |
340 case EEventEnterKeyPressed: |
369 case EEventEnterKeyPressed: |
341 case EEventItemSingleClicked: |
370 case EEventItemSingleClicked: |
342 { |
371 { |
356 void CWsfMainView::SelectionKeyPressed() |
385 void CWsfMainView::SelectionKeyPressed() |
357 { |
386 { |
358 iSelectionKey = ETrue; |
387 iSelectionKey = ETrue; |
359 } |
388 } |
360 |
389 |
361 |
390 // --------------------------------------------------------------------------- |
362 // --------------------------------------------------------------------------- |
391 // CWsfMainView::UpdateBrowserUsageInfoL |
363 // CWsfMainView::StartWebBrowsingVisibleL |
392 // --------------------------------------------------------------------------- |
364 // --------------------------------------------------------------------------- |
393 // |
365 // |
394 void CWsfMainView::UpdateBrowserUsageInfoL() |
366 TBool CWsfMainView::StartWebBrowsingVisibleL() |
395 { |
367 { |
396 LOG_ENTERFN( "CWsfMainView::UpdateBrowserUsageInfoL" ); |
368 LOG_ENTERFN( "CWsfMainView::StartWebBrowsingVisibleL" ); |
397 iIsBrowserUsingWlan = IsBrowserUsingWlanL(); |
|
398 } |
|
399 |
|
400 |
|
401 // --------------------------------------------------------------------------- |
|
402 // CWsfMainView::IsBrowserUsingWlanL |
|
403 // --------------------------------------------------------------------------- |
|
404 // |
|
405 TBool CWsfMainView::IsBrowserUsingWlanL() |
|
406 { |
|
407 LOG_ENTERFN( "CWsfMainView::IsBrowserUsingWlanL" ); |
|
408 |
369 const TInt KBrowserUid = 0x10008D39; |
409 const TInt KBrowserUid = 0x10008D39; |
370 TUid id( TUid::Uid( KBrowserUid ) ); |
410 TUid id( TUid::Uid( KBrowserUid ) ); |
371 |
411 |
372 // Check if the Browser application is already running. |
412 // Check if the Browser application is already running. |
373 TApaTaskList taskList( iEikonEnv->WsSession() ); |
413 TApaTaskList taskList( iEikonEnv->WsSession() ); |
374 TApaTask task = taskList.FindApp( id ); |
414 TApaTask task = taskList.FindApp( id ); |
375 TBool isBrowserRuning( EFalse ); |
415 TBool isBrowserRunning( EFalse ); |
376 |
416 |
377 #ifndef __WINS__ |
417 #ifndef __WINS__ |
378 |
418 |
379 if ( task.Exists() ) |
419 if ( task.Exists() ) |
380 { |
420 { |
381 LOG_WRITE( "The Browser is running." ); |
421 LOG_WRITE( "The Browser is running." ); |
382 // The Browser is already running. |
422 // The Browser is already running. |
383 // Check if the selected WLAN is connected. |
423 // Check if the selected WLAN is connected. |
|
424 iController.UpdateSelectedItemL(); |
384 TWsfWlanInfo* selectedItem = iController.SelectedItem(); |
425 TWsfWlanInfo* selectedItem = iController.SelectedItem(); |
385 TBool connected( EFalse ); |
426 TBool connected( EFalse ); |
386 if( selectedItem ) |
427 if( selectedItem ) |
387 { |
428 { |
388 connected = selectedItem->Connected(); |
429 connected = selectedItem->Connected(); |
464 LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", |
505 LOG_WRITEF( "iClientInfo.iUid[i].iUid: %x", |
465 clientBuf().iUid[i].iUid ); |
506 clientBuf().iUid[i].iUid ); |
466 |
507 |
467 if ( clientBuf().iUid[i].iUid == KBrowserUid ) |
508 if ( clientBuf().iUid[i].iUid == KBrowserUid ) |
468 { |
509 { |
469 isBrowserRuning = ETrue; |
510 isBrowserRunning = ETrue; |
470 } |
511 } |
471 } |
512 } |
472 CleanupStack::PopAndDestroy( waiter ); |
513 CleanupStack::PopAndDestroy( waiter ); |
473 appSess.Close(); |
514 appSess.Close(); |
474 connectionMonitor.Close(); |
515 connectionMonitor.Close(); |