author | harlekin <harlekin> | 2003-03-21 15:56:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-21 15:56:58 (UTC) |
commit | d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c (patch) (unidiff) | |
tree | 922b36110df58bdc00a3e2508313609c0f00c45f /noncore/net/opietooth/manager | |
parent | 69086f42072e7fc1ea5256cb9275a27bf5b41f87 (diff) | |
download | opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.zip opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.gz opie-d3f71dadbd2dafcf42480afeffe75e7e36ec7d9c.tar.bz2 |
move connection work to the lib
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 2 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 243 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.cpp | 44 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/panpopup.h | 9 |
4 files changed, 123 insertions, 175 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index b5a09e5..04fa117 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -333,7 +333,7 @@ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & poin | |||
333 | QPopupMenu *popup =0l; | 333 | QPopupMenu *popup =0l; |
334 | if ( it != list.end() ) { | 334 | if ( it != list.end() ) { |
335 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); | 335 | qWarning("Searching id %d %s", it.key(), it.data().latin1() ); |
336 | popup = m_popHelper.find( it.key() /*1*/, | 336 | popup = m_popHelper.find( 4358, |
337 | service->services(), | 337 | service->services(), |
338 | (BTDeviceItem*)service->parent() ); | 338 | (BTDeviceItem*)service->parent() ); |
339 | }else { | 339 | }else { |
diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index b51c8c6..9ff970f 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui | |||
@@ -11,7 +11,7 @@ | |||
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>228</width> | 14 | <width>224</width> |
15 | <height>320</height> | 15 | <height>320</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
@@ -19,20 +19,32 @@ | |||
19 | <name>caption</name> | 19 | <name>caption</name> |
20 | <string>Form1</string> | 20 | <string>Form1</string> |
21 | </property> | 21 | </property> |
22 | <property> | ||
23 | <name>layoutMargin</name> | ||
24 | </property> | ||
25 | <property> | ||
26 | <name>layoutSpacing</name> | ||
27 | </property> | ||
28 | <vbox> | ||
29 | <property stdset="1"> | ||
30 | <name>margin</name> | ||
31 | <number>0</number> | ||
32 | </property> | ||
33 | <property stdset="1"> | ||
34 | <name>spacing</name> | ||
35 | <number>0</number> | ||
36 | </property> | ||
22 | <widget> | 37 | <widget> |
23 | <class>QTabWidget</class> | 38 | <class>QTabWidget</class> |
24 | <property stdset="1"> | 39 | <property stdset="1"> |
25 | <name>name</name> | 40 | <name>name</name> |
26 | <cstring>Status</cstring> | 41 | <cstring>Status</cstring> |
27 | </property> | 42 | </property> |
28 | <property stdset="1"> | 43 | <property> |
29 | <name>geometry</name> | 44 | <name>layoutMargin</name> |
30 | <rect> | 45 | </property> |
31 | <x>0</x> | 46 | <property> |
32 | <y>0</y> | 47 | <name>layoutSpacing</name> |
33 | <width>260</width> | ||
34 | <height>350</height> | ||
35 | </rect> | ||
36 | </property> | 48 | </property> |
37 | <widget> | 49 | <widget> |
38 | <class>QWidget</class> | 50 | <class>QWidget</class> |
@@ -44,48 +56,15 @@ | |||
44 | <name>title</name> | 56 | <name>title</name> |
45 | <string>Devices</string> | 57 | <string>Devices</string> |
46 | </attribute> | 58 | </attribute> |
47 | <spacer> | 59 | <vbox> |
48 | <property> | ||
49 | <name>name</name> | ||
50 | <cstring>Spacer3</cstring> | ||
51 | </property> | ||
52 | <property stdset="1"> | ||
53 | <name>orientation</name> | ||
54 | <enum>Vertical</enum> | ||
55 | </property> | ||
56 | <property stdset="1"> | ||
57 | <name>sizeType</name> | ||
58 | <enum>Expanding</enum> | ||
59 | </property> | ||
60 | <property> | ||
61 | <name>sizeHint</name> | ||
62 | <size> | ||
63 | <width>20</width> | ||
64 | <height>20</height> | ||
65 | </size> | ||
66 | </property> | ||
67 | </spacer> | ||
68 | <spacer> | ||
69 | <property> | ||
70 | <name>name</name> | ||
71 | <cstring>Spacer1</cstring> | ||
72 | </property> | ||
73 | <property stdset="1"> | 60 | <property stdset="1"> |
74 | <name>orientation</name> | 61 | <name>margin</name> |
75 | <enum>Vertical</enum> | 62 | <number>2</number> |
76 | </property> | 63 | </property> |
77 | <property stdset="1"> | 64 | <property stdset="1"> |
78 | <name>sizeType</name> | 65 | <name>spacing</name> |
79 | <enum>Fixed</enum> | 66 | <number>2</number> |
80 | </property> | ||
81 | <property> | ||
82 | <name>sizeHint</name> | ||
83 | <size> | ||
84 | <width>20</width> | ||
85 | <height>20</height> | ||
86 | </size> | ||
87 | </property> | 67 | </property> |
88 | </spacer> | ||
89 | <widget> | 68 | <widget> |
90 | <class>QListView</class> | 69 | <class>QListView</class> |
91 | <column> | 70 | <column> |
@@ -120,15 +99,6 @@ | |||
120 | <name>name</name> | 99 | <name>name</name> |
121 | <cstring>ListView2</cstring> | 100 | <cstring>ListView2</cstring> |
122 | </property> | 101 | </property> |
123 | <property stdset="1"> | ||
124 | <name>geometry</name> | ||
125 | <rect> | ||
126 | <x>0</x> | ||
127 | <y>0</y> | ||
128 | <width>230</width> | ||
129 | <height>230</height> | ||
130 | </rect> | ||
131 | </property> | ||
132 | </widget> | 102 | </widget> |
133 | <widget> | 103 | <widget> |
134 | <class>QPushButton</class> | 104 | <class>QPushButton</class> |
@@ -137,15 +107,6 @@ | |||
137 | <cstring>PushButton2</cstring> | 107 | <cstring>PushButton2</cstring> |
138 | </property> | 108 | </property> |
139 | <property stdset="1"> | 109 | <property stdset="1"> |
140 | <name>geometry</name> | ||
141 | <rect> | ||
142 | <x>40</x> | ||
143 | <y>231</y> | ||
144 | <width>154</width> | ||
145 | <height>30</height> | ||
146 | </rect> | ||
147 | </property> | ||
148 | <property stdset="1"> | ||
149 | <name>sizePolicy</name> | 110 | <name>sizePolicy</name> |
150 | <sizepolicy> | 111 | <sizepolicy> |
151 | <hsizetype>0</hsizetype> | 112 | <hsizetype>0</hsizetype> |
@@ -157,6 +118,7 @@ | |||
157 | <string>Scan for Devices</string> | 118 | <string>Scan for Devices</string> |
158 | </property> | 119 | </property> |
159 | </widget> | 120 | </widget> |
121 | </vbox> | ||
160 | </widget> | 122 | </widget> |
161 | <widget> | 123 | <widget> |
162 | <class>QWidget</class> | 124 | <class>QWidget</class> |
@@ -168,6 +130,15 @@ | |||
168 | <name>title</name> | 130 | <name>title</name> |
169 | <string>Connections</string> | 131 | <string>Connections</string> |
170 | </attribute> | 132 | </attribute> |
133 | <vbox> | ||
134 | <property stdset="1"> | ||
135 | <name>margin</name> | ||
136 | <number>2</number> | ||
137 | </property> | ||
138 | <property stdset="1"> | ||
139 | <name>spacing</name> | ||
140 | <number>2</number> | ||
141 | </property> | ||
171 | <widget> | 142 | <widget> |
172 | <class>QListView</class> | 143 | <class>QListView</class> |
173 | <column> | 144 | <column> |
@@ -216,16 +187,8 @@ | |||
216 | <name>name</name> | 187 | <name>name</name> |
217 | <cstring>ListView4</cstring> | 188 | <cstring>ListView4</cstring> |
218 | </property> | 189 | </property> |
219 | <property stdset="1"> | ||
220 | <name>geometry</name> | ||
221 | <rect> | ||
222 | <x>0</x> | ||
223 | <y>0</y> | ||
224 | <width>240</width> | ||
225 | <height>240</height> | ||
226 | </rect> | ||
227 | </property> | ||
228 | </widget> | 190 | </widget> |
191 | </vbox> | ||
229 | </widget> | 192 | </widget> |
230 | <widget> | 193 | <widget> |
231 | <class>QWidget</class> | 194 | <class>QWidget</class> |
@@ -237,20 +200,35 @@ | |||
237 | <name>title</name> | 200 | <name>title</name> |
238 | <string>Config</string> | 201 | <string>Config</string> |
239 | </attribute> | 202 | </attribute> |
203 | <vbox> | ||
204 | <property stdset="1"> | ||
205 | <name>margin</name> | ||
206 | <number>2</number> | ||
207 | </property> | ||
208 | <property stdset="1"> | ||
209 | <name>spacing</name> | ||
210 | <number>2</number> | ||
211 | </property> | ||
240 | <widget> | 212 | <widget> |
241 | <class>QLabel</class> | 213 | <class>QLayoutWidget</class> |
242 | <property stdset="1"> | 214 | <property stdset="1"> |
243 | <name>name</name> | 215 | <name>name</name> |
244 | <cstring>deviceNameLabel</cstring> | 216 | <cstring>Layout2</cstring> |
245 | </property> | 217 | </property> |
218 | <hbox> | ||
246 | <property stdset="1"> | 219 | <property stdset="1"> |
247 | <name>geometry</name> | 220 | <name>margin</name> |
248 | <rect> | 221 | <number>0</number> |
249 | <x>10</x> | 222 | </property> |
250 | <y>10</y> | 223 | <property stdset="1"> |
251 | <width>70</width> | 224 | <name>spacing</name> |
252 | <height>20</height> | 225 | <number>6</number> |
253 | </rect> | 226 | </property> |
227 | <widget> | ||
228 | <class>QLabel</class> | ||
229 | <property stdset="1"> | ||
230 | <name>name</name> | ||
231 | <cstring>deviceNameLabel</cstring> | ||
254 | </property> | 232 | </property> |
255 | <property stdset="1"> | 233 | <property stdset="1"> |
256 | <name>text</name> | 234 | <name>text</name> |
@@ -258,19 +236,34 @@ | |||
258 | </property> | 236 | </property> |
259 | </widget> | 237 | </widget> |
260 | <widget> | 238 | <widget> |
261 | <class>QLabel</class> | 239 | <class>QLineEdit</class> |
262 | <property stdset="1"> | 240 | <property stdset="1"> |
263 | <name>name</name> | 241 | <name>name</name> |
264 | <cstring>passkeyLabel</cstring> | 242 | <cstring>deviceNameLine</cstring> |
265 | </property> | 243 | </property> |
244 | </widget> | ||
245 | </hbox> | ||
246 | </widget> | ||
247 | <widget> | ||
248 | <class>QLayoutWidget</class> | ||
266 | <property stdset="1"> | 249 | <property stdset="1"> |
267 | <name>geometry</name> | 250 | <name>name</name> |
268 | <rect> | 251 | <cstring>Layout3</cstring> |
269 | <x>10</x> | 252 | </property> |
270 | <y>50</y> | 253 | <hbox> |
271 | <width>80</width> | 254 | <property stdset="1"> |
272 | <height>20</height> | 255 | <name>margin</name> |
273 | </rect> | 256 | <number>0</number> |
257 | </property> | ||
258 | <property stdset="1"> | ||
259 | <name>spacing</name> | ||
260 | <number>6</number> | ||
261 | </property> | ||
262 | <widget> | ||
263 | <class>QLabel</class> | ||
264 | <property stdset="1"> | ||
265 | <name>name</name> | ||
266 | <cstring>passkeyLabel</cstring> | ||
274 | </property> | 267 | </property> |
275 | <property stdset="1"> | 268 | <property stdset="1"> |
276 | <name>text</name> | 269 | <name>text</name> |
@@ -284,34 +277,18 @@ | |||
284 | <cstring>passkeyLine</cstring> | 277 | <cstring>passkeyLine</cstring> |
285 | </property> | 278 | </property> |
286 | <property stdset="1"> | 279 | <property stdset="1"> |
287 | <name>geometry</name> | ||
288 | <rect> | ||
289 | <x>98</x> | ||
290 | <y>53</y> | ||
291 | <width>120</width> | ||
292 | <height>22</height> | ||
293 | </rect> | ||
294 | </property> | ||
295 | <property stdset="1"> | ||
296 | <name>echoMode</name> | 280 | <name>echoMode</name> |
297 | <enum>Password</enum> | 281 | <enum>Password</enum> |
298 | </property> | 282 | </property> |
299 | </widget> | 283 | </widget> |
284 | </hbox> | ||
285 | </widget> | ||
300 | <widget> | 286 | <widget> |
301 | <class>QLayoutWidget</class> | 287 | <class>QLayoutWidget</class> |
302 | <property stdset="1"> | 288 | <property stdset="1"> |
303 | <name>name</name> | 289 | <name>name</name> |
304 | <cstring>Layout5</cstring> | 290 | <cstring>Layout5</cstring> |
305 | </property> | 291 | </property> |
306 | <property stdset="1"> | ||
307 | <name>geometry</name> | ||
308 | <rect> | ||
309 | <x>10</x> | ||
310 | <y>100</y> | ||
311 | <width>188</width> | ||
312 | <height>120</height> | ||
313 | </rect> | ||
314 | </property> | ||
315 | <vbox> | 292 | <vbox> |
316 | <property stdset="1"> | 293 | <property stdset="1"> |
317 | <name>margin</name> | 294 | <name>margin</name> |
@@ -368,41 +345,17 @@ | |||
368 | </vbox> | 345 | </vbox> |
369 | </widget> | 346 | </widget> |
370 | <widget> | 347 | <widget> |
371 | <class>QLineEdit</class> | ||
372 | <property stdset="1"> | ||
373 | <name>name</name> | ||
374 | <cstring>deviceNameLine</cstring> | ||
375 | </property> | ||
376 | <property stdset="1"> | ||
377 | <name>geometry</name> | ||
378 | <rect> | ||
379 | <x>98</x> | ||
380 | <y>13</y> | ||
381 | <width>120</width> | ||
382 | <height>22</height> | ||
383 | </rect> | ||
384 | </property> | ||
385 | </widget> | ||
386 | <widget> | ||
387 | <class>QPushButton</class> | 348 | <class>QPushButton</class> |
388 | <property stdset="1"> | 349 | <property stdset="1"> |
389 | <name>name</name> | 350 | <name>name</name> |
390 | <cstring>configApplyButton</cstring> | 351 | <cstring>configApplyButton</cstring> |
391 | </property> | 352 | </property> |
392 | <property stdset="1"> | 353 | <property stdset="1"> |
393 | <name>geometry</name> | ||
394 | <rect> | ||
395 | <x>60</x> | ||
396 | <y>230</y> | ||
397 | <width>99</width> | ||
398 | <height>32</height> | ||
399 | </rect> | ||
400 | </property> | ||
401 | <property stdset="1"> | ||
402 | <name>text</name> | 354 | <name>text</name> |
403 | <string>Apply</string> | 355 | <string>Apply</string> |
404 | </property> | 356 | </property> |
405 | </widget> | 357 | </widget> |
358 | </vbox> | ||
406 | </widget> | 359 | </widget> |
407 | <widget> | 360 | <widget> |
408 | <class>QWidget</class> | 361 | <class>QWidget</class> |
@@ -414,6 +367,15 @@ | |||
414 | <name>title</name> | 367 | <name>title</name> |
415 | <string>Status</string> | 368 | <string>Status</string> |
416 | </attribute> | 369 | </attribute> |
370 | <vbox> | ||
371 | <property stdset="1"> | ||
372 | <name>margin</name> | ||
373 | <number>2</number> | ||
374 | </property> | ||
375 | <property stdset="1"> | ||
376 | <name>spacing</name> | ||
377 | <number>2</number> | ||
378 | </property> | ||
417 | <widget> | 379 | <widget> |
418 | <class>QLabel</class> | 380 | <class>QLabel</class> |
419 | <property stdset="1"> | 381 | <property stdset="1"> |
@@ -421,20 +383,13 @@ | |||
421 | <cstring>StatusLabel</cstring> | 383 | <cstring>StatusLabel</cstring> |
422 | </property> | 384 | </property> |
423 | <property stdset="1"> | 385 | <property stdset="1"> |
424 | <name>geometry</name> | ||
425 | <rect> | ||
426 | <x>10</x> | ||
427 | <y>10</y> | ||
428 | <width>220</width> | ||
429 | <height>250</height> | ||
430 | </rect> | ||
431 | </property> | ||
432 | <property stdset="1"> | ||
433 | <name>text</name> | 386 | <name>text</name> |
434 | <string>Status Label</string> | 387 | <string>Status Label</string> |
435 | </property> | 388 | </property> |
436 | </widget> | 389 | </widget> |
390 | </vbox> | ||
437 | </widget> | 391 | </widget> |
438 | </widget> | 392 | </widget> |
393 | </vbox> | ||
439 | </widget> | 394 | </widget> |
440 | </UI> | 395 | </UI> |
diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index d3d1347..61e632b 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp | |||
@@ -14,51 +14,43 @@ PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { | |||
14 | qWarning("PanPopup c'tor"); | 14 | qWarning("PanPopup c'tor"); |
15 | 15 | ||
16 | m_item = item; | 16 | m_item = item; |
17 | m_panconnect = 0l; | 17 | QAction *a, *b, *c; |
18 | QAction *a, *b; | ||
19 | 18 | ||
19 | m_panconnection = 0l; | ||
20 | /* connect action */ | 20 | /* connect action */ |
21 | |||
22 | |||
21 | a = new QAction( ); // so it's get deleted | 23 | a = new QAction( ); // so it's get deleted |
22 | a->setText( "connect" ); | 24 | a->setText( tr("connect") ); |
23 | a->addTo( this ); | 25 | a->addTo( this ); |
24 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); | 26 | connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); |
25 | 27 | ||
28 | |||
26 | b = new QAction(); | 29 | b = new QAction(); |
27 | b->setText( "connect+conf" ); | 30 | b->setText( tr( "connect+conf" ) ); |
28 | b->addTo( this ); | 31 | b->addTo( this ); |
29 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); | 32 | connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); |
33 | |||
34 | c = new QAction(); | ||
35 | c->setText( tr( "disconnect" ) ); | ||
36 | c->addTo( this ); | ||
37 | connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); | ||
38 | |||
30 | }; | 39 | }; |
31 | 40 | ||
32 | PanPopup::~PanPopup() { | 41 | PanPopup::~PanPopup() { |
33 | delete m_panconnect; | 42 | |
34 | } | 43 | } |
35 | 44 | ||
36 | void PanPopup::slotConnect() { | 45 | void PanPopup::slotConnect() { |
37 | 46 | m_panconnection = new StartPanConnection( m_item->mac() ); | |
38 | 47 | m_panconnection->start(); | |
39 | // SHOULD move to lib | ||
40 | // before pand must be in "pand --listen --role panu" mode ( client ) | ||
41 | |||
42 | m_panconnect = new OProcess(); | ||
43 | *m_panconnect << "pand" << "--connect" << m_item->mac(); | ||
44 | |||
45 | connect( m_panconnect, SIGNAL( processExited( OProcess* ) ) , | ||
46 | this, SLOT( slotConnectExited( OProcess* ) ) ); | ||
47 | connect( m_panconnect, SIGNAL( receivedStdout( OProcess*, char*, int ) ), | ||
48 | this, SLOT( slotConnectOut( OProcess*, char*, int ) ) ); | ||
49 | if (!m_panconnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { | ||
50 | qWarning( "could not start" ); | ||
51 | delete m_panconnect; | ||
52 | } | ||
53 | } | 48 | } |
54 | 49 | ||
55 | void PanPopup::slotExited( OProcess* proc ) { | 50 | void PanPopup::slotDisconnect() { |
56 | delete m_panconnect; | 51 | m_panconnection->stop(); |
57 | } | 52 | } |
58 | 53 | ||
59 | void PanPopup::slotStdOut(OProcess* proc, char* chars, int len) | ||
60 | {} | ||
61 | |||
62 | 54 | ||
63 | void PanPopup::slotConnectAndConfig() { | 55 | void PanPopup::slotConnectAndConfig() { |
64 | slotConnect(); | 56 | slotConnect(); |
diff --git a/noncore/net/opietooth/manager/panpopup.h b/noncore/net/opietooth/manager/panpopup.h index 9d99f5e..1496f3a 100644 --- a/noncore/net/opietooth/manager/panpopup.h +++ b/noncore/net/opietooth/manager/panpopup.h | |||
@@ -3,10 +3,12 @@ | |||
3 | 3 | ||
4 | #include <qpopupmenu.h> | 4 | #include <qpopupmenu.h> |
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <opie/oprocess.h> | 6 | |
7 | #include <startpanconnection.h> | ||
7 | 8 | ||
8 | #include "btdeviceitem.h" | 9 | #include "btdeviceitem.h" |
9 | 10 | ||
11 | |||
10 | namespace OpieTooth { | 12 | namespace OpieTooth { |
11 | 13 | ||
12 | class PanPopup : public QPopupMenu { | 14 | class PanPopup : public QPopupMenu { |
@@ -19,13 +21,12 @@ namespace OpieTooth { | |||
19 | 21 | ||
20 | private: | 22 | private: |
21 | QAction* m_push; | 23 | QAction* m_push; |
22 | OProcess* m_panconnect; | 24 | OpieTooth::StartPanConnection* m_panconnection; |
23 | OpieTooth::BTDeviceItem *m_item; | 25 | OpieTooth::BTDeviceItem *m_item; |
24 | private slots: | 26 | private slots: |
25 | void slotConnect(); | 27 | void slotConnect(); |
28 | void slotDisconnect(); | ||
26 | void slotConnectAndConfig(); | 29 | void slotConnectAndConfig(); |
27 | void slotExited( OProcess* proc ); | ||
28 | void slotStdOut( OProcess* proc, char* chars, int len ); | ||
29 | }; | 30 | }; |
30 | }; | 31 | }; |
31 | 32 | ||