summaryrefslogtreecommitdiff
path: root/noncore
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 /noncore
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 (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/cornucopia/olistview.cpp8
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp60
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h4
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp32
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.h10
-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, 118 insertions, 27 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
@@ -204,6 +204,6 @@ bool OListViewItem::isAlternate()
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;
@@ -223,3 +223,3 @@ bool OListViewItem::isAlternate()
item = static_cast<OListViewItem *>(parent()->firstChild());
- /* if !( item.inherits( "OListViewItem" ) item = 0; */
+ /* if ( !item.inherits( "OListViewItem" ) item = 0; */
}
@@ -235,3 +235,3 @@ bool OListViewItem::isAlternate()
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
@@ -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,21 @@ void WellenreiterMainWindow::fileSaveLog()
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 to file '%s'", (const char*) fname );
+ }
+
+}
+
+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 );
}
@@ -194,5 +224,17 @@ void WellenreiterMainWindow::fileSaveLog()
{
- qDebug( "Problem saving log in file '%s'", (const char*) fname );
+ qDebug( "Problem saving session to file '%s'", (const char*) fname );
}
+}
-} \ No newline at end of file
+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
@@ -45,2 +45,5 @@ class WellenreiterMainWindow: public QMainWindow
+ protected:
+ virtual void closeEvent( QCloseEvent* );
+
public slots:
@@ -49,2 +52,3 @@ class WellenreiterMainWindow: public QMainWindow
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
@@ -22,2 +22,4 @@
+#include <qtextstream.h>
+
MScanListView::MScanListView( QWidget* parent, const char* name )
@@ -28,3 +30,3 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
setFrameShadow( QListView::Sunken );
-
+
addColumn( tr( "Net/Station" ) );
@@ -127,13 +129,13 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
s.sprintf( "(i) new network: '%s'", (const char*) essid );
-
+
network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
- }
-
-
+ }
+
+
// insert new station as child from network
-
+
// no essid to reduce clutter, maybe later we have a nick or stationname to display!?
-
+
qDebug( "inserting new station %s", (const char*) macaddr );
-
+
MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
@@ -150,4 +152,16 @@ 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
@@ -20,4 +20,5 @@
-class QString;
+#include <qtextstream.h>
+class QString;
class ManufacturerDB;
@@ -27,3 +28,3 @@ class MScanListView: public OListView
Q_OBJECT
-
+
public:
@@ -31,5 +32,6 @@ class MScanListView: public OListView
virtual ~MScanListView();
-
+
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
@@ -85,3 +85,8 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
this->type = type;
-
+ _type = type;
+ _essid = essid;
+ _macaddr = macaddr;
+ _channel = channel;
+ _beacons = 0;
+ _signal = 0;
}
@@ -102 +107,15 @@ void MScanListItem::receivedBeacon()
}
+
+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
@@ -20,2 +20,4 @@
+#include <qtextstream.h>
+
class QString;
@@ -66,2 +68,4 @@ class MScanListItem: public OListViewItem
+ void dump( QTextStream& t ) const;
+
private:
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
@@ -125,2 +125,7 @@ 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
@@ -55,2 +55,3 @@ class Wellenreiter : public WellenreiterBase {
MLogWindow* logWindow() const { return logwindow; };
+ bool isDaemonRunning() const { return daemonRunning; };