summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc3
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc61
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h15
3 files changed, 77 insertions, 2 deletions
diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc
index aa360aa..29e46ae 100644
--- a/noncore/net/opietooth/blue-pin/main.cc
+++ b/noncore/net/opietooth/blue-pin/main.cc
@@ -3,9 +3,12 @@
3 3
4 4
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <opie2/oapplicationfactory.h>
6 7
7#include "pindlg.h" 8#include "pindlg.h"
8 9
10using namespace Opie::Core;
11OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> )
9 12
10int main( int argc, char* argv[] ) 13int main( int argc, char* argv[] )
11{ 14{
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index f0b2309..96be1e5 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -23,15 +23,39 @@ PinDlg::PinDlg( const QString& status,
23 m_mac = mac; 23 m_mac = mac;
24 test( mac ); 24 test( mac );
25 txtStatus->setText(status); 25 txtStatus->setText(status);
26 if(!m_mac.isEmpty())
26 QPEApplication::showDialog( this ); 27 QPEApplication::showDialog( this );
27} 28}
28 29
30PinDlg::PinDlg(QWidget* parent,
31 const char* name,
32 Qt::WFlags f )
33 : PinDlgBase( parent, name, f )
34{
35 m_mac = makeMacFromArgs();
36
37 if(m_mac.isEmpty())
38 {
39 // can't obtain MAC
40 printf("ERR\n");
41 qApp->quit();
42 }
43 else
44 {
45 test( m_mac );
46 txtStatus->setText(makeTextFromArgs());
47 QPEApplication::showDialog( this ) ;
48 }
49}
50
29PinDlg::~PinDlg() 51PinDlg::~PinDlg()
30{} 52{}
53
31void PinDlg::setMac( const QString& mac ) 54void PinDlg::setMac( const QString& mac )
32{ 55{
33 txtStatus->setText( mac ); 56 txtStatus->setText( mac );
34} 57}
58
35QString PinDlg::pin() const 59QString PinDlg::pin() const
36{ 60{
37 return lnePin->text(); 61 return lnePin->text();
@@ -48,10 +72,45 @@ void PinDlg::test( const QString& mac )
48 { 72 {
49 //QTimer::singleShot(100, this, SLOT(accept() ) ); 73 //QTimer::singleShot(100, this, SLOT(accept() ) );
50 } 74 }
75 }
51 76
52 } 77 }
53 78
79QString PinDlg::makeTextFromArgs()
80{
81 if(qApp->argc() > 2)
82 {
83 QCString dir(qApp->argv()[1]) ;
84 QCString bdaddr(qApp->argv()[2]) ;
85
86 QCString name;
87 if ( qApp->argc() > 3 ) {
88 name = qApp->argv()[3];
89 }
90 QString status;
91 if (dir == "out" ) {
92 status = QObject::tr("Outgoing connection to ");
93 } else
94 status = QObject::tr("Incoming connection from ");
95
96 status += name;
97 status += "<br>";
98 status += "[" + bdaddr + "]";
99
100 return status ;
54} 101}
102 else
103 return QString();
104}
105
106QString PinDlg::makeMacFromArgs()
107{
108 if(qApp->argc() < 3)
109 return QString();
110 else
111 return qApp->argv()[2] ;
112}
113
55void PinDlg::accept() 114void PinDlg::accept()
56{ 115{
57 if ( ckbPin->isChecked() ) 116 if ( ckbPin->isChecked() )
@@ -60,5 +119,7 @@ void PinDlg::accept()
60 cfg.setGroup(m_mac ); 119 cfg.setGroup(m_mac );
61 cfg.writeEntryCrypt("pin", lnePin->text() ); 120 cfg.writeEntryCrypt("pin", lnePin->text() );
62 } 121 }
122 printf("PIN:%s\n", lnePin->text().latin1());
63 QDialog::accept(); 123 QDialog::accept();
124 qApp->quit();
64} 125}
diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h
index 5e5a763..5f7dc55 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.h
+++ b/noncore/net/opietooth/blue-pin/pindlg.h
@@ -10,16 +10,27 @@ namespace OpieTooth {
10 Q_OBJECT 10 Q_OBJECT
11 11
12 public: 12 public:
13 PinDlg(const QString& text, 13 PinDlg(const QString& text="",
14 const QString& mac, 14 const QString& mac="",
15 QWidget* parent = 0, 15 QWidget* parent = 0,
16 const char* name= 0 ); 16 const char* name= 0 );
17
18 PinDlg(QWidget* parent,
19 const char* name,
20 Qt::WFlags f );
21
17 ~PinDlg(); 22 ~PinDlg();
18 void setMac( const QString& ); 23 void setMac( const QString& );
19 QString pin() const; 24 QString pin() const;
20 25
26 static QString appName() { return QString::fromLatin1("bluepin") ; }
27
21 private: 28 private:
22 void test( const QString& mac ); 29 void test( const QString& mac );
30
31 QString makeTextFromArgs();
32 QString makeMacFromArgs();
33
23 QString m_mac; 34 QString m_mac;
24 35
25 protected slots: 36 protected slots: