Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 21 |
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; | |||
42 | const int col_ap = 2; | 42 | const int col_ap = 2; |
43 | const int col_channel = 3; | 43 | const int col_channel = 3; |
44 | const int col_wep = 4; | 44 | const int col_wep = 4; |
45 | const int col_traffic = 5; | 45 | const int col_traffic = 5; |
46 | const int col_ip = 6; | 46 | const int col_ip = 6; |
47 | const int col_manuf = 7; | 47 | const int col_manuf = 7; |
48 | const int col_firstseen = 8; | 48 | const int col_firstseen = 8; |
49 | const int col_lastseen = 9; | 49 | const int col_lastseen = 9; |
50 | const int col_location = 10; | ||
50 | 51 | ||
51 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 52 | MScanListView::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 | ||
109 | void MScanListView::serializeFrom( QDataStream& s) | 112 | void 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 | ||
116 | void MScanListView::addNewItem( const QString& type, const QString& essid, const OMacAddress& mac, bool wep, int channel, int signal ) | 119 | void 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 | ||
465 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 475 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
466 | { | 476 | { |
467 | setText( col_manuf, manufacturer ); | 477 | setText( col_manuf, manufacturer ); |
468 | } | 478 | } |
469 | 479 | ||
470 | 480 | ||
481 | void 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 | |||
471 | void MScanListItem::playSound( const QString& sound ) const | 490 | void 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 |