author | zecke <zecke> | 2002-06-18 16:41:18 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-18 16:41:18 (UTC) |
commit | 46543a909fc88017998ede20ed25cd85992938e4 (patch) (unidiff) | |
tree | 1afafb1b96dadd2d9d320ae81820578245f74f98 | |
parent | eacd774d0bf520d17dac5eea092197174b43c9f9 (diff) | |
download | opie-46543a909fc88017998ede20ed25cd85992938e4.zip opie-46543a909fc88017998ede20ed25cd85992938e4.tar.gz opie-46543a909fc88017998ede20ed25cd85992938e4.tar.bz2 |
add the inital version of blue-pin for Opie
-rw-r--r-- | noncore/net/opietooth/blue-pin/blue-pin.pro | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/blue-pin/main.cc | 39 | ||||
-rw-r--r-- | noncore/net/opietooth/blue-pin/pindlg.cc | 53 | ||||
-rw-r--r-- | noncore/net/opietooth/blue-pin/pindlg.h | 26 | ||||
-rw-r--r-- | noncore/net/opietooth/blue-pin/pindlgbase.ui | 198 |
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 @@ | |||
1 | TEMPLATE = app | ||
2 | #CONFIG = qt warn_on debug | ||
3 | CONFIG = qt warn_on release | ||
4 | HEADERS = pindlg.h | ||
5 | SOURCES = main.cc pindlg.cc | ||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib | ||
8 | DEPENDPATH += $(OPIEDIR)/include | ||
9 | LIBS += -lqpe | ||
10 | INTERFACES = pindlgbase.ui | ||
11 | TARGET = $(OPIEDIR)bin/bluepin | ||
12 | |||
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 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | |||
4 | |||
5 | #include <qpe/qpeapplication.h> | ||
6 | #include <qpe/config.h> | ||
7 | |||
8 | #include "pindlg.h" | ||
9 | |||
10 | |||
11 | int main( int argc, char* argv[] ) | ||
12 | { | ||
13 | if (argc < 2 ) { | ||
14 | printf("ERR\n"); | ||
15 | exit(0); | ||
16 | } | ||
17 | QCString dir(argv[1] ); | ||
18 | QCString bdaddr( argv[2] ); | ||
19 | QCString name; | ||
20 | if ( argc > 3 ) { | ||
21 | name = argv[3]; | ||
22 | } | ||
23 | QPEApplication a(argc, argv ); | ||
24 | QString status; | ||
25 | if (dir == "out" ) { | ||
26 | status = QObject::tr("Outgoing connection to "); | ||
27 | }else | ||
28 | status = QObject::tr("Incoming connection from "); | ||
29 | status += name; | ||
30 | status += "<br>"; | ||
31 | status += "[" + bdaddr + "]"; | ||
32 | OpieTooth::PinDlg dlg( status, bdaddr ); | ||
33 | if ( dlg.exec() ) { | ||
34 | printf("PIN:%s\n", dlg.pin().stripWhiteSpace().latin1() ); | ||
35 | }else | ||
36 | printf("ERR\n"); | ||
37 | return 0; | ||
38 | } | ||
39 | |||
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 @@ | |||
1 | |||
2 | #include <stdio.h> | ||
3 | |||
4 | #include <qcheckbox.h> | ||
5 | #include <qlabel.h> | ||
6 | #include <qlineedit.h> | ||
7 | #include <qtimer.h> | ||
8 | |||
9 | #include <qpe/config.h> | ||
10 | |||
11 | #include "pindlg.h" | ||
12 | |||
13 | using namespace OpieTooth; | ||
14 | |||
15 | PinDlg::PinDlg( const QString& status, | ||
16 | const QString& mac, QWidget* parent, | ||
17 | const char* name ) | ||
18 | : PinDlgBase( parent, name, WType_Modal ) | ||
19 | { | ||
20 | m_mac = mac; | ||
21 | test( mac ); | ||
22 | txtStatus->setText(status); | ||
23 | } | ||
24 | PinDlg::~PinDlg() { | ||
25 | |||
26 | } | ||
27 | void PinDlg::setMac( const QString& mac ) { | ||
28 | txtStatus->setText( mac ); | ||
29 | } | ||
30 | QString PinDlg::pin() const{ | ||
31 | return lnePin->text(); | ||
32 | } | ||
33 | |||
34 | void PinDlg::test( const QString& mac ) { | ||
35 | if (!mac.isEmpty() ) { | ||
36 | Config cfg("bluepin"); | ||
37 | cfg.setGroup(mac); | ||
38 | lnePin->setText(cfg.readEntryCrypt("pin", QString::null ) ); | ||
39 | if ( !lnePin->text().isEmpty() ) { | ||
40 | //QTimer::singleShot(100, this, SLOT(accept() ) ); | ||
41 | } | ||
42 | |||
43 | } | ||
44 | |||
45 | } | ||
46 | void PinDlg::accept() { | ||
47 | if ( ckbPin->isChecked() ) { | ||
48 | Config cfg("bluepin"); | ||
49 | cfg.setGroup(m_mac ); | ||
50 | cfg.writeEntryCrypt("pin", lnePin->text() ); | ||
51 | } | ||
52 | QDialog::accept(); | ||
53 | } | ||
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 @@ | |||
1 | |||
2 | |||
3 | #include <qdialog.h> | ||
4 | |||
5 | #include "pindlgbase.h" | ||
6 | |||
7 | namespace OpieTooth { | ||
8 | class PinDlg : public PinDlgBase { | ||
9 | Q_OBJECT | ||
10 | public: | ||
11 | PinDlg(const QString& text, | ||
12 | const QString& mac, | ||
13 | QWidget* parent = 0, | ||
14 | const char* name= 0 ); | ||
15 | ~PinDlg(); | ||
16 | void setMac( const QString& ); | ||
17 | QString pin() const; | ||
18 | private: | ||
19 | void test( const QString& mac ); | ||
20 | QString m_mac; | ||
21 | protected slots: | ||
22 | void accept(); | ||
23 | }; | ||
24 | |||
25 | |||
26 | }; | ||
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 @@ | |||
1 | <!DOCTYPE UI><UI> | ||
2 | <class>PinDlgBase</class> | ||
3 | <author>zecke</author> | ||
4 | <widget> | ||
5 | <class>QDialog</class> | ||
6 | <property stdset="1"> | ||
7 | <name>name</name> | ||
8 | <cstring>Form1</cstring> | ||
9 | </property> | ||
10 | <property stdset="1"> | ||
11 | <name>geometry</name> | ||
12 | <rect> | ||
13 | <x>0</x> | ||
14 | <y>0</y> | ||
15 | <width>248</width> | ||
16 | <height>167</height> | ||
17 | </rect> | ||
18 | </property> | ||
19 | <property stdset="1"> | ||
20 | <name>caption</name> | ||
21 | <string>Please enter pin</string> | ||
22 | </property> | ||
23 | <grid> | ||
24 | <property stdset="1"> | ||
25 | <name>margin</name> | ||
26 | <number>11</number> | ||
27 | </property> | ||
28 | <property stdset="1"> | ||
29 | <name>spacing</name> | ||
30 | <number>6</number> | ||
31 | </property> | ||
32 | <widget row="0" column="0" > | ||
33 | <class>QLayoutWidget</class> | ||
34 | <property stdset="1"> | ||
35 | <name>name</name> | ||
36 | <cstring>Layout6</cstring> | ||
37 | </property> | ||
38 | <grid> | ||
39 | <property stdset="1"> | ||
40 | <name>margin</name> | ||
41 | <number>0</number> | ||
42 | </property> | ||
43 | <property stdset="1"> | ||
44 | <name>spacing</name> | ||
45 | <number>6</number> | ||
46 | </property> | ||
47 | <widget row="3" column="0" rowspan="1" colspan="3" > | ||
48 | <class>QLineEdit</class> | ||
49 | <property stdset="1"> | ||
50 | <name>name</name> | ||
51 | <cstring>lnePin</cstring> | ||
52 | </property> | ||
53 | <property stdset="1"> | ||
54 | <name>echoMode</name> | ||
55 | <enum>Password</enum> | ||
56 | </property> | ||
57 | </widget> | ||
58 | <spacer row="5" column="4" > | ||
59 | <property> | ||
60 | <name>name</name> | ||
61 | <cstring>Spacer2</cstring> | ||
62 | </property> | ||
63 | <property stdset="1"> | ||
64 | <name>orientation</name> | ||
65 | <enum>Horizontal</enum> | ||
66 | </property> | ||
67 | <property stdset="1"> | ||
68 | <name>sizeType</name> | ||
69 | <enum>Fixed</enum> | ||
70 | </property> | ||
71 | <property> | ||
72 | <name>sizeHint</name> | ||
73 | <size> | ||
74 | <width>16</width> | ||
75 | <height>20</height> | ||
76 | </size> | ||
77 | </property> | ||
78 | </spacer> | ||
79 | <spacer row="5" column="0" > | ||
80 | <property> | ||
81 | <name>name</name> | ||
82 | <cstring>Spacer1</cstring> | ||
83 | </property> | ||
84 | <property stdset="1"> | ||
85 | <name>orientation</name> | ||
86 | <enum>Horizontal</enum> | ||
87 | </property> | ||
88 | <property stdset="1"> | ||
89 | <name>sizeType</name> | ||
90 | <enum>Fixed</enum> | ||
91 | </property> | ||
92 | <property> | ||
93 | <name>sizeHint</name> | ||
94 | <size> | ||
95 | <width>30</width> | ||
96 | <height>20</height> | ||
97 | </size> | ||
98 | </property> | ||
99 | </spacer> | ||
100 | <spacer row="3" column="3" > | ||
101 | <property> | ||
102 | <name>name</name> | ||
103 | <cstring>Spacer4</cstring> | ||
104 | </property> | ||
105 | <property stdset="1"> | ||
106 | <name>orientation</name> | ||
107 | <enum>Horizontal</enum> | ||
108 | </property> | ||
109 | <property stdset="1"> | ||
110 | <name>sizeType</name> | ||
111 | <enum>Fixed</enum> | ||
112 | </property> | ||
113 | <property> | ||
114 | <name>sizeHint</name> | ||
115 | <size> | ||
116 | <width>21</width> | ||
117 | <height>20</height> | ||
118 | </size> | ||
119 | </property> | ||
120 | </spacer> | ||
121 | <widget row="0" column="0" rowspan="1" colspan="5" > | ||
122 | <class>QLabel</class> | ||
123 | <property stdset="1"> | ||
124 | <name>name</name> | ||
125 | <cstring>txtStatus</cstring> | ||
126 | </property> | ||
127 | <property stdset="1"> | ||
128 | <name>text</name> | ||
129 | <string></string> | ||
130 | </property> | ||
131 | <property stdset="1"> | ||
132 | <name>textFormat</name> | ||
133 | <enum>RichText</enum> | ||
134 | </property> | ||
135 | </widget> | ||
136 | <widget row="2" column="0" rowspan="1" colspan="5" > | ||
137 | <class>QLabel</class> | ||
138 | <property stdset="1"> | ||
139 | <name>name</name> | ||
140 | <cstring>TextLabel3</cstring> | ||
141 | </property> | ||
142 | <property stdset="1"> | ||
143 | <name>text</name> | ||
144 | <string>Please enter PIN:</string> | ||
145 | </property> | ||
146 | </widget> | ||
147 | <widget row="5" column="1" > | ||
148 | <class>QPushButton</class> | ||
149 | <property stdset="1"> | ||
150 | <name>name</name> | ||
151 | <cstring>PushButton1</cstring> | ||
152 | </property> | ||
153 | <property stdset="1"> | ||
154 | <name>text</name> | ||
155 | <string>&Ok</string> | ||
156 | </property> | ||
157 | </widget> | ||
158 | <widget row="5" column="2" rowspan="1" colspan="2" > | ||
159 | <class>QPushButton</class> | ||
160 | <property stdset="1"> | ||
161 | <name>name</name> | ||
162 | <cstring>PushButton2</cstring> | ||
163 | </property> | ||
164 | <property stdset="1"> | ||
165 | <name>text</name> | ||
166 | <string>&Cancel</string> | ||
167 | </property> | ||
168 | </widget> | ||
169 | <widget row="4" column="0" rowspan="1" colspan="5" > | ||
170 | <class>QCheckBox</class> | ||
171 | <property stdset="1"> | ||
172 | <name>name</name> | ||
173 | <cstring>ckbPin</cstring> | ||
174 | </property> | ||
175 | <property stdset="1"> | ||
176 | <name>text</name> | ||
177 | <string>Save pin</string> | ||
178 | </property> | ||
179 | </widget> | ||
180 | </grid> | ||
181 | </widget> | ||
182 | </grid> | ||
183 | </widget> | ||
184 | <connections> | ||
185 | <connection> | ||
186 | <sender>PushButton1</sender> | ||
187 | <signal>clicked()</signal> | ||
188 | <receiver>Form1</receiver> | ||
189 | <slot>accept()</slot> | ||
190 | </connection> | ||
191 | <connection> | ||
192 | <sender>PushButton2</sender> | ||
193 | <signal>clicked()</signal> | ||
194 | <receiver>Form1</receiver> | ||
195 | <slot>reject()</slot> | ||
196 | </connection> | ||
197 | </connections> | ||
198 | </UI> | ||