summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-02-24 21:37:49 (UTC)
committer mickeyl <mickeyl>2003-02-24 21:37:49 (UTC)
commitd14b92ef8984ae654ff187bf6c8f5946d3ba218d (patch) (side-by-side diff)
treefd209280150b48eb137315d9bfe693892525697e
parent93151a1467b45759d320ce6673160190d6ab8872 (diff)
downloadopie-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 (more/less context) (show whitespace changes)
-rw-r--r--noncore/net/wellenreiter/cornucopia/olistview.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp58
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h4
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp14
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h4
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp21
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.h4
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp5
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h1
9 files changed, 105 insertions, 14 deletions
diff --git a/noncore/net/wellenreiter/cornucopia/olistview.cpp b/noncore/net/wellenreiter/cornucopia/olistview.cpp
index bca17b2..8bc59de 100644
--- a/noncore/net/wellenreiter/cornucopia/olistview.cpp
+++ b/noncore/net/wellenreiter/cornucopia/olistview.cpp
@@ -203,8 +203,8 @@ bool OListViewItem::isAlternate()
// check if the item above is an OListViewItem
OListViewItem *above = static_cast<OListViewItem*>( itemAbove() );
- /*if (not itemAbove()->inherits( "OListViewItem" )) return false;*/
+ /*if (! itemAbove()->inherits( "OListViewItem" )) return false;*/
// check if we have a valid alternate background color
- if (not (lv && lv->alternateBackground().isValid())) return false;
+ if (!(lv && lv->alternateBackground().isValid())) return false;
m_known = above ? above->m_known : true;
@@ -222,5 +222,5 @@ bool OListViewItem::isAlternate()
if ( item /*&& item->inherits( "OListViewItem" )*/ ) previous = item->m_odd;
item = static_cast<OListViewItem *>(parent()->firstChild());
- /* if !( item.inherits( "OListViewItem" ) item = 0; */
+ /* if ( !item.inherits( "OListViewItem" ) item = 0; */
}
else
@@ -234,5 +234,5 @@ bool OListViewItem::isAlternate()
item->m_known = true;
item = static_cast<OListViewItem *>(item->nextSibling());
- /* if !(item.inherits( "OListViewItem" ) ) break; */
+ /* if (!item.inherits( "OListViewItem" ) ) break; */
}
}
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
@@ -25,4 +25,5 @@
#include <qiconset.h>
#include <qmenubar.h>
+#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qstatusbar.h>
@@ -60,5 +61,7 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
startStopButton = new QToolButton( 0 );
+ #ifdef QWS
startStopButton->setAutoRaise( true );
+ #endif
#ifdef QWS
startStopButton->setOnIconSet( *cancelIconSet );
@@ -72,10 +75,14 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
QToolButton* c = new QToolButton( 0 );
+ #ifdef QWS
c->setAutoRaise( true );
+ #endif
c->setIconSet( *infoIconSet );
c->setEnabled( false );
QToolButton* d = new QToolButton( 0 );
+ #ifdef QWS
d->setAutoRaise( true );
+ #endif
d->setIconSet( *settingsIconSet );
connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
@@ -88,8 +95,13 @@ 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 );
file->insertItem( "&Save", fileSave );
@@ -173,9 +185,9 @@ WellenreiterMainWindow::~WellenreiterMainWindow()
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 );
}
@@ -189,10 +201,40 @@ void WellenreiterMainWindow::fileSaveLog()
t << mw->logWindow()->getLog();
f.close();
- qDebug( "saved log in file '%s'", (const char*) fname );
+ qDebug( "Saved log to file '%s'", (const char*) fname );
}
else
{
- qDebug( "Problem saving log in file '%s'", (const char*) fname );
+ qDebug( "Problem saving log to file '%s'", (const char*) fname );
}
} \ 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 );
+ }
+}
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index 03aa08a..8bfccf3 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -44,8 +44,12 @@ class WellenreiterMainWindow: public QMainWindow
QToolButton* startStopButton;
+ protected:
+ virtual void closeEvent( QCloseEvent* );
+
public slots:
void showConfigure();
void demoAddStations();
void fileSaveLog();
+ void fileSaveSession();
};
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 6d3469c..cdc2c48 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -21,4 +21,6 @@
#include "manufacturers.h"
+#include <qtextstream.h>
+
MScanListView::MScanListView( QWidget* parent, const char* name )
:OListView( parent, name ), _manufacturerdb( 0 )
@@ -152,2 +154,14 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
}
+void MScanListView::dump( QTextStream& t ) const
+{
+ qDebug( "dumping scanlist..." );
+
+ QListViewItemIterator it( const_cast<MScanListView*>( this ) );
+ for ( ; it.current(); ++it )
+ {
+ static_cast<MScanListItem*>( it.current() )->dump( t );
+ }
+
+ qDebug( "dump finished." );
+}
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h
index 475f7b6..f06f251 100644
--- a/noncore/net/wellenreiter/gui/scanlist.h
+++ b/noncore/net/wellenreiter/gui/scanlist.h
@@ -19,6 +19,7 @@
#include <cornucopia/olistview.h>
-class QString;
+#include <qtextstream.h>
+class QString;
class ManufacturerDB;
@@ -32,4 +33,5 @@ class MScanListView: public OListView
void setManufacturerDB( ManufacturerDB* manufacturerdb );
+ void dump( QTextStream& t ) const;
public slots:
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index bfa7aa9..4aecd2b 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -84,5 +84,10 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
this->type = type;
-
+ _type = type;
+ _essid = essid;
+ _macaddr = macaddr;
+ _channel = channel;
+ _beacons = 0;
+ _signal = 0;
}
@@ -101,2 +106,16 @@ void MScanListItem::receivedBeacon()
setText( col_lastseen, QTime::currentTime().toString() );
}
+
+void MScanListItem::dump( QTextStream& t ) const
+{
+ qDebug( "dumping scanlistitem at <%d>", this );
+ t << "<ITEM type=" << _type;
+ t << " ESSID='" << _essid;
+ t << "' MAC=" << _macaddr;
+ t << " WEP=" << _wep;
+ t << " CHANNEL=" << _channel;
+ t << " SIGNAL=" << _signal;
+ t << " BEACONS=" << _beacons;
+ t << ">\n";
+}
+
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h
index 89b3bc4..5f6ae40 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.h
+++ b/noncore/net/wellenreiter/gui/scanlistitem.h
@@ -19,4 +19,6 @@
#include <cornucopia/olistview.h>
+#include <qtextstream.h>
+
class QString;
@@ -65,4 +67,6 @@ class MScanListItem: public OListViewItem
void setManufacturer( const QString& manufacturer );
+ void dump( QTextStream& t ) const;
+
private:
QString _type;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index c599bb4..1ccf971 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -124,4 +124,9 @@ Wellenreiter::~Wellenreiter()
delete manufacturerdb;
+ if ( daemon_fd != -1 )
+ {
+ qDebug( "closing comm socket" );
+ close( daemon_fd );
+ }
}
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index ff523d4..ee9dca9 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -54,4 +54,5 @@ class Wellenreiter : public WellenreiterBase {
MScanListView* netView() const { return netview; };
MLogWindow* logWindow() const { return logwindow; };
+ bool isDaemonRunning() const { return daemonRunning; };
protected: