author | mickeyl <mickeyl> | 2004-01-09 20:01:42 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-01-09 20:01:42 (UTC) |
commit | 88af644c534f19e391ebbe8ea0babf3ccf459eb1 (patch) (unidiff) | |
tree | f49e88a6dfc58d3f196e6918bb402a14ee9f0ad0 | |
parent | 56bb9961db1158250bbfe971f4556b56c0bd6581 (diff) | |
download | opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.zip opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.gz opie-88af644c534f19e391ebbe8ea0babf3ccf459eb1.tar.bz2 |
save configuration settings in accept(), not in the ~
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 16 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.h | 3 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 3 |
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> |
26 | using namespace Opie; | 26 | using 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 | ||
46 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; | 46 | WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; |
47 | 47 | ||
48 | WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) | 48 | WellenreiterConfigWindow::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 | ||
95 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | 95 | void WellenreiterConfigWindow::accept() |
96 | { | 96 | { |
97 | save(); | 97 | save(); |
98 | QDialog::accept(); | ||
99 | } | ||
100 | |||
101 | |||
102 | WellenreiterConfigWindow::~WellenreiterConfigWindow() | ||
103 | { | ||
98 | } | 104 | } |
99 | 105 | ||
100 | 106 | ||
101 | void WellenreiterConfigWindow::performAutodetection() | 107 | void 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 | ||
134 | int WellenreiterConfigWindow::driverType() const | 140 | int 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 | ||
148 | int WellenreiterConfigWindow::hoppingInterval() const | 154 | int WellenreiterConfigWindow::hoppingInterval() const |
149 | { | 155 | { |
150 | return hopInterval->cleanText().toInt(); | 156 | return hopInterval->cleanText().toInt(); |
151 | } | 157 | } |
152 | 158 | ||
153 | 159 | ||
154 | bool WellenreiterConfigWindow::usePrismHeader() const | 160 | bool WellenreiterConfigWindow::usePrismHeader() const |
155 | { | 161 | { |
156 | return prismHeader->isChecked(); | 162 | return prismHeader->isChecked(); |
157 | } | 163 | } |
158 | 164 | ||
159 | 165 | ||
160 | bool WellenreiterConfigWindow::isChannelChecked( int channel ) const | 166 | bool 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 | ||
182 | void WellenreiterConfigWindow::changedDeviceType(int t) | 188 | void 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 | ||
199 | void WellenreiterConfigWindow::synchronizeActionsAndScripts() | 205 | void 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 | ||
211 | void WellenreiterConfigWindow::changedNetworkAction(int t) | 217 | void WellenreiterConfigWindow::changedNetworkAction(int t) |
212 | { | 218 | { |
213 | synchronizeActionsAndScripts(); | 219 | synchronizeActionsAndScripts(); |
214 | } | 220 | } |
215 | 221 | ||
216 | 222 | ||
217 | void WellenreiterConfigWindow::changedClientAction(int t) | 223 | void WellenreiterConfigWindow::changedClientAction(int t) |
218 | { | 224 | { |
219 | synchronizeActionsAndScripts(); | 225 | synchronizeActionsAndScripts(); |
220 | } | 226 | } |
221 | 227 | ||
222 | 228 | ||
223 | void WellenreiterConfigWindow::changedStationAction(int t) | 229 | void WellenreiterConfigWindow::changedStationAction(int t) |
224 | { | 230 | { |
225 | synchronizeActionsAndScripts(); | 231 | synchronizeActionsAndScripts(); |
226 | } | 232 | } |
227 | 233 | ||
228 | 234 | ||
229 | void WellenreiterConfigWindow::getCaptureFileNameClicked() | 235 | void 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 | ||
240 | void WellenreiterConfigWindow::channelAllClicked(int state) | 246 | void 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 | ||
260 | bool WellenreiterConfigWindow::useGPS() const | 266 | bool WellenreiterConfigWindow::useGPS() const |
261 | { | 267 | { |
262 | return enableGPS->isChecked(); | 268 | return enableGPS->isChecked(); |
263 | } | 269 | } |
264 | 270 | ||
265 | 271 | ||
266 | const QString WellenreiterConfigWindow::gpsHost() const | 272 | const 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 | ||
272 | int WellenreiterConfigWindow::gpsPort() const | 278 | int 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 | ||
279 | void WellenreiterConfigWindow::performAction( const QString& type, | 285 | void 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 | ||
346 | void WellenreiterConfigWindow::load() | 352 | void 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 | ||
425 | void WellenreiterConfigWindow::save() | 431 | void 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 | ||
27 | const int DEVTYPE_SELECT = 0; | 27 | const int DEVTYPE_SELECT = 0; |
28 | const int DEVTYPE_CISCO = 1; | 28 | const int DEVTYPE_CISCO = 1; |
29 | const int DEVTYPE_WLAN_NG = 2; | 29 | const int DEVTYPE_WLAN_NG = 2; |
30 | const int DEVTYPE_HOSTAP = 3; | 30 | const int DEVTYPE_HOSTAP = 3; |
31 | const int DEVTYPE_ORINOCO = 4; | 31 | const int DEVTYPE_ORINOCO = 4; |
32 | const int DEVTYPE_MANUAL = 5; | 32 | const int DEVTYPE_MANUAL = 5; |
33 | const int DEVTYPE_FILE = 6; | 33 | const int DEVTYPE_FILE = 6; |
34 | 34 | ||
35 | class WellenreiterConfigWindow; | 35 | class WellenreiterConfigWindow; |
36 | 36 | ||
37 | class WellenreiterConfigWindow : public WellenreiterConfigBase | 37 | class 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 | |||
@@ -243,318 +243,321 @@ void MScanListView::addIfNotExisting( MScanListItem* network, const OMacAddress& | |||
243 | void MScanListView::WDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& viaFrom, const OMacAddress& viaTo ) | 243 | void 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 | ||
268 | void MScanListView::toDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 268 | void 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 | ||
291 | void MScanListView::fromDStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 291 | void 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 | ||
313 | void MScanListView::IBSStraffic( const OMacAddress& from, const OMacAddress& to, const OMacAddress& via ) | 313 | void 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 | ||
320 | void MScanListView::identify( const OMacAddress& macaddr, const QString& ip ) | 320 | void 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 | ||
339 | void MScanListView::addService( const QString& name, const OMacAddress& macaddr, const QString& ip ) | 339 | void 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 | ||
387 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 387 | void 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 | ||
412 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 412 | MScanListItem::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 | ||
428 | MScanListItem::MScanListItem( QListViewItem* parent, const QString& type, const QString& essid, const QString& macaddr, | 428 | MScanListItem::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 | ||
438 | const QString& MScanListItem::essid() const | 441 | const 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 | ||
446 | OListViewItem* MScanListItem::childFactory() | 449 | OListViewItem* MScanListItem::childFactory() |
447 | { | 450 | { |
448 | return new MScanListItem( this ); | 451 | return new MScanListItem( this ); |
449 | } | 452 | } |
450 | 453 | ||
451 | void MScanListItem::serializeTo( QDataStream& s ) const | 454 | void 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 | ||
462 | void MScanListItem::serializeFrom( QDataStream& s ) | 465 | void 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 | ||
482 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) | 485 | void 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 | ||
535 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 538 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
536 | { | 539 | { |
537 | setText( col_manuf, manufacturer ); | 540 | setText( col_manuf, manufacturer ); |
538 | } | 541 | } |
539 | 542 | ||
540 | 543 | ||
541 | void MScanListItem::setLocation( const QString& location ) | 544 | void MScanListItem::setLocation( const QString& location ) |
542 | { | 545 | { |
543 | setText( col_location, location ); | 546 | setText( col_location, location ); |
544 | } | 547 | } |
545 | 548 | ||
546 | 549 | ||
547 | void MScanListItem::receivedBeacon() | 550 | void 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 | ||