Add option to refresh the list of localdevices

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29473 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Oliver Ruiz Dorantes 2009-03-11 19:36:57 +00:00
parent 5b9d5a2ec9
commit 011db60a81
3 changed files with 17 additions and 7 deletions

View File

@ -127,9 +127,12 @@ BluetoothSettingsView::MessageReceived(BMessage *msg)
// Device integrity should be rechecked
fExtDeviceView->SetLocalDevice(lDevice);
ActiveLocalDevice = lDevice;
}
break;
}
}
break;
case kMsgRefresh:
_BuildLocalDevicesMenu();
break;
default:
BView::MessageReceived(msg);
}
@ -192,12 +195,15 @@ BluetoothSettingsView::_BuildLocalDevicesMenu()
{
LocalDevice* lDevice;
fLocalDevicesMenu = new BPopUpMenu("Pick LocalDevice...");
if (!fLocalDevicesMenu)
fLocalDevicesMenu = new BPopUpMenu("Pick LocalDevice...");
for (uint32 index = 0 ; index < LocalDevice::GetLocalDeviceCount() ; index++) {
lDevice = LocalDevice::GetLocalDevice();
if (lDevice != NULL) {
// TODO Check if they already exists
BMessage* message = new BMessage(kMsgLocalSwitched);
message->AddPointer("LocalDevice", lDevice);

View File

@ -50,6 +50,7 @@ BluetoothWindow::BluetoothWindow(BRect frame)
menu->AddItem(new BMenuItem("Stop Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStopServices), 0));
menu->AddSeparatorItem();
menu->AddItem(new BMenuItem("Show Bluetooth console" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0));
menu->AddItem(new BMenuItem("Refresh LocalDevices" B_UTF8_ELLIPSIS, new BMessage(kMsgRefresh), 0));
fMenubar->AddItem(menu);
menu = new BMenu("View");
@ -121,14 +122,16 @@ BluetoothWindow::MessageReceived(BMessage *message)
printf("kMsgStopServices: %s\n", strerror(BMessenger("application/x-vnd.Be-bluetooth_server").SendMessage(B_QUIT_REQUESTED)));
}
break;
case kMsgAddToRemoteList:
{
PostMessage(message, fRemoteDevices);
}
PostMessage(message, fRemoteDevices);
break;
case kMsgRefresh:
fSettingsView->MessageReceived(message);
break;
case B_ABOUT_REQUESTED:
be_app->PostMessage(message);
break;
break;
default:
BWindow::MessageReceived(message);
break;

View File

@ -27,6 +27,7 @@ const uint32 kBorderSpace = 10;
const uint32 kItemSpace = 7;
static const uint32 kMsgAddToRemoteList = 'aDdL';
static const uint32 kMsgRefresh = 'rFLd';
extern LocalDevice* ActiveLocalDevice;