-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.cpp | 9 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/logwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 32 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.h | 1 |
7 files changed, 49 insertions, 9 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 @@ -25,5 +25,5 @@ MLogWindow::MLogWindow( QWidget * parent, const char * name, WFlags f ) // FIXME: Set properties( font, read-only, etc...) -}; +} void MLogWindow::log( QString text ) @@ -35,5 +35,8 @@ void MLogWindow::log( QString text ) qDebug( line ); -}; - +} +const QString MLogWindow::getLog() const +{ + return ledit->text(); +} 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 @@ -29,4 +29,5 @@ class MLogWindow: public QVBox void log( QString text ); + const QString getLog() const; protected: 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 @@ -15,4 +15,5 @@ #include "configwindow.h" +#include "logwindow.h" #include "mainwindow.h" #include "wellenreiter.h" @@ -21,8 +22,10 @@ #include <qcombobox.h> +#include <qfile.h> #include <qiconset.h> #include <qmenubar.h> #include <qpopupmenu.h> #include <qstatusbar.h> +#include <qtextstream.h> #include <qtoolbutton.h> @@ -80,9 +83,15 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n // setup menu bar + int id; + QMenuBar* mb = menuBar(); + QPopupMenu* fileSave = new QPopupMenu( mb ); + fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); + QPopupMenu* file = new QPopupMenu( mb ); - file->insertItem( "&Load..." ); - file->insertItem( "&Save..." ); + id = file->insertItem( "&Load" ); + file->setItemEnabled( id, false ); + file->insertItem( "&Save", fileSave ); QPopupMenu* view = new QPopupMenu( mb ); @@ -96,7 +105,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); - int id; id = mb->insertItem( "&File", file ); - mb->setItemEnabled( id, false ); id = mb->insertItem( "&View", view ); mb->setItemEnabled( id, false ); @@ -173,2 +180,19 @@ void WellenreiterMainWindow::demoAddStations() } +void WellenreiterMainWindow::fileSaveLog() +{ + const QString fname( "/tmp/log.txt" ); + QFile f( fname ); + if ( f.open(IO_WriteOnly) ) + { + QTextStream t( &f ); + t << mw->logWindow()->getLog(); + f.close(); + qDebug( "saved log in file '%s'", (const char*) fname ); + } + else + { + qDebug( "Problem saving log in file '%s'", (const char*) fname ); + } + +}
\ 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 @@ -47,4 +47,5 @@ class WellenreiterMainWindow: public QMainWindow void showConfigure(); void demoAddStations(); + void fileSaveLog(); }; 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 @@ -42,4 +42,8 @@ MScanListView::MScanListView( QWidget* parent, const char* name ) addColumn( tr( "Manufacturer" ) ); setColumnAlignment( 6, AlignCenter ); + addColumn( tr( "First Seen" ) ); + setColumnAlignment( 7, AlignCenter ); + addColumn( tr( "Last Seen" ) ); + setColumnAlignment( 8, AlignCenter ); setRootIsDecorated( true ); setAllColumnsShowFocus( true ); 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 @@ -16,4 +16,5 @@ #include "scanlistitem.h" #include <assert.h> +#include <qdatetime.h> #include <qpixmap.h> @@ -32,4 +33,6 @@ const int col_wep = 4; const int col_traffic = 5; const int col_manuf = 6; +const int col_firstseen = 7; +const int col_lastseen = 8; MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, @@ -66,5 +69,5 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, // set icon for wep (wireless encryption protocol) if ( wep ) - setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); // rename the pixmap! + setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! // set channel and signal text @@ -75,4 +78,7 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, setText( col_channel, QString::number( channel ) ); + setText( col_firstseen, QTime::currentTime().toString() ); + //setText( col_lastseen, QTime::currentTime().toString() ); + listView()->triggerUpdate(); @@ -93,4 +99,4 @@ void MScanListItem::receivedBeacon() #endif setText( col_sig, QString::number( _beacons ) ); + setText( col_lastseen, QTime::currentTime().toString() ); } - 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 @@ -53,4 +53,5 @@ class Wellenreiter : public WellenreiterBase { void setConfigWindow( WellenreiterConfigWindow* cw ); MScanListView* netView() const { return netview; }; + MLogWindow* logWindow() const { return logwindow; }; protected: |