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.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index f4cfe52..d695c17 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -42,16 +42,17 @@ const int col_sig = 1;
42const int col_ap = 2; 42const int col_ap = 2;
43const int col_channel = 3; 43const int col_channel = 3;
44const int col_wep = 4; 44const int col_wep = 4;
45const int col_traffic = 5; 45const int col_traffic = 5;
46const int col_ip = 6; 46const int col_ip = 6;
47const int col_manuf = 7; 47const int col_manuf = 7;
48const int col_firstseen = 8; 48const int col_firstseen = 8;
49const int col_lastseen = 9; 49const int col_lastseen = 9;
50const int col_location = 10;
50 51
51MScanListView::MScanListView( QWidget* parent, const char* name ) 52MScanListView::MScanListView( QWidget* parent, const char* name )
52 :OListView( parent, name ) 53 :OListView( parent, name )
53{ 54{
54 55
55 setFrameShape( QListView::StyledPanel ); 56 setFrameShape( QListView::StyledPanel );
56 setFrameShadow( QListView::Sunken ); 57 setFrameShadow( QListView::Sunken );
57 58
@@ -70,16 +71,18 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
70 addColumn( tr( "IP" ) ); 71 addColumn( tr( "IP" ) );
71 setColumnAlignment( col_ip, AlignCenter ); 72 setColumnAlignment( col_ip, AlignCenter );
72 addColumn( tr( "Manufacturer" ) ); 73 addColumn( tr( "Manufacturer" ) );
73 setColumnAlignment( col_manuf, AlignCenter ); 74 setColumnAlignment( col_manuf, AlignCenter );
74 addColumn( tr( "First Seen" ) ); 75 addColumn( tr( "First Seen" ) );
75 setColumnAlignment( col_firstseen, AlignCenter ); 76 setColumnAlignment( col_firstseen, AlignCenter );
76 addColumn( tr( "Last Seen" ) ); 77 addColumn( tr( "Last Seen" ) );
77 setColumnAlignment( col_lastseen, AlignCenter ); 78 setColumnAlignment( col_lastseen, AlignCenter );
79 addColumn( tr( "Location" ) );
80 setColumnAlignment( col_location, AlignCenter );
78 setRootIsDecorated( true ); 81 setRootIsDecorated( true );
79 setAllColumnsShowFocus( true ); 82 setAllColumnsShowFocus( true );
80 83
81 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 84 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
82 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 85 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
83 86
84 #ifdef QWS 87 #ifdef QWS
85 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 88 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
@@ -108,17 +111,23 @@ void MScanListView::serializeTo( QDataStream& s) const
108 111
109void MScanListView::serializeFrom( QDataStream& s) 112void MScanListView::serializeFrom( QDataStream& s)
110{ 113{
111 qDebug( "serializing MScanListView" ); 114 qDebug( "serializing MScanListView" );
112 OListView::serializeFrom( s ); 115 OListView::serializeFrom( s );
113} 116}
114 117
115 118
116void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal ) 119void MScanListView::addNewItem( const QString& type,
120 const QString& essid,
121 const OMacAddress& mac,
122 bool wep,
123 int channel,
124 int signal,
125 const GpsLocation& loc )
117{ 126{
118 QString macaddr = mac.toString(true); 127 QString macaddr = mac.toString(true);
119 128
120 #ifdef DEBUG 129 #ifdef DEBUG
121 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, 130 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type,
122 (const char*) essid, (const char*) macaddr, channel ); 131 (const char*) essid, (const char*) macaddr, channel );
123 #endif 132 #endif
124 133
@@ -174,16 +183,17 @@ void MScanListView::addNewItem( const QString& type, const QString& essid, const
174 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 183 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
175 184
176 #ifdef DEBUG 185 #ifdef DEBUG
177 qDebug( "inserting new station %s", (const char*) macaddr ); 186 qDebug( "inserting new station %s", (const char*) macaddr );
178 #endif 187 #endif
179 188
180 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 189 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
181 station->setManufacturer( mac.manufacturer() ); 190 station->setManufacturer( mac.manufacturer() );
191 station->setLocation( loc.latitude, loc.longitude );
182 192
183 if ( type == "managed" ) 193 if ( type == "managed" )
184 { 194 {
185 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel ); 195 s.sprintf( "(i) New Access Point in '%s' [%d]", (const char*) essid, channel );
186 } 196 }
187 else 197 else
188 { 198 {
189 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel ); 199 s.sprintf( "(i) New AdHoc station in '%s' [%d]", (const char*) essid, channel );
@@ -463,16 +473,25 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
463 473
464 474
465void MScanListItem::setManufacturer( const QString& manufacturer ) 475void MScanListItem::setManufacturer( const QString& manufacturer )
466{ 476{
467 setText( col_manuf, manufacturer ); 477 setText( col_manuf, manufacturer );
468} 478}
469 479
470 480
481void MScanListItem::setLocation( const float& latitude, const float& longitude )
482{
483 if ( latitude == 0.0 || longitude == 0.0 )
484 setText( col_location, "N/A" );
485 else
486 setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) );
487}
488
489
471void MScanListItem::playSound( const QString& sound ) const 490void MScanListItem::playSound( const QString& sound ) const
472{ 491{
473 #ifdef QWS 492 #ifdef QWS
474 if ( sound == "Ignore" ) return; 493 if ( sound == "Ignore" ) return;
475 else if ( sound == "Touch" ) ODevice::inst()->touchSound(); 494 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
476 else if ( sound == "Key" ) ODevice::inst()->keySound(); 495 else if ( sound == "Key" ) ODevice::inst()->keySound();
477 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); 496 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
478 #endif 497 #endif