summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/configwindow.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp32
1 files changed, 30 insertions, 2 deletions
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
@@ -14,21 +14,25 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
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{
32 _devicetype[ "cisco" ] = 1; 36 _devicetype[ "cisco" ] = 1;
33 _devicetype[ "wlan-ng" ] = 2; 37 _devicetype[ "wlan-ng" ] = 2;
34 _devicetype[ "hostap" ] = 3; 38 _devicetype[ "hostap" ] = 3;
@@ -42,18 +46,42 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char
42 { 46 {
43 if ( it.current()->isWireless() ) 47 if ( it.current()->isWireless() )
44 interfaceName->insertItem( it.current()->name() ); 48 interfaceName->insertItem( it.current()->name() );
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()
57{ 85{
58 QString name = deviceType->currentText(); 86 QString name = deviceType->currentText();
59 if ( _devicetype.contains( name ) ) 87 if ( _devicetype.contains( name ) )