Ticket #9265: bluetoothUI-v2.patch

File bluetoothUI-v2.patch, 18.9 KB (added by TriEdgeAI, 11 years ago)
  • new file headers/private/bluetooth/BluetoothIconView.h

    diff --git a/headers/private/bluetooth/BluetoothIconView.h b/headers/private/bluetooth/BluetoothIconView.h
    new file mode 100644
    index 0000000..159c9ca
    - +  
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Tri-Edge AI <triedgeai@gmail.com>
     7 */
     8
     9#ifndef _BLUETOOTH_ICON_VIEW_H_
     10#define _BLUETOOTH_ICON_VIEW_H_
     11
     12#include <View.h>
     13#include <Bitmap.h>
     14#include <MimeType.h>
     15#include <IconUtils.h>
     16
     17namespace Bluetooth
     18{
     19
     20class BluetoothIconView : public BView
     21{
     22public:
     23                        BluetoothIconView();
     24                        ~BluetoothIconView();
     25                       
     26    void                Draw(BRect rect);
     27   
     28private:
     29    static BBitmap*     fBitmap;
     30    static int32        fRefCount;
     31};
     32
     33}
     34
     35#endif /* _BLUETOOTH_ICON_VIEW_H_ */
  • headers/private/bluetooth/ConnectionIncoming.h

    diff --git a/headers/private/bluetooth/ConnectionIncoming.h b/headers/private/bluetooth/ConnectionIncoming.h
    index f8292f8..831efc4 100644
    a b  
    1 /*
    2  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
    3  *
    4  * All rights reserved. Distributed under the terms of the MIT License.
    5  *
    6  */
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
     7 *      Tri-Edge AI <triedgeai@gmail.com>
     8 */
    79
    810#ifndef _CONNECTION_INCOMING_H_
    911#define _CONNECTION_INCOMING_H_
    1012
    11 
    12 //----------------------- Global includes  ----------------------
    1313#include <AppKit.h>
    1414#include <SupportKit.h>
    1515#include <InterfaceKit.h>
     16
     17#include <ConnectionView.h>
     18#include <bluetooth/RemoteDevice.h>
     19#include <bluetooth/bdaddrUtils.h>
     20
    1621#include <iostream>
    1722#include <stdio.h>
    1823#include <stdlib.h>
    1924
    20 namespace Bluetooth {
    21 
    22 class RemoteDevice;
    23 
    24 class ConnectionView
    25         : public BView
     25namespace Bluetooth
    2626{
    27 public:
    28                         ConnectionView(BRect frame, const char *name);
    29                         ~ConnectionView();
    30     virtual void        MessageReceived(BMessage *message);
    31     void                Draw(BRect update);
    32     void                Pulse();
    33 
    34 private:
    35 
    36 
    37 };
    3827
     28class RemoteDevice;
     29class ConnectionView;
    3930
    4031class ConnectionIncoming : public BWindow
    4132{
    4233public:
    43                         ConnectionIncoming(RemoteDevice* rDevice);
     34                        ConnectionIncoming(bdaddr_t address);
     35                        ConnectionIncoming(RemoteDevice* rDevice = NULL);
    4436                        ~ConnectionIncoming();
    45     virtual void        MessageReceived(BMessage *message);
     37                       
     38    virtual void        MessageReceived(BMessage* message);
    4639    virtual bool        QuitRequested();
    4740
    4841private:
    49     ConnectionView*             _ConnectionView;
     42    ConnectionView*     fView;
    5043};
    5144
    5245}
    private:  
    5548using Bluetooth::ConnectionIncoming;
    5649#endif
    5750
    58 
    59 #endif
     51#endif /* _CONNECTION_INCOMING_H_ */
  • new file headers/private/bluetooth/ConnectionView.h

    diff --git a/headers/private/bluetooth/ConnectionView.h b/headers/private/bluetooth/ConnectionView.h
    new file mode 100644
    index 0000000..ef45341
    - +  
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Tri-Edge AI <triedgeai@gmail.com>
     7 */
     8 
     9#ifndef _CONNECTION_VIEW_H_
     10#define _CONNECTION_VIEW_H_
     11 
     12#include <Window.h>
     13#include <View.h>
     14#include <StringView.h>
     15#include <GroupLayout.h>
     16#include <GroupLayoutBuilder.h>
     17#include <Font.h>
     18#include <String.h>
     19 
     20namespace Bluetooth
     21{
     22
     23class BluetoothIconView;
     24
     25class ConnectionView : public BView
     26{
     27public:
     28                        ConnectionView::ConnectionView(BRect frame,
     29                            BString device, BString address);
     30                           
     31    void                Pulse();
     32   
     33private:
     34    BString             strMessage;
     35    BluetoothIconView*  fIcon;
     36    BStringView*        fMessage;
     37    BStringView*        fDeviceLabel;
     38    BStringView*        fDeviceText;
     39    BStringView*        fAddressLabel;
     40    BStringView*        fAddressText;
     41};
     42
     43}
     44
     45#endif /* _CONNECTION_VIEW_H_ */
  • headers/private/bluetooth/PincodeWindow.h

    diff --git a/headers/private/bluetooth/PincodeWindow.h b/headers/private/bluetooth/PincodeWindow.h
    index c7bb86b..911aaec 100644
    a b  
    1 /*
    2  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
    3  * All rights reserved. Distributed under the terms of the MIT License.
    4  */
    5 #ifndef _PINCODE_REQUEST_WINDOW_H
    6 #define _PINCODE_REQUEST_WINDOW_H
    7 
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
     7 *      Tri-Edge AI <triedgeai@gmail.com>
     8 */
     9 
     10#ifndef _PINCODE_REQUEST_WINDOW_H_
     11#define _PINCODE_REQUEST_WINDOW_H_
    812
    913#include <View.h>
    1014#include <Window.h>
     
    1216#include <bluetooth/bluetooth.h>
    1317#include <bluetooth/HCI/btHCI.h>
    1418
     19#include <BluetoothIconView.h>
     20
    1521class BStringView;
    1622class BButton;
    1723class BTextControl;
    1824
    19 namespace Bluetooth {
     25namespace Bluetooth
     26{
    2027
    2128class RemoteDevice;
    2229
    2330class PincodeWindow : public BWindow
    2431{
    2532public:
    26                             PincodeWindow(bdaddr_t address, hci_id hid);
    27                             PincodeWindow(RemoteDevice* rDevice);
    28     virtual void            MessageReceived(BMessage *msg);
    29     virtual bool            QuitRequested();
    30             void            SetBDaddr(const char* address);
     33                                PincodeWindow(bdaddr_t address, hci_id hid);
     34                                PincodeWindow(RemoteDevice* rDevice);
     35    virtual void                MessageReceived(BMessage *msg);
     36    virtual bool                QuitRequested();
     37            void                SetBDaddr(const char* address);
    3138
    3239private:
    33             void            InitUI();
    34             bdaddr_t        fBdaddr;
    35             hci_id          fHid;
    36 
    37             BStringView*    fMessage;
    38             BStringView*    fRemoteInfo;
    39             BButton*        fAcceptButton;
    40             BButton*        fCancelButton;
    41             BTextControl*   fPincodeText;
     40            void                InitUI();
     41            bdaddr_t            fBdaddr;
     42            hci_id              fHid;
     43
     44            BluetoothIconView*  fIcon;
     45            BStringView*        fMessage;
     46            BStringView*        fMessage2;
     47            BStringView*        fDeviceLabel;
     48            BStringView*        fDeviceText;
     49            BStringView*        fAddressLabel;
     50            BStringView*        fAddressText;
     51            BButton*            fAcceptButton;
     52            BButton*            fCancelButton;
     53            BTextControl*       fPINCode;
    4254};
    4355
    4456}
    private:  
    4759using Bluetooth::PincodeWindow;
    4860#endif
    4961
    50 #endif
     62#endif /* _PINCODE_REQUEST_WINDOW_H_ */
  • new file src/kits/bluetooth/UI/BluetoothIconView.cpp

    diff --git a/src/kits/bluetooth/UI/BluetoothIconView.cpp b/src/kits/bluetooth/UI/BluetoothIconView.cpp
    new file mode 100644
    index 0000000..5a2a817
    - +  
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Tri-Edge AI <triedgeai@gmail.com>
     7 */
     8
     9#include <BluetoothIconView.h>
     10
     11#include <stdio.h>
     12
     13namespace Bluetooth
     14{
     15   
     16BBitmap*    BluetoothIconView::fBitmap = NULL;
     17int32       BluetoothIconView::fRefCount = 0;
     18
     19BluetoothIconView::BluetoothIconView()
     20    :
     21    BView(BRect(0, 0, 80, 80), "", B_FOLLOW_ALL, B_WILL_DRAW)
     22{
     23    if (fRefCount == 0) {
     24        fBitmap = new BBitmap(BRect(0, 0, 64, 64), 0, B_RGBA32);
     25       
     26        uint8* tempIcon;
     27        size_t tempSize;
     28       
     29        BMimeType mime("application/x-vnd.Haiku-bluetooth_server");
     30        mime.GetIcon(&tempIcon, &tempSize);
     31       
     32        BIconUtils::GetVectorIcon(tempIcon, tempSize, fBitmap);
     33       
     34        fRefCount++;
     35    } else {
     36        fRefCount++;
     37    }
     38   
     39    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
     40    SetDrawingMode(B_OP_ALPHA);
     41    SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY);
     42}
     43
     44
     45BluetoothIconView::~BluetoothIconView()
     46{
     47    fRefCount--;
     48   
     49    if (fRefCount <= 0)
     50        delete fBitmap;
     51}
     52
     53
     54void
     55BluetoothIconView::Draw(BRect rect)
     56{
     57    this->DrawBitmap(fBitmap);
     58}
     59
     60}
  • src/kits/bluetooth/UI/ConnectionIncoming.cpp

    diff --git a/src/kits/bluetooth/UI/ConnectionIncoming.cpp b/src/kits/bluetooth/UI/ConnectionIncoming.cpp
    index 1aced3a..bac0aed 100644
    a b  
    1 /*
    2  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
    3  *
    4  * All rights reserved. Distributed under the terms of the MIT License.
    5  *
    6  */
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
     7 *      Tri-Edge AI <triedgeai@gmail.com>
     8 */
    79
    810#include <ConnectionIncoming.h>
     11#include <ConnectionView.h>
    912
    10 #define B_PULSES_BY_SECOND(x) (2*x)
    11 
    12 namespace Bluetooth {
    13 
    14 ConnectionView::ConnectionView(BRect frame, const char *name): BView(BRect(0, 0, 400, 400), "MyViewName",
    15                                                                     B_FOLLOW_LEFT | B_FOLLOW_TOP,
    16                                                                     B_WILL_DRAW | B_PULSE_NEEDED)
     13namespace Bluetooth
    1714{
    1815
    19     SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
    20 
    21 }
    22 
    23 ConnectionView::~ConnectionView()
     16ConnectionIncoming::ConnectionIncoming(bdaddr_t address)
     17            :
     18            BWindow(BRect(600, 100, 1000, 180), "Incoming Connection",
     19                B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
     20                B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
     21                    // 400x80
    2422{
    25 
    26 }
    27 
    28 
    29 void ConnectionView::MessageReceived(BMessage *message)
    30 {
    31     switch(message->what)
    32     {
    33     default:
     23    SetPulseRate(1 * 1000 * 1000);
     24        // 1 second
    3425   
    35     break;
    36     }
    37 }
    38 
    39 
    40 void ConnectionView::Draw(BRect update)
    41 {
    42 
    43 }
    44 
    45 
    46 void ConnectionView::Pulse()
    47 {
    48     static int a = 0;
     26    fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>",
     27                bdaddrUtils::ToString(address));
    4928   
    50     if (a++ == B_PULSES_BY_SECOND(5)) {
    51         // BUG: for some reason the window is not being removed...
    52         Window()->PostMessage(B_QUIT_REQUESTED);
    53         Window()->Quit();
    54     }
     29    AddChild(fView);
    5530}
    5631
    5732
    58 
    59 //---------------------------------------------------------------
    60 ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice)
    61              : BWindow(BRect(700, 100, 900, 150), "Connection completed",
    62                                    B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
    63                                    B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
     33ConnectionIncoming::ConnectionIncoming(RemoteDevice* rDevice = NULL)
     34            :
     35            BWindow(BRect(600, 100, 1000, 180), "Incoming Connection",
     36                B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
     37                B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
     38                    // 400x80
    6439{
    65     _ConnectionView = new ConnectionView(BRect(0, 0, 400, 400),"mViewName");
    66 
    67     AddChild(_ConnectionView);
     40    SetPulseRate(1 * 1000 * 1000);
     41        // 1 second
     42   
     43    if (rDevice != NULL)
     44        fView = new ConnectionView(BRect(0, 0, 400, 80), rDevice->GetFriendlyName(),
     45                    bdaddrUtils::ToString(rDevice->GetBluetoothAddress()));
     46    else
     47        fView = new ConnectionView(BRect(0, 0, 400, 80), "<unknown_device>",
     48                    bdaddrUtils::ToString(bdaddrUtils::NullAddress()));
     49   
     50    AddChild(fView);
    6851}
    6952
    7053
    7154ConnectionIncoming::~ConnectionIncoming()
    7255{
    73 
     56   
    7457}
    7558
    7659
    77 void ConnectionIncoming::MessageReceived(BMessage *message)
     60void
     61ConnectionIncoming::MessageReceived(BMessage* message)
    7862{
    79     switch(message->what)
     63    switch (message->what)
    8064    {
    8165    default:
    8266   
    void ConnectionIncoming::MessageReceived(BMessage *message)  
    8569}
    8670
    8771
    88 bool ConnectionIncoming::QuitRequested()
     72bool
     73ConnectionIncoming::QuitRequested()
    8974{
    9075    return BWindow::QuitRequested();
    9176}
  • new file src/kits/bluetooth/UI/ConnectionView.cpp

    diff --git a/src/kits/bluetooth/UI/ConnectionView.cpp b/src/kits/bluetooth/UI/ConnectionView.cpp
    new file mode 100644
    index 0000000..1639c33
    - +  
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Tri-Edge AI <triedgeai@gmail.com>
     7 */
     8
     9#include <ConnectionView.h>
     10#include <BluetoothIconView.h>
     11
     12namespace Bluetooth
     13{
     14
     15ConnectionView::ConnectionView(BRect frame, BString device, BString address)
     16    :
     17    BView(frame, "ConnectionView", 0, B_PULSE_NEEDED)
     18{
     19    SetLayout(new BGroupLayout(B_HORIZONTAL));
     20    SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
     21   
     22    fIcon = new BluetoothIconView();
     23   
     24    strMessage = "A new connection is incoming..";
     25   
     26    fMessage = new BStringView(frame, "", strMessage, B_FOLLOW_LEFT);
     27    fMessage->SetAlignment(B_ALIGN_LEFT);
     28                                                       
     29    fDeviceLabel = new BStringView(frame, "", "Device Name:", B_FOLLOW_LEFT);
     30    fDeviceLabel->SetFont(be_bold_font);
     31   
     32    fDeviceText = new BStringView(frame, "", device, B_FOLLOW_RIGHT);
     33    fDeviceText->SetAlignment(B_ALIGN_RIGHT);
     34   
     35    fAddressLabel = new BStringView(frame, "", "MAC Address:", B_FOLLOW_LEFT);
     36
     37    //fAddressLabel->SetFont(be_bold_font);
     38        // TriEdgeAI:   IMHO, it looks better when both a bolded.
     39        //              I'm leaving it here, so you can decide.
     40   
     41    fAddressText = new BStringView(frame, "", address, B_FOLLOW_RIGHT);
     42   
     43    AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 0)
     44            .Add(BGroupLayoutBuilder(B_VERTICAL, 8)
     45                .Add(fIcon)
     46            )
     47            .Add(BGroupLayoutBuilder(B_VERTICAL, 0)
     48                .Add(fMessage)
     49                .AddGlue()
     50                .Add(BGroupLayoutBuilder(B_HORIZONTAL, 42)
     51                    .Add(fDeviceLabel)
     52                    .AddGlue()
     53                    .Add(fDeviceText)
     54                )
     55                .Add(BGroupLayoutBuilder(B_HORIZONTAL, 42)
     56                    .Add(fAddressLabel)
     57                    .AddGlue()
     58                    .Add(fAddressText)
     59                )
     60                .AddGlue()
     61            )
     62            .AddGlue()
     63            .SetInsets(8, 8, 8, 8)
     64    );
     65}
     66
     67
     68void
     69ConnectionView::Pulse()
     70{
     71    static int pulses = 0;
     72   
     73    pulses++;
     74   
     75    if (pulses >= 5) {
     76        Window()->PostMessage(B_QUIT_REQUESTED);
     77    } else {
     78        strMessage += ".";
     79        fMessage->SetText(strMessage);
     80    }
     81}
     82
     83}
  • src/kits/bluetooth/UI/PincodeWindow.cpp

    diff --git a/src/kits/bluetooth/UI/PincodeWindow.cpp b/src/kits/bluetooth/UI/PincodeWindow.cpp
    index 65b1ae5..a48e91c 100644
    a b  
    1 /*
    2  * Copyright 2007-2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com
    3  * All rights reserved. Distributed under the terms of the MIT License.
    4  */
     1/*
     2 * Copyright 2012, Haiku, Inc.
     3 * Distributed under the terms of the MIT License.
     4 *
     5 * Authors:
     6 *      Oliver Ruiz Dorantes <oliver.ruiz.dorantes@gmail.com>
     7 *      Tri-Edge AI <triedgeai@gmail.com>
     8 */
    59
    610#include <stdio.h>
    711#include <unistd.h>
     
    3034#include <bluetoothserver_p.h>
    3135#include <CommandManager.h>
    3236
    33 
    3437#define H_SEPARATION  15
    3538#define V_SEPARATION  10
    3639#define BD_ADDR_LABEL "BD_ADDR: "
     
    3841static const uint32 skMessageAcceptButton = 'acCp';
    3942static const uint32 skMessageCancelButton = 'mVch';
    4043
    41 
    42 namespace Bluetooth {
    43 
    44 
    45 #if 0
    46 #pragma mark -
    47 #endif
     44namespace Bluetooth
     45{
    4846
    4947PincodeWindow::PincodeWindow(bdaddr_t address, hci_id hid)
    50     : BWindow(BRect(800, 200, 900, 300), "Pincode request",
    51         B_FLOATING_WINDOW,
    52         B_WILL_ACCEPT_FIRST_CLICK | B_NOT_RESIZABLE|  B_NOT_ZOOMABLE
    53         | B_AUTO_UPDATE_SIZE_LIMITS,
    54         B_ALL_WORKSPACES), fBdaddr(address), fHid(hid)
     48    : BWindow(BRect(700, 200, 1000, 400), "PIN Code Request",
     49        B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
     50        B_NOT_ZOOMABLE | B_NOT_RESIZABLE),
     51        fBdaddr(address),
     52        fHid(hid)
    5553{
    5654    InitUI();
    5755
    5856    // TODO: Get more info about device" ote name/features/encry/auth... etc
    5957    SetBDaddr(bdaddrUtils::ToString(fBdaddr));
    60 
    6158}
    6259
    6360
    6461PincodeWindow::PincodeWindow(RemoteDevice* rDevice)
    65     : BWindow(BRect(800, 200, 900, 300), "Pincode request",
    66         B_FLOATING_WINDOW,
    67         B_WILL_ACCEPT_FIRST_CLICK | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
    68         | B_AUTO_UPDATE_SIZE_LIMITS,
    69         B_ALL_WORKSPACES)
     62    : BWindow(BRect(700, 200, 1000, 400), "PIN Code Request",
     63        B_FLOATING_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
     64        B_NOT_ZOOMABLE | B_NOT_RESIZABLE)
    7065{
     66    InitUI();
     67   
    7168    // TODO: Get more info about device" ote name/features/encry/auth... etc
     69    fDeviceText->SetText(rDevice->GetFriendlyName());
    7270    SetBDaddr(bdaddrUtils::ToString(rDevice->GetBluetoothAddress()));
    7371    fHid = (rDevice->GetLocalDeviceOwner())->ID();
    7472}
    PincodeWindow::InitUI()  
    7977{
    8078    SetLayout(new BGroupLayout(B_HORIZONTAL));
    8179
    82     fMessage = new BStringView("Pincode", "Please enter the pincode ...");
    83     fMessage->SetFont(be_bold_font);
    84 
    85     fRemoteInfo = new BStringView("bdaddr","BD_ADDR: ");
    86 
    87     // TODO: Pincode cannot be more than 16 bytes
    88     fPincodeText = new BTextControl("pincode TextControl", "PIN code:", "5555", NULL);
    89 
     80    fIcon = new BluetoothIconView();
     81
     82    fMessage = new BStringView("fMessage", "Input the PIN code to pair with");
     83    fMessage2 = new BStringView("fMessage2", "the following Bluetooth device.");
     84
     85    fDeviceLabel = new BStringView("fDeviceLabel","Device Name: ");
     86    fDeviceLabel->SetFont(be_bold_font);
     87   
     88    fDeviceText = new BStringView("fDeviceText", "<unknown_device>");
     89    fAddressLabel = new BStringView("fAddressLabel", "MAC Address: ");
     90    //fAddressLabel->SetFont(be_bold_font);
     91        // TriEdgeAI:   IMHO, it looks better when both a bolded.
     92        //              I'm leaving it here, so you can decide.
     93   
     94    fAddressText = new BStringView("fAddressText", "<mac_address>");
     95
     96    fPINCode = new BTextControl("fPINCode", "PIN Code:", "0000", NULL);
     97    fPINCode->TextView()->SetMaxBytes(16 * sizeof(fPINCode->Text()[0]));
     98    fPINCode->MakeFocus();
     99   
    90100    fAcceptButton = new BButton("fAcceptButton", "Pair",
    91101        new BMessage(skMessageAcceptButton));
    92102
    93103    fCancelButton = new BButton("fCancelButton", "Cancel",
    94104        new BMessage(skMessageCancelButton));
    95105
    96     AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
     106    AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
     107        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
     108            .Add(BGroupLayoutBuilder(B_HORIZONTAL, 8)
     109                .Add(fIcon)
     110            )
     111            .Add(BGroupLayoutBuilder(B_VERTICAL, 0)
    97112                .Add(fMessage)
    98                 .Add(fRemoteInfo)
    99                 .Add(fPincodeText)
    100                 .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
    101                     .AddGlue()
    102                     .Add(fCancelButton)
    103                     .Add(fAcceptButton)
    104                     .SetInsets(5, 5, 5, 5)
    105                 )
    106             .SetInsets(15, 15, 15, 15)
     113                .Add(fMessage2)
     114                .AddGlue()
     115            )
     116        )
     117        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
     118            .Add(fDeviceLabel)
     119            .AddGlue()
     120            .Add(fDeviceText)
     121        )
     122        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
     123            .Add(fAddressLabel)
     124            .AddGlue()
     125            .Add(fAddressText)
     126        )
     127        .AddGlue()
     128        .Add(fPINCode)
     129        .AddGlue()
     130        .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
     131            .AddGlue()
     132            .Add(fCancelButton)
     133            .Add(fAcceptButton)
     134        )
     135        .SetInsets(8, 8, 8, 8)
    107136    );
    108137}
    109138
    PincodeWindow::InitUI()  
    111140void
    112141PincodeWindow::MessageReceived(BMessage *msg)
    113142{
    114 //  status_t err = B_OK;
    115 
    116     switch(msg->what)
     143    switch (msg->what)
    117144    {
    118145        case skMessageAcceptButton:
    119146        {
    PincodeWindow::MessageReceived(BMessage *msg)  
    123150            int8 bt_status = BT_ERROR;
    124151
    125152            void* command = buildPinCodeRequestReply(fBdaddr,
    126                 strlen(fPincodeText->Text()),
    127                 (char*)fPincodeText->Text(), &size);
     153                strlen(fPINCode->Text()),
     154                (char*)fPINCode->Text(), &size);
    128155
    129156            if (command == NULL) {
    130157                break;
    PincodeWindow::MessageReceived(BMessage *msg)  
    138165
    139166            // we reside in the server
    140167            if (be_app_messenger.SendMessage(&request, &reply) == B_OK) {
    141                 if (reply.FindInt8("status", &bt_status ) == B_OK ) {
     168                if (reply.FindInt8("status", &bt_status ) == B_OK) {
    142169                    PostMessage(B_QUIT_REQUESTED);
    143170                }
    144171                // TODO: something failed here
    PincodeWindow::MessageReceived(BMessage *msg)  
    181208}
    182209
    183210
    184 bool PincodeWindow::QuitRequested()
     211bool
     212PincodeWindow::QuitRequested()
    185213{
    186214    return BWindow::QuitRequested();
    187215}
    188216
    189217
    190 void PincodeWindow::SetBDaddr(const char* address)
     218void
     219PincodeWindow::SetBDaddr(const char* address)
    191220{
    192     BString label;
    193 
    194     label << BD_ADDR_LABEL << address;
    195     printf("++ %s\n",label.String());
    196     fRemoteInfo->SetText(label.String());
    197     fRemoteInfo->ResizeToPreferred();
    198     //Invalidate();
    199 
     221    fAddressText->SetText(address);
    200222}
    201223
    202 
    203224}