summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/blue-pin.pro12
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc39
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc53
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h26
-rw-r--r--noncore/net/opietooth/blue-pin/pindlgbase.ui198
5 files changed, 328 insertions, 0 deletions
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 <stdio.h>
+#include <stdlib.h>
+
+
+#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
+
+#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 += "<br>";
+ 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 <stdio.h>
+
+#include <qcheckbox.h>
+#include <qlabel.h>
+#include <qlineedit.h>
+#include <qtimer.h>
+
+#include <qpe/config.h>
+
+#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 <qdialog.h>
+
+#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 @@
+<!DOCTYPE UI><UI>
+<class>PinDlgBase</class>
+<author>zecke</author>
+<widget>
+ <class>QDialog</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Form1</cstring>
+ </property>
+ <property stdset="1">
+ <name>geometry</name>
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>248</width>
+ <height>167</height>
+ </rect>
+ </property>
+ <property stdset="1">
+ <name>caption</name>
+ <string>Please enter pin</string>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>11</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="0" column="0" >
+ <class>QLayoutWidget</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>Layout6</cstring>
+ </property>
+ <grid>
+ <property stdset="1">
+ <name>margin</name>
+ <number>0</number>
+ </property>
+ <property stdset="1">
+ <name>spacing</name>
+ <number>6</number>
+ </property>
+ <widget row="3" column="0" rowspan="1" colspan="3" >
+ <class>QLineEdit</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>lnePin</cstring>
+ </property>
+ <property stdset="1">
+ <name>echoMode</name>
+ <enum>Password</enum>
+ </property>
+ </widget>
+ <spacer row="5" column="4" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer2</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>16</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="5" column="0" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer1</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>30</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <spacer row="3" column="3" >
+ <property>
+ <name>name</name>
+ <cstring>Spacer4</cstring>
+ </property>
+ <property stdset="1">
+ <name>orientation</name>
+ <enum>Horizontal</enum>
+ </property>
+ <property stdset="1">
+ <name>sizeType</name>
+ <enum>Fixed</enum>
+ </property>
+ <property>
+ <name>sizeHint</name>
+ <size>
+ <width>21</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ <widget row="0" column="0" rowspan="1" colspan="5" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>txtStatus</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string></string>
+ </property>
+ <property stdset="1">
+ <name>textFormat</name>
+ <enum>RichText</enum>
+ </property>
+ </widget>
+ <widget row="2" column="0" rowspan="1" colspan="5" >
+ <class>QLabel</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>TextLabel3</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Please enter PIN:</string>
+ </property>
+ </widget>
+ <widget row="5" column="1" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>PushButton1</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Ok</string>
+ </property>
+ </widget>
+ <widget row="5" column="2" rowspan="1" colspan="2" >
+ <class>QPushButton</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>PushButton2</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>&amp;Cancel</string>
+ </property>
+ </widget>
+ <widget row="4" column="0" rowspan="1" colspan="5" >
+ <class>QCheckBox</class>
+ <property stdset="1">
+ <name>name</name>
+ <cstring>ckbPin</cstring>
+ </property>
+ <property stdset="1">
+ <name>text</name>
+ <string>Save pin</string>
+ </property>
+ </widget>
+ </grid>
+ </widget>
+ </grid>
+</widget>
+<connections>
+ <connection>
+ <sender>PushButton1</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>accept()</slot>
+ </connection>
+ <connection>
+ <sender>PushButton2</sender>
+ <signal>clicked()</signal>
+ <receiver>Form1</receiver>
+ <slot>reject()</slot>
+ </connection>
+</connections>
+</UI>