summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-09-26 10:25:38 (UTC)
committer mickeyl <mickeyl>2003-09-26 10:25:38 (UTC)
commit0009e5f8bfb3050a7906bf03ce7b9870275496e6 (patch) (unidiff)
tree197c61e4bb1eda153ca5bf9fa6986bffafaea137
parent11370952060598f7c79f9df70289f74ecc7693a1 (diff)
downloadopie-0009e5f8bfb3050a7906bf03ce7b9870275496e6.zip
opie-0009e5f8bfb3050a7906bf03ce7b9870275496e6.tar.gz
opie-0009e5f8bfb3050a7906bf03ce7b9870275496e6.tar.bz2
add automatic tree-opening if checked in config
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index d695c17..245290d 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -1,72 +1,73 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
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#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 26
26#ifdef QWS 27#ifdef QWS
27#include <qpe/qpeapplication.h> 28#include <qpe/qpeapplication.h>
28#include <opie/odevice.h> 29#include <opie/odevice.h>
29using namespace Opie; 30using namespace Opie;
30#endif 31#endif
31 32
32 33
33#ifdef QWS 34#ifdef QWS
34#include <qpe/resource.h> 35#include <qpe/resource.h>
35#else 36#else
36#include "resource.h" 37#include "resource.h"
37#endif 38#endif
38 39
39const int col_type = 0; 40const int col_type = 0;
40const int col_essid = 0; 41const int col_essid = 0;
41const int col_sig = 1; 42const int col_sig = 1;
42const int col_ap = 2; 43const int col_ap = 2;
43const int col_channel = 3; 44const int col_channel = 3;
44const int col_wep = 4; 45const int col_wep = 4;
45const int col_traffic = 5; 46const int col_traffic = 5;
46const int col_ip = 6; 47const int col_ip = 6;
47const int col_manuf = 7; 48const int col_manuf = 7;
48const int col_firstseen = 8; 49const int col_firstseen = 8;
49const int col_lastseen = 9; 50const int col_lastseen = 9;
50const int col_location = 10; 51const int col_location = 10;
51 52
52MScanListView::MScanListView( QWidget* parent, const char* name ) 53MScanListView::MScanListView( QWidget* parent, const char* name )
53 :OListView( parent, name ) 54 :OListView( parent, name )
54{ 55{
55 56
56 setFrameShape( QListView::StyledPanel ); 57 setFrameShape( QListView::StyledPanel );
57 setFrameShadow( QListView::Sunken ); 58 setFrameShadow( QListView::Sunken );
58 59
59 addColumn( tr( "Net/Station" ) ); 60 addColumn( tr( "Net/Station" ) );
60 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 61 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
61 addColumn( tr( "#" ) ); 62 addColumn( tr( "#" ) );
62 setColumnAlignment( col_sig, AlignCenter ); 63 setColumnAlignment( col_sig, AlignCenter );
63 addColumn( tr( "MAC" ) ); 64 addColumn( tr( "MAC" ) );
64 setColumnAlignment( col_ap, AlignCenter ); 65 setColumnAlignment( col_ap, AlignCenter );
65 addColumn( tr( "Chn" ) ); 66 addColumn( tr( "Chn" ) );
66 setColumnAlignment( col_channel, AlignCenter ); 67 setColumnAlignment( col_channel, AlignCenter );
67 addColumn( tr( "W" ) ); 68 addColumn( tr( "W" ) );
68 setColumnAlignment( col_wep, AlignCenter ); 69 setColumnAlignment( col_wep, AlignCenter );
69 addColumn( tr( "T" ) ); 70 addColumn( tr( "T" ) );
70 setColumnAlignment( col_traffic, AlignCenter ); 71 setColumnAlignment( col_traffic, AlignCenter );
71 addColumn( tr( "IP" ) ); 72 addColumn( tr( "IP" ) );
72 setColumnAlignment( col_ip, AlignCenter ); 73 setColumnAlignment( col_ip, AlignCenter );
@@ -424,91 +425,97 @@ void MScanListItem::serializeFrom( QDataStream& s )
424 _wep = (wep == 'y'); 425 _wep = (wep == 'y');
425 426
426 QString name; 427 QString name;
427 name.sprintf( "wellenreiter/%s", (const char*) _type ); 428 name.sprintf( "wellenreiter/%s", (const char*) _type );
428 setPixmap( col_type, Resource::loadPixmap( name ) ); 429 setPixmap( col_type, Resource::loadPixmap( name ) );
429 if ( _wep ) 430 if ( _wep )
430 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 431 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
431 listView()->triggerUpdate(); 432 listView()->triggerUpdate();
432} 433}
433 434
434void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 435void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
435{ 436{
436 #ifdef DEBUG 437 #ifdef DEBUG
437 qDebug( "decorating scanlist item %s / %s / %s [%d]", 438 qDebug( "decorating scanlist item %s / %s / %s [%d]",
438 (const char*) type, 439 (const char*) type,
439 (const char*) essid, 440 (const char*) essid,
440 (const char*) macaddr, 441 (const char*) macaddr,
441 channel ); 442 channel );
442 #endif 443 #endif
443 444
444 // set icon for managed or adhoc mode 445 // set icon for managed or adhoc mode
445 QString name; 446 QString name;
446 name.sprintf( "wellenreiter/%s", (const char*) type ); 447 name.sprintf( "wellenreiter/%s", (const char*) type );
447 setPixmap( col_type, Resource::loadPixmap( name ) ); 448 setPixmap( col_type, Resource::loadPixmap( name ) );
448 449
449 // set icon for wep (wireless encryption protocol) 450 // set icon for wep (wireless encryption protocol)
450 if ( wep ) 451 if ( wep )
451 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! 452 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
452 453
453 // set channel and signal text 454 // set channel and signal text
454 455
455 if ( signal != -1 ) 456 if ( signal != -1 )
456 setText( col_sig, QString::number( signal ) ); 457 setText( col_sig, QString::number( signal ) );
457 if ( channel != -1 ) 458 if ( channel != -1 )
458 setText( col_channel, QString::number( channel ) ); 459 setText( col_channel, QString::number( channel ) );
459 460
460 setText( col_firstseen, QTime::currentTime().toString() ); 461 setText( col_firstseen, QTime::currentTime().toString() );
461 //setText( col_lastseen, QTime::currentTime().toString() ); 462 //setText( col_lastseen, QTime::currentTime().toString() );
462 463
463 listView()->triggerUpdate(); 464 listView()->triggerUpdate();
464 465
465 this->type = type; 466 this->type = type;
466 _type = type; 467 _type = type;
467 _essid = essid; 468 _essid = essid;
468 _macaddr = macaddr; 469 _macaddr = macaddr;
469 _channel = channel; 470 _channel = channel;
470 _beacons = 1; 471 _beacons = 1;
471 _signal = 0; 472 _signal = 0;
473
474 if ( WellenreiterConfigWindow::instance()->openTree->isChecked() )
475 {
476 listView()->ensureItemVisible( this );
477 }
478
472} 479}
473 480
474 481
475void MScanListItem::setManufacturer( const QString& manufacturer ) 482void MScanListItem::setManufacturer( const QString& manufacturer )
476{ 483{
477 setText( col_manuf, manufacturer ); 484 setText( col_manuf, manufacturer );
478} 485}
479 486
480 487
481void MScanListItem::setLocation( const float& latitude, const float& longitude ) 488void MScanListItem::setLocation( const float& latitude, const float& longitude )
482{ 489{
483 if ( latitude == 0.0 || longitude == 0.0 ) 490 if ( latitude == 0.0 || longitude == 0.0 )
484 setText( col_location, "N/A" ); 491 setText( col_location, "N/A" );
485 else 492 else
486 setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) ); 493 setText( col_location, QString().sprintf( "%.2f / %.2f", latitude, longitude ) );
487} 494}
488 495
489 496
490void MScanListItem::playSound( const QString& sound ) const 497void MScanListItem::playSound( const QString& sound ) const
491{ 498{
492 #ifdef QWS 499 #ifdef QWS
493 if ( sound == "Ignore" ) return; 500 if ( sound == "Ignore" ) return;
494 else if ( sound == "Touch" ) ODevice::inst()->touchSound(); 501 else if ( sound == "Touch" ) ODevice::inst()->touchSound();
495 else if ( sound == "Key" ) ODevice::inst()->keySound(); 502 else if ( sound == "Key" ) ODevice::inst()->keySound();
496 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); 503 else if ( sound == "Alarm" ) ODevice::inst()->alarmSound();
497 #endif 504 #endif
498} 505}
499 506
500 507
501void MScanListItem::receivedBeacon() 508void MScanListItem::receivedBeacon()
502{ 509{
503 _beacons++; 510 _beacons++;
504 #ifdef DEBUG 511 #ifdef DEBUG
505 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 512 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
506 #endif 513 #endif
507 setText( col_sig, QString::number( _beacons ) ); 514 setText( col_sig, QString::number( _beacons ) );
508 setText( col_lastseen, QTime::currentTime().toString() ); 515 setText( col_lastseen, QTime::currentTime().toString() );
509 516
510 MScanListItem* p = (MScanListItem*) parent(); 517 MScanListItem* p = (MScanListItem*) parent();
511 if ( p ) p->receivedBeacon(); 518 if ( p ) p->receivedBeacon();
512 519
513} 520}
514 521