summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp21
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 8c2015e..f24e09f 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -474,96 +474,117 @@ void MScanListItem::serializeTo( QDataStream& s ) const
474void MScanListItem::serializeFrom( QDataStream& s ) 474void MScanListItem::serializeFrom( QDataStream& s )
475{ 475{
476 #ifdef DEBUG 476 #ifdef DEBUG
477 odebug << "serializing MScanListItem" << oendl; 477 odebug << "serializing MScanListItem" << oendl;
478 #endif 478 #endif
479 OListViewItem::serializeFrom( s ); 479 OListViewItem::serializeFrom( s );
480 480
481 Q_UINT8 wep; 481 Q_UINT8 wep;
482 s >> _type; 482 s >> _type;
483 s >> wep; 483 s >> wep;
484 _wep = (wep == 'y'); 484 _wep = (wep == 'y');
485 485
486 QString name = QString( "wellenreiter/"+ _type ); 486 QString name = QString( "wellenreiter/"+ _type );
487 setPixmap( col_type, Resource::loadPixmap( name ) ); 487 setPixmap( col_type, Resource::loadPixmap( name ) );
488 if ( _wep ) 488 if ( _wep )
489 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 489 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
490 listView()->triggerUpdate(); 490 listView()->triggerUpdate();
491} 491}
492 492
493void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) 493void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed )
494{ 494{
495 #ifdef DEBUG 495 #ifdef DEBUG
496 odebug << "decorating scanlist item " << type << " / " 496 odebug << "decorating scanlist item " << type << " / "
497 << essid << " / " << macaddr 497 << essid << " / " << macaddr
498 << "[" << channel << "]" << oendl; 498 << "[" << channel << "]" << oendl;
499 #endif 499 #endif
500 500
501 // set icon for managed or adhoc mode 501 // set icon for managed or adhoc mode
502 QString name; 502 QString name;
503 name.sprintf( "wellenreiter/"+ type ); 503 name.sprintf( "wellenreiter/"+ type );
504 setPixmap( col_type, Resource::loadPixmap( name ) ); 504 setPixmap( col_type, Resource::loadPixmap( name ) );
505 505
506 // special case for probed networks FIXME: This is ugly at present 506 // special case for probed networks FIXME: This is ugly at present
507 if ( type == "network" && probed ) 507 if ( type == "network" && probed )
508 { 508 {
509 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); 509 setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) );
510 } 510 }
511 511
512 // set icon for wep (wireless encryption protocol) 512 // set icon for wep (wireless encryption protocol)
513 if ( wep ) 513 if ( wep )
514 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 514 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
515 515
516 // set channel and signal text 516 // set channel and signal text
517 517
518 if ( signal != -1 ) 518 if ( signal != -1 )
519 setText( col_sig, QString::number( signal ) ); 519 setText( col_sig, QString::number( signal ) );
520 if ( channel != -1 ) 520 if ( channel != -1 )
521 setText( col_channel, QString::number( channel ) ); 521 setText( col_channel, QString::number( channel ) );
522 522
523 setText( col_firstseen, QTime::currentTime().toString() ); 523 setText( col_firstseen, QTime::currentTime().toString() );
524 //setText( col_lastseen, QTime::currentTime().toString() ); 524 //setText( col_lastseen, QTime::currentTime().toString() );
525 525
526 listView()->triggerUpdate(); 526 listView()->triggerUpdate();
527 527
528 this->type = type; 528 this->type = type;
529 _type = type; 529 _type = type;
530 _essid = essid; 530 _essid = essid;
531 _macaddr = macaddr; 531 _macaddr = macaddr;
532 _channel = channel; 532 _channel = channel;
533 _beacons = 1; 533 _beacons = 1;
534 _signal = 0; 534 _signal = 0;
535 535
536 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() ) 536 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
537 { 537 {
538 listView()->ensureItemVisible( this ); 538 listView()->ensureItemVisible( this );
539 } 539 }
540 540
541} 541}
542 542
543 543
544void MScanListItem::setManufacturer( const QString& manufacturer ) 544void MScanListItem::setManufacturer( const QString& manufacturer )
545{ 545{
546 setText( col_manuf, manufacturer ); 546 setText( col_manuf, manufacturer );
547} 547}
548 548
549 549
550void MScanListItem::setLocation( const QString& location ) 550void MScanListItem::setLocation( const QString& location )
551{ 551{
552 setText( col_location, location ); 552 setText( col_location, location );
553} 553}
554 554
555 555
556void MScanListItem::receivedBeacon() 556void MScanListItem::receivedBeacon()
557{ 557{
558 _beacons++; 558 _beacons++;
559 #ifdef DEBUG 559 #ifdef DEBUG
560 odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl; 560 odebug << "MScanListItem " << _macaddr << ": received beacon #" << _beacons << "" << oendl;
561 #endif 561 #endif
562 setText( col_sig, QString::number( _beacons ) ); 562 setText( col_sig, QString::number( _beacons ) );
563 setText( col_lastseen, QTime::currentTime().toString() ); 563 setText( col_lastseen, QTime::currentTime().toString() );
564 564
565 MScanListItem* p = (MScanListItem*) parent(); 565 MScanListItem* p = (MScanListItem*) parent();
566 if ( p ) p->receivedBeacon(); 566 if ( p ) p->receivedBeacon();
567 567
568} 568}
569 569
570QString MScanListItem::key( int id, bool b )const {
571 QString str;
572
573 /*
574 * Pad the amount of received packages, number
575 * of the channel.
576 */
577 switch( id ) {
578 case col_sig:
579 str = text(col_sig).rightJustify( 20, '0' );
580 break;
581 case col_channel:
582 str = text(col_channel).rightJustify( 2, '0' );
583 break;
584 default:
585 str = Opie::Ui::OListViewItem::key( id, b );
586 break;
587 }
588
589 return str;
590}
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 6a80f70..8b3814a 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -17,124 +17,126 @@
17#define SCANLIST_H 17#define SCANLIST_H
18 18
19#include "gps.h" 19#include "gps.h"
20 20
21/* OPIE */ 21/* OPIE */
22#include <opie2/olistview.h> 22#include <opie2/olistview.h>
23#include <opie2/onetutils.h> 23#include <opie2/onetutils.h>
24 24
25/* QT */ 25/* QT */
26#include <qtextstream.h> 26#include <qtextstream.h>
27 27
28class QString; 28class QString;
29class MScanListItem; 29class MScanListItem;
30 30
31class MScanListView: public Opie::Ui::OListView 31class MScanListView: public Opie::Ui::OListView
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35 public: 35 public:
36 MScanListView( QWidget* parent = 0, const char* name = 0 ); 36 MScanListView( QWidget* parent = 0, const char* name = 0 );
37 virtual ~MScanListView(); 37 virtual ~MScanListView();
38 38
39 virtual Opie::Ui::OListViewItem* childFactory(); 39 virtual Opie::Ui::OListViewItem* childFactory();
40 virtual void serializeTo( QDataStream& s ) const; 40 virtual void serializeTo( QDataStream& s ) const;
41 virtual void serializeFrom( QDataStream& s ); 41 virtual void serializeFrom( QDataStream& s );
42 42
43 public slots: 43 public slots:
44 void addNewItem( const QString& type, const QString&, const Opie::Net::OMacAddress&, bool, int, int, const GpsLocation&, bool = false ); 44 void addNewItem( const QString& type, const QString&, const Opie::Net::OMacAddress&, bool, int, int, const GpsLocation&, bool = false );
45 void addService( const QString& name, const Opie::Net::OMacAddress& macaddr, const QString& ip ); 45 void addService( const QString& name, const Opie::Net::OMacAddress& macaddr, const QString& ip );
46 46
47 void fromDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 47 void fromDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
48 void toDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 48 void toDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
49 void WDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& viaFrom, const Opie::Net::OMacAddress& viaTo ); 49 void WDStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& viaFrom, const Opie::Net::OMacAddress& viaTo );
50 void IBSStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via ); 50 void IBSStraffic( const Opie::Net::OMacAddress& from, const Opie::Net::OMacAddress& to, const Opie::Net::OMacAddress& via );
51 51
52 void identify( const Opie::Net::OMacAddress&, const QString& ipaddr ); 52 void identify( const Opie::Net::OMacAddress&, const QString& ipaddr );
53 53
54 void contextMenuRequested( QListViewItem* item, const QPoint&, int ); 54 void contextMenuRequested( QListViewItem* item, const QPoint&, int );
55 55
56 signals: 56 signals:
57 void rightButtonClicked(QListViewItem*,const QPoint&,int); 57 void rightButtonClicked(QListViewItem*,const QPoint&,int);
58 void joinNetwork( const QString&, const QString&, int, const QString& ); 58 void joinNetwork( const QString&, const QString&, int, const QString& );
59 59
60 protected: 60 protected:
61 void addIfNotExisting( MScanListItem* parent, const Opie::Net::OMacAddress& addr, const QString& type = "station" ); 61 void addIfNotExisting( MScanListItem* parent, const Opie::Net::OMacAddress& addr, const QString& type = "station" );
62 62
63}; 63};
64 64
65//****************************** MScanListItem **************************************************************** 65//****************************** MScanListItem ****************************************************************
66 66
67class MScanListItem: public Opie::Ui::OListViewItem 67class MScanListItem: public Opie::Ui::OListViewItem
68{ 68{
69 public: 69 public:
70 MScanListItem::MScanListItem( QListView* parent, 70 MScanListItem::MScanListItem( QListView* parent,
71 const QString& type = "unknown", 71 const QString& type = "unknown",
72 const QString& essid = "unknown", 72 const QString& essid = "unknown",
73 const QString& macaddr = "unknown", 73 const QString& macaddr = "unknown",
74 bool wep = false, 74 bool wep = false,
75 int channel = 0, 75 int channel = 0,
76 int signal = 0, 76 int signal = 0,
77 bool probed = false ); 77 bool probed = false );
78 78
79 MScanListItem::MScanListItem( QListViewItem* parent, 79 MScanListItem::MScanListItem( QListViewItem* parent,
80 const QString& type = "unknown", 80 const QString& type = "unknown",
81 const QString& essid = "unknown", 81 const QString& essid = "unknown",
82 const QString& macaddr = "unknown", 82 const QString& macaddr = "unknown",
83 bool wep = false, 83 bool wep = false,
84 int channel = 0, 84 int channel = 0,
85 int signal = 0 ); 85 int signal = 0 );
86 86
87 87
88 protected: 88 protected:
89 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ); 89 virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed );
90 90
91 public: 91 public:
92 QString type; 92 QString type;
93 93
94 public: 94 public:
95 //const QString& type() { return _type; }; 95 //const QString& type() { return _type; };
96 const QString& essid() const; 96 const QString& essid() const;
97 const QString& macaddr() { return _macaddr; }; 97 const QString& macaddr() { return _macaddr; };
98 bool wep() { return _wep; }; 98 bool wep() { return _wep; };
99 int channel() { return _channel; }; 99 int channel() { return _channel; };
100 int signal() { return _signal; }; 100 int signal() { return _signal; };
101 int beacons() { return _beacons; }; 101 int beacons() { return _beacons; };
102 102
103 void setSignal( int signal ) { /* TODO */ }; 103 void setSignal( int signal ) { /* TODO */ };
104 void receivedBeacon(); 104 void receivedBeacon();
105 105
106 void setManufacturer( const QString& manufacturer ); 106 void setManufacturer( const QString& manufacturer );
107 void setLocation( const QString& location ); 107 void setLocation( const QString& location );
108 108
109 virtual Opie::Ui::OListViewItem* childFactory(); 109 virtual Opie::Ui::OListViewItem* childFactory();
110 virtual void serializeTo( QDataStream& s ) const; 110 virtual void serializeTo( QDataStream& s ) const;
111 virtual void serializeFrom( QDataStream& s ); 111 virtual void serializeFrom( QDataStream& s );
112 112
113 virtual QString key( int id, bool )const;
114
113 private: 115 private:
114 QString _type; 116 QString _type;
115 QString _essid; 117 QString _essid;
116 QString _macaddr; 118 QString _macaddr;
117 bool _wep; 119 bool _wep;
118 int _channel; 120 int _channel;
119 int _signal; 121 int _signal;
120 int _beacons; 122 int _beacons;
121 123
122}; 124};
123 125
124//****************************** MScanListViewFactory **************************************************************** 126//****************************** MScanListViewFactory ****************************************************************
125 127
126/* 128/*
127 129
128class MScanListViewFactory : public Opie::Ui::OListViewFactory 130class MScanListViewFactory : public Opie::Ui::OListViewFactory
129{ 131{
130public: 132public:
131 virtual QListView* listViewFactory(); 133 virtual QListView* listViewFactory();
132 virtual QListViewItem* listViewItemFactory( QListView* lv ); 134 virtual QListViewItem* listViewItemFactory( QListView* lv );
133 virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); 135 virtual QListViewItem* listViewItemFactory( QListViewItem* lvi );
134 virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); 136 virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text );
135 virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); 137 virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text );
136} 138}
137*/ 139*/
138 140
139#endif 141#endif
140 142