Bluetooth Pref: Inactiveate button and things that don't do anything.

* Inactiveate button and things that don't do anything.
* Those button and controlles that hade any actions in the Bluetooth Pref now saves in settings.
* Fix some windows/views.
* Fix Copyright in last Bluetooth commit.
* Last commit before we move saving settings with BMessage.
* Changed PoupMenu to BOptionPopUp

Change-Id: I32b85f1985b558d24b294a184665e08e6ce18a7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3829
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Fredrik Modéen 2021-03-31 21:58:20 +02:00
parent 6d93dff127
commit 91cbfa855e
17 changed files with 146 additions and 169 deletions

View File

@ -1,9 +1,9 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
* Tri-Edge AI <triedgeai@gmail.com>
*/

View File

@ -1,10 +1,10 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Tri-Edge AI <triedgeai@gmail.com>
* Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
*/
#ifndef _CONNECTION_VIEW_H_

View File

@ -1,4 +1,5 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*

View File

@ -1,9 +1,9 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
* Tri-Edge AI <triedgeai@gmail.com>
*/

View File

@ -1,9 +1,9 @@
/*
* Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
* Tri-Edge AI <triedgeai@gmail.com>
*/

View File

@ -1,10 +1,12 @@
/*
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
* Copyright 2012-2013, Tri-Edge AI <triedgeai@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* All rights reserved. Distributed under the terms of the MIT license.
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#include "BluetoothSettings.h"
BluetoothSettings::BluetoothSettings()
@ -24,6 +26,8 @@ BluetoothSettings::Defaults()
{
Data.PickedDevice = bdaddrUtils::NullAddress();
Data.LocalDeviceClass = DeviceClass();
Data.Policy = 0;
Data.InquiryTime = 15;
}
@ -34,7 +38,6 @@ BluetoothSettings::Load()
if (fFile->InitCheck() == B_OK) {
fFile->Read(&Data, sizeof(Data));
// TODO: Add more settings here.
} else
Defaults();
@ -49,7 +52,6 @@ BluetoothSettings::Save()
if (fFile->InitCheck() == B_OK) {
fFile->Write(&Data, sizeof(Data));
// TODO: Add more settings here.
}
delete fFile;

View File

@ -1,8 +1,11 @@
/*
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
* Copyright 2012-2013, Tri-Edge AI <triedgeai@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* All rights reserved. Distributed under the terms of the MIT license.
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#ifndef BLUETOOTH_SETTINGS_H
@ -21,6 +24,8 @@ public:
struct {
bdaddr_t PickedDevice;
DeviceClass LocalDeviceClass;
int32 Policy;
int32 InquiryTime;
} Data;
BluetoothSettings();

View File

@ -1,8 +1,11 @@
/*
* Copyright 2008-2009, Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
* Copyright 2012-2013, Tri-Edge AI, <triedgeai@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* All rights reserved. Distributed under the terms of the MIT License.
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#include "BluetoothSettingsView.h"
@ -20,6 +23,7 @@
#include <MenuField.h>
#include <MenuItem.h>
#include <PopUpMenu.h>
#include <OptionPopUp.h>
#include <Slider.h>
#include <SpaceLayoutItem.h>
#include <String.h>
@ -31,11 +35,6 @@
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Settings view"
static const int32 kMsgSetConnectionPolicy = 'sCpo';
static const int32 kMsgSetDeviceClass = 'sDC0';
static const int32 kMsgSetInquiryTime = 'afEa';
static const int32 kMsgLocalSwitched = 'lDsW';
static const char* kAllLabel = B_TRANSLATE_MARK("From all devices");
static const char* kTrustedLabel =
B_TRANSLATE_MARK("Only from trusted devices");
@ -56,18 +55,25 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
{
fSettings.Load();
_BuildConnectionPolicy();
fPolicyMenuField = new BMenuField("policy",
B_TRANSLATE("Incoming connections policy:"), fPolicyMenu);
fPolicyMenu = new BOptionPopUp("policy",
B_TRANSLATE("Incoming connections policy:"),
new BMessage(kMsgSetConnectionPolicy));
fPolicyMenu->AddOption(B_TRANSLATE_NOCOLLECT(kAllLabel), 1);
fPolicyMenu->AddOption(B_TRANSLATE_NOCOLLECT(kTrustedLabel), 2);
fPolicyMenu->AddOption(B_TRANSLATE_NOCOLLECT(kAlwaysLabel), 3);
fInquiryTimeControl = new BSlider("time",
B_TRANSLATE("Default inquiry time:"), new BMessage(kMsgSetInquiryTime),
0, 255, B_HORIZONTAL);
fPolicyMenu->SetValue(fSettings.Data.Policy);
BString label(B_TRANSLATE("Default inquiry time:"));
label << " " << fSettings.Data.InquiryTime;
fInquiryTimeControl = new BSlider("time", label.String()
, new BMessage(kMsgSetInquiryTime), 15, 61, B_HORIZONTAL);
fInquiryTimeControl->SetLimitLabels(B_TRANSLATE("15 secs"),
B_TRANSLATE("61 secs"));
fInquiryTimeControl->SetHashMarks(B_HASH_MARKS_BOTTOM);
fInquiryTimeControl->SetHashMarkCount(255 / 15);
fInquiryTimeControl->SetHashMarkCount(20);
fInquiryTimeControl->SetEnabled(true);
fInquiryTimeControl->SetValue(fSettings.Data.InquiryTime);
fExtDeviceView = new ExtendedLocalDeviceView(NULL);
@ -87,18 +93,20 @@ BluetoothSettingsView::BluetoothSettingsView(const char* name)
fSettings.Data.LocalDeviceClass = rememberedClass;
}
// hinting menu
_BuildClassMenu();
fClassMenuField = new BMenuField("class", B_TRANSLATE("Identify host as:"),
fClassMenu);
fClassMenu = new BOptionPopUp("DeviceClass", B_TRANSLATE("Identify host as:"),
new BMessage(kMsgSetDeviceClass));
fClassMenu->AddOption(B_TRANSLATE_NOCOLLECT(kDesktopLabel), 1);
fClassMenu->AddOption(B_TRANSLATE_NOCOLLECT(kServerLabel), 2);
fClassMenu->AddOption(B_TRANSLATE_NOCOLLECT(kLaptopLabel), 3);
fClassMenu->AddOption(B_TRANSLATE_NOCOLLECT(kHandheldLabel), 4);
fClassMenu->AddOption(B_TRANSLATE_NOCOLLECT(kPhoneLabel), 5);
fClassMenu->SetValue(_GetClassForMenu());
BLayoutBuilder::Grid<>(this, 0)
.SetInsets(10)
.Add(fClassMenuField->CreateLabelLayoutItem(), 0, 0)
.Add(fClassMenuField->CreateMenuBarLayoutItem(), 1, 0)
.Add(fPolicyMenuField->CreateLabelLayoutItem(), 0, 1)
.Add(fPolicyMenuField->CreateMenuBarLayoutItem(), 1, 1)
.Add(fClassMenu, 0, 0)
.Add(fPolicyMenu, 0, 1)
.Add(fInquiryTimeControl, 0, 2, 2)
@ -124,8 +132,6 @@ BluetoothSettingsView::AttachedToWindow()
else
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
fPolicyMenu->SetTargetForItems(this);
fClassMenu->SetTargetForItems(this);
fLocalDevicesMenu->SetTargetForItems(this);
fInquiryTimeControl->SetTarget(this);
}
@ -134,7 +140,9 @@ BluetoothSettingsView::AttachedToWindow()
void
BluetoothSettingsView::MessageReceived(BMessage* message)
{
//message->PrintToStream();
switch (message->what) {
case kMsgLocalSwitched:
{
LocalDevice* lDevice;
@ -147,27 +155,33 @@ BluetoothSettingsView::MessageReceived(BMessage* message)
break;
}
// TODO: To be fixed. :)
/*
case kMsgSetConnectionPolicy:
{
//uint8 Policy;
//if (message->FindInt8("Policy", (int8*)&Policy) == B_OK)
int32 policy;
if (message->FindInt32("be:value", (int32*)&policy) == B_OK) {
fSettings.Data.Policy = policy;
printf("Policy = %d\n", fSettings.Data.Policy);
}
break;
}
case kMsgSetInquiryTime:
{
fSettings.Data.InquiryTime = fInquiryTimeControl->Value();
BString label(B_TRANSLATE("Default inquiry time:"));
label << " " << fInquiryTimeControl->Value();
fInquiryTimeControl->SetLabel(label.String());
break;
}
*/
case kMsgSetDeviceClass:
{
uint8 deviceClass;
int32 deviceClass;
if (message->FindInt32("be:value",
(int32*)&deviceClass) == B_OK) {
if (message->FindInt8("DeviceClass",
(int8*)&deviceClass) == B_OK) {
printf("deviceClass = %d\n", deviceClass);
if (deviceClass == 5)
_SetDeviceClass(2, 3, 0x72);
@ -208,85 +222,6 @@ BluetoothSettingsView::_SetDeviceClass(uint8 major, uint8 minor,
}
void
BluetoothSettingsView::_BuildConnectionPolicy()
{
BMessage* message = NULL;
BMenuItem* item = NULL;
fPolicyMenu = new BPopUpMenu(B_TRANSLATE("Policy" B_UTF8_ELLIPSIS));
message = new BMessage(kMsgSetConnectionPolicy);
message->AddInt8("Policy", 1);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kAllLabel), message);
fPolicyMenu->AddItem(item);
message = new BMessage(kMsgSetConnectionPolicy);
message->AddInt8("Policy", 2);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kTrustedLabel), message);
fPolicyMenu->AddItem(item);
message = new BMessage(kMsgSetConnectionPolicy);
message->AddInt8("Policy", 3);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kAlwaysLabel), NULL);
fPolicyMenu->AddItem(item);
}
void
BluetoothSettingsView::_BuildClassMenu()
{
BMessage* message = NULL;
BMenuItem* item = NULL;
fClassMenu = new BPopUpMenu(B_TRANSLATE("Identify us as" B_UTF8_ELLIPSIS));
message = new BMessage(kMsgSetDeviceClass);
message->AddInt8("DeviceClass", 1);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kDesktopLabel), message);
fClassMenu->AddItem(item);
if (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 1 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 1)
item->SetMarked(true);
message = new BMessage(kMsgSetDeviceClass);
message->AddInt8("DeviceClass", 2);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kServerLabel), message);
fClassMenu->AddItem(item);
if (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 1 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 2)
item->SetMarked(true);
message = new BMessage(kMsgSetDeviceClass);
message->AddInt8("DeviceClass", 3);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kLaptopLabel), message);
fClassMenu->AddItem(item);
if (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 1 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 3)
item->SetMarked(true);
message = new BMessage(kMsgSetDeviceClass);
message->AddInt8("DeviceClass", 4);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kHandheldLabel), message);
fClassMenu->AddItem(item);
if (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 1 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 4)
item->SetMarked(true);
message = new BMessage(kMsgSetDeviceClass);
message->AddInt8("DeviceClass", 5);
item = new BMenuItem(B_TRANSLATE_NOCOLLECT(kPhoneLabel), message);
fClassMenu->AddItem(item);
if (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 2 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 3)
item->SetMarked(true);
}
void
BluetoothSettingsView::_BuildLocalDevicesMenu()
{
@ -338,3 +273,22 @@ BluetoothSettingsView::_MarkLocalDevice(LocalDevice* lDevice)
ActiveLocalDevice = lDevice;
fSettings.Data.PickedDevice = lDevice->GetBluetoothAddress();
}
int
BluetoothSettingsView::_GetClassForMenu()
{
int deviceClass = fSettings.Data.LocalDeviceClass.MajorDeviceClass() +
fSettings.Data.LocalDeviceClass.MinorDeviceClass()-1;
// As of now we only support MajorDeviceClass = 1 and MinorDeviceClass 1-4
// and MajorDeviceClass = 2 and MinorDeviceClass 3.
if ((fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 1
&& (fSettings.Data.LocalDeviceClass.MinorDeviceClass() > 0
&& fSettings.Data.LocalDeviceClass.MinorDeviceClass() < 5))
|| (fSettings.Data.LocalDeviceClass.MajorDeviceClass() == 2 &&
fSettings.Data.LocalDeviceClass.MinorDeviceClass() == 3))
return deviceClass; //No other wil have the same number.
else
return 0;
}

View File

@ -19,6 +19,7 @@ class BBox;
class BMenuField;
class BPopUpMenu;
class BSlider;
class BOptionPopUp;
class BluetoothSettingsView : public BView {
public:
@ -30,22 +31,19 @@ public:
private:
void _BuildConnectionPolicy();
void _BuildClassMenu();
void _BuildLocalDevicesMenu();
bool _SetDeviceClass(uint8 major, uint8 minor,
uint16 service);
void _MarkLocalDevice(LocalDevice* lDevice);
int _GetClassForMenu();
protected:
BluetoothSettings fSettings;
float fDivider;
BMenuField* fPolicyMenuField;
BPopUpMenu* fPolicyMenu;
BMenuField* fClassMenuField;
BPopUpMenu* fClassMenu;
BOptionPopUp* fPolicyMenu;
BOptionPopUp* fClassMenu;
BMenuField* fLocalDevicesMenuField;
BPopUpMenu* fLocalDevicesMenu;

View File

@ -41,9 +41,11 @@ BluetoothWindow::BluetoothWindow(BRect frame)
{
fDefaultsButton = new BButton("defaults", B_TRANSLATE("Defaults"),
new BMessage(kMsgSetDefaults), B_WILL_DRAW);
fDefaultsButton->SetEnabled(false);
fRevertButton = new BButton("revert", B_TRANSLATE("Revert"),
new BMessage(kMsgRevert), B_WILL_DRAW);
fRevertButton->SetEnabled(false);
// Add the menu bar
fMenubar = new BMenuBar(Bounds(), "menu_bar");
@ -71,16 +73,12 @@ BluetoothWindow::BluetoothWindow(BRect frame)
tabView->SetBorder(B_NO_BORDER);
fSettingsView = new BluetoothSettingsView(B_TRANSLATE("Settings"));
// fConnChan = new ConnChanView("Connections & Channels", B_WILL_DRAW);
fRemoteDevices = new RemoteDevicesView(
B_TRANSLATE("Remote devices"), B_WILL_DRAW);
tabView->AddTab(fRemoteDevices);
// tabView->AddTab(fConnChan);
tabView->AddTab(fSettingsView);
fRevertButton->SetEnabled(false);
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(0)
.Add(fMenubar)
@ -102,7 +100,13 @@ BluetoothWindow::BluetoothWindow(BRect frame)
void
BluetoothWindow::MessageReceived(BMessage* message)
{
//message->PrintToStream();
switch (message->what) {
case kMsgSetConnectionPolicy:
case kMsgSetDeviceClass:
fSettingsView->MessageReceived(message);
break;
case kMsgSetDefaults:
/* fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS));
fAntialiasingSettings->SetDefaults();

View File

@ -16,7 +16,6 @@
class BluetoothSettingsView;
class RemoteDevicesView;
class ConnChanView;
class BluetoothWindow : public BWindow {
public:
@ -26,7 +25,6 @@ public:
private:
RemoteDevicesView* fRemoteDevices;
ConnChanView* fConnChan;
BButton* fDefaultsButton;
BButton* fRevertButton;
BMenuBar* fMenubar;

View File

@ -8,7 +8,6 @@
#include <bluetooth/bdaddrUtils.h>
#include <bluetooth/BluetoothDevice.h>
/*#include "../media/iconfile.h"*/
#include "DeviceListItem.h"

View File

@ -1,7 +1,12 @@
/*
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
* All rights reserved. Distributed under the terms of the MIT License.
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#include "ExtendedLocalDeviceView.h"
#include <bluetooth/bdaddrUtils.h>
@ -34,6 +39,7 @@ ExtendedLocalDeviceView::ExtendedLocalDeviceView(LocalDevice* bDevice,
B_TRANSLATE("Show name"), new BMessage(SET_VISIBLE));
fAuthentication = new BCheckBox("Authenticate",
B_TRANSLATE("Authenticate"), new BMessage(SET_AUTHENTICATION));
fAuthentication->SetEnabled(false);
SetEnabled(false);
@ -42,11 +48,10 @@ ExtendedLocalDeviceView::ExtendedLocalDeviceView(LocalDevice* bDevice,
.Add(fDeviceView)
.AddGroup(B_HORIZONTAL, 0)
.SetInsets(5)
.AddGlue()
.Add(fDiscoverable)
.Add(fVisible)
.Add(fAuthentication)
.End()
.Add(fAuthentication)
.End();
}
@ -67,7 +72,6 @@ ExtendedLocalDeviceView::SetLocalDevice(LocalDevice* lDevice)
ClearDevice();
int value = fDevice->GetDiscoverable();
printf("ExtendedLocalDeviceView::SetLocalDevice value = %d\n", value);
if (value == 1)
fDiscoverable->SetValue(true);
else if (value == 2)
@ -76,6 +80,11 @@ ExtendedLocalDeviceView::SetLocalDevice(LocalDevice* lDevice)
fDiscoverable->SetValue(true);
fVisible->SetValue(true);
}
#if 0
// TODO implement GetAuthentication in LocalDevice
if (fDevice->GetAuthentication())
fAuthentication->SetValue(true);
#endif
}
}
@ -115,16 +124,14 @@ ExtendedLocalDeviceView::MessageReceived(BMessage* message)
case SET_VISIBLE:
fScanMode = 0;
if (fDiscoverable->Value()) {
if (fDiscoverable->Value())
fScanMode = 1;
fVisible->SetEnabled(true);
} else {
fVisible->SetValue(false);
fVisible->SetEnabled(false);
}
if (fVisible->Value())
fScanMode |= 2;
fScanMode = 2;
if (fVisible->Value() && fDiscoverable->Value())
fScanMode = 3;
if (fDevice != NULL)
fDevice->SetDiscoverable(fScanMode);

View File

@ -1,6 +1,10 @@
/*
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
* All rights reserved. Distributed under the terms of the MIT License.
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#include <Alert.h>
@ -63,9 +67,7 @@ public:
DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod)
{
BMessage* message = new BMessage(kMsgAddListDevice);
message->AddPointer("remoteItem", new DeviceListItem(btDevice));
fInquiryPanel->PostMessage(message);
}
@ -149,11 +151,11 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice)
fRetrieveMessage = new BMessage(kMsgRetrieve);
fSecondsMessage = new BMessage(kMsgSecond);
BLayoutBuilder::Group<>(this, B_VERTICAL, 10)
.SetInsets(15)
.Add(fMessage)
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
.SetInsets(B_USE_SMALL_SPACING)
.Add(fMessage, 0)
.Add(fScanProgress, 10)
.Add(fScrollView)
.Add(fScrollView, 20)
.AddGroup(B_HORIZONTAL, 10)
.Add(fAddButton)
.AddGlue()

View File

@ -1,7 +1,12 @@
/*
* Copyright 2008-09, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
* All rights reserved. Distributed under the terms of the MIT License.
* Copyright 2008-2009, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes@gmail.com>
* Copyright 2021, Haiku, Inc.
* Distributed under the terms of the MIT License.
*
* Authors:
* Fredrik Modéen <fredrik_at_modeen.se>
*/
#include <stdio.h>
#include <Alert.h>
@ -33,8 +38,8 @@ static const uint32 kMsgAddDevices = 'ddDv';
static const uint32 kMsgRemoveDevice = 'rmDv';
static const uint32 kMsgPairDevice = 'trDv';
static const uint32 kMsgDisconnectDevice = 'dsDv';
static const uint32 kMsgBlockDevice = 'blDv';
static const uint32 kMsgRefreshDevices = 'rfDv';
//static const uint32 kMsgBlockDevice = 'blDv';
//static const uint32 kMsgRefreshDevices = 'rfDv';
using namespace Bluetooth;
@ -52,14 +57,13 @@ RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags)
disconnectButton = new BButton("disconnect", B_TRANSLATE("Disconnect"),
new BMessage(kMsgDisconnectDevice));
/*
blockButton = new BButton("block", B_TRANSLATE("As blocked"),
new BMessage(kMsgBlockDevice));
availButton = new BButton("check", B_TRANSLATE("Refresh" B_UTF8_ELLIPSIS),
new BMessage(kMsgRefreshDevices));
*/
// Set up device list
fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST);
@ -74,11 +78,11 @@ RemoteDevicesView::RemoteDevicesView(const char* name, uint32 flags)
.Add(addButton)
.Add(removeButton)
.AddGlue()
.Add(availButton)
.AddGlue()
// .Add(availButton)
// .AddGlue()
.Add(pairButton)
.Add(disconnectButton)
.Add(blockButton)
// .Add(blockButton)
.AddGlue()
.End()
.End();
@ -101,8 +105,8 @@ RemoteDevicesView::AttachedToWindow(void)
removeButton->SetTarget(this);
pairButton->SetTarget(this);
disconnectButton->SetTarget(this);
blockButton->SetTarget(this);
availButton->SetTarget(this);
// blockButton->SetTarget(this);
// availButton->SetTarget(this);
LoadSettings();
fDeviceList->Select(0);
@ -122,8 +126,6 @@ RemoteDevicesView::MessageReceived(BMessage* message)
}
case kMsgRemoveDevice:
printf("kMsgRemoveDevice: %" B_PRId32 "\n",
fDeviceList->CurrentSelection(0));
fDeviceList->RemoveItem(fDeviceList->CurrentSelection(0));
break;
case kMsgAddToRemoteList:

View File

@ -43,8 +43,8 @@ protected:
BButton* removeButton;
BButton* pairButton;
BButton* disconnectButton;
BButton* blockButton;
BButton* availButton;
// BButton* blockButton;
// BButton* availButton;
BListView* fDeviceList;
BScrollView* fScrollView;

View File

@ -31,6 +31,11 @@ const uint32 kItemSpace = 7;
static const uint32 kMsgAddToRemoteList = 'aDdL';
static const uint32 kMsgRefresh = 'rFLd';
static const int32 kMsgSetConnectionPolicy = 'sCpo';
static const int32 kMsgSetDeviceClass = 'sDC0';
static const int32 kMsgSetInquiryTime = 'afEa';
static const int32 kMsgLocalSwitched = 'lDsW';
extern LocalDevice* ActiveLocalDevice;
#endif