Add Pair button to show the pincode screen(class testing purposes)
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34331 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
e97e2846af
commit
b973d02fde
@ -6,15 +6,18 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Catalog.h>
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
#include <Messenger.h>
|
||||||
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <Entry.h>
|
#include <Entry.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <GroupLayoutBuilder.h>
|
|
||||||
#include <Locale.h>
|
|
||||||
#include <Messenger.h>
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
|
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
#include <SpaceLayoutItem.h>
|
#include <SpaceLayoutItem.h>
|
||||||
|
|
||||||
|
#include <PincodeWindow.h>
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "InquiryPanel.h"
|
#include "InquiryPanel.h"
|
||||||
@ -26,7 +29,7 @@
|
|||||||
|
|
||||||
static const uint32 kMsgAddDevices = 'ddDv';
|
static const uint32 kMsgAddDevices = 'ddDv';
|
||||||
static const uint32 kMsgRemoveDevice = 'rmDv';
|
static const uint32 kMsgRemoveDevice = 'rmDv';
|
||||||
static const uint32 kMsgTrustDevice = 'trDv';
|
static const uint32 kMsgPairDevice = 'trDv';
|
||||||
static const uint32 kMsgBlockDevice = 'blDv';
|
static const uint32 kMsgBlockDevice = 'blDv';
|
||||||
static const uint32 kMsgRefreshDevices = 'rfDv';
|
static const uint32 kMsgRefreshDevices = 'rfDv';
|
||||||
|
|
||||||
@ -34,29 +37,27 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags)
|
|||||||
: BView(name, flags)
|
: BView(name, flags)
|
||||||
{
|
{
|
||||||
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
addButton = new BButton("add", TR("Add" B_UTF8_ELLIPSIS),
|
addButton = new BButton("add", TR("Add" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgAddDevices));
|
new BMessage(kMsgAddDevices));
|
||||||
|
|
||||||
removeButton = new BButton("remove", TR("Remove"),
|
removeButton = new BButton("remove", TR("Remove"),
|
||||||
new BMessage(kMsgRemoveDevice));
|
new BMessage(kMsgRemoveDevice));
|
||||||
|
|
||||||
trustButton = new BButton("trust", TR("As Trusted"),
|
pairButton = new BButton("pair", TR("Pair" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgTrustDevice));
|
new BMessage(kMsgPairDevice));
|
||||||
|
|
||||||
|
|
||||||
blockButton = new BButton("trust", TR("As Blocked"),
|
blockButton = new BButton("block", TR("As Blocked"),
|
||||||
new BMessage(kMsgBlockDevice));
|
new BMessage(kMsgBlockDevice));
|
||||||
|
|
||||||
|
|
||||||
availButton = new BButton("check", TR("Refresh" B_UTF8_ELLIPSIS),
|
availButton = new BButton("check", TR("Refresh" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(kMsgRefreshDevices));
|
new BMessage(kMsgRefreshDevices));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Set up device list
|
// Set up device list
|
||||||
fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST);
|
fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST);
|
||||||
|
|
||||||
fScrollView = new BScrollView("ScrollView", fDeviceList, 0, false, true);
|
fScrollView = new BScrollView("ScrollView", fDeviceList, 0, false, true);
|
||||||
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
||||||
|
|
||||||
@ -66,13 +67,13 @@ RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags)
|
|||||||
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10)
|
||||||
.Add(fScrollView)
|
.Add(fScrollView)
|
||||||
//.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
|
//.Add(BSpaceLayoutItem::CreateHorizontalStrut(5))
|
||||||
.Add(BGroupLayoutBuilder(B_VERTICAL)
|
.Add(BGroupLayoutBuilder(B_VERTICAL)
|
||||||
.Add(addButton)
|
.Add(addButton)
|
||||||
.Add(removeButton)
|
.Add(removeButton)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(availButton)
|
.Add(availButton)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.Add(trustButton)
|
.Add(pairButton)
|
||||||
.Add(blockButton)
|
.Add(blockButton)
|
||||||
.AddGlue()
|
.AddGlue()
|
||||||
.SetInsets(0, 15, 0, 15)
|
.SetInsets(0, 15, 0, 15)
|
||||||
@ -94,7 +95,7 @@ RemoteDevicesView::AttachedToWindow(void)
|
|||||||
fDeviceList->SetTarget(this);
|
fDeviceList->SetTarget(this);
|
||||||
addButton->SetTarget(this);
|
addButton->SetTarget(this);
|
||||||
removeButton->SetTarget(this);
|
removeButton->SetTarget(this);
|
||||||
trustButton->SetTarget(this);
|
pairButton->SetTarget(this);
|
||||||
blockButton->SetTarget(this);
|
blockButton->SetTarget(this);
|
||||||
availButton->SetTarget(this);
|
availButton->SetTarget(this);
|
||||||
|
|
||||||
@ -111,20 +112,37 @@ RemoteDevicesView::MessageReceived(BMessage *msg)
|
|||||||
{
|
{
|
||||||
InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,450,450), ActiveLocalDevice);
|
InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,450,450), ActiveLocalDevice);
|
||||||
iPanel->Show();
|
iPanel->Show();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case kMsgRemoveDevice:
|
case kMsgRemoveDevice:
|
||||||
printf("kMsgRemoveDevice: %ld\n", fDeviceList->CurrentSelection(0));
|
printf("kMsgRemoveDevice: %ld\n", fDeviceList->CurrentSelection(0));
|
||||||
fDeviceList->RemoveItem(fDeviceList->CurrentSelection(0));
|
fDeviceList->RemoveItem(fDeviceList->CurrentSelection(0));
|
||||||
break;
|
break;
|
||||||
case kMsgAddToRemoteList:
|
case kMsgAddToRemoteList:
|
||||||
{
|
{
|
||||||
BListItem* device;
|
BListItem* device;
|
||||||
msg->FindPointer("device", (void**)&device);
|
msg->FindPointer("device", (void**)&device);
|
||||||
fDeviceList->AddItem(device);
|
fDeviceList->AddItem(device);
|
||||||
fDeviceList->Invalidate();
|
fDeviceList->Invalidate();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
case kMsgPairDevice:
|
||||||
|
{
|
||||||
|
bdaddr_t address;
|
||||||
|
address.b[5] = 0x55;
|
||||||
|
address.b[4] = 0x44;
|
||||||
|
address.b[3] = 0x33;
|
||||||
|
address.b[2] = 0x22;
|
||||||
|
address.b[1] = 0x11;
|
||||||
|
address.b[0] = 0x00;
|
||||||
|
|
||||||
|
PincodeWindow* iPincode = new PincodeWindow(address, 0);
|
||||||
|
iPincode->Show();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BView::MessageReceived(msg);
|
BView::MessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
~RemoteDevicesView(void);
|
~RemoteDevicesView(void);
|
||||||
void AttachedToWindow(void);
|
void AttachedToWindow(void);
|
||||||
void MessageReceived(BMessage *msg);
|
void MessageReceived(BMessage *msg);
|
||||||
|
|
||||||
void LoadSettings(void);
|
void LoadSettings(void);
|
||||||
bool IsDefaultable(void);
|
bool IsDefaultable(void);
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ protected:
|
|||||||
|
|
||||||
BButton* addButton;
|
BButton* addButton;
|
||||||
BButton* removeButton;
|
BButton* removeButton;
|
||||||
BButton* trustButton;
|
BButton* pairButton;
|
||||||
BButton* blockButton;
|
BButton* blockButton;
|
||||||
BButton* availButton;
|
BButton* availButton;
|
||||||
BListView* fDeviceList;
|
BListView* fDeviceList;
|
||||||
BScrollView* fScrollView;
|
BScrollView* fScrollView;
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user