summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/mainwindow.cpp
Side-by-side diff
Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index d4988af..8e0164f 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -1,44 +1,44 @@
/**********************************************************************
** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
**
** This file is part of Opie Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
**********************************************************************/
#include "configwindow.h"
#include "logwindow.h"
+#include "hexwindow.h"
#include "mainwindow.h"
#include "wellenreiter.h"
-
#include "scanlist.h"
#include <qcombobox.h>
#include <qdatastream.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qiconset.h>
#include <qmenubar.h>
#include <qmessagebox.h>
#include <qpopupmenu.h>
#include <qstatusbar.h>
#include <qtextstream.h>
#include <qtoolbutton.h>
#ifdef QWS
#include <qpe/resource.h>
#include <opie/ofiledialog.h>
#else
#include "resource.h"
#include <qapplication.h>
#include <qfiledialog.h>
#endif
WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f )
@@ -93,48 +93,49 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
c->setEnabled( false );
QToolButton* d = new QToolButton( 0 );
#ifdef QWS
d->setAutoRaise( true );
#endif
d->setIconSet( *settingsIconSet );
connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
// setup menu bar
int id;
QMenuBar* mb = menuBar();
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 );
+ file->insertItem( "&New", this, SLOT( fileNew() ) );
id = file->insertItem( "&Load", fileLoad );
file->insertItem( "&Save", fileSave );
file->insertSeparator();
file->insertItem( "&Exit", qApp, SLOT( quit() ) );
QPopupMenu* view = new QPopupMenu( mb );
view->insertItem( "&Configure..." );
QPopupMenu* sniffer = new QPopupMenu( mb );
sniffer->insertItem( "&Configure..." );
sniffer->insertSeparator();
QPopupMenu* demo = new QPopupMenu( mb );
demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) );
id = mb->insertItem( "&File", file );
id = mb->insertItem( "&View", view );
mb->setItemEnabled( id, false );
id = mb->insertItem( "&Sniffer", sniffer );
mb->setItemEnabled( id, false );
id = mb->insertItem( "&Demo", demo );
mb->setItemEnabled( id, true );
#ifdef QWS
@@ -278,36 +279,43 @@ void WellenreiterMainWindow::fileSaveSession()
}
}
}
void WellenreiterMainWindow::fileLoadSession()
{
QString fname = getFileName( false );
if ( !fname.isEmpty() )
{
QFile f( fname );
if ( f.open(IO_ReadOnly) )
{
QDataStream t( &f );
t >> *mw->netView();
f.close();
qDebug( "Loaded session from file '%s'", (const char*) fname );
}
else
{
qDebug( "Problem loading session from file '%s'", (const char*) fname );
}
}
}
+void WellenreiterMainWindow::fileNew()
+{
+ mw->netView()->clear();
+ mw->logWindow()->clear();
+ mw->hexWindow()->clear();
+}
+
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 );
}
}