summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configbase.ui155
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp32
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp24
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h3
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp16
6 files changed, 166 insertions, 72 deletions
diff --git a/noncore/net/wellenreiter/gui/configbase.ui b/noncore/net/wellenreiter/gui/configbase.ui
index fa727f9..dda7ba0 100644
--- a/noncore/net/wellenreiter/gui/configbase.ui
+++ b/noncore/net/wellenreiter/gui/configbase.ui
@@ -11,8 +11,8 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>212</width> 14 <width>220</width>
15 <height>267</height> 15 <height>306</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
18 <property stdset="1"> 18 <property stdset="1">
@@ -28,7 +28,7 @@
28 <vbox> 28 <vbox>
29 <property stdset="1"> 29 <property stdset="1">
30 <name>margin</name> 30 <name>margin</name>
31 <number>4</number> 31 <number>3</number>
32 </property> 32 </property>
33 <property stdset="1"> 33 <property stdset="1">
34 <name>spacing</name> 34 <name>spacing</name>
@@ -325,91 +325,136 @@
325 </hbox> 325 </hbox>
326 </widget> 326 </widget>
327 <widget> 327 <widget>
328 <class>QCheckBox</class>
329 <property stdset="1">
330 <name>name</name>
331 <cstring>groupNetworks</cstring>
332 </property>
333 <property stdset="1">
334 <name>enabled</name>
335 <bool>false</bool>
336 </property>
337 <property stdset="1">
338 <name>text</name>
339 <string>Group Detected Networks</string>
340 </property>
341 </widget>
342 <widget>
343 <class>QCheckBox</class>
344 <property stdset="1">
345 <name>name</name>
346 <cstring>enableActivity</cstring>
347 </property>
348 <property stdset="1">
349 <name>enabled</name>
350 <bool>false</bool>
351 </property>
352 <property stdset="1">
353 <name>text</name>
354 <string>Enable Activity Display</string>
355 </property>
356 </widget>
357 <widget>
328 <class>QLayoutWidget</class> 358 <class>QLayoutWidget</class>
329 <property stdset="1"> 359 <property stdset="1">
330 <name>name</name> 360 <name>name</name>
331 <cstring>Layout5</cstring> 361 <cstring>Layout5</cstring>
332 </property> 362 </property>
333 <property> 363 <grid>
334 <name>layoutSpacing</name>
335 </property>
336 <vbox>
337 <property stdset="1"> 364 <property stdset="1">
338 <name>margin</name> 365 <name>margin</name>
339 <number>0</number> 366 <number>0</number>
340 </property> 367 </property>
341 <property stdset="1"> 368 <property stdset="1">
342 <name>spacing</name> 369 <name>spacing</name>
343 <number>-1</number> 370 <number>6</number>
344 </property> 371 </property>
345 <widget> 372 <widget row="0" column="1" >
346 <class>QCheckBox</class> 373 <class>QLabel</class>
347 <property stdset="1"> 374 <property stdset="1">
348 <name>name</name> 375 <name>name</name>
349 <cstring>groupNetworks</cstring> 376 <cstring>TextLabel1</cstring>
350 </property>
351 <property stdset="1">
352 <name>enabled</name>
353 <bool>false</bool>
354 </property> 377 </property>
355 <property stdset="1"> 378 <property stdset="1">
356 <name>text</name> 379 <name>text</name>
357 <string>Group Detected Networks</string> 380 <string>sound on new net</string>
358 </property> 381 </property>
359 </widget> 382 </widget>
360 <widget> 383 <widget row="1" column="0" >
361 <class>QCheckBox</class> 384 <class>QComboBox</class>
385 <item>
386 <property>
387 <name>text</name>
388 <string>Ignore</string>
389 </property>
390 </item>
391 <item>
392 <property>
393 <name>text</name>
394 <string>Touch</string>
395 </property>
396 </item>
397 <item>
398 <property>
399 <name>text</name>
400 <string>Key</string>
401 </property>
402 </item>
403 <item>
404 <property>
405 <name>text</name>
406 <string>Alarm</string>
407 </property>
408 </item>
362 <property stdset="1"> 409 <property stdset="1">
363 <name>name</name> 410 <name>name</name>
364 <cstring>enableActivity</cstring> 411 <cstring>beaconSound</cstring>
365 </property>
366 <property stdset="1">
367 <name>enabled</name>
368 <bool>false</bool>
369 </property>
370 <property stdset="1">
371 <name>text</name>
372 <string>Enable Activity Display</string>
373 </property> 412 </property>
374 </widget> 413 </widget>
375 <widget> 414 <widget row="0" column="0" >
376 <class>QCheckBox</class> 415 <class>QComboBox</class>
416 <item>
417 <property>
418 <name>text</name>
419 <string>Ignore</string>
420 </property>
421 </item>
422 <item>
423 <property>
424 <name>text</name>
425 <string>Touch</string>
426 </property>
427 </item>
428 <item>
429 <property>
430 <name>text</name>
431 <string>Key</string>
432 </property>
433 </item>
434 <item>
435 <property>
436 <name>text</name>
437 <string>Alarm</string>
438 </property>
439 </item>
377 <property stdset="1"> 440 <property stdset="1">
378 <name>name</name> 441 <name>name</name>
379 <cstring>beepOnFound</cstring> 442 <cstring>netSound</cstring>
380 </property> 443 </property>
444 </widget>
445 <widget row="1" column="1" >
446 <class>QLabel</class>
381 <property stdset="1"> 447 <property stdset="1">
382 <name>enabled</name> 448 <name>name</name>
383 <bool>false</bool> 449 <cstring>TextLabel1_3</cstring>
384 </property> 450 </property>
385 <property stdset="1"> 451 <property stdset="1">
386 <name>text</name> 452 <name>text</name>
387 <string>Beep on new network</string> 453 <string>sound on beacon</string>
388 </property> 454 </property>
389 </widget> 455 </widget>
390 </vbox> 456 </grid>
391 </widget> 457 </widget>
392 <spacer>
393 <property>
394 <name>name</name>
395 <cstring>Spacer2</cstring>
396 </property>
397 <property stdset="1">
398 <name>orientation</name>
399 <enum>Vertical</enum>
400 </property>
401 <property stdset="1">
402 <name>sizeType</name>
403 <enum>Expanding</enum>
404 </property>
405 <property>
406 <name>sizeHint</name>
407 <size>
408 <width>20</width>
409 <height>20</height>
410 </size>
411 </property>
412 </spacer>
413 </vbox> 458 </vbox>
414</widget> 459</widget>
415</UI> 460</UI>
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 6dd862f..e287b47 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -17,15 +17,19 @@
17#include "configwindow.h" 17#include "configwindow.h"
18 18
19/* QT */ 19/* QT */
20#include <qmap.h>
21#include <qcombobox.h> 20#include <qcombobox.h>
21#include <qfile.h>
22#include <qlayout.h>
23#include <qmap.h>
22#include <qpushbutton.h> 24#include <qpushbutton.h>
23#include <qspinbox.h> 25#include <qspinbox.h>
24#include <qlayout.h> 26#include <qtextstream.h>
25 27
26/* OPIE */ 28/* OPIE */
27#include <opie2/onetwork.h> 29#include <opie2/onetwork.h>
28 30
31WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
32
29WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 33WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
30 :WellenreiterConfigBase( parent, name, true, f ) 34 :WellenreiterConfigBase( parent, name, true, f )
31{ 35{
@@ -45,12 +49,36 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
45 ++it; 49 ++it;
46 } 50 }
47 51
52 // try to guess device type
53 QFile m( "/proc/modules" );
54 if ( m.open( IO_ReadOnly ) )
55 {
56 int devicetype(0);
57 QString line;
58 QTextStream modules( &m );
59 while( !modules.atEnd() && !devicetype )
60 {
61 modules >> line;
62 if ( line.contains( "cisco" ) ) devicetype = 1;
63 else if ( line.contains( "wlan" ) ) devicetype = 2;
64 else if ( line.contains( "hostap" ) ) devicetype = 3;
65 else if ( line.contains( "orinoco" ) ) devicetype = 4;
66 }
67 if ( devicetype )
68 {
69 deviceType->setCurrentItem( devicetype );
70 qDebug( "Wellenreiter: guessed device type to be %d", devicetype );
71 }
72 }
73
48 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 74 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
49 QPushButton* okButton = new QPushButton( "ok", this ); 75 QPushButton* okButton = new QPushButton( "ok", this );
50 okButton->show(); 76 okButton->show();
51 Layout5_2->addWidget( okButton ); //FIXME: rename this in configbase.ui 77 Layout5_2->addWidget( okButton ); //FIXME: rename this in configbase.ui
52 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 78 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
53 #endif 79 #endif
80
81 WellenreiterConfigWindow::_instance = this;
54}; 82};
55 83
56int WellenreiterConfigWindow::daemonDeviceType() 84int WellenreiterConfigWindow::daemonDeviceType()
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index c627901..5fd0327 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -18,6 +18,10 @@
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include <qmap.h> 20#include <qmap.h>
21#include <qcombobox.h>
22#include <qstring.h>
23
24class WellenreiterConfigWindow;
21 25
22class WellenreiterConfigWindow : public WellenreiterConfigBase 26class WellenreiterConfigWindow : public WellenreiterConfigBase
23{ 27{
@@ -26,9 +30,13 @@ class WellenreiterConfigWindow : public WellenreiterConfigBase
26 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 30 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
27 int daemonDeviceType(); 31 int daemonDeviceType();
28 int daemonHopInterval(); 32 int daemonHopInterval();
33 const QString soundOnNetwork() const { return netSound->currentText(); };
34 const QString soundOnBeacon() const { return beaconSound->currentText(); };
35 static WellenreiterConfigWindow* instance() { return _instance; };
29 36
30 protected: 37 protected:
31 QMap<QString, int> _devicetype; 38 QMap<QString, int> _devicetype;
39 static WellenreiterConfigWindow* _instance;
32 40
33}; 41};
34 42
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index be1245e..a006a3c 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -14,12 +14,18 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h"
17 18
18#include <assert.h> 19#include <assert.h>
19#include "manufacturers.h" 20#include "manufacturers.h"
20#include <qdatetime.h> 21#include <qdatetime.h>
21#include <qtextstream.h> 22#include <qtextstream.h>
22 23
24#ifdef QWS
25#include <opie/odevice.h>
26using namespace Opie;
27#endif
28
23MScanListView::MScanListView( QWidget* parent, const char* name ) 29MScanListView::MScanListView( QWidget* parent, const char* name )
24 :OListView( parent, name ), _manufacturerdb( 0 ) 30 :OListView( parent, name ), _manufacturerdb( 0 )
25{ 31{
@@ -142,7 +148,6 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
142 else 148 else
143 { 149 {
144 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 150 s.sprintf( "(i) new network: '%s'", (const char*) essid );
145
146 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); 151 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
147 } 152 }
148 153
@@ -192,6 +197,8 @@ MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QS
192 _channel( channel ), _signal( signal ), _beacons( 0 ) 197 _channel( channel ), _signal( signal ), _beacons( 0 )
193{ 198{
194 qDebug( "creating scanlist item" ); 199 qDebug( "creating scanlist item" );
200 if ( WellenreiterConfigWindow::instance() && type == "networks" )
201 playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() );
195 decorateItem( type, essid, macaddr, wep, channel, signal ); 202 decorateItem( type, essid, macaddr, wep, channel, signal );
196} 203}
197 204
@@ -271,11 +278,24 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
271 _signal = 0; 278 _signal = 0;
272} 279}
273 280
281
274void MScanListItem::setManufacturer( const QString& manufacturer ) 282void MScanListItem::setManufacturer( const QString& manufacturer )
275{ 283{
276 setText( col_manuf, manufacturer ); 284 setText( col_manuf, manufacturer );
277} 285}
278 286
287
288void MScanListItem::playSound( const QString& sound ) const
289{
290 #ifdef QWS
291 if ( sound == "Ignore" ) return;
292 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
293 else if ( sound == "Key" ) ODevice::inst()->keySound();
294 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
295 #endif
296}
297
298
279void MScanListItem::receivedBeacon() 299void MScanListItem::receivedBeacon()
280{ 300{
281 _beacons++; 301 _beacons++;
@@ -284,5 +304,7 @@ void MScanListItem::receivedBeacon()
284 #endif 304 #endif
285 setText( col_sig, QString::number( _beacons ) ); 305 setText( col_sig, QString::number( _beacons ) );
286 setText( col_lastseen, QTime::currentTime().toString() ); 306 setText( col_lastseen, QTime::currentTime().toString() );
307 if ( WellenreiterConfigWindow::instance() )
308 playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() );
287} 309}
288 310
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index da9369f..01db172 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -91,6 +91,9 @@ class MScanListItem: public OListViewItem
91 virtual void serializeTo( QDataStream& s ) const; 91 virtual void serializeTo( QDataStream& s ) const;
92 virtual void serializeFrom( QDataStream& s ); 92 virtual void serializeFrom( QDataStream& s );
93 93
94 protected:
95 void playSound( const QString& ) const;
96
94 private: 97 private:
95 QString _type; 98 QString _type;
96 QString _essid; 99 QString _essid;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 41ffdcc..d1dd73a 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -110,9 +110,6 @@ void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw )
110 110
111void Wellenreiter::receivePacket(OPacket* p) 111void Wellenreiter::receivePacket(OPacket* p)
112{ 112{
113 logwindow->log( "(d) Received data from daemon" );
114 //TODO
115
116 // check if we received a beacon frame 113 // check if we received a beacon frame
117 // static_cast is justified here 114 // static_cast is justified here
118 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); 115 OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) );
@@ -163,19 +160,10 @@ void Wellenreiter::startStopClicked()
163 // switch off promisc flag 160 // switch off promisc flag
164 iface->setPromiscuousMode( false ); 161 iface->setPromiscuousMode( false );
165 162
166 //TODO: Display "please wait..." (use owait?) 163 system( "cardctl reset; sleep 1; dhclient; udhcpc" ); //FIXME: Use OProcess
167
168 /*
169
170 QString cmdline;
171 cmdline.sprintf( "ifdown %s; sleep 1; ifup %s", (const char*) interface, (const char*) interface, (const char*) interface );
172 system( cmdline ); //FIXME: Use OProcess
173
174 */
175 164
176 // message the user 165 // message the user
177 166 QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
178 //QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." );
179 } 167 }
180 168
181 else 169 else