From 0db890095c9f330089ec2bc8880412451f6d6b70 Mon Sep 17 00:00:00 2001 From: Oliver Ruiz Dorantes Date: Sat, 14 Mar 2009 14:51:41 +0000 Subject: [PATCH] - Prevent crashing when there is no localDevice picked(raynald lesieur) - SetTarget for localDevices not found during startup of the app git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29517 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/bluetooth/BluetoothSettingsView.cpp | 2 ++ src/preferences/bluetooth/ExtendedLocalDeviceView.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/preferences/bluetooth/BluetoothSettingsView.cpp b/src/preferences/bluetooth/BluetoothSettingsView.cpp index 84007b357a..a2feb63697 100644 --- a/src/preferences/bluetooth/BluetoothSettingsView.cpp +++ b/src/preferences/bluetooth/BluetoothSettingsView.cpp @@ -126,12 +126,14 @@ BluetoothSettingsView::MessageReceived(BMessage *msg) if (msg->FindPointer("LocalDevice", (void**) &lDevice) == B_OK) { // Device integrity should be rechecked fExtDeviceView->SetLocalDevice(lDevice); + fExtDeviceView->SetEnabled(true); ActiveLocalDevice = lDevice; } } break; case kMsgRefresh: _BuildLocalDevicesMenu(); + fLocalDevicesMenu->SetTargetForItems(this); break; default: BView::MessageReceived(msg); diff --git a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp index 1e235327f5..91f0ea1a17 100644 --- a/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp +++ b/src/preferences/bluetooth/ExtendedLocalDeviceView.cpp @@ -31,7 +31,8 @@ ExtendedLocalDeviceView::ExtendedLocalDeviceView(BRect frame, LocalDevice* bDevi fDiscoverable = new BCheckBox(iDontCare, "Discoverable","Discoverable", new BMessage(SET_DISCOVERABLE)); fVisible = new BCheckBox(iDontCare, "Visible", "Show Name", new BMessage(SET_VISIBLE)); - + fDiscoverable->SetEnabled(false); + fVisible->SetEnabled(false); AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) .Add(fDeviceView) @@ -103,8 +104,8 @@ ExtendedLocalDeviceView::MessageReceived(BMessage *msg) if (fVisible->Value()) fScanMode |= 2; - - fDevice->SetDiscoverable(fScanMode); + if (fDevice != NULL) + fDevice->SetDiscoverable(fScanMode); break; @@ -118,5 +119,5 @@ ExtendedLocalDeviceView::MessageReceived(BMessage *msg) void ExtendedLocalDeviceView::SetEnabled(bool value) { - + fDiscoverable->SetEnabled(value); }