From 46543a909fc88017998ede20ed25cd85992938e4 Mon Sep 17 00:00:00 2001 From: zecke Date: Tue, 18 Jun 2002 16:41:18 +0000 Subject: add the inital version of blue-pin for Opie --- (limited to 'noncore/net/opietooth/blue-pin') diff --git a/noncore/net/opietooth/blue-pin/blue-pin.pro b/noncore/net/opietooth/blue-pin/blue-pin.pro new file mode 100644 index 0000000..8b103ce --- a/dev/null +++ b/noncore/net/opietooth/blue-pin/blue-pin.pro @@ -0,0 +1,12 @@ +TEMPLATE = app +#CONFIG = qt warn_on debug +CONFIG = qt warn_on release +HEADERS = pindlg.h +SOURCES = main.cc pindlg.cc +INCLUDEPATH += $(OPIEDIR)/include +INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib +DEPENDPATH += $(OPIEDIR)/include +LIBS += -lqpe +INTERFACES = pindlgbase.ui +TARGET = $(OPIEDIR)bin/bluepin + diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc new file mode 100644 index 0000000..1b7daec --- a/dev/null +++ b/noncore/net/opietooth/blue-pin/main.cc @@ -0,0 +1,39 @@ +#include +#include + + +#include +#include + +#include "pindlg.h" + + +int main( int argc, char* argv[] ) +{ + if (argc < 2 ) { + printf("ERR\n"); + exit(0); + } + QCString dir(argv[1] ); + QCString bdaddr( argv[2] ); + QCString name; + if ( argc > 3 ) { + name = argv[3]; + } + QPEApplication a(argc, argv ); + QString status; + if (dir == "out" ) { + status = QObject::tr("Outgoing connection to "); + }else + status = QObject::tr("Incoming connection from "); + status += name; + status += "
"; + status += "[" + bdaddr + "]"; + OpieTooth::PinDlg dlg( status, bdaddr ); + if ( dlg.exec() ) { + printf("PIN:%s\n", dlg.pin().stripWhiteSpace().latin1() ); + }else + printf("ERR\n"); + return 0; +} + diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc new file mode 100644 index 0000000..54f096e --- a/dev/null +++ b/noncore/net/opietooth/blue-pin/pindlg.cc @@ -0,0 +1,53 @@ + +#include + +#include +#include +#include +#include + +#include + +#include "pindlg.h" + +using namespace OpieTooth; + +PinDlg::PinDlg( const QString& status, + const QString& mac, QWidget* parent, + const char* name ) + : PinDlgBase( parent, name, WType_Modal ) +{ + m_mac = mac; + test( mac ); + txtStatus->setText(status); +} +PinDlg::~PinDlg() { + +} +void PinDlg::setMac( const QString& mac ) { + txtStatus->setText( mac ); +} +QString PinDlg::pin() const{ + return lnePin->text(); +} + +void PinDlg::test( const QString& mac ) { + if (!mac.isEmpty() ) { + Config cfg("bluepin"); + cfg.setGroup(mac); + lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) ); + if ( !lnePin->text().isEmpty() ) { + //QTimer::singleShot(100, this, SLOT(accept() ) ); + } + + } + +} +void PinDlg::accept() { + if ( ckbPin->isChecked() ) { + Config cfg("bluepin"); + cfg.setGroup(m_mac ); + cfg.writeEntryCrypt("pin", lnePin->text() ); + } + QDialog::accept(); +} diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h new file mode 100644 index 0000000..b4f5ff8 --- a/dev/null +++ b/noncore/net/opietooth/blue-pin/pindlg.h @@ -0,0 +1,26 @@ + + +#include + +#include "pindlgbase.h" + +namespace OpieTooth { + class PinDlg : public PinDlgBase { + Q_OBJECT + public: + PinDlg(const QString& text, + const QString& mac, + QWidget* parent = 0, + const char* name= 0 ); + ~PinDlg(); + void setMac( const QString& ); + QString pin() const; + private: + void test( const QString& mac ); + QString m_mac; +protected slots: + void accept(); + }; + + +}; diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui new file mode 100644 index 0000000..6966a03 --- a/dev/null +++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui @@ -0,0 +1,198 @@ + +PinDlgBase +zecke + + QDialog + + name + Form1 + + + geometry + + 0 + 0 + 248 + 167 + + + + caption + Please enter pin + + + + margin + 11 + + + spacing + 6 + + + QLayoutWidget + + name + Layout6 + + + + margin + 0 + + + spacing + 6 + + + QLineEdit + + name + lnePin + + + echoMode + Password + + + + + name + Spacer2 + + + orientation + Horizontal + + + sizeType + Fixed + + + sizeHint + + 16 + 20 + + + + + + name + Spacer1 + + + orientation + Horizontal + + + sizeType + Fixed + + + sizeHint + + 30 + 20 + + + + + + name + Spacer4 + + + orientation + Horizontal + + + sizeType + Fixed + + + sizeHint + + 21 + 20 + + + + + QLabel + + name + txtStatus + + + text + + + + textFormat + RichText + + + + QLabel + + name + TextLabel3 + + + text + Please enter PIN: + + + + QPushButton + + name + PushButton1 + + + text + &Ok + + + + QPushButton + + name + PushButton2 + + + text + &Cancel + + + + QCheckBox + + name + ckbPin + + + text + Save pin + + + + + + + + + PushButton1 + clicked() + Form1 + accept() + + + PushButton2 + clicked() + Form1 + reject() + + + -- cgit v0.9.0.2