summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-05-03 13:50:22 (UTC)
committer mickeyl <mickeyl>2004-05-03 13:50:22 (UTC)
commitaad04cffe30ef133edcd5051ce7e486f27599d83 (patch) (side-by-side diff)
tree830ccec1732ae743073511268c7bb67764c4fb6b
parent9efa98c49988a41de7613f56818f2e31bb24e22b (diff)
downloadopie-aad04cffe30ef133edcd5051ce7e486f27599d83.zip
opie-aad04cffe30ef133edcd5051ce7e486f27599d83.tar.gz
opie-aad04cffe30ef133edcd5051ce7e486f27599d83.tar.bz2
don't always write a capture file
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp30
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp12
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.h2
3 files changed, 22 insertions, 22 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 8525109..ef7ffcf 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -28,9 +28,9 @@
#include <opie2/ofiledialog.h>
#else
#include "resource.h"
#include <qapplication.h>
-#include <qfiledialog.h>
+#include <qfiledialog.h>
#endif
using namespace Opie::Core;
using namespace Opie::Net;
using namespace Opie::Ui;
@@ -188,9 +188,9 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
void WellenreiterMainWindow::showConfigure()
{
- odebug << "show configure..." << oendl;
+ odebug << "show configure..." << oendl;
cw->setCaption( tr( "Configure" ) );
int result = QPEApplication::execDialog( cw );
if ( result ) updateToolButtonState();
@@ -221,9 +221,9 @@ void WellenreiterMainWindow::changedSniffingState()
menuBar()->setItemEnabled( startID, !mw->sniffing );
stopButton->setEnabled( mw->sniffing );
menuBar()->setItemEnabled( stopID, mw->sniffing );
- if ( !mw->sniffing )
+ if ( !mw->sniffing && QFile::exists( mw->dumpname ) )
{
menuBar()->setItemEnabled( uploadID, true );
uploadButton->setEnabled( true );
}
@@ -231,9 +231,9 @@ void WellenreiterMainWindow::changedSniffingState()
WellenreiterMainWindow::~WellenreiterMainWindow()
{
- odebug << "Wellenreiter: bye." << oendl;
+ odebug << "Wellenreiter: bye." << oendl;
};
void WellenreiterMainWindow::demoAddStations()
@@ -251,9 +251,9 @@ void WellenreiterMainWindow::demoAddStations()
void WellenreiterMainWindow::demoReadFromGps()
{
WellenreiterConfigWindow* configwindow = WellenreiterConfigWindow::instance();
GPS* gps = new GPS( this );
- odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl;
+ odebug << "Wellenreiter::demoReadFromGps(): url=gps://" << configwindow->gpsdHost->currentText() << ":" << configwindow->gpsdPort->value() << "/" << oendl;
gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
GpsLocation loc = gps->position();
QMessageBox::information( this, "Wellenreiter/Opie", tr( "GPS said:\n%1" ).arg( loc.dmsPosition() ) );
delete gps;
@@ -305,13 +305,13 @@ void WellenreiterMainWindow::fileSaveLog()
{
QTextStream t( &f );
t << mw->logWindow()->getLog();
f.close();
- odebug << "Saved log to file '" << fname << "'" << oendl;
+ odebug << "Saved log to file '" << fname << "'" << oendl;
}
else
{
- odebug << "Problem saving log to file '" << fname << "'" << oendl;
+ odebug << "Problem saving log to file '" << fname << "'" << oendl;
}
}
}
@@ -326,13 +326,13 @@ void WellenreiterMainWindow::fileSaveSession()
{
QDataStream t( &f );
t << *mw->netView();
f.close();
- odebug << "Saved session to file '" << fname << "'" << oendl;
+ odebug << "Saved session to file '" << fname << "'" << oendl;
}
else
{
- odebug << "Problem saving session to file '" << fname << "'" << oendl;
+ odebug << "Problem saving session to file '" << fname << "'" << oendl;
}
}
}
@@ -348,13 +348,13 @@ void WellenreiterMainWindow::fileSaveHex()
{
QTextStream t( &f );
t << mw->hexWindow()->getLog();
f.close();
- odebug << "Saved hex log to file '" << fname << "'" << oendl;
+ odebug << "Saved hex log to file '" << fname << "'" << oendl;
}
else
{
- odebug << "Problem saving hex log to file '" << fname << "'" << oendl;
+ odebug << "Problem saving hex log to file '" << fname << "'" << oendl;
}
}
*/
}
@@ -369,13 +369,13 @@ void WellenreiterMainWindow::fileLoadSession()
{
QDataStream t( &f );
t >> *mw->netView();
f.close();
- odebug << "Loaded session from file '" << fname << "'" << oendl;
+ odebug << "Loaded session from file '" << fname << "'" << oendl;
}
else
{
- odebug << "Problem loading session from file '" << fname << "'" << oendl;
+ odebug << "Problem loading session from file '" << fname << "'" << oendl;
}
}
}
@@ -438,13 +438,13 @@ void WellenreiterMainWindow::uploadSession()
int result = d->exec();
if ( !result )
{
- odebug << "Session upload cancelled :(" << oendl;
+ odebug << "Session upload cancelled :(" << oendl;
return;
}
- odebug << "Starting upload..." << oendl;
+ odebug << "Starting upload..." << oendl;
struct sockaddr_in raddr;
struct hostent *rhost_info;
int sock = -1;
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index fe8f22d..2f85790 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -112,8 +112,9 @@ void Wellenreiter::signalHandler( int sig )
{
oerr << "Aye! Received SIGSEGV or SIGBUS! Trying to exit gracefully..." << oendl;
if ( Wellenreiter::instance->sniffing )
{
+ Wellenreiter::instance->pcap->closeDumpFile();
Wellenreiter::instance->pcap->close();
Wellenreiter::instance->stopClicked();
}
oerr << "Phew. Seemed to work." << oendl;
@@ -621,20 +622,19 @@ void Wellenreiter::startClicked()
dumpname.append( '-' );
dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
dumpname.append( ".wellenreiter" );
}
- else // write it anyway ;)
- {
- dumpname = "/var/log/dump.wellenreiter";
- }
if ( cardtype != DEVTYPE_FILE )
pcap->open( interface );
else
pcap->openCaptureFile( interface );
- odebug << "Wellenreiter:: dumping to " << dumpname << "" << oendl;
- pcap->openDumpFile( dumpname );
+ if ( configwindow->writeCaptureFile->isChecked() )
+ {
+ odebug << "Wellenreiter:: dumping to " << dumpname << oendl;
+ pcap->openDumpFile( dumpname );
+ }
if ( !pcap->isOpen() )
{
QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.h b/noncore/net/wellenreiter/gui/wellenreiter.h
index 32e5690..f582a5f 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.h
+++ b/noncore/net/wellenreiter/gui/wellenreiter.h
@@ -54,8 +54,9 @@ class Wellenreiter : public WellenreiterBase {
bool isDaemonRunning() const { return sniffing; };
QString captureFileName() const { return dumpname; };
public:
+ QString dumpname;
bool sniffing;
static Wellenreiter* instance;
static void signalHandler( int sig );
@@ -96,9 +97,8 @@ class Wellenreiter : public WellenreiterBase {
#ifdef QWS
Opie::Core::OSystem _system; // Opie Operating System identifier
#endif
- QString dumpname;
Opie::Net::OWirelessNetworkInterface* iface;
Opie::Net::OPacketCapturer* pcap;
WellenreiterConfigWindow* configwindow;
GPS* gps;