summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/blue-pin/main.cc9
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.cc26
-rw-r--r--noncore/net/opietooth/blue-pin/pindlg.h9
-rw-r--r--noncore/net/opietooth/blue-pin/pindlgbase.ui56
4 files changed, 20 insertions, 80 deletions
diff --git a/noncore/net/opietooth/blue-pin/main.cc b/noncore/net/opietooth/blue-pin/main.cc
index dbe5b41..90d42e0 100644
--- a/noncore/net/opietooth/blue-pin/main.cc
+++ b/noncore/net/opietooth/blue-pin/main.cc
@@ -1,11 +1,16 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3 3
4 4
5#include <qpe/qpeapplication.h> 5#include <qpe/qpeapplication.h>
6#include <opie2/oapplicationfactory.h> 6#include <opie2/oapplicationfactory.h>
7 7
8#include "pindlg.h" 8#include "pindlg.h"
9 9
10using namespace Opie::Core; 10int main(int argc, char *argv[]) {
11OPIE_EXPORT_APP( OApplicationFactory<OpieTooth::PinDlg> ) 11 QPEApplication oapp(argc, argv);
12
13 OpieTooth::PinDlg dlg;
14 return oapp.exec();
15}
16
diff --git a/noncore/net/opietooth/blue-pin/pindlg.cc b/noncore/net/opietooth/blue-pin/pindlg.cc
index 96be1e5..e40fe33 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.cc
+++ b/noncore/net/opietooth/blue-pin/pindlg.cc
@@ -1,125 +1,109 @@
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 12
13/* STD */ 13/* STD */
14#include <stdio.h> 14#include <stdio.h>
15 15
16using namespace OpieTooth; 16using namespace OpieTooth;
17 17
18PinDlg::PinDlg( const QString& status,
19 const QString& mac, QWidget* parent,
20 const char* name )
21 : PinDlgBase( parent, name, WType_Modal )
22{
23 m_mac = mac;
24 test( mac );
25 txtStatus->setText(status);
26 if(!m_mac.isEmpty())
27 QPEApplication::showDialog( this );
28}
29
30PinDlg::PinDlg(QWidget* parent, 18PinDlg::PinDlg(QWidget* parent,
31 const char* name, 19 const char* name,
32 Qt::WFlags f ) 20 Qt::WFlags f )
33 : PinDlgBase( parent, name, f ) 21 : PinDlgBase( parent, name, f )
34{ 22{
35 m_mac = makeMacFromArgs(); 23 m_mac = makeMacFromArgs();
36 24
37 if(m_mac.isEmpty()) 25 if(m_mac.isEmpty())
38 { 26 {
39 // can't obtain MAC 27 // can't obtain MAC
40 printf("ERR\n"); 28 printf("ERR\n");
41 qApp->quit(); 29 ::exit(0);
42 } 30 }
43 else 31 else
44 { 32 {
45 test( m_mac ); 33 test( m_mac );
46 txtStatus->setText(makeTextFromArgs()); 34 txtStatus->setText(makeTextFromArgs());
47 QPEApplication::showDialog( this ) ; 35 QPEApplication::showDialog( this , true) ;
48 } 36 }
49} 37}
50 38
51PinDlg::~PinDlg() 39PinDlg::~PinDlg()
52{} 40{}
53 41
54void PinDlg::setMac( const QString& mac ) 42void PinDlg::setMac( const QString& mac )
55{ 43{
56 txtStatus->setText( mac ); 44 txtStatus->setText( mac );
57} 45}
58 46
59QString PinDlg::pin() const 47QString PinDlg::pin() const
60{ 48{
61 return lnePin->text(); 49 return lnePin->text();
62} 50}
63 51
64void PinDlg::test( const QString& mac ) 52void PinDlg::test( const QString& mac )
65{ 53{
66 if (!mac.isEmpty() ) 54 if (!mac.isEmpty() )
67 { 55 {
68 Config cfg("bluepin"); 56 Config cfg("bluepin");
69 cfg.setGroup(mac); 57 cfg.setGroup(mac);
70 lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) ); 58 lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) );
71 if ( !lnePin->text().isEmpty() )
72 {
73 //QTimer::singleShot(100, this, SLOT(accept() ) );
74 }
75 } 59 }
76
77} 60}
78 61
79QString PinDlg::makeTextFromArgs() 62QString PinDlg::makeTextFromArgs()
80{ 63{
81 if(qApp->argc() > 2) 64 if(qApp->argc() > 2)
82 { 65 {
83 QCString dir(qApp->argv()[1]) ; 66 QCString dir(qApp->argv()[1]) ;
84 QCString bdaddr(qApp->argv()[2]) ; 67 QCString bdaddr(qApp->argv()[2]) ;
85 68
86 QCString name; 69 QCString name;
87 if ( qApp->argc() > 3 ) { 70 if ( qApp->argc() > 3 ) {
88 name = qApp->argv()[3]; 71 name = qApp->argv()[3];
89 } 72 }
90 QString status; 73 QString status;
91 if (dir == "out" ) { 74 if (dir == "out" ) {
92 status = QObject::tr("Outgoing connection to "); 75 status = QObject::tr("Outgoing connection to ");
93 } else 76 } else
94 status = QObject::tr("Incoming connection from "); 77 status = QObject::tr("Incoming connection from ");
95 78
96 status += name; 79 status += name;
97 status += "<br>"; 80 status += "<br>";
98 status += "[" + bdaddr + "]"; 81 status += "[" + bdaddr + "]";
99 82
100 return status ; 83 return status ;
101 } 84 }
102 else 85 else
103 return QString(); 86 return QString::null;
104} 87}
105 88
106QString PinDlg::makeMacFromArgs() 89QString PinDlg::makeMacFromArgs()
107{ 90{
108 if(qApp->argc() < 3) 91 if(qApp->argc() < 3)
109 return QString(); 92 return QString::null;
110 else 93 else
111 return qApp->argv()[2] ; 94 return qApp->argv()[2] ;
112} 95}
113 96
114void PinDlg::accept() 97void PinDlg::accept()
115{ 98{
116 if ( ckbPin->isChecked() ) 99 if ( ckbPin->isChecked() )
117 { 100 {
118 Config cfg("bluepin"); 101 Config cfg("bluepin");
119 cfg.setGroup(m_mac ); 102 cfg.setGroup(m_mac );
120 cfg.writeEntryCrypt("pin", lnePin->text() ); 103 cfg.writeEntryCrypt("pin", lnePin->text() );
121 } 104 }
122 printf("PIN:%s\n", lnePin->text().latin1()); 105 printf("PIN:%s\n", lnePin->text().latin1());
123 QDialog::accept(); 106 QDialog::accept();
124 qApp->quit(); 107 qApp->quit();
108 ::exit(0);
125} 109}
diff --git a/noncore/net/opietooth/blue-pin/pindlg.h b/noncore/net/opietooth/blue-pin/pindlg.h
index 5f7dc55..8623274 100644
--- a/noncore/net/opietooth/blue-pin/pindlg.h
+++ b/noncore/net/opietooth/blue-pin/pindlg.h
@@ -1,40 +1,33 @@
1 1
2 2
3#include <qdialog.h> 3#include <qdialog.h>
4#include "pindlgbase.h" 4#include "pindlgbase.h"
5 5
6namespace OpieTooth { 6namespace OpieTooth {
7 7
8 class PinDlg : public PinDlgBase { 8 class PinDlg : public PinDlgBase {
9 9
10 Q_OBJECT 10 Q_OBJECT
11 11
12 public: 12 public:
13 PinDlg(const QString& text="", 13 PinDlg(QWidget* parent = 0,const char* name = 0, Qt::WFlags f = 0);
14 const QString& mac="",
15 QWidget* parent = 0,
16 const char* name= 0 );
17
18 PinDlg(QWidget* parent,
19 const char* name,
20 Qt::WFlags f );
21 14
22 ~PinDlg(); 15 ~PinDlg();
23 void setMac( const QString& ); 16 void setMac( const QString& );
24 QString pin() const; 17 QString pin() const;
25 18
26 static QString appName() { return QString::fromLatin1("bluepin") ; } 19 static QString appName() { return QString::fromLatin1("bluepin") ; }
27 20
28 private: 21 private:
29 void test( const QString& mac ); 22 void test( const QString& mac );
30 23
31 QString makeTextFromArgs(); 24 QString makeTextFromArgs();
32 QString makeMacFromArgs(); 25 QString makeMacFromArgs();
33 26
34 QString m_mac; 27 QString m_mac;
35 28
36 protected slots: 29 protected slots:
37 void accept(); 30 void accept();
38 31
39 }; 32 };
40}; 33};
diff --git a/noncore/net/opietooth/blue-pin/pindlgbase.ui b/noncore/net/opietooth/blue-pin/pindlgbase.ui
index 6784de7..a79bb49 100644
--- a/noncore/net/opietooth/blue-pin/pindlgbase.ui
+++ b/noncore/net/opietooth/blue-pin/pindlgbase.ui
@@ -1,274 +1,232 @@
1<!DOCTYPE UI><UI> 1<!DOCTYPE UI><UI>
2<class>PinDlgBase</class> 2<class>PinDlgBase</class>
3<author>zecke</author> 3<author>zecke</author>
4<widget> 4<widget>
5 <class>QDialog</class> 5 <class>QDialog</class>
6 <property stdset="1"> 6 <property stdset="1">
7 <name>name</name> 7 <name>name</name>
8 <cstring>Form1</cstring> 8 <cstring>Form1</cstring>
9 </property> 9 </property>
10 <property stdset="1"> 10 <property stdset="1">
11 <name>geometry</name> 11 <name>geometry</name>
12 <rect> 12 <rect>
13 <x>0</x> 13 <x>0</x>
14 <y>0</y> 14 <y>0</y>
15 <width>254</width> 15 <width>267</width>
16 <height>245</height> 16 <height>161</height>
17 </rect> 17 </rect>
18 </property> 18 </property>
19 <property stdset="1"> 19 <property stdset="1">
20 <name>caption</name> 20 <name>caption</name>
21 <string>Please enter pin</string> 21 <string>Please enter pin</string>
22 </property> 22 </property>
23 <vbox> 23 <grid>
24 <property stdset="1"> 24 <property stdset="1">
25 <name>margin</name> 25 <name>margin</name>
26 <number>11</number> 26 <number>11</number>
27 </property> 27 </property>
28 <property stdset="1"> 28 <property stdset="1">
29 <name>spacing</name> 29 <name>spacing</name>
30 <number>6</number> 30 <number>6</number>
31 </property> 31 </property>
32 <spacer> 32 <widget row="0" column="0" >
33 <property>
34 <name>name</name>
35 <cstring>Spacer4_2</cstring>
36 </property>
37 <property stdset="1">
38 <name>orientation</name>
39 <enum>Vertical</enum>
40 </property>
41 <property stdset="1">
42 <name>sizeType</name>
43 <enum>Expanding</enum>
44 </property>
45 <property>
46 <name>sizeHint</name>
47 <size>
48 <width>20</width>
49 <height>20</height>
50 </size>
51 </property>
52 </spacer>
53 <widget>
54 <class>QLabel</class> 33 <class>QLabel</class>
55 <property stdset="1"> 34 <property stdset="1">
56 <name>name</name> 35 <name>name</name>
57 <cstring>txtStatus</cstring> 36 <cstring>txtStatus</cstring>
58 </property> 37 </property>
59 <property stdset="1"> 38 <property stdset="1">
60 <name>text</name> 39 <name>text</name>
61 <string></string> 40 <string></string>
62 </property> 41 </property>
63 <property stdset="1"> 42 <property stdset="1">
64 <name>textFormat</name> 43 <name>textFormat</name>
65 <enum>RichText</enum> 44 <enum>RichText</enum>
66 </property> 45 </property>
67 </widget> 46 </widget>
68 <widget> 47 <widget row="1" column="0" >
69 <class>QLayoutWidget</class> 48 <class>QLayoutWidget</class>
70 <property stdset="1"> 49 <property stdset="1">
71 <name>name</name> 50 <name>name</name>
72 <cstring>Layout6</cstring> 51 <cstring>Layout6</cstring>
73 </property> 52 </property>
74 <vbox> 53 <vbox>
75 <property stdset="1"> 54 <property stdset="1">
76 <name>margin</name> 55 <name>margin</name>
77 <number>0</number> 56 <number>0</number>
78 </property> 57 </property>
79 <property stdset="1"> 58 <property stdset="1">
80 <name>spacing</name> 59 <name>spacing</name>
81 <number>6</number> 60 <number>6</number>
82 </property> 61 </property>
83 <widget> 62 <widget>
84 <class>QLabel</class> 63 <class>QLabel</class>
85 <property stdset="1"> 64 <property stdset="1">
86 <name>name</name> 65 <name>name</name>
87 <cstring>TextLabel3</cstring> 66 <cstring>TextLabel3</cstring>
88 </property> 67 </property>
89 <property stdset="1"> 68 <property stdset="1">
90 <name>text</name> 69 <name>text</name>
91 <string>Please enter PIN:</string> 70 <string>Please enter PIN:</string>
92 </property> 71 </property>
93 </widget> 72 </widget>
94 <widget> 73 <widget>
95 <class>QLayoutWidget</class> 74 <class>QLayoutWidget</class>
96 <property stdset="1"> 75 <property stdset="1">
97 <name>name</name> 76 <name>name</name>
98 <cstring>Layout5</cstring> 77 <cstring>Layout5</cstring>
99 </property> 78 </property>
100 <hbox> 79 <hbox>
101 <property stdset="1"> 80 <property stdset="1">
102 <name>margin</name> 81 <name>margin</name>
103 <number>0</number> 82 <number>0</number>
104 </property> 83 </property>
105 <property stdset="1"> 84 <property stdset="1">
106 <name>spacing</name> 85 <name>spacing</name>
107 <number>6</number> 86 <number>6</number>
108 </property> 87 </property>
109 <widget> 88 <widget>
110 <class>QLineEdit</class> 89 <class>QLineEdit</class>
111 <property stdset="1"> 90 <property stdset="1">
112 <name>name</name> 91 <name>name</name>
113 <cstring>lnePin</cstring> 92 <cstring>lnePin</cstring>
114 </property> 93 </property>
115 <property stdset="1"> 94 <property stdset="1">
116 <name>echoMode</name> 95 <name>echoMode</name>
117 <enum>Password</enum> 96 <enum>Password</enum>
118 </property> 97 </property>
119 </widget> 98 </widget>
120 <spacer> 99 <spacer>
121 <property> 100 <property>
122 <name>name</name> 101 <name>name</name>
123 <cstring>Spacer4</cstring> 102 <cstring>Spacer4</cstring>
124 </property> 103 </property>
125 <property stdset="1"> 104 <property stdset="1">
126 <name>orientation</name> 105 <name>orientation</name>
127 <enum>Horizontal</enum> 106 <enum>Horizontal</enum>
128 </property> 107 </property>
129 <property stdset="1"> 108 <property stdset="1">
130 <name>sizeType</name> 109 <name>sizeType</name>
131 <enum>Fixed</enum> 110 <enum>Fixed</enum>
132 </property> 111 </property>
133 <property> 112 <property>
134 <name>sizeHint</name> 113 <name>sizeHint</name>
135 <size> 114 <size>
136 <width>21</width> 115 <width>21</width>
137 <height>20</height> 116 <height>20</height>
138 </size> 117 </size>
139 </property> 118 </property>
140 </spacer> 119 </spacer>
141 </hbox> 120 </hbox>
142 </widget> 121 </widget>
143 <widget> 122 <widget>
144 <class>QCheckBox</class> 123 <class>QCheckBox</class>
145 <property stdset="1"> 124 <property stdset="1">
146 <name>name</name> 125 <name>name</name>
147 <cstring>ckbPin</cstring> 126 <cstring>ckbPin</cstring>
148 </property> 127 </property>
149 <property stdset="1"> 128 <property stdset="1">
150 <name>text</name> 129 <name>text</name>
151 <string>Save pin</string> 130 <string>Save pin</string>
152 </property> 131 </property>
153 </widget> 132 </widget>
154 </vbox> 133 </vbox>
155 </widget> 134 </widget>
156 <spacer> 135 <widget row="2" column="0" >
157 <property>
158 <name>name</name>
159 <cstring>Spacer5</cstring>
160 </property>
161 <property stdset="1">
162 <name>orientation</name>
163 <enum>Vertical</enum>
164 </property>
165 <property stdset="1">
166 <name>sizeType</name>
167 <enum>Expanding</enum>
168 </property>
169 <property>
170 <name>sizeHint</name>
171 <size>
172 <width>20</width>
173 <height>20</height>
174 </size>
175 </property>
176 </spacer>
177 <widget>
178 <class>QLayoutWidget</class> 136 <class>QLayoutWidget</class>
179 <property stdset="1"> 137 <property stdset="1">
180 <name>name</name> 138 <name>name</name>
181 <cstring>Layout7</cstring> 139 <cstring>Layout7</cstring>
182 </property> 140 </property>
183 <hbox> 141 <hbox>
184 <property stdset="1"> 142 <property stdset="1">
185 <name>margin</name> 143 <name>margin</name>
186 <number>0</number> 144 <number>0</number>
187 </property> 145 </property>
188 <property stdset="1"> 146 <property stdset="1">
189 <name>spacing</name> 147 <name>spacing</name>
190 <number>6</number> 148 <number>6</number>
191 </property> 149 </property>
192 <spacer> 150 <spacer>
193 <property> 151 <property>
194 <name>name</name> 152 <name>name</name>
195 <cstring>Spacer1</cstring> 153 <cstring>Spacer1</cstring>
196 </property> 154 </property>
197 <property stdset="1"> 155 <property stdset="1">
198 <name>orientation</name> 156 <name>orientation</name>
199 <enum>Horizontal</enum> 157 <enum>Horizontal</enum>
200 </property> 158 </property>
201 <property stdset="1"> 159 <property stdset="1">
202 <name>sizeType</name> 160 <name>sizeType</name>
203 <enum>Fixed</enum> 161 <enum>Fixed</enum>
204 </property> 162 </property>
205 <property> 163 <property>
206 <name>sizeHint</name> 164 <name>sizeHint</name>
207 <size> 165 <size>
208 <width>30</width> 166 <width>30</width>
209 <height>20</height> 167 <height>20</height>
210 </size> 168 </size>
211 </property> 169 </property>
212 </spacer> 170 </spacer>
213 <widget> 171 <widget>
214 <class>QPushButton</class> 172 <class>QPushButton</class>
215 <property stdset="1"> 173 <property stdset="1">
216 <name>name</name> 174 <name>name</name>
217 <cstring>PushButton1</cstring> 175 <cstring>PushButton1</cstring>
218 </property> 176 </property>
219 <property stdset="1"> 177 <property stdset="1">
220 <name>text</name> 178 <name>text</name>
221 <string>&amp;Ok</string> 179 <string>&amp;Ok</string>
222 </property> 180 </property>
223 </widget> 181 </widget>
224 <widget> 182 <widget>
225 <class>QPushButton</class> 183 <class>QPushButton</class>
226 <property stdset="1"> 184 <property stdset="1">
227 <name>name</name> 185 <name>name</name>
228 <cstring>PushButton2</cstring> 186 <cstring>PushButton2</cstring>
229 </property> 187 </property>
230 <property stdset="1"> 188 <property stdset="1">
231 <name>text</name> 189 <name>text</name>
232 <string>&amp;Cancel</string> 190 <string>&amp;Cancel</string>
233 </property> 191 </property>
234 </widget> 192 </widget>
235 <spacer> 193 <spacer>
236 <property> 194 <property>
237 <name>name</name> 195 <name>name</name>
238 <cstring>Spacer2</cstring> 196 <cstring>Spacer2</cstring>
239 </property> 197 </property>
240 <property stdset="1"> 198 <property stdset="1">
241 <name>orientation</name> 199 <name>orientation</name>
242 <enum>Horizontal</enum> 200 <enum>Horizontal</enum>
243 </property> 201 </property>
244 <property stdset="1"> 202 <property stdset="1">
245 <name>sizeType</name> 203 <name>sizeType</name>
246 <enum>Fixed</enum> 204 <enum>Fixed</enum>
247 </property> 205 </property>
248 <property> 206 <property>
249 <name>sizeHint</name> 207 <name>sizeHint</name>
250 <size> 208 <size>
251 <width>16</width> 209 <width>16</width>
252 <height>20</height> 210 <height>20</height>
253 </size> 211 </size>
254 </property> 212 </property>
255 </spacer> 213 </spacer>
256 </hbox> 214 </hbox>
257 </widget> 215 </widget>
258 </vbox> 216 </grid>
259</widget> 217</widget>
260<connections> 218<connections>
261 <connection> 219 <connection>
262 <sender>PushButton1</sender> 220 <sender>PushButton1</sender>
263 <signal>clicked()</signal> 221 <signal>clicked()</signal>
264 <receiver>Form1</receiver> 222 <receiver>Form1</receiver>
265 <slot>accept()</slot> 223 <slot>accept()</slot>
266 </connection> 224 </connection>
267 <connection> 225 <connection>
268 <sender>PushButton2</sender> 226 <sender>PushButton2</sender>
269 <signal>clicked()</signal> 227 <signal>clicked()</signal>
270 <receiver>Form1</receiver> 228 <receiver>Form1</receiver>
271 <slot>reject()</slot> 229 <slot>reject()</slot>
272 </connection> 230 </connection>
273</connections> 231</connections>
274</UI> 232</UI>