Diffstat (limited to 'noncore/net/wellenreiter/gui/configwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 32 |
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 | |||
@@ -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 | ||
31 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | ||
32 | |||
29 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 33 | WellenreiterConfigWindow::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 | ||
56 | int WellenreiterConfigWindow::daemonDeviceType() | 84 | int WellenreiterConfigWindow::daemonDeviceType() |