summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-02-23 18:48:17 (UTC)
committer mickeyl <mickeyl>2003-02-23 18:48:17 (UTC)
commita195865dfdb03b4c7c972acfc8cfd87743ab3e6f (patch) (unidiff)
tree9be601d3d82e40ea144d12027869dd9bc39a33cd
parent9f24ae5ae12aa1eb0f974b072d46868ba048e65d (diff)
downloadopie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.zip
opie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.tar.gz
opie-a195865dfdb03b4c7c972acfc8cfd87743ab3e6f.tar.bz2
- write simple log
- record first seen / last seen per item
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp9
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.h5
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp32
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h1
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp4
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp14
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h1
7 files changed, 53 insertions, 13 deletions
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
index c355f09..f132f56 100644
--- a/noncore/net/wellenreiter/gui/logwindow.cpp
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -23,9 +23,9 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f )
23 ledit = new QMultiLineEdit( this ); 23 ledit = new QMultiLineEdit( this );
24 24
25 // FIXME: Set properties( font, read-only, etc...) 25 // FIXME: Set properties( font, read-only, etc...)
26 26
27}; 27}
28 28
29void MLogWindow::log( QString text ) 29void MLogWindow::log( QString text )
30{ 30{
31 QTime time = QTime::currentTime(); 31 QTime time = QTime::currentTime();
@@ -33,7 +33,10 @@ void MLogWindow::log( QString text )
33 line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text ); 33 line.sprintf( "[%s] %s", (const char*) time.toString(), (const char*) text );
34 ledit->append( line ); 34 ledit->append( line );
35 qDebug( line ); 35 qDebug( line );
36 36
37}; 37}
38
39 38
39const QString MLogWindow::getLog() const
40{
41 return ledit->text();
42}
diff --git a/noncore/net/wellenreiter/gui/logwindow.h b/noncore/net/wellenreiter/gui/logwindow.h
index 325f8d0..253defa 100644
--- a/noncore/net/wellenreiter/gui/logwindow.h
+++ b/noncore/net/wellenreiter/gui/logwindow.h
@@ -25,11 +25,12 @@ class MLogWindow: public QVBox
25{ 25{
26 26
27 public: 27 public:
28 MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 ); 28 MLogWindow( QWidget * parent = 0, const char * name = "MLogWindow", WFlags f = 0 );
29 29
30 void log( QString text ); 30 void log( QString text );
31 31 const QString getLog() const;
32
32 protected: 33 protected:
33 QMultiLineEdit* ledit; 34 QMultiLineEdit* ledit;
34 35
35}; 36};
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 2d5ecd2..cb003dd 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -13,18 +13,21 @@
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "configwindow.h" 16#include "configwindow.h"
17#include "logwindow.h"
17#include "mainwindow.h" 18#include "mainwindow.h"
18#include "wellenreiter.h" 19#include "wellenreiter.h"
19 20
20#include "scanlist.h" 21#include "scanlist.h"
21 22
22#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qfile.h>
23#include <qiconset.h> 25#include <qiconset.h>
24#include <qmenubar.h> 26#include <qmenubar.h>
25#include <qpopupmenu.h> 27#include <qpopupmenu.h>
26#include <qstatusbar.h> 28#include <qstatusbar.h>
29#include <qtextstream.h>
27#include <qtoolbutton.h> 30#include <qtoolbutton.h>
28 31
29#ifdef QWS 32#ifdef QWS
30#include <qpe/resource.h> 33#include <qpe/resource.h>
@@ -78,13 +81,19 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
78 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 81 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
79 82
80 // setup menu bar 83 // setup menu bar
81 84
85 int id;
86
82 QMenuBar* mb = menuBar(); 87 QMenuBar* mb = menuBar();
83 88
89 QPopupMenu* fileSave = new QPopupMenu( mb );
90 fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) );
91
84 QPopupMenu* file = new QPopupMenu( mb ); 92 QPopupMenu* file = new QPopupMenu( mb );
85 file->insertItem( "&Load..." ); 93 id = file->insertItem( "&Load" );
86 file->insertItem( "&Save..." ); 94 file->setItemEnabled( id, false );
95 file->insertItem( "&Save", fileSave );
87 96
88 QPopupMenu* view = new QPopupMenu( mb ); 97 QPopupMenu* view = new QPopupMenu( mb );
89 view->insertItem( "&Configure..." ); 98 view->insertItem( "&Configure..." );
90 99
@@ -94,11 +103,9 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
94 103
95 QPopupMenu* demo = new QPopupMenu( mb ); 104 QPopupMenu* demo = new QPopupMenu( mb );
96 demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); 105 demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) );
97 106
98 int id;
99 id = mb->insertItem( "&File", file ); 107 id = mb->insertItem( "&File", file );
100 mb->setItemEnabled( id, false );
101 id = mb->insertItem( "&View", view ); 108 id = mb->insertItem( "&View", view );
102 mb->setItemEnabled( id, false ); 109 mb->setItemEnabled( id, false );
103 id = mb->insertItem( "&Sniffer", sniffer ); 110 id = mb->insertItem( "&Sniffer", sniffer );
104 mb->setItemEnabled( id, false ); 111 mb->setItemEnabled( id, false );
@@ -171,4 +178,21 @@ void WellenreiterMainWindow::demoAddStations()
171 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); 178 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 );
172 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); 179 mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 );
173} 180}
174 181
182void WellenreiterMainWindow::fileSaveLog()
183{
184 const QString fname( "/tmp/log.txt" );
185 QFile f( fname );
186 if ( f.open(IO_WriteOnly) )
187 {
188 QTextStream t( &f );
189 t << mw->logWindow()->getLog();
190 f.close();
191 qDebug( "saved log in file '%s'", (const char*) fname );
192 }
193 else
194 {
195 qDebug( "Problem saving log in file '%s'", (const char*) fname );
196 }
197
198} \ No newline at end of file
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index 22c21e8..03aa08a 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -45,7 +45,8 @@ class WellenreiterMainWindow: public QMainWindow
45 45
46 public slots: 46 public slots:
47 void showConfigure(); 47 void showConfigure();
48 void demoAddStations(); 48 void demoAddStations();
49 void fileSaveLog();
49}; 50};
50 51
51#endif 52#endif
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index ab19701..a689cca 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -40,8 +40,12 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
40 addColumn( tr( "T" ) ); 40 addColumn( tr( "T" ) );
41 setColumnAlignment( 5, AlignCenter ); 41 setColumnAlignment( 5, AlignCenter );
42 addColumn( tr( "Manufacturer" ) ); 42 addColumn( tr( "Manufacturer" ) );
43 setColumnAlignment( 6, AlignCenter ); 43 setColumnAlignment( 6, AlignCenter );
44 addColumn( tr( "First Seen" ) );
45 setColumnAlignment( 7, AlignCenter );
46 addColumn( tr( "Last Seen" ) );
47 setColumnAlignment( 8, AlignCenter );
44 setRootIsDecorated( true ); 48 setRootIsDecorated( true );
45 setAllColumnsShowFocus( true ); 49 setAllColumnsShowFocus( true );
46}; 50};
47 51
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 15aef0c..dd33f5f 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -14,8 +14,9 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlistitem.h" 16#include "scanlistitem.h"
17#include <assert.h> 17#include <assert.h>
18#include <qdatetime.h>
18#include <qpixmap.h> 19#include <qpixmap.h>
19 20
20#ifdef QWS 21#ifdef QWS
21#include <qpe/resource.h> 22#include <qpe/resource.h>
@@ -30,8 +31,10 @@ const int col_ap = 2;
30const int col_channel = 3; 31const int col_channel = 3;
31const int col_wep = 4; 32const int col_wep = 4;
32const int col_traffic = 5; 33const int col_traffic = 5;
33const int col_manuf = 6; 34const int col_manuf = 6;
35const int col_firstseen = 7;
36const int col_lastseen = 8;
34 37
35MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, 38MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr,
36 bool wep, int channel, int signal ) 39 bool wep, int channel, int signal )
37 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), 40 :QListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ),
@@ -64,19 +67,22 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
64 setPixmap( col_type, Resource::loadPixmap( name ) ); 67 setPixmap( col_type, Resource::loadPixmap( name ) );
65 68
66 // set icon for wep (wireless encryption protocol) 69 // set icon for wep (wireless encryption protocol)
67 if ( wep ) 70 if ( wep )
68 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! 71 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
69 72
70 // set channel and signal text 73 // set channel and signal text
71 74
72 if ( signal != -1 ) 75 if ( signal != -1 )
73 setText( col_sig, QString::number( signal ) ); 76 setText( col_sig, QString::number( signal ) );
74 if ( channel != -1 ) 77 if ( channel != -1 )
75 setText( col_channel, QString::number( channel ) ); 78 setText( col_channel, QString::number( channel ) );
76 79
80 setText( col_firstseen, QTime::currentTime().toString() );
81 //setText( col_lastseen, QTime::currentTime().toString() );
82
77 listView()->triggerUpdate(); 83 listView()->triggerUpdate();
78 84
79 this->type = type; 85 this->type = type;
80 86
81} 87}
82 88
@@ -91,6 +97,6 @@ void MScanListItem::receivedBeacon()
91 #ifdef DEBUG 97 #ifdef DEBUG
92 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); 98 qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons );
93 #endif 99 #endif
94 setText( col_sig, QString::number( _beacons ) ); 100 setText( col_sig, QString::number( _beacons ) );
101 setText( col_lastseen, QTime::currentTime().toString() );
95} 102}
96
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 61960d2..ff523d4 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -51,8 +51,9 @@ class Wellenreiter : public WellenreiterBase {
51 ~Wellenreiter(); 51 ~Wellenreiter();
52 52
53 void setConfigWindow( WellenreiterConfigWindow* cw ); 53 void setConfigWindow( WellenreiterConfigWindow* cw );
54 MScanListView* netView() const { return netview; }; 54 MScanListView* netView() const { return netview; };
55 MLogWindow* logWindow() const { return logwindow; };
55 56
56 protected: 57 protected:
57 bool daemonRunning; 58 bool daemonRunning;
58 59