author | mickeyl <mickeyl> | 2003-02-24 21:37:49 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-02-24 21:37:49 (UTC) |
commit | d14b92ef8984ae654ff187bf6c8f5946d3ba218d (patch) (side-by-side diff) | |
tree | fd209280150b48eb137315d9bfe693892525697e /noncore/net/wellenreiter/gui/mainwindow.cpp | |
parent | 93151a1467b45759d320ce6673160190d6ab8872 (diff) | |
download | opie-d14b92ef8984ae654ff187bf6c8f5946d3ba218d.zip opie-d14b92ef8984ae654ff187bf6c8f5946d3ba218d.tar.gz opie-d14b92ef8984ae654ff187bf6c8f5946d3ba218d.tar.bz2 |
- work around yet another g++ 2.x bug
- started work on saving session to xml
[ any classes from libopie I can reuse without too much effort? ]
Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 58 |
1 files changed, 50 insertions, 8 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index cb003dd..e388fc5 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp @@ -26,2 +26,3 @@ #include <qmenubar.h> +#include <qmessagebox.h> #include <qpopupmenu.h> @@ -61,3 +62,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n startStopButton = new QToolButton( 0 ); + #ifdef QWS startStopButton->setAutoRaise( true ); + #endif #ifdef QWS @@ -73,3 +76,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QToolButton* c = new QToolButton( 0 ); + #ifdef QWS c->setAutoRaise( true ); + #endif c->setIconSet( *infoIconSet ); @@ -78,3 +83,5 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QToolButton* d = new QToolButton( 0 ); + #ifdef QWS d->setAutoRaise( true ); + #endif d->setIconSet( *settingsIconSet ); @@ -89,6 +96,11 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n QPopupMenu* fileSave = new QPopupMenu( mb ); + fileSave->insertItem( "&Session", this, SLOT( fileSaveSession() ) ); fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); + QPopupMenu* fileLoad = new QPopupMenu( mb ); + fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); + fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); + QPopupMenu* file = new QPopupMenu( mb ); - id = file->insertItem( "&Load" ); + id = file->insertItem( "&Load", fileLoad ); file->setItemEnabled( id, false ); @@ -174,7 +186,7 @@ void WellenreiterMainWindow::demoAddStations() { - mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:43", true, 6, 80 ); - mw->netView()->addNewItem( "managed", "Vanille", "04:00:20:EF:A6:23", true, 11, 10 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:43:E7:16:22", false, 3, 10 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:53:E7:56:62", false, 3, 15 ); - mw->netView()->addNewItem( "adhoc", "ELAN", "40:03:63:E7:56:E2", false, 3, 20 ); + mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); + mw->netView()->addNewItem( "managed", "Vanille", "00:00:1c:EF:A6:23", true, 11, 10 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); + mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); } @@ -190,3 +202,3 @@ void WellenreiterMainWindow::fileSaveLog() f.close(); - qDebug( "saved log in file '%s'", (const char*) fname ); + qDebug( "Saved log to file '%s'", (const char*) fname ); } @@ -194,3 +206,3 @@ void WellenreiterMainWindow::fileSaveLog() { - qDebug( "Problem saving log in file '%s'", (const char*) fname ); + qDebug( "Problem saving log to file '%s'", (const char*) fname ); } @@ -198 +210,31 @@ void WellenreiterMainWindow::fileSaveLog() }
\ No newline at end of file + +void WellenreiterMainWindow::fileSaveSession() +{ + const QString fname( "/tmp/session.xml" ); + QFile f( fname ); + if ( f.open(IO_WriteOnly) ) + { + QTextStream t( &f ); + mw->netView()->dump( t ); + f.close(); + qDebug( "Saved session to file '%s'", (const char*) fname ); + } + else + { + qDebug( "Problem saving session to file '%s'", (const char*) fname ); + } +} + +void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) +{ + if ( mw->isDaemonRunning() ) + { + QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); + e->ignore(); + } + else + { + QMainWindow::closeEvent( e ); + } +} |