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 | |||
@@ -19,7 +19,9 @@ | |||
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 | ||
@@ -28,2 +30,4 @@ | |||
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 ) |
@@ -47,2 +51,24 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
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 |
@@ -53,2 +79,4 @@ WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char | |||
53 | #endif | 79 | #endif |
80 | |||
81 | WellenreiterConfigWindow::_instance = this; | ||
54 | }; | 82 | }; |