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.cpp146
1 files changed, 0 insertions, 146 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
deleted file mode 100644
index 92715b4..0000000
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/dev/null
@@ -1,146 +0,0 @@
1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3**
4** This file is part of Opie Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14**********************************************************************/
15
16/* LOCAL */
17#include "configwindow.h"
18#include "mainwindow.h"
19
20/* QT */
21#include <qapplication.h>
22#include <qcombobox.h>
23#include <qfile.h>
24#include <qlineedit.h>
25#include <qlayout.h>
26#include <qmap.h>
27#include <qpushbutton.h>
28#include <qtoolbutton.h>
29#include <qspinbox.h>
30#include <qtextstream.h>
31
32/* OPIE */
33#include <opie2/onetwork.h>
34
35WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
36
37WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
38 :WellenreiterConfigBase( parent, name, true, f )
39{
40 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
41 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
42 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
43 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
44 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
45 _devicetype[ "<file>" ] = DEVTYPE_FILE;
46
47 // gather possible interface names from ONetwork
48 ONetwork* net = ONetwork::instance();
49 ONetwork::InterfaceIterator it = net->iterator();
50 while ( it.current() )
51 {
52 if ( it.current()->isWireless() )
53 interfaceName->insertItem( it.current()->name() );
54 ++it;
55 }
56
57 // try to guess device type
58 QFile m( "/proc/modules" );
59 if ( m.open( IO_ReadOnly ) )
60 {
61 int devicetype(0);
62 QString line;
63 QTextStream modules( &m );
64 while( !modules.atEnd() && !devicetype )
65 {
66 modules >> line;
67 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
68 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
69 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
70 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
71 }
72 if ( devicetype )
73 {
74 deviceType->setCurrentItem( devicetype );
75 _guess = devicetype;
76 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
77 }
78 }
79
80 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
81 QPushButton* okButton = new QPushButton( "ok", this );
82 okButton->show();
83 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
84 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
85 #endif
86
87 WellenreiterConfigWindow::_instance = this;
88
89 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
90 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
91};
92
93
94int WellenreiterConfigWindow::daemonDeviceType()
95{
96 QString name = deviceType->currentText();
97 if ( _devicetype.contains( name ) )
98 {
99 return _devicetype[name];
100 }
101 else
102 {
103 return 0;
104 }
105};
106
107
108int WellenreiterConfigWindow::daemonHopInterval()
109{
110 return hopInterval->cleanText().toInt();
111}
112
113
114void WellenreiterConfigWindow::changedDeviceType(int t)
115{
116 if ( t != DEVTYPE_FILE ) return;
117 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
118 if ( !name.isEmpty() && QFile::exists( name ) )
119 {
120 interfaceName->insertItem( name );
121 interfaceName->setCurrentItem( interfaceName->count()-1 );
122 }
123 else
124 {
125 deviceType->setCurrentItem( _guess );
126 }
127
128}
129
130
131void WellenreiterConfigWindow::getCaptureFileNameClicked()
132{
133 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
134 qDebug( "name = %s", (const char*) name );
135 if ( !name.isEmpty() )
136 {
137 captureFileName->setText( name );
138 }
139}
140
141
142bool WellenreiterConfigWindow::usePrismHeader()
143{
144 return true;
145 //return interface->usePrismHeader();
146}