From 011db60a815d0306d885ab8d6ab0304f3df9c83b Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Wed, 11 Mar 2009 19:36:57 +0000 Subject: [PATCH] Add option to refresh the list of localdevices git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29473 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/bluetooth/BluetoothSettingsView.cpp | 12 +++++++++--- src/preferences/bluetooth/BluetoothWindow.cpp | 11 +++++++---- src/preferences/bluetooth/defs.h | 1 + 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/preferences/bluetooth/BluetoothSettingsView.cpp b/src/preferences/bluetooth/BluetoothSettingsView.cpp index 7ed661e124..84007b357a 100644 --- a/src/preferences/bluetooth/BluetoothSettingsView.cpp +++ b/src/preferences/bluetooth/BluetoothSettingsView.cpp @@ -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); diff --git a/src/preferences/bluetooth/BluetoothWindow.cpp b/src/preferences/bluetooth/BluetoothWindow.cpp index 9f9edf2028..bcf57602ac 100644 --- a/src/preferences/bluetooth/BluetoothWindow.cpp +++ b/src/preferences/bluetooth/BluetoothWindow.cpp @@ -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; diff --git a/src/preferences/bluetooth/defs.h b/src/preferences/bluetooth/defs.h index 8289567129..0ad9f0e0d6 100644 --- a/src/preferences/bluetooth/defs.h +++ b/src/preferences/bluetooth/defs.h @@ -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;