summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-01-09 20:01:42 (UTC)
committer mickeyl <mickeyl>2004-01-09 20:01:42 (UTC)
commit88af644c534f19e391ebbe8ea0babf3ccf459eb1 (patch) (unidiff)
treef49e88a6dfc58d3f196e6918bb402a14ee9f0ad0
parent56bb9961db1158250bbfe971f4556b56c0bd6581 (diff)
downloadopie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.zip
opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.gz
opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.bz2
save configuration settings in accept(), not in the ~
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp16
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.h3
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp3
3 files changed, 16 insertions, 6 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 7f39230..9358866 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -1,468 +1,474 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16/* LOCAL */ 16/* LOCAL */
17#include "configwindow.h" 17#include "configwindow.h"
18#include "mainwindow.h" 18#include "mainwindow.h"
19 19
20/* OPIE */ 20/* OPIE */
21#include <opie2/onetwork.h> 21#include <opie2/onetwork.h>
22#ifdef QWS 22#ifdef QWS
23#include <opie2/oapplication.h> 23#include <opie2/oapplication.h>
24#include <opie2/oconfig.h> 24#include <opie2/oconfig.h>
25#include <opie/odevice.h> 25#include <opie/odevice.h>
26using namespace Opie; 26using namespace Opie;
27#endif 27#endif
28 28
29/* QT */ 29/* QT */
30#include <qapplication.h> 30#include <qapplication.h>
31#include <qcheckbox.h> 31#include <qcheckbox.h>
32#include <qcombobox.h> 32#include <qcombobox.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qlineedit.h> 34#include <qlineedit.h>
35#include <qlayout.h> 35#include <qlayout.h>
36#include <qmap.h> 36#include <qmap.h>
37#include <qpushbutton.h> 37#include <qpushbutton.h>
38#include <qtabwidget.h> 38#include <qtabwidget.h>
39#include <qtoolbutton.h> 39#include <qtoolbutton.h>
40#include <qspinbox.h> 40#include <qspinbox.h>
41#include <qtextstream.h> 41#include <qtextstream.h>
42 42
43/* POSIX */ 43/* POSIX */
44#include <assert.h> 44#include <assert.h>
45 45
46WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 46WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
47 47
48WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 48WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
49 :WellenreiterConfigBase( parent, name, true, f ) 49 :WellenreiterConfigBase( parent, name, true, f )
50{ 50{
51 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 51 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
52 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 52 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
53 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 53 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
54 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 54 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
55 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 55 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
56 _devicetype[ "<file>" ] = DEVTYPE_FILE; 56 _devicetype[ "<file>" ] = DEVTYPE_FILE;
57 57
58 // gather possible interface names from ONetwork 58 // gather possible interface names from ONetwork
59 ONetwork* net = ONetwork::instance(); 59 ONetwork* net = ONetwork::instance();
60 ONetwork::InterfaceIterator it = net->iterator(); 60 ONetwork::InterfaceIterator it = net->iterator();
61 while ( it.current() ) 61 while ( it.current() )
62 { 62 {
63 if ( it.current()->isWireless() ) 63 if ( it.current()->isWireless() )
64 interfaceName->insertItem( it.current()->name() ); 64 interfaceName->insertItem( it.current()->name() );
65 ++it; 65 ++it;
66 } 66 }
67 67
68 load(); 68 load();
69 69
70 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 70 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
71 QPushButton* okButton = new QPushButton( "ok", this ); 71 QPushButton* okButton = new QPushButton( "ok", this );
72 okButton->show(); 72 okButton->show();
73 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 73 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
74 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 74 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
75 #endif 75 #endif
76 76
77 WellenreiterConfigWindow::_instance = this; 77 WellenreiterConfigWindow::_instance = this;
78 78
79 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 79 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
80 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) ); 80 connect( newNetworkAction, SIGNAL( activated(int) ), this, SLOT( changedNetworkAction(int) ) );
81 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) ); 81 connect( newClientAction, SIGNAL( activated(int) ), this, SLOT( changedClientAction(int) ) );
82 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) ); 82 connect( newStationAction, SIGNAL( activated(int) ), this, SLOT( changedStationAction(int) ) );
83 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 83 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
84 84
85 // make the checkbox 'channelAll' control all other channels 85 // make the checkbox 'channelAll' control all other channels
86 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 86 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
87 87
88 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) ); 88 connect( autodetect, SIGNAL( clicked() ), this, SLOT( performAutodetection() ) );
89 89
90 // hide tab4 (parse) until Wellenreiter 1.2 90 // hide tab4 (parse) until Wellenreiter 1.2
91 tab->removePage( tab_4 ); 91 tab->removePage( tab_4 );
92}; 92};
93 93
94 94
95WellenreiterConfigWindow::~WellenreiterConfigWindow() 95void WellenreiterConfigWindow::accept()
96{ 96{
97 save(); 97 save();
98 QDialog::accept();
99}
100
101
102WellenreiterConfigWindow::~WellenreiterConfigWindow()
103{
98} 104}
99 105
100 106
101void WellenreiterConfigWindow::performAutodetection() 107void WellenreiterConfigWindow::performAutodetection()
102{ 108{
103 //TODO: insert modal splash screen here 109 //TODO: insert modal splash screen here
104 // and sleep a second, so that it looks 110 // and sleep a second, so that it looks
105 // like we're actually doing something fancy... ;-) 111 // like we're actually doing something fancy... ;-)
106 112
107 qDebug( "WellenreiterConfigWindow::performAutodetection()" ); 113 qDebug( "WellenreiterConfigWindow::performAutodetection()" );
108 114
109 // try to guess device type 115 // try to guess device type
110 QFile m( "/proc/modules" ); 116 QFile m( "/proc/modules" );
111 if ( m.open( IO_ReadOnly ) ) 117 if ( m.open( IO_ReadOnly ) )
112 { 118 {
113 int devicetype(0); 119 int devicetype(0);
114 QString line; 120 QString line;
115 QTextStream modules( &m ); 121 QTextStream modules( &m );
116 while( !modules.atEnd() && !devicetype ) 122 while( !modules.atEnd() && !devicetype )
117 { 123 {
118 modules >> line; 124 modules >> line;
119 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 125 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
120 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 126 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
121 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 127 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
122 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 128 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
123 } 129 }
124 if ( devicetype ) 130 if ( devicetype )
125 { 131 {
126 deviceType->setCurrentItem( devicetype ); 132 deviceType->setCurrentItem( devicetype );
127 _guess = devicetype; 133 _guess = devicetype;
128 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); 134 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
129 } 135 }
130 } 136 }
131} 137}
132 138
133 139
134int WellenreiterConfigWindow::driverType() const 140int WellenreiterConfigWindow::driverType() const
135{ 141{
136 QString name = deviceType->currentText(); 142 QString name = deviceType->currentText();
137 if ( _devicetype.contains( name ) ) 143 if ( _devicetype.contains( name ) )
138 { 144 {
139 return _devicetype[name]; 145 return _devicetype[name];
140 } 146 }
141 else 147 else
142 { 148 {
143 return 0; 149 return 0;
144 } 150 }
145}; 151};
146 152
147 153
148int WellenreiterConfigWindow::hoppingInterval() const 154int WellenreiterConfigWindow::hoppingInterval() const
149{ 155{
150 return hopInterval->cleanText().toInt(); 156 return hopInterval->cleanText().toInt();
151} 157}
152 158
153 159
154bool WellenreiterConfigWindow::usePrismHeader() const 160bool WellenreiterConfigWindow::usePrismHeader() const
155{ 161{
156 return prismHeader->isChecked(); 162 return prismHeader->isChecked();
157} 163}
158 164
159 165
160bool WellenreiterConfigWindow::isChannelChecked( int channel ) const 166bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
161{ 167{
162 switch ( channel ) 168 switch ( channel )
163 { 169 {
164 case 1: return channel1->isOn(); 170 case 1: return channel1->isOn();
165 case 2: return channel2->isOn(); 171 case 2: return channel2->isOn();
166 case 3: return channel3->isOn(); 172 case 3: return channel3->isOn();
167 case 4: return channel4->isOn(); 173 case 4: return channel4->isOn();
168 case 5: return channel5->isOn(); 174 case 5: return channel5->isOn();
169 case 6: return channel6->isOn(); 175 case 6: return channel6->isOn();
170 case 7: return channel7->isOn(); 176 case 7: return channel7->isOn();
171 case 8: return channel8->isOn(); 177 case 8: return channel8->isOn();
172 case 9: return channel9->isOn(); 178 case 9: return channel9->isOn();
173 case 10: return channel10->isOn(); 179 case 10: return channel10->isOn();
174 case 11: return channel11->isOn(); 180 case 11: return channel11->isOn();
175 case 12: return channel12->isOn(); 181 case 12: return channel12->isOn();
176 case 13: return channel13->isOn(); 182 case 13: return channel13->isOn();
177 case 14: return channel14->isOn(); 183 case 14: return channel14->isOn();
178 } 184 }
179} 185}
180 186
181 187
182void WellenreiterConfigWindow::changedDeviceType(int t) 188void WellenreiterConfigWindow::changedDeviceType(int t)
183{ 189{
184 if ( t != DEVTYPE_FILE ) return; 190 if ( t != DEVTYPE_FILE ) return;
185 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false); 191 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(false);
186 if ( !name.isEmpty() && QFile::exists( name ) ) 192 if ( !name.isEmpty() && QFile::exists( name ) )
187 { 193 {
188 interfaceName->insertItem( name ); 194 interfaceName->insertItem( name );
189 interfaceName->setCurrentItem( interfaceName->count()-1 ); 195 interfaceName->setCurrentItem( interfaceName->count()-1 );
190 } 196 }
191 else 197 else
192 { 198 {
193 deviceType->setCurrentItem( _guess ); 199 deviceType->setCurrentItem( _guess );
194 } 200 }
195 201
196} 202}
197 203
198 204
199void WellenreiterConfigWindow::synchronizeActionsAndScripts() 205void WellenreiterConfigWindow::synchronizeActionsAndScripts()
200{ 206{
201 if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide(); 207 if ( newNetworkAction->currentItem() == 4 ) newNetworkScript->show(); else newNetworkScript->hide();
202 if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide(); 208 if ( newClientAction->currentItem() == 4 ) newClientScript->show(); else newClientScript->hide();
203 if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide(); 209 if ( newStationAction->currentItem() == 4 ) newStationScript->show(); else newStationScript->hide();
204 210
205 //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 ); 211 //newNetworkScript->setEnabled( newNetworkAction->currentItem() == 4 );
206 //newClientScript->setEnabled( newClientAction->currentItem() == 4 ); 212 //newClientScript->setEnabled( newClientAction->currentItem() == 4 );
207 //newStationScript->setEnabled( newStationAction->currentItem() == 4 ); 213 //newStationScript->setEnabled( newStationAction->currentItem() == 4 );
208} 214}
209 215
210 216
211void WellenreiterConfigWindow::changedNetworkAction(int t) 217void WellenreiterConfigWindow::changedNetworkAction(int t)
212{ 218{
213 synchronizeActionsAndScripts(); 219 synchronizeActionsAndScripts();
214} 220}
215 221
216 222
217void WellenreiterConfigWindow::changedClientAction(int t) 223void WellenreiterConfigWindow::changedClientAction(int t)
218{ 224{
219 synchronizeActionsAndScripts(); 225 synchronizeActionsAndScripts();
220} 226}
221 227
222 228
223void WellenreiterConfigWindow::changedStationAction(int t) 229void WellenreiterConfigWindow::changedStationAction(int t)
224{ 230{
225 synchronizeActionsAndScripts(); 231 synchronizeActionsAndScripts();
226} 232}
227 233
228 234
229void WellenreiterConfigWindow::getCaptureFileNameClicked() 235void WellenreiterConfigWindow::getCaptureFileNameClicked()
230{ 236{
231 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true); 237 QString name = ( (WellenreiterMainWindow*) qApp->mainWidget() )->getFileName(true);
232 qDebug( "name = %s", (const char*) name ); 238 qDebug( "name = %s", (const char*) name );
233 if ( !name.isEmpty() ) 239 if ( !name.isEmpty() )
234 { 240 {
235 captureFileName->setText( name ); 241 captureFileName->setText( name );
236 } 242 }
237} 243}
238 244
239 245
240void WellenreiterConfigWindow::channelAllClicked(int state) 246void WellenreiterConfigWindow::channelAllClicked(int state)
241{ 247{
242 bool b = state; 248 bool b = state;
243 channel1->setChecked( b ); 249 channel1->setChecked( b );
244 channel2->setChecked( b ); 250 channel2->setChecked( b );
245 channel3->setChecked( b ); 251 channel3->setChecked( b );
246 channel4->setChecked( b ); 252 channel4->setChecked( b );
247 channel5->setChecked( b ); 253 channel5->setChecked( b );
248 channel6->setChecked( b ); 254 channel6->setChecked( b );
249 channel7->setChecked( b ); 255 channel7->setChecked( b );
250 channel8->setChecked( b ); 256 channel8->setChecked( b );
251 channel9->setChecked( b ); 257 channel9->setChecked( b );
252 channel10->setChecked( b ); 258 channel10->setChecked( b );
253 channel11->setChecked( b ); 259 channel11->setChecked( b );
254 channel12->setChecked( b ); 260 channel12->setChecked( b );
255 channel13->setChecked( b ); 261 channel13->setChecked( b );
256 channel14->setChecked( b ); 262 channel14->setChecked( b );
257} 263}
258 264
259 265
260bool WellenreiterConfigWindow::useGPS() const 266bool WellenreiterConfigWindow::useGPS() const
261{ 267{
262 return enableGPS->isChecked(); 268 return enableGPS->isChecked();
263} 269}
264 270
265 271
266const QString WellenreiterConfigWindow::gpsHost() const 272const QString WellenreiterConfigWindow::gpsHost() const
267{ 273{
268 return useGPS() ? gpsdHost->currentText() : QString::null; 274 return useGPS() ? gpsdHost->currentText() : QString::null;
269} 275}
270 276
271 277
272int WellenreiterConfigWindow::gpsPort() const 278int WellenreiterConfigWindow::gpsPort() const
273{ 279{
274 bool ok; 280 bool ok;
275 return useGPS() ? gpsdPort->value() : -1; 281 return useGPS() ? gpsdPort->value() : -1;
276} 282}
277 283
278 284
279void WellenreiterConfigWindow::performAction( const QString& type, 285void WellenreiterConfigWindow::performAction( const QString& type,
280 const QString& essid, 286 const QString& essid,
281 const QString& mac, 287 const QString& mac,
282 bool wep, 288 bool wep,
283 int channel, 289 int channel,
284 int signal 290 int signal
285 /* , const GpsLocation& loc */ ) 291 /* , const GpsLocation& loc */ )
286{ 292{
287 int action; 293 int action;
288 QString script; 294 QString script;
289 295
290 if ( type == "network" ) 296 if ( type == "network" )
291 { 297 {
292 action = newNetworkAction->currentItem(); 298 action = newNetworkAction->currentItem();
293 script = newNetworkScript->text(); 299 script = newNetworkScript->text();
294 } 300 }
295 else if ( type == "managed" || type == "adhoc" ) 301 else if ( type == "managed" || type == "adhoc" )
296 { 302 {
297 action = newClientAction->currentItem(); 303 action = newClientAction->currentItem();
298 script = newClientScript->text(); 304 script = newClientScript->text();
299 } 305 }
300 else if ( type == "station" ) 306 else if ( type == "station" )
301 { 307 {
302 action = newStationAction->currentItem(); 308 action = newStationAction->currentItem();
303 script = newStationScript->text(); 309 script = newStationScript->text();
304 } 310 }
305 else 311 else
306 { 312 {
307 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); 313 qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type );
308 return; 314 return;
309 } 315 }
310 316
311 qDebug( "going to perform action %d (script='%s')", action, (const char*) script ); 317 qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script );
312 318
313 switch( action ) 319 switch( action )
314 { 320 {
315 case 0: /* Ignore */ return; 321 case 0: /* Ignore */ return;
316 case 1: /* Play Alarm */ ODevice::inst()->alarmSound(); return; 322 case 1: /* Play Alarm */ ODevice::inst()->alarmSound(); return;
317 case 2: /* Play Click */ ODevice::inst()->touchSound(); return; 323 case 2: /* Play Click */ ODevice::inst()->touchSound(); return;
318 case 3: /* Blink LED */ break; //FIXME: Implement this 324 case 3: /* Blink LED */ break; //FIXME: Implement this
319 case 4: /* Run Script */ 325 case 4: /* Run Script */
320 { 326 {
321 /** 327 /**
322 * 328 *
323 * Script Substitution Information: 329 * Script Substitution Information:
324 * 330 *
325 * $SSID = SSID 331 * $SSID = SSID
326 * $MAC = MAC 332 * $MAC = MAC
327 * $WEP = Wep 333 * $WEP = Wep
328 * $CHAN = Channel 334 * $CHAN = Channel
329 * 335 *
330 **/ 336 **/
331 script = script.replace( QRegExp( "$SSID" ), essid ); 337 script = script.replace( QRegExp( "$SSID" ), essid );
332 script = script.replace( QRegExp( "$MAC" ), mac ); 338 script = script.replace( QRegExp( "$MAC" ), mac );
333 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); 339 script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) );
334 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); 340 script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) );
335 341
336 qDebug( "going to call script '%s'", (const char*) script ); 342 qDebug( "going to call script '%s'", (const char*) script );
337 ::system( script ); 343 ::system( script );
338 qDebug( "script returned." ); 344 qDebug( "script returned." );
339 return; 345 return;
340 } 346 }
341 default: assert( false ); 347 default: assert( false );
342 } 348 }
343} 349}
344 350
345 351
346void WellenreiterConfigWindow::load() 352void WellenreiterConfigWindow::load()
347{ 353{
348#ifdef Q_WS_X11 354#ifdef Q_WS_X11
349 #warning Persistent Configuration not yet implemented for standalone X11 build 355 #warning Persistent Configuration not yet implemented for standalone X11 build
350 performAutodetection(); 356 performAutodetection();
351#else 357#else
352 qDebug( "loading configuration settings..." ); 358 qDebug( "loading configuration settings..." );
353 359
354 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 360 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
355 361
356 OConfig* c = oApp->config(); 362 OConfig* c = oApp->config();
357 363
358 c->setGroup( "Interface" ); 364 c->setGroup( "Interface" );
359 365
360 QString interface = c->readEntry( "name", "<none>" ); 366 QString interface = c->readEntry( "name", "<none>" );
361 if ( interface != "<none>" ) 367 if ( interface != "<none>" )
362 { 368 {
363#if QT_VERSION < 300 369#if QT_VERSION < 300
364 interfaceName->insertItem( interface, 0 ); 370 interfaceName->insertItem( interface, 0 );
365 interfaceName->setCurrentItem( 0 ); 371 interfaceName->setCurrentItem( 0 );
366#else 372#else
367 interfaceName->setCurrentText( interface ); 373 interfaceName->setCurrentText( interface );
368#endif 374#endif
369 375
370 QString device = c->readEntry( "type", "<select>" ); 376 QString device = c->readEntry( "type", "<select>" );
371#if QT_VERSION < 300 377#if QT_VERSION < 300
372 for ( int i = 0; i < deviceType->count(); ++i ) 378 for ( int i = 0; i < deviceType->count(); ++i )
373 { 379 {
374 if ( deviceType->text( i ) == device ) 380 if ( deviceType->text( i ) == device )
375 { 381 {
376 deviceType->setCurrentItem( i ); 382 deviceType->setCurrentItem( i );
377 break; 383 break;
378 } 384 }
379 } 385 }
380#else 386#else
381 deviceType->setCurrentText( device ); 387 deviceType->setCurrentText( device );
382#endif 388#endif
383 } 389 }
384 else 390 else
385 { 391 {
386 performAutodetection(); 392 performAutodetection();
387 } 393 }
388 394
389 prismHeader->setChecked( c->readBoolEntry( "prism", false ) ); 395 prismHeader->setChecked( c->readBoolEntry( "prism", false ) );
390 hopChannels->setChecked( c->readBoolEntry( "hop", true ) ); 396 hopChannels->setChecked( c->readBoolEntry( "hop", true ) );
391 hopInterval->setValue( c->readNumEntry( "interval", 250 ) ); 397 hopInterval->setValue( c->readNumEntry( "interval", 250 ) );
392 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) ); 398 adaptiveHopping->setChecked( c->readBoolEntry( "adaptive", true ) );
393 399
394 c->setGroup( "Capture" ); 400 c->setGroup( "Capture" );
395 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) ); 401 captureFileName->setText( c->readEntry( "filename", "/tmp/capture" ) );
396 402
397 c->setGroup( "UI" ); 403 c->setGroup( "UI" );
398 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) ); 404 lookupVendor->setChecked( c->readBoolEntry( "lookupVendor", true ) );
399 openTree->setChecked( c->readBoolEntry( "openTree", true ) ); 405 openTree->setChecked( c->readBoolEntry( "openTree", true ) );
400 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) ); 406 disablePM->setChecked( c->readBoolEntry( "disablePM", true ) );
401 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 0 ) ); 407 newNetworkAction->setCurrentItem( c->readNumEntry( "newNetworkAction", 1 ) ); // Default: Play Alarm
402 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) ); 408 newNetworkScript->setText( c->readEntry( "newNetworkScript", "" ) );
403 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 0 ) ); 409 newClientAction->setCurrentItem( c->readNumEntry( "newClientAction", 2 ) ); // Default: Play Click
404 newClientScript->setText( c->readEntry( "newClientScript", "" ) ); 410 newClientScript->setText( c->readEntry( "newClientScript", "" ) );
405 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 0 ) ); 411 newStationAction->setCurrentItem( c->readNumEntry( "newStationAction", 2 ) ); // Default: Play Click
406 newStationScript->setText( c->readEntry( "newStationScript", "" ) ); 412 newStationScript->setText( c->readEntry( "newStationScript", "" ) );
407 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand 413 synchronizeActionsAndScripts(); // needed for showing/hiding the script QLineEdit on demand
408 414
409 c->setGroup( "GPS" ); 415 c->setGroup( "GPS" );
410 enableGPS->setChecked( c->readBoolEntry( "use", false ) ); 416 enableGPS->setChecked( c->readBoolEntry( "use", false ) );
411#if QT_VERSION < 300 417#if QT_VERSION < 300
412 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 ); 418 gpsdHost->insertItem( c->readEntry( "host", "localhost" ), 0 );
413 gpsdHost->setCurrentItem( 0 ); 419 gpsdHost->setCurrentItem( 0 );
414#else 420#else
415 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) ); 421 gpsdHost->setCurrentText( c->readEntry( "host", "localhost" ) );
416#endif 422#endif
417 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) ); 423 gpsdPort->setValue( c->readNumEntry( "port", 2947 ) );
418 startGPS->setChecked( c->readBoolEntry( "start", false ) ); 424 startGPS->setChecked( c->readBoolEntry( "start", false ) );
419 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) ); 425 commandGPS->setText( c->readEntry( "command", "gpsd -p /dev/ttyS3 -s 57600" ) );
420 426
421#endif 427#endif
422} 428}
423 429
424 430
425void WellenreiterConfigWindow::save() 431void WellenreiterConfigWindow::save()
426{ 432{
427#ifdef Q_WS_X11 433#ifdef Q_WS_X11
428 #warning Persistent Configuration not yet implemented for standalone X11 build 434 #warning Persistent Configuration not yet implemented for standalone X11 build
429#else 435#else
430 qDebug( "saving configuration settings..." ); 436 qDebug( "saving configuration settings..." );
431 437
432 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ 438 /* This is dumb monkey typing stuff... We _need_ to do this automatically! */
433 439
434 OConfig* c = oApp->config(); 440 OConfig* c = oApp->config();
435 441
436 c->setGroup( "Interface" ); 442 c->setGroup( "Interface" );
437 c->writeEntry( "name", interfaceName->currentText() ); 443 c->writeEntry( "name", interfaceName->currentText() );
438 c->writeEntry( "type", deviceType->currentText() ); 444 c->writeEntry( "type", deviceType->currentText() );
439 c->writeEntry( "prism", prismHeader->isChecked() ); 445 c->writeEntry( "prism", prismHeader->isChecked() );
440 c->writeEntry( "hop", hopChannels->isChecked() ); 446 c->writeEntry( "hop", hopChannels->isChecked() );
441 c->writeEntry( "interval", hopInterval->value() ); 447 c->writeEntry( "interval", hopInterval->value() );
442 c->writeEntry( "adaptive", adaptiveHopping->isChecked() ); 448 c->writeEntry( "adaptive", adaptiveHopping->isChecked() );
443 449
444 c->setGroup( "Capture" ); 450 c->setGroup( "Capture" );
445 c->writeEntry( "filename", captureFileName->text() ); 451 c->writeEntry( "filename", captureFileName->text() );
446 452
447 c->setGroup( "UI" ); 453 c->setGroup( "UI" );
448 c->writeEntry( "lookupVendor", lookupVendor->isChecked() ); 454 c->writeEntry( "lookupVendor", lookupVendor->isChecked() );
449 c->writeEntry( "openTree", openTree->isChecked() ); 455 c->writeEntry( "openTree", openTree->isChecked() );
450 c->writeEntry( "disablePM", disablePM->isChecked() ); 456 c->writeEntry( "disablePM", disablePM->isChecked() );
451 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() ); 457 c->writeEntry( "newNetworkAction", newNetworkAction->currentItem() );
452 c->writeEntry( "newNetworkScript", newNetworkScript->text() ); 458 c->writeEntry( "newNetworkScript", newNetworkScript->text() );
453 c->writeEntry( "newClientAction", newClientAction->currentItem() ); 459 c->writeEntry( "newClientAction", newClientAction->currentItem() );
454 c->writeEntry( "newClientScript", newClientScript->text() ); 460 c->writeEntry( "newClientScript", newClientScript->text() );
455 c->writeEntry( "newStationAction", newStationAction->currentItem() ); 461 c->writeEntry( "newStationAction", newStationAction->currentItem() );
456 c->writeEntry( "newStationScript", newStationScript->text() ); 462 c->writeEntry( "newStationScript", newStationScript->text() );
457 463
458 c->setGroup( "GPS" ); 464 c->setGroup( "GPS" );
459 c->writeEntry( "use", enableGPS->isChecked() ); 465 c->writeEntry( "use", enableGPS->isChecked() );
460 c->writeEntry( "host", gpsdHost->currentText() ); 466 c->writeEntry( "host", gpsdHost->currentText() );
461 c->writeEntry( "port", gpsdPort->value() ); 467 c->writeEntry( "port", gpsdPort->value() );
462 c->writeEntry( "start", startGPS->isChecked() ); 468 c->writeEntry( "start", startGPS->isChecked() );
463 c->writeEntry( "command", commandGPS->text() ); 469 c->writeEntry( "command", commandGPS->text() );
464 470
465 c->write(); 471 c->write();
466 472
467#endif 473#endif
468} 474}
diff --git a/noncore/net/wellenreiter/gui/configwindow.h b/noncore/net/wellenreiter/gui/configwindow.h
index 5c998cb..d31d1e8 100644
--- a/noncore/net/wellenreiter/gui/configwindow.h
+++ b/noncore/net/wellenreiter/gui/configwindow.h
@@ -1,81 +1,82 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 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 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 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 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. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#ifndef WELLENREITERCONFIGWINDOW_H 16#ifndef WELLENREITERCONFIGWINDOW_H
17#define WELLENREITERCONFIGWINDOW_H 17#define WELLENREITERCONFIGWINDOW_H
18 18
19#include "configbase.h" 19#include "configbase.h"
20#include "gps.h" 20#include "gps.h"
21 21
22/* QT */ 22/* QT */
23#include <qmap.h> 23#include <qmap.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qstring.h> 25#include <qstring.h>
26 26
27const int DEVTYPE_SELECT = 0; 27const int DEVTYPE_SELECT = 0;
28const int DEVTYPE_CISCO = 1; 28const int DEVTYPE_CISCO = 1;
29const int DEVTYPE_WLAN_NG = 2; 29const int DEVTYPE_WLAN_NG = 2;
30const int DEVTYPE_HOSTAP = 3; 30const int DEVTYPE_HOSTAP = 3;
31const int DEVTYPE_ORINOCO = 4; 31const int DEVTYPE_ORINOCO = 4;
32const int DEVTYPE_MANUAL = 5; 32const int DEVTYPE_MANUAL = 5;
33const int DEVTYPE_FILE = 6; 33const int DEVTYPE_FILE = 6;
34 34
35class WellenreiterConfigWindow; 35class WellenreiterConfigWindow;
36 36
37class WellenreiterConfigWindow : public WellenreiterConfigBase 37class WellenreiterConfigWindow : public WellenreiterConfigBase
38{ 38{
39 Q_OBJECT 39 Q_OBJECT
40 40
41 public: 41 public:
42 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 ); 42 WellenreiterConfigWindow( QWidget * parent = 0, const char * name = "WellenreiterConfigWindow", WFlags f = 0 );
43 ~WellenreiterConfigWindow(); 43 ~WellenreiterConfigWindow();
44 44
45 int driverType() const; 45 int driverType() const;
46 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ }; 46 const QString soundOnNetwork() const { return "";/*netSound->currentText();*/ };
47 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ }; 47 const QString soundOnBeacon() const { return "";/*beaconSound->currentText();*/ };
48 static WellenreiterConfigWindow* instance() { return _instance; }; 48 static WellenreiterConfigWindow* instance() { return _instance; };
49 49
50 int hoppingInterval() const; 50 int hoppingInterval() const;
51 bool usePrismHeader() const; 51 bool usePrismHeader() const;
52 bool isChannelChecked( int ) const; 52 bool isChannelChecked( int ) const;
53 53
54 bool useGPS() const; 54 bool useGPS() const;
55 const QString gpsHost() const; 55 const QString gpsHost() const;
56 int gpsPort() const; 56 int gpsPort() const;
57 57
58 void save(); 58 void save();
59 void load(); 59 void load();
60 60
61 public slots: 61 public slots:
62 void changedDeviceType(int); 62 void changedDeviceType(int);
63 void changedNetworkAction(int t); 63 void changedNetworkAction(int t);
64 void changedClientAction(int t); 64 void changedClientAction(int t);
65 void changedStationAction(int t); 65 void changedStationAction(int t);
66 void getCaptureFileNameClicked(); 66 void getCaptureFileNameClicked();
67 void performAutodetection(); 67 void performAutodetection();
68 void channelAllClicked(int); 68 void channelAllClicked(int);
69 void performAction( const QString&, const QString&, const QString&, bool, int, int /* , const GpsLocation& */ ); 69 void performAction( const QString&, const QString&, const QString&, bool, int, int /* , const GpsLocation& */ );
70 70
71 protected: 71 protected slots:
72 void synchronizeActionsAndScripts(); 72 void synchronizeActionsAndScripts();
73 virtual void accept();
73 74
74 protected: 75 protected:
75 QMap<QString, int> _devicetype; 76 QMap<QString, int> _devicetype;
76 static WellenreiterConfigWindow* _instance; 77 static WellenreiterConfigWindow* _instance;
77 int _guess; 78 int _guess;
78 79
79}; 80};
80 81
81#endif 82#endif
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index fd88b63..10ead53 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -51,510 +51,513 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
51 :OListView( parent, name ) 51 :OListView( parent, name )
52{ 52{
53 53
54 setFrameShape( QListView::StyledPanel ); 54 setFrameShape( QListView::StyledPanel );
55 setFrameShadow( QListView::Sunken ); 55 setFrameShadow( QListView::Sunken );
56 56
57 addColumn( tr( "Net/Station" ) ); 57 addColumn( tr( "Net/Station" ) );
58 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 58 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
59 addColumn( tr( "#" ) ); 59 addColumn( tr( "#" ) );
60 setColumnAlignment( col_sig, AlignCenter ); 60 setColumnAlignment( col_sig, AlignCenter );
61 addColumn( tr( "MAC" ) ); 61 addColumn( tr( "MAC" ) );
62 setColumnAlignment( col_ap, AlignCenter ); 62 setColumnAlignment( col_ap, AlignCenter );
63 addColumn( tr( "Chn" ) ); 63 addColumn( tr( "Chn" ) );
64 setColumnAlignment( col_channel, AlignCenter ); 64 setColumnAlignment( col_channel, AlignCenter );
65 addColumn( tr( "W" ) ); 65 addColumn( tr( "W" ) );
66 setColumnAlignment( col_wep, AlignCenter ); 66 setColumnAlignment( col_wep, AlignCenter );
67 addColumn( tr( "T" ) ); 67 addColumn( tr( "T" ) );
68 setColumnAlignment( col_traffic, AlignCenter ); 68 setColumnAlignment( col_traffic, AlignCenter );
69 addColumn( tr( "IP" ) ); 69 addColumn( tr( "IP" ) );
70 setColumnAlignment( col_ip, AlignCenter ); 70 setColumnAlignment( col_ip, AlignCenter );
71 addColumn( tr( "Manufacturer" ) ); 71 addColumn( tr( "Manufacturer" ) );
72 setColumnAlignment( col_manuf, AlignCenter ); 72 setColumnAlignment( col_manuf, AlignCenter );
73 addColumn( tr( "First Seen" ) ); 73 addColumn( tr( "First Seen" ) );
74 setColumnAlignment( col_firstseen, AlignCenter ); 74 setColumnAlignment( col_firstseen, AlignCenter );
75 addColumn( tr( "Last Seen" ) ); 75 addColumn( tr( "Last Seen" ) );
76 setColumnAlignment( col_lastseen, AlignCenter ); 76 setColumnAlignment( col_lastseen, AlignCenter );
77 addColumn( tr( "Location" ) ); 77 addColumn( tr( "Location" ) );
78 setColumnAlignment( col_location, AlignCenter ); 78 setColumnAlignment( col_location, AlignCenter );
79 setRootIsDecorated( true ); 79 setRootIsDecorated( true );
80 setAllColumnsShowFocus( true ); 80 setAllColumnsShowFocus( true );
81 81
82 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 82 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
83 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 83 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
84 84
85 #ifdef QWS 85 #ifdef QWS
86 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 86 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
87 #endif 87 #endif
88 88
89}; 89};
90 90
91 91
92MScanListView::~MScanListView() 92MScanListView::~MScanListView()
93{ 93{
94}; 94};
95 95
96 96
97OListViewItem* MScanListView::childFactory() 97OListViewItem* MScanListView::childFactory()
98{ 98{
99 return new MScanListItem( this ); 99 return new MScanListItem( this );
100} 100}
101 101
102 102
103void MScanListView::serializeTo( QDataStream& s) const 103void MScanListView::serializeTo( QDataStream& s) const
104{ 104{
105 qDebug( "serializing MScanListView" ); 105 qDebug( "serializing MScanListView" );
106 OListView::serializeTo( s ); 106 OListView::serializeTo( s );
107} 107}
108 108
109 109
110void MScanListView::serializeFrom( QDataStream& s) 110void MScanListView::serializeFrom( QDataStream& s)
111{ 111{
112 qDebug( "serializing MScanListView" ); 112 qDebug( "serializing MScanListView" );
113 OListView::serializeFrom( s ); 113 OListView::serializeFrom( s );
114} 114}
115 115
116 116
117void MScanListView::addNewItem( const QString& type, 117void MScanListView::addNewItem( const QString& type,
118 const QString& essid, 118 const QString& essid,
119 const OMacAddress& mac, 119 const OMacAddress& mac,
120 bool wep, 120 bool wep,
121 int channel, 121 int channel,
122 int signal, 122 int signal,
123 const GpsLocation& loc, 123 const GpsLocation& loc,
124 bool probe ) 124 bool probe )
125{ 125{
126 QString macaddr = mac.toString(true); 126 QString macaddr = mac.toString(true);
127 127
128 #ifdef DEBUG 128 #ifdef DEBUG
129 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, 129 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
130 (const char*) essid, (const char*) macaddr, channel ); 130 (const char*) essid, (const char*) macaddr, channel );
131 #endif 131 #endif
132 132
133 // search, if we already have seen this net 133 // search, if we already have seen this net
134 134
135 QString s; 135 QString s;
136 MScanListItem* network; 136 MScanListItem* network;
137 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 137 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
138 138
139 while ( item && ( item->text( col_essid ) != essid ) ) 139 while ( item && ( item->text( col_essid ) != essid ) )
140 { 140 {
141 #ifdef DEBUG 141 #ifdef DEBUG
142 qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); 142 qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
143 #endif 143 #endif
144 item = static_cast<MScanListItem*> ( item->nextSibling() ); 144 item = static_cast<MScanListItem*> ( item->nextSibling() );
145 } 145 }
146 if ( item ) 146 if ( item )
147 { 147 {
148 // we have already seen this net, check all childs if MAC exists 148 // we have already seen this net, check all childs if MAC exists
149 149
150 network = item; 150 network = item;
151 151
152 item = static_cast<MScanListItem*> ( item->firstChild() ); 152 item = static_cast<MScanListItem*> ( item->firstChild() );
153 assert( item ); // this shouldn't fail 153 assert( item ); // this shouldn't fail
154 154
155 while ( item && ( item->text( col_ap ) != macaddr ) ) 155 while ( item && ( item->text( col_ap ) != macaddr ) )
156 { 156 {
157 #ifdef DEBUG 157 #ifdef DEBUG
158 qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); 158 qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
159 #endif 159 #endif
160 item = static_cast<MScanListItem*> ( item->nextSibling() ); 160 item = static_cast<MScanListItem*> ( item->nextSibling() );
161 } 161 }
162 162
163 if ( item ) 163 if ( item )
164 { 164 {
165 // we have already seen this item, it's a dupe 165 // we have already seen this item, it's a dupe
166 #ifdef DEBUG 166 #ifdef DEBUG
167 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 167 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
168 #endif 168 #endif
169 item->receivedBeacon(); 169 item->receivedBeacon();
170 return; 170 return;
171 } 171 }
172 } 172 }
173 else 173 else
174 { 174 {
175 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid ); 175 s.sprintf( "(i) New network: ESSID '%s'", (const char*) essid );
176 MLogWindow::logwindow()->log( s ); 176 MLogWindow::logwindow()->log( s );
177 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe ); 177 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0, probe );
178 } 178 }
179 179
180 180
181 // insert new station as child from network 181 // insert new station as child from network
182 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 182 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
183 183
184 #ifdef DEBUG 184 #ifdef DEBUG
185 qDebug( "inserting new station %s", (const char*) macaddr ); 185 qDebug( "inserting new station %s", (const char*) macaddr );
186 #endif 186 #endif
187 187
188 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 188 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
189 station->setManufacturer( mac.manufacturer() ); 189 station->setManufacturer( mac.manufacturer() );
190 station->setLocation( loc.dmsPosition() ); 190 station->setLocation( loc.dmsPosition() );
191 191
192 if ( type == "managed" ) 192 if ( type == "managed" )
193 { 193 {
194 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 194 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
195 } 195 }
196 else 196 else
197 { 197 {
198 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); 198 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
199 } 199 }
200 MLogWindow::logwindow()->log( s ); 200 MLogWindow::logwindow()->log( s );
201} 201}
202 202
203 203
204void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type ) 204void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& addr, const QString& type )
205{ 205{
206 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 206 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
207 207
208 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) ) 208 while ( subitem && ( subitem->text( col_ap ) != addr.toString(true) ) )
209 { 209 {
210 #ifdef DEBUG 210 #ifdef DEBUG
211 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 211 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
212 #endif 212 #endif
213 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 213 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
214 } 214 }
215 215
216 if ( subitem ) 216 if ( subitem )
217 { 217 {
218 // we have already seen this item, it's a dupe 218 // we have already seen this item, it's a dupe
219 #ifdef DEBUG 219 #ifdef DEBUG
220 qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) ); 220 qDebug( "%s is a dupe - ignoring...", (const char*) addr.toString(true) );
221 #endif 221 #endif
222 subitem->receivedBeacon(); //FIXME: sent data bit 222 subitem->receivedBeacon(); //FIXME: sent data bit
223 return; 223 return;
224 } 224 }
225 225
226 // Hey, it seems to be a new item :-D 226 // Hey, it seems to be a new item :-D
227 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 ); 227 MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr.toString(true), false, -1, -1 );
228 station->setManufacturer( addr.manufacturer() ); 228 station->setManufacturer( addr.manufacturer() );
229 229
230 QString s; 230 QString s;
231 if ( type == "station" ) 231 if ( type == "station" )
232 { 232 {
233 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 233 s.sprintf( "(i) New Station in '%s' [xx]", (const char*) network->text( col_essid ) );
234 } 234 }
235 else 235 else
236 { 236 {
237 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) ); 237 s.sprintf( "(i) New Wireless Station in '%s' [xx]", (const char*) network->text( col_essid ) );
238 } 238 }
239 MLogWindow::logwindow()->log( s ); 239 MLogWindow::logwindow()->log( s );
240} 240}
241 241
242 242
243void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) 243void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo )
244{ 244{
245 QString s; 245 QString s;
246 MScanListItem* network; 246 MScanListItem* network;
247 247
248 QListViewItemIterator it( this ); 248 QListViewItemIterator it( this );
249 while ( it.current() && 249 while ( it.current() &&
250 it.current()->text( col_ap ) != viaFrom.toString(true) && 250 it.current()->text( col_ap ) != viaFrom.toString(true) &&
251 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it; 251 it.current()->text( col_ap ) != viaTo.toString(true) ) ++it;
252 252
253 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 253 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
254 254
255 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations 255 if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations
256 { 256 {
257 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); 257 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from );
258 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); 258 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to );
259 } 259 }
260 else 260 else
261 { 261 {
262 qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); 262 qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" );
263 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" ); 263 MLogWindow::logwindow()->log( "WARNING: Unhandled WSD traffic!" );
264 } 264 }
265} 265}
266 266
267 267
268void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 268void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
269{ 269{
270 QString s; 270 QString s;
271 MScanListItem* network; 271 MScanListItem* network;
272 272
273 QListViewItemIterator it( this ); 273 QListViewItemIterator it( this );
274 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 274 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
275 275
276 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 276 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
277 277
278 if ( item ) // AP has shown up yet, so just add our new "from" - station 278 if ( item ) // AP has shown up yet, so just add our new "from" - station
279 { 279 {
280 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); 280 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" );
281 } 281 }
282 else 282 else
283 { 283 {
284 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 284 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
285 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" ); 285 MLogWindow::logwindow()->log( "WARNING: Unhandled toDS traffic!" );
286 286
287 } 287 }
288} 288}
289 289
290 290
291void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 291void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
292{ 292{
293 QString s; 293 QString s;
294 MScanListItem* network; 294 MScanListItem* network;
295 295
296 QListViewItemIterator it( this ); 296 QListViewItemIterator it( this );
297 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it; 297 while ( it.current() && it.current()->text( col_ap ) != via.toString(true) ) ++it;
298 298
299 MScanListItem* item = static_cast<MScanListItem*>( it.current() ); 299 MScanListItem* item = static_cast<MScanListItem*>( it.current() );
300 300
301 if ( item ) // AP has shown up yet, so just add our new "from" - station 301 if ( item ) // AP has shown up yet, so just add our new "from" - station
302 { 302 {
303 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); 303 addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" );
304 } 304 }
305 else 305 else
306 { 306 {
307 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); 307 qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" );
308 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" ); 308 MLogWindow::logwindow()->log( "WARNING: Unhandled fromDS traffic!" );
309 } 309 }
310} 310}
311 311
312 312
313void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) 313void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via )
314{ 314{
315 qWarning( "D'oh! Not yet implemented..." ); 315 qWarning( "D'oh! Not yet implemented..." );
316 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" ); 316 MLogWindow::logwindow()->log( "WARNING: Unhandled IBSS traffic!" );
317} 317}
318 318
319 319
320void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) 320void MScanListView::identify( const OMacAddress& macaddr, const QString& ip )
321{ 321{
322 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip ); 322 qDebug( "identify %s = %s", (const char*) macaddr.toString(), (const char*) ip );
323 323
324 QListViewItemIterator it( this ); 324 QListViewItemIterator it( this );
325 for ( ; it.current(); ++it ) 325 for ( ; it.current(); ++it )
326 { 326 {
327 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 327 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
328 { 328 {
329 it.current()->setText( col_ip, ip ); 329 it.current()->setText( col_ip, ip );
330 return; 330 return;
331 } 331 }
332 } 332 }
333 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 333 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
334 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!", 334 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled identification %s = %s!",
335 (const char*) macaddr.toString(), (const char*) ip ) ); 335 (const char*) macaddr.toString(), (const char*) ip ) );
336} 336}
337 337
338 338
339void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) 339void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip )
340{ 340{
341 qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip ); 341 qDebug( "addService '%s', Server = %s = %s", (const char*) name, (const char*) macaddr.toString(), (const char*) ip );
342 342
343 //TODO: Refactor that out, we need it all over the place. 343 //TODO: Refactor that out, we need it all over the place.
344 // Best to do it in a more comfortable abstraction in OListView 344 // Best to do it in a more comfortable abstraction in OListView
345 // (Hmm, didn't I already start something in this direction?) 345 // (Hmm, didn't I already start something in this direction?)
346 346
347 QListViewItemIterator it( this ); 347 QListViewItemIterator it( this );
348 for ( ; it.current(); ++it ) 348 for ( ; it.current(); ++it )
349 { 349 {
350 if ( it.current()->text( col_ap ) == macaddr.toString(true) ) 350 if ( it.current()->text( col_ap ) == macaddr.toString(true) )
351 { 351 {
352 352
353 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() ); 353 MScanListItem* subitem = static_cast<MScanListItem*>( it.current()->firstChild() );
354 354
355 while ( subitem && ( subitem->text( col_essid ) != name ) ) 355 while ( subitem && ( subitem->text( col_essid ) != name ) )
356 { 356 {
357 #ifdef DEBUG 357 #ifdef DEBUG
358 qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) ); 358 qDebug( "subitemtext: %s", (const char*) subitem->text( col_essid ) );
359 #endif 359 #endif
360 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); 360 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
361 } 361 }
362 362
363 if ( subitem ) 363 if ( subitem )
364 { 364 {
365 // we have already seen this item, it's a dupe 365 // we have already seen this item, it's a dupe
366 #ifdef DEBUG 366 #ifdef DEBUG
367 qDebug( "%s is a dupe - ignoring...", (const char*) name ); 367 qDebug( "%s is a dupe - ignoring...", (const char*) name );
368 #endif 368 #endif
369 subitem->receivedBeacon(); //FIXME: sent data bit 369 subitem->receivedBeacon(); //FIXME: sent data bit
370 return; 370 return;
371 } 371 }
372 372
373 // never seen that - add new item 373 // never seen that - add new item
374 374
375 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); 375 MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 );
376 item->setText( col_essid, name ); 376 item->setText( col_essid, name );
377 377
378 return; 378 return;
379 } 379 }
380 } 380 }
381 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" ); 381 qDebug( "D'oh! Received identification, but item not yet in list... ==> Handle this!" );
382 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", 382 MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!",
383 (const char*) macaddr.toString(), (const char*) ip ) ); 383 (const char*) macaddr.toString(), (const char*) ip ) );
384} 384}
385 385
386 386
387void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) 387void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col )
388{ 388{
389 if ( !item ) return; 389 if ( !item ) return;
390 390
391 MScanListItem* itm = static_cast<MScanListItem*>( item ); 391 MScanListItem* itm = static_cast<MScanListItem*>( item );
392 392
393 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", 393 qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'",
394 (const char*) itm->text(0), (const char*) itm->type, col ); 394 (const char*) itm->text(0), (const char*) itm->type, col );
395 395
396 if ( itm->type == "adhoc" || itm->type == "managed" ) 396 if ( itm->type == "adhoc" || itm->type == "managed" )
397 { 397 {
398 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); 398 QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() );
399 399
400 QPopupMenu m( this ); 400 QPopupMenu m( this );
401 m.insertItem( entry, 37773, 0 ); 401 m.insertItem( entry, 37773, 0 );
402 int result = m.exec( QCursor::pos() ); 402 int result = m.exec( QCursor::pos() );
403 if ( result == 37773 ) 403 if ( result == 37773 )
404 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); 404 emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() );
405 } 405 }
406} 406}
407 407
408//============================================================ 408//============================================================
409// MScanListItem 409// MScanListItem
410//============================================================ 410//============================================================
411 411
412MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, 412MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr,
413 bool wep, int channel, int signal, bool probed ) 413 bool wep, int channel, int signal, bool probed )
414 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 414 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
415 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 415 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
416 _channel( channel ), _signal( signal ), _beacons( 1 ) 416 _channel( channel ), _signal( signal ), _beacons( 1 )
417{ 417{
418 #ifdef DEBUG 418 #ifdef DEBUG
419 qDebug( "creating scanlist item" ); 419 qDebug( "creating scanlist item" );
420 #endif 420 #endif
421 421
422 if ( WellenreiterConfigWindow::instance() ) 422 if ( WellenreiterConfigWindow::instance() )
423 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here 423 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
424 424
425 decorateItem( type, essid, macaddr, wep, channel, signal, probed ); 425 decorateItem( type, essid, macaddr, wep, channel, signal, probed );
426} 426}
427 427
428MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, 428MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr,
429 bool wep, int channel, int signal ) 429 bool wep, int channel, int signal )
430 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 430 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
431{ 431{
432 #ifdef DEBUG 432 #ifdef DEBUG
433 qDebug( "creating scanlist item" ); 433 qDebug( "creating scanlist item" );
434 #endif 434 #endif
435 if ( WellenreiterConfigWindow::instance() )
436 WellenreiterConfigWindow::instance()->performAction( type, essid, macaddr, wep, channel, signal ); // better use signal/slot combination here
437
435 decorateItem( type, essid, macaddr, wep, channel, signal, false ); 438 decorateItem( type, essid, macaddr, wep, channel, signal, false );
436} 439}
437 440
438const QString& MScanListItem::essid() const 441const QString& MScanListItem::essid() const
439{ 442{
440 if ( type == "network" ) 443 if ( type == "network" )
441 return _essid; 444 return _essid;
442 else 445 else
443 return ( (MScanListItem*) parent() )->essid(); 446 return ( (MScanListItem*) parent() )->essid();
444} 447}
445 448
446OListViewItem* MScanListItem::childFactory() 449OListViewItem* MScanListItem::childFactory()
447{ 450{
448 return new MScanListItem( this ); 451 return new MScanListItem( this );
449} 452}
450 453
451void MScanListItem::serializeTo( QDataStream& s ) const 454void MScanListItem::serializeTo( QDataStream& s ) const
452{ 455{
453 #ifdef DEBUG 456 #ifdef DEBUG
454 qDebug( "serializing MScanListItem" ); 457 qDebug( "serializing MScanListItem" );
455 #endif 458 #endif
456 OListViewItem::serializeTo( s ); 459 OListViewItem::serializeTo( s );
457 460
458 s << _type; 461 s << _type;
459 s << (Q_UINT8) ( _wep ? 'y' : 'n' ); 462 s << (Q_UINT8) ( _wep ? 'y' : 'n' );
460} 463}
461 464
462void MScanListItem::serializeFrom( QDataStream& s ) 465void MScanListItem::serializeFrom( QDataStream& s )
463{ 466{
464 #ifdef DEBUG 467 #ifdef DEBUG
465 qDebug( "serializing MScanListItem" ); 468 qDebug( "serializing MScanListItem" );
466 #endif 469 #endif
467 OListViewItem::serializeFrom( s ); 470 OListViewItem::serializeFrom( s );
468 471
469 char wep; 472 char wep;
470 s >> _type; 473 s >> _type;
471 s >> (Q_UINT8) wep; 474 s >> (Q_UINT8) wep;
472 _wep = (wep == 'y'); 475 _wep = (wep == 'y');
473 476
474 QString name; 477 QString name;
475 name.sprintf( "wellenreiter/%s", (const char*) _type ); 478 name.sprintf( "wellenreiter/%s", (const char*) _type );
476 setPixmap( col_type, Resource::loadPixmap( name ) ); 479 setPixmap( col_type, Resource::loadPixmap( name ) );
477 if ( _wep ) 480 if ( _wep )
478 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 481 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
479 listView()->triggerUpdate(); 482 listView()->triggerUpdate();
480} 483}
481 484
482void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) 485void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed )
483{ 486{
484 #ifdef DEBUG 487 #ifdef DEBUG
485 qDebug( "decorating scanlist item %s / %s / %s [%d]", 488 qDebug( "decorating scanlist item %s / %s / %s [%d]",
486 (const char*) type, 489 (const char*) type,
487 (const char*) essid, 490 (const char*) essid,
488 (const char*) macaddr, 491 (const char*) macaddr,
489 channel ); 492 channel );
490 #endif 493 #endif
491 494
492 // set icon for managed or adhoc mode 495 // set icon for managed or adhoc mode
493 QString name; 496 QString name;
494 name.sprintf( "wellenreiter/%s", (const char*) type ); 497 name.sprintf( "wellenreiter/%s", (const char*) type );
495 setPixmap( col_type, Resource::loadPixmap( name ) ); 498 setPixmap( col_type, Resource::loadPixmap( name ) );
496 499
497 // special case for probed networks FIXME: This is ugly at present 500 // special case for probed networks FIXME: This is ugly at present
498 if ( type == "network" && probed ) 501 if ( type == "network" && probed )
499 { 502 {
500 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); 503 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) );
501 } 504 }
502 505
503 // set icon for wep (wireless encryption protocol) 506 // set icon for wep (wireless encryption protocol)
504 if ( wep ) 507 if ( wep )
505 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 508 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
506 509
507 // set channel and signal text 510 // set channel and signal text
508 511
509 if ( signal != -1 ) 512 if ( signal != -1 )
510 setText( col_sig, QString::number( signal ) ); 513 setText( col_sig, QString::number( signal ) );
511 if ( channel != -1 ) 514 if ( channel != -1 )
512 setText( col_channel, QString::number( channel ) ); 515 setText( col_channel, QString::number( channel ) );
513 516
514 setText( col_firstseen, QTime::currentTime().toString() ); 517 setText( col_firstseen, QTime::currentTime().toString() );
515 //setText( col_lastseen, QTime::currentTime().toString() ); 518 //setText( col_lastseen, QTime::currentTime().toString() );
516 519
517 listView()->triggerUpdate(); 520 listView()->triggerUpdate();
518 521
519 this->type = type; 522 this->type = type;
520 _type = type; 523 _type = type;
521 _essid = essid; 524 _essid = essid;
522 _macaddr = macaddr; 525 _macaddr = macaddr;
523 _channel = channel; 526 _channel = channel;
524 _beacons = 1; 527 _beacons = 1;
525 _signal = 0; 528 _signal = 0;
526 529
527 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) 530 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
528 { 531 {
529 listView()->ensureItemVisible( this ); 532 listView()->ensureItemVisible( this );
530 } 533 }
531 534
532} 535}
533 536
534 537
535void MScanListItem::setManufacturer( const QString& manufacturer ) 538void MScanListItem::setManufacturer( const QString& manufacturer )
536{ 539{
537 setText( col_manuf, manufacturer ); 540 setText( col_manuf, manufacturer );
538} 541}
539 542
540 543
541void MScanListItem::setLocation( const QString& location ) 544void MScanListItem::setLocation( const QString& location )
542{ 545{
543 setText( col_location, location ); 546 setText( col_location, location );
544} 547}
545 548
546 549
547void MScanListItem::receivedBeacon() 550void MScanListItem::receivedBeacon()
548{ 551{
549 _beacons++; 552 _beacons++;
550 #ifdef DEBUG 553 #ifdef DEBUG
551 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 554 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
552 #endif 555 #endif
553 setText( col_sig, QString::number( _beacons ) ); 556 setText( col_sig, QString::number( _beacons ) );
554 setText( col_lastseen, QTime::currentTime().toString() ); 557 setText( col_lastseen, QTime::currentTime().toString() );
555 558
556 MScanListItem* p = (MScanListItem*) parent(); 559 MScanListItem* p = (MScanListItem*) parent();
557 if ( p ) p->receivedBeacon(); 560 if ( p ) p->receivedBeacon();
558 561
559} 562}
560 563