summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp20
1 files changed, 4 insertions, 16 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index d89c71f..470646d 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -17,29 +17,26 @@
17#include "configwindow.h" 17#include "configwindow.h"
18#include "logwindow.h" 18#include "logwindow.h"
19 19
20#include <assert.h> 20#include <assert.h>
21#include <qcursor.h> 21#include <qcursor.h>
22#include <qdatetime.h> 22#include <qdatetime.h>
23#include <qtextstream.h> 23#include <qtextstream.h>
24#include <qpopupmenu.h> 24#include <qpopupmenu.h>
25#include <qcheckbox.h> 25#include <qcheckbox.h>
26 26
27#ifdef QWS 27#ifdef QWS
28#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
29#include <opie/odevice.h>
30using namespace Opie;
31#endif 29#endif
32 30
33
34#ifdef QWS 31#ifdef QWS
35#include <qpe/resource.h> 32#include <qpe/resource.h>
36#else 33#else
37#include "resource.h" 34#include "resource.h"
38#endif 35#endif
39 36
40const int col_type = 0; 37const int col_type = 0;
41const int col_essid = 0; 38const int col_essid = 0;
42const int col_sig = 1; 39const int col_sig = 1;
43const int col_ap = 2; 40const int col_ap = 2;
44const int col_channel = 3; 41const int col_channel = 3;
45const int col_wep = 4; 42const int col_wep = 4;
@@ -412,26 +409,28 @@ void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, in
412// MScanListItem 409// MScanListItem
413//============================================================ 410//============================================================
414 411
415MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 412MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
416 bool wep, int channel, int signal ) 413 bool wep, int channel, int signal )
417 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 414 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
418 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), 415 _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ),
419 _channel( channel ), _signal( signal ), _beacons( 1 ) 416 _channel( channel ), _signal( signal ), _beacons( 1 )
420{ 417{
421 #ifdef DEBUG 418 #ifdef DEBUG
422 qDebug( "creating scanlist item" ); 419 qDebug( "creating scanlist item" );
423 #endif 420 #endif
424 if ( WellenreiterConfigWindow::instance() && type == "network" ) 421
425 playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); 422 if ( WellenreiterConfigWindow::instance() )
423 WellenreiterConfigWindow::instance()->performAction( type ); // better use signal/slot combination here
424
426 decorateItem( type, essid, macaddr, wep, channel, signal ); 425 decorateItem( type, essid, macaddr, wep, channel, signal );
427} 426}
428 427
429MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, 428MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr,
430 bool wep, int channel, int signal ) 429 bool wep, int channel, int signal )
431 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 430 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
432{ 431{
433 #ifdef DEBUG 432 #ifdef DEBUG
434 qDebug( "creating scanlist item" ); 433 qDebug( "creating scanlist item" );
435 #endif 434 #endif
436 decorateItem( type, essid, macaddr, wep, channel, signal ); 435 decorateItem( type, essid, macaddr, wep, channel, signal );
437} 436}
@@ -530,35 +529,24 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
530void MScanListItem::setManufacturer( const QString& manufacturer ) 529void MScanListItem::setManufacturer( const QString& manufacturer )
531{ 530{
532 setText( col_manuf, manufacturer ); 531 setText( col_manuf, manufacturer );
533} 532}
534 533
535 534
536void MScanListItem::setLocation( const QString& location ) 535void MScanListItem::setLocation( const QString& location )
537{ 536{
538 setText( col_location, location ); 537 setText( col_location, location );
539} 538}
540 539
541 540
542void MScanListItem::playSound( const QString& sound ) const
543{
544 #ifdef QWS
545 if ( sound == "Ignore" ) return;
546 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
547 else if ( sound == "Key" ) ODevice::inst()->keySound();
548 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
549 #endif
550}
551
552
553void MScanListItem::receivedBeacon() 541void MScanListItem::receivedBeacon()
554{ 542{
555 _beacons++; 543 _beacons++;
556 #ifdef DEBUG 544 #ifdef DEBUG
557 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 545 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
558 #endif 546 #endif
559 setText( col_sig, QString::number( _beacons ) ); 547 setText( col_sig, QString::number( _beacons ) );
560 setText( col_lastseen, QTime::currentTime().toString() ); 548 setText( col_lastseen, QTime::currentTime().toString() );
561 549
562 MScanListItem* p = (MScanListItem*) parent(); 550 MScanListItem* p = (MScanListItem*) parent();
563 if ( p ) p->receivedBeacon(); 551 if ( p ) p->receivedBeacon();
564 552