summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/blue-pin/pindlg.cc
Unidiff
Diffstat (limited to 'noncore/net/opietooth/blue-pin/pindlg.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index e40fe33..3db6095 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -1,47 +1,48 @@
1 1
2#include "pindlg.h" 2#include "pindlg.h"
3 3
4/* OPIE */ 4/* OPIE */
5#include <qpe/config.h> 5#include <qpe/config.h>
6#include <qpe/qpeapplication.h> 6#include <qpe/qpeapplication.h>
7 7
8/* QT */ 8/* QT */
9#include <qcheckbox.h> 9#include <qcheckbox.h>
10#include <qlabel.h> 10#include <qlabel.h>
11#include <qlineedit.h> 11#include <qlineedit.h>
12#include <qpushbutton.h>
12 13
13/* STD */ 14/* STD */
14#include <stdio.h> 15#include <stdio.h>
15 16
16using namespace OpieTooth; 17using namespace OpieTooth;
17 18
18PinDlg::PinDlg(QWidget* parent, 19PinDlg::PinDlg(QWidget* parent,
19 const char* name, 20 const char* name,
20 Qt::WFlags f ) 21 Qt::WFlags f )
21 : PinDlgBase( parent, name, f ) 22 : PinDlgBase( parent, name, f )
22{ 23{
23 m_mac = makeMacFromArgs(); 24 m_mac = makeMacFromArgs();
24 25
25 if(m_mac.isEmpty()) 26 if(m_mac.isEmpty())
26 { 27 {
27 // can't obtain MAC 28 // can't obtain MAC
28 printf("ERR\n"); 29 printf("ERR\n");
29 ::exit(0); 30 ::exit(0);
30 } 31 }
31 else 32 else
32 { 33 {
33 test( m_mac ); 34 test( m_mac );
34 txtStatus->setText(makeTextFromArgs()); 35 txtStatus->setText(makeTextFromArgs());
35 QPEApplication::showDialog( this , true) ; 36 QPEApplication::showDialog( this , false) ;
36 } 37 }
37} 38}
38 39
39PinDlg::~PinDlg() 40PinDlg::~PinDlg()
40{} 41{}
41 42
42void PinDlg::setMac( const QString& mac ) 43void PinDlg::setMac( const QString& mac )
43{ 44{
44 txtStatus->setText( mac ); 45 txtStatus->setText( mac );
45} 46}
46 47
47QString PinDlg::pin() const 48QString PinDlg::pin() const
@@ -85,25 +86,34 @@ QString PinDlg::makeTextFromArgs()
85 else 86 else
86 return QString::null; 87 return QString::null;
87} 88}
88 89
89QString PinDlg::makeMacFromArgs() 90QString PinDlg::makeMacFromArgs()
90{ 91{
91 if(qApp->argc() < 3) 92 if(qApp->argc() < 3)
92 return QString::null; 93 return QString::null;
93 else 94 else
94 return qApp->argv()[2] ; 95 return qApp->argv()[2] ;
95} 96}
96 97
98void PinDlg::addnum()
99{
100 if( sender()->inherits( "QPushButton") ) {
101 const QPushButton* btn = static_cast<const QPushButton*> (sender());
102 lnePin->setText(lnePin->text() + btn->text());
103 }
104}
105
97void PinDlg::accept() 106void PinDlg::accept()
98{ 107{
99 if ( ckbPin->isChecked() ) 108 if ( ckbPin->isChecked() )
100 { 109 {
101 Config cfg("bluepin"); 110 Config cfg("bluepin");
102 cfg.setGroup(m_mac ); 111 cfg.setGroup(m_mac );
103 cfg.writeEntryCrypt("pin", lnePin->text() ); 112 cfg.writeEntryCrypt("pin", lnePin->text() );
104 } 113 }
105 printf("PIN:%s\n", lnePin->text().latin1()); 114 printf("PIN:%s\n", lnePin->text().latin1());
106 QDialog::accept(); 115 QDialog::accept();
107 qApp->quit(); 116 qApp->quit();
108 ::exit(0); 117 ::exit(0);
109} 118}
119