summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index be1245e..a006a3c 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -5,30 +5,36 @@
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#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h"
17 18
18#include <assert.h> 19#include <assert.h>
19#include "manufacturers.h" 20#include "manufacturers.h"
20#include <qdatetime.h> 21#include <qdatetime.h>
21#include <qtextstream.h> 22#include <qtextstream.h>
22 23
24#ifdef QWS
25#include <opie/odevice.h>
26using namespace Opie;
27#endif
28
23MScanListView::MScanListView( QWidget* parent, const char* name ) 29MScanListView::MScanListView( QWidget* parent, const char* name )
24 :OListView( parent, name ), _manufacturerdb( 0 ) 30 :OListView( parent, name ), _manufacturerdb( 0 )
25{ 31{
26 32
27 setFrameShape( QListView::StyledPanel ); 33 setFrameShape( QListView::StyledPanel );
28 setFrameShadow( QListView::Sunken ); 34 setFrameShadow( QListView::Sunken );
29 35
30 addColumn( tr( "Net/Station" ) ); 36 addColumn( tr( "Net/Station" ) );
31 setColumnAlignment( 0, AlignLeft || AlignVCenter ); 37 setColumnAlignment( 0, AlignLeft || AlignVCenter );
32 addColumn( tr( "B" ) ); 38 addColumn( tr( "B" ) );
33 setColumnAlignment( 1, AlignCenter ); 39 setColumnAlignment( 1, AlignCenter );
34 addColumn( tr( "AP" ) ); 40 addColumn( tr( "AP" ) );
@@ -133,25 +139,24 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
133 { 139 {
134 // we have already seen this item, it's a dupe 140 // we have already seen this item, it's a dupe
135 #ifdef DEBUG 141 #ifdef DEBUG
136 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 142 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
137 #endif 143 #endif
138 item->receivedBeacon(); 144 item->receivedBeacon();
139 return; 145 return;
140 } 146 }
141 } 147 }
142 else 148 else
143 { 149 {
144 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 150 s.sprintf( "(i) new network: '%s'", (const char*) essid );
145
146 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); 151 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
147 } 152 }
148 153
149 154
150 // insert new station as child from network 155 // insert new station as child from network
151 156
152 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 157 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
153 158
154 qDebug( "inserting new station %s", (const char*) macaddr ); 159 qDebug( "inserting new station %s", (const char*) macaddr );
155 160
156 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 161 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
157 if ( _manufacturerdb ) 162 if ( _manufacturerdb )
@@ -183,24 +188,26 @@ const int col_wep = 4;
183const int col_traffic = 5; 188const int col_traffic = 5;
184const int col_manuf = 6; 189const int col_manuf = 6;
185const int col_firstseen = 7; 190const int col_firstseen = 7;
186const int col_lastseen = 8; 191const int col_lastseen = 8;
187 192
188MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 193MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
189 bool wep, int channel, int signal ) 194 bool wep, int channel, int signal )
190 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 195 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
191 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 196 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
192 _channel( channel ), _signal( signal ), _beacons( 0 ) 197 _channel( channel ), _signal( signal ), _beacons( 0 )
193{ 198{
194 qDebug( "creating scanlist item" ); 199 qDebug( "creating scanlist item" );
200 if ( WellenreiterConfigWindow::instance() && type == "networks" )
201 playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() );
195 decorateItem( type, essid, macaddr, wep, channel, signal ); 202 decorateItem( type, essid, macaddr, wep, channel, signal );
196} 203}
197 204
198MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 205MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
199 bool wep, int channel, int signal ) 206 bool wep, int channel, int signal )
200 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 207 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
201{ 208{
202 qDebug( "creating scanlist item" ); 209 qDebug( "creating scanlist item" );
203 decorateItem( type, essid, macaddr, wep, channel, signal ); 210 decorateItem( type, essid, macaddr, wep, channel, signal );
204} 211}
205 212
206OListViewItem* MScanListItem::childFactory() 213OListViewItem* MScanListItem::childFactory()
@@ -262,27 +269,42 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
262 269
263 listView()->triggerUpdate(); 270 listView()->triggerUpdate();
264 271
265 this->type = type; 272 this->type = type;
266 _type = type; 273 _type = type;
267 _essid = essid; 274 _essid = essid;
268 _macaddr = macaddr; 275 _macaddr = macaddr;
269 _channel = channel; 276 _channel = channel;
270 _beacons = 0; 277 _beacons = 0;
271 _signal = 0; 278 _signal = 0;
272} 279}
273 280
281
274void MScanListItem::setManufacturer( const QString& manufacturer ) 282void MScanListItem::setManufacturer( const QString& manufacturer )
275{ 283{
276 setText( col_manuf, manufacturer ); 284 setText( col_manuf, manufacturer );
277} 285}
278 286
287
288void MScanListItem::playSound( const QString& sound ) const
289{
290 #ifdef QWS
291 if ( sound == "Ignore" ) return;
292 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
293 else if ( sound == "Key" ) ODevice::inst()->keySound();
294 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
295 #endif
296}
297
298
279void MScanListItem::receivedBeacon() 299void MScanListItem::receivedBeacon()
280{ 300{
281 _beacons++; 301 _beacons++;
282 #ifdef DEBUG 302 #ifdef DEBUG
283 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 303 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
284 #endif 304 #endif
285 setText( col_sig, QString::number( _beacons ) ); 305 setText( col_sig, QString::number( _beacons ) );
286 setText( col_lastseen, QTime::currentTime().toString() ); 306 setText( col_lastseen, QTime::currentTime().toString() );
307 if ( WellenreiterConfigWindow::instance() )
308 playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() );
287} 309}
288 310