413 // --------------------------------------------------------- |
413 // --------------------------------------------------------- |
414 // |
414 // |
415 void CBTUIPairedDevicesView::DynInitMenuPaneL(TInt aResId, CEikMenuPane* aMenu) |
415 void CBTUIPairedDevicesView::DynInitMenuPaneL(TInt aResId, CEikMenuPane* aMenu) |
416 { |
416 { |
417 TRACE_FUNC_ENTRY |
417 TRACE_FUNC_ENTRY |
418 iActiveMenuPane = aMenu; |
418 |
419 // dim help if it exists and is not supported |
419 // dim help if it exists and is not supported |
420 TInt tmp; |
420 TInt tmp; |
421 if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) ) |
421 if ( aMenu->MenuItemExists(EAknCmdHelp,tmp ) ) |
422 { |
422 { |
423 aMenu->SetItemDimmed(EAknCmdHelp, |
423 aMenu->SetItemDimmed(EAknCmdHelp, |
424 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); |
424 !FeatureManager::FeatureSupported( KFeatureIdHelp ) ); |
425 } |
425 } |
426 |
426 |
427 if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU ) |
427 if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU ) |
428 { |
428 { |
|
429 |
429 TInt index = iContainer->CurrentItemIndex(); |
430 TInt index = iContainer->CurrentItemIndex(); |
430 |
431 |
431 // we only show "new pair device", "help" , "Exit" and "Delete All" if view contains device(s). |
|
432 aMenu->SetItemDimmed(EBTUICmdSetTrusted, ETrue); |
|
433 aMenu->SetItemDimmed(EBTUICmdDelete,ETrue); |
|
434 aMenu->SetItemDimmed(EBTUICmdSetTrusted,ETrue); |
|
435 aMenu->SetItemDimmed(EBTUICmdSetUnTrusted,ETrue); |
|
436 aMenu->SetItemDimmed(EBTUICmdConnect,ETrue); |
|
437 aMenu->SetItemDimmed(EBTUICmdConnectAudio,ETrue); |
|
438 aMenu->SetItemDimmed(EBTUICmdDisconnect,ETrue); |
|
439 aMenu->SetItemDimmed(EBTUICmdSetBlocked,ETrue); |
|
440 aMenu->SetItemDimmed(EBTUICmdSettings,ETrue); |
|
441 aMenu->SetItemDimmed(EBTUICmdGiveNickname, ETrue); |
|
442 |
|
443 if ( index < 0 ) // No devices at list. Hide all device related commands. |
432 if ( index < 0 ) // No devices at list. Hide all device related commands. |
444 { |
433 { |
445 aMenu->SetItemDimmed(EBTUICmdDeleteAll, ETrue); |
434 aMenu->SetItemDimmed(EBTUICmdDeleteAll, ETrue); |
446 } |
435 } |
447 |
436 else |
|
437 { |
|
438 SetupMenuCmd(index, aMenu); |
|
439 } |
448 } |
440 } |
449 |
441 |
450 if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU_CONTEXT ) |
442 if ( aResId == R_BTUI_OTHER_DEVICES_VIEW_MENU_CONTEXT ) |
451 { |
443 { |
|
444 iActiveMenuPane = aMenu; |
452 TInt index = iContainer->CurrentItemIndex(); |
445 TInt index = iContainer->CurrentItemIndex(); |
453 |
446 |
454 // If user is fast enough to click the RSK option between |
447 // If user is fast enough to click the RSK option between |
455 // bt discovery view and device found view, bt ui will crash. |
448 // bt discovery view and device found view, bt ui will crash. |
456 // Therefore, we disable commands if bt discovery is onging. |
449 // Therefore, we disable commands if bt discovery is onging. |
457 // |
450 // |
458 if(iSearchOngoing) |
451 if(iSearchOngoing) |
483 aMenu->SetItemDimmed(EBTUICmdDisconnect, ETrue); |
476 aMenu->SetItemDimmed(EBTUICmdDisconnect, ETrue); |
484 aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); |
477 aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); |
485 } |
478 } |
486 else // There are devices at list |
479 else // There are devices at list |
487 { |
480 { |
488 TBTDevice device; |
481 SetupMenuCmd(index, aMenu); |
489 device.iIndex = index; |
482 //Hide New pair device in context menu |
490 iModel->GetDevice(device); |
|
491 iMenuDevice = device; |
|
492 |
|
493 TRACE_INFO(_L("there are device in list")) |
|
494 |
|
495 TBool dim = (device.iStatus & EStatusTrusted) == EStatusTrusted; |
|
496 |
|
497 aMenu->SetItemDimmed(EBTUICmdSetTrusted, dim); |
|
498 aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, !dim); |
|
499 |
|
500 // Check if device can be connected or disconnected |
|
501 dim = (! (device.iStatus & EStatusConnectable) |
|
502 || device.iStatus & EStatusBtuiConnected); |
|
503 |
|
504 if (dim) |
|
505 { |
|
506 aMenu->SetItemDimmed(EBTUICmdConnect, dim); |
|
507 aMenu->SetItemDimmed(EBTUICmdConnectAudio, dim); |
|
508 } |
|
509 else |
|
510 { |
|
511 if ( device.iDeviceClass.MajorDeviceClass() == EMajorDeviceComputer) |
|
512 { |
|
513 aMenu->SetItemDimmed(EBTUICmdConnect, ETrue); |
|
514 } |
|
515 else |
|
516 { |
|
517 aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue); |
|
518 } |
|
519 } |
|
520 dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; |
|
521 aMenu->SetItemDimmed(EBTUICmdDisconnect, dim); |
|
522 |
|
523 if ( !iBTPluginMan->IsPluginAvaiable(device.iDeviceClass) ) |
|
524 { |
|
525 aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); |
|
526 } |
|
527 else |
|
528 { |
|
529 dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; |
|
530 aMenu->SetItemDimmed(EBTUICmdSettings, dim); |
|
531 } |
|
532 //Hide New pair device |
|
533 aMenu->SetItemDimmed(EBTUICmdNewPairedDevice, ETrue); |
483 aMenu->SetItemDimmed(EBTUICmdNewPairedDevice, ETrue); |
534 } |
484 } |
535 } |
485 } |
536 TRACE_FUNC_EXIT |
486 TRACE_FUNC_EXIT |
537 } |
487 } |
1897 EMbmBtuiQgn_prop_bt_devices_tab3, |
1847 EMbmBtuiQgn_prop_bt_devices_tab3, |
1898 EMbmBtuiQgn_prop_bt_devices_tab3_mask ); |
1848 EMbmBtuiQgn_prop_bt_devices_tab3_mask ); |
1899 |
1849 |
1900 return icon; |
1850 return icon; |
1901 } |
1851 } |
|
1852 |
|
1853 |
|
1854 void CBTUIPairedDevicesView::SetupMenuCmd(TInt aIndex, CEikMenuPane* aMenu) |
|
1855 { |
|
1856 TBTDevice device; |
|
1857 device.iIndex = aIndex; |
|
1858 iModel->GetDevice(device); |
|
1859 iMenuDevice = device; |
|
1860 |
|
1861 TRACE_INFO(_L("there are device in list")) |
|
1862 |
|
1863 TBool dim = (device.iStatus & EStatusTrusted) == EStatusTrusted; |
|
1864 |
|
1865 aMenu->SetItemDimmed(EBTUICmdSetTrusted, dim); |
|
1866 aMenu->SetItemDimmed(EBTUICmdSetUnTrusted, !dim); |
|
1867 |
|
1868 // Check if device can be connected or disconnected |
|
1869 dim = (! (device.iStatus & EStatusConnectable) |
|
1870 || device.iStatus & EStatusBtuiConnected); |
|
1871 |
|
1872 if (dim) |
|
1873 { |
|
1874 aMenu->SetItemDimmed(EBTUICmdConnect, dim); |
|
1875 aMenu->SetItemDimmed(EBTUICmdConnectAudio, dim); |
|
1876 } |
|
1877 else |
|
1878 { |
|
1879 if ( device.iDeviceClass.MajorDeviceClass() == EMajorDeviceComputer) |
|
1880 { |
|
1881 aMenu->SetItemDimmed(EBTUICmdConnect, ETrue); |
|
1882 } |
|
1883 else |
|
1884 { |
|
1885 aMenu->SetItemDimmed(EBTUICmdConnectAudio, ETrue); |
|
1886 } |
|
1887 } |
|
1888 dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; |
|
1889 aMenu->SetItemDimmed(EBTUICmdDisconnect, dim); |
|
1890 |
|
1891 if ( !iBTPluginMan->IsPluginAvaiable(device.iDeviceClass) ) |
|
1892 { |
|
1893 aMenu->SetItemDimmed(EBTUICmdSettings, ETrue); |
|
1894 } |
|
1895 else |
|
1896 { |
|
1897 dim = (device.iStatus & EStatusBtuiConnected) != EStatusBtuiConnected; |
|
1898 aMenu->SetItemDimmed(EBTUICmdSettings, dim); |
|
1899 } |
|
1900 } |
|
1901 |
1902 |
1902 |
1903 // End of File |
1903 // End of File |
1904 |
1904 |