summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-12-09 21:33:48 (UTC)
committer mickeyl <mickeyl>2003-12-09 21:33:48 (UTC)
commit0a1f6405780b18c9f3d953adcfd072de8fd4dc18 (patch) (unidiff)
treeb155d2ee3c7766155b028f4e8ee92599fd50e8a9
parentdc1fc74ee3988fb3a89f6fc46cbcfe8b74416647 (diff)
downloadopie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.zip
opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.gz
opie-0a1f6405780b18c9f3d953adcfd072de8fd4dc18.tar.bz2
misc. fixes and preparations for uploading dumps
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.cpp56
-rw-r--r--noncore/net/wellenreiter/gui/mainwindow.h8
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp38
3 files changed, 54 insertions, 48 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp
index 868b0b0..ab7e0c7 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.cpp
+++ b/noncore/net/wellenreiter/gui/mainwindow.cpp
@@ -48,115 +48,112 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n
48 cw = new WellenreiterConfigWindow( this ); 48 cw = new WellenreiterConfigWindow( this );
49 mw = new Wellenreiter( this ); 49 mw = new Wellenreiter( this );
50 mw->setConfigWindow( cw ); 50 mw->setConfigWindow( cw );
51 setCentralWidget( mw ); 51 setCentralWidget( mw );
52 52
53 // setup application icon 53 // setup application icon
54 54
55 #ifndef QWS 55 #ifndef QWS
56 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); 56 setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) );
57 setIconText( "Wellenreiter/X11" ); 57 setIconText( "Wellenreiter/X11" );
58 #endif 58 #endif
59 59
60 // setup icon sets
61
62 infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) );
63 settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) );
64 startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) );
65 stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) );
66
67 // setup tool buttons 60 // setup tool buttons
68 61
69 startButton = new QToolButton( 0 ); 62 startButton = new QToolButton( 0 );
70 #ifdef QWS 63 #ifdef QWS
71 startButton->setAutoRaise( true ); 64 startButton->setAutoRaise( true );
72 #endif 65 #endif
73 startButton->setIconSet( *startIconSet ); 66 startButton->setIconSet( Resource::loadIconSet( "wellenreiter/SearchIcon" ) );
74 startButton->setEnabled( false ); 67 startButton->setEnabled( false );
75 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); 68 connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) );
76 69
77 stopButton = new QToolButton( 0 ); 70 stopButton = new QToolButton( 0 );
78 #ifdef QWS 71 #ifdef QWS
79 stopButton->setAutoRaise( true ); 72 stopButton->setAutoRaise( true );
80 #endif 73 #endif
81 stopButton->setIconSet( *stopIconSet ); 74 stopButton->setIconSet( Resource::loadIconSet( "wellenreiter/CancelIcon" ) );
82 stopButton->setEnabled( false ); 75 stopButton->setEnabled( false );
83 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); 76 connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) );
84 77
85 QToolButton* c = new QToolButton( 0 );
86 #ifdef QWS
87 c->setAutoRaise( true );
88 #endif
89 c->setIconSet( *infoIconSet );
90 c->setEnabled( false );
91
92 QToolButton* d = new QToolButton( 0 ); 78 QToolButton* d = new QToolButton( 0 );
93 #ifdef QWS 79 #ifdef QWS
94 d->setAutoRaise( true ); 80 d->setAutoRaise( true );
95 #endif 81 #endif
96 d->setIconSet( *settingsIconSet ); 82 d->setIconSet( Resource::loadIconSet( "wellenreiter/SettingsIcon" ) );
97 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); 83 connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) );
98 84
85 uploadButton = new QToolButton( 0 );
86 #ifdef QWS
87 uploadButton->setAutoRaise( true );
88 #endif
89 uploadButton->setIconSet( Resource::loadIconSet( "up" ) );
90 uploadButton->setEnabled( false );
91 connect( uploadButton, SIGNAL( clicked() ), this, SLOT( uploadSession() ) );
92
99 // setup menu bar 93 // setup menu bar
100 94
101 int id; 95 int id;
102 96
103 QMenuBar* mb = menuBar(); 97 QMenuBar* mb = menuBar();
104 98
105 QPopupMenu* fileSave = new QPopupMenu( mb ); 99 QPopupMenu* fileSave = new QPopupMenu( mb );
106 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); 100 fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) );
107 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); 101 fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) );
108 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); 102 fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) );
109 103
110 QPopupMenu* fileLoad = new QPopupMenu( mb ); 104 QPopupMenu* fileLoad = new QPopupMenu( mb );
111 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); 105 fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) );
112 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); 106 //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) );
113 107
114 QPopupMenu* file = new QPopupMenu( mb ); 108 QPopupMenu* file = new QPopupMenu( mb );
115 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); 109 file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) );
116 id = file->insertItem( tr( "&Load" ), fileLoad ); 110 id = file->insertItem( tr( "&Load" ), fileLoad );
117 file->insertItem( tr( "&Save" ), fileSave ); 111 file->insertItem( tr( "&Save" ), fileSave );
118 file->insertSeparator(); 112 file->insertSeparator();
113 uploadID = file->insertItem( tr( "&Upload Session" ), this, SLOT( uploadSession() ) );
114 file->insertSeparator();
119 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); 115 file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) );
120 116
121 QPopupMenu* view = new QPopupMenu( mb ); 117 QPopupMenu* view = new QPopupMenu( mb );
122 view->insertItem( tr( "&Configure..." ) ); 118 view->insertItem( tr( "&Configure..." ) );
123 119
124 QPopupMenu* sniffer = new QPopupMenu( mb ); 120 QPopupMenu* sniffer = new QPopupMenu( mb );
125 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); 121 sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) );
126 sniffer->insertSeparator(); 122 sniffer->insertSeparator();
127 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); 123 startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) );
128 sniffer->setItemEnabled( startID, false ); 124 sniffer->setItemEnabled( startID, false );
129 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); 125 stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) );
130 sniffer->setItemEnabled( stopID, false ); 126 sniffer->setItemEnabled( stopID, false );
131 127
132 QPopupMenu* demo = new QPopupMenu( mb ); 128 QPopupMenu* demo = new QPopupMenu( mb );
133 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); 129 demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) );
134 130
135 id = mb->insertItem( tr( "&File" ), file ); 131 id = mb->insertItem( tr( "&File" ), file );
136 //id = mb->insertItem( tr( "&View" ), view ); 132 //id = mb->insertItem( tr( "&View" ), view );
137 //mb->setItemEnabled( id, false ); 133 //mb->setItemEnabled( id, false );
138 id = mb->insertItem( tr( "&Sniffer" ), sniffer ); 134 id = mb->insertItem( tr( "&Sniffer" ), sniffer );
139 135
140 id = mb->insertItem( tr( "&Demo" ), demo ); 136 id = mb->insertItem( tr( "&Demo" ), demo );
141 mb->setItemEnabled( id, true ); 137 mb->setItemEnabled( id, true );
138 mb->setItemEnabled( uploadID, false );
142 139
143 #ifdef QWS 140 #ifdef QWS
144 mb->insertItem( startButton ); 141 mb->insertItem( startButton );
145 mb->insertItem( stopButton ); 142 mb->insertItem( stopButton );
146 mb->insertItem( c ); 143 mb->insertItem( uploadButton );
147 mb->insertItem( d ); 144 mb->insertItem( d );
148 #else // Qt3 changed the insertion order. It's now totally random :( 145 #else // Qt3 changed the insertion order. It's now totally random :(
149 mb->insertItem( d ); 146 mb->insertItem( d );
150 mb->insertItem( c ); 147 mb->insertItem( uploadButton );
151 mb->insertItem( stopButton ); 148 mb->insertItem( stopButton );
152 mb->insertItem( startButton ); 149 mb->insertItem( startButton );
153 #endif 150 #endif
154 151
155 updateToolButtonState(); 152 updateToolButtonState();
156 153
157 // setup status bar (for now only on X11) 154 // setup status bar (for now only on X11)
158 155
159 #ifndef QWS 156 #ifndef QWS
160 statusBar()->message( tr( "Ready." ) ); 157 statusBar()->message( tr( "Ready." ) );
161 #endif 158 #endif
162 159
@@ -170,60 +167,63 @@ void WellenreiterMainWindow::showConfigure()
170{ 167{
171 qDebug( "show configure..." ); 168 qDebug( "show configure..." );
172 cw->setCaption( tr( "Configure" ) ); 169 cw->setCaption( tr( "Configure" ) );
173 #ifdef QWS 170 #ifdef QWS
174 cw->showMaximized(); 171 cw->showMaximized();
175 #endif 172 #endif
176 int result = cw->exec(); 173 int result = cw->exec();
177 174
178 if ( result ) updateToolButtonState(); 175 if ( result ) updateToolButtonState();
179} 176}
180 177
181 178
182
183void WellenreiterMainWindow::updateToolButtonState() 179void WellenreiterMainWindow::updateToolButtonState()
184{ 180{
185 const QString& interface = cw->interfaceName->currentText(); 181 const QString& interface = cw->interfaceName->currentText();
186 const int cardtype = cw->driverType(); 182 const int cardtype = cw->driverType();
187 183
188 if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) 184 if ( ( interface != "<select>" ) && ( cardtype != 0 ) )
189 { 185 {
190 startButton->setEnabled( true ); 186 startButton->setEnabled( true );
191 menuBar()->setItemEnabled( startID, true ); 187 menuBar()->setItemEnabled( startID, true );
192 } 188 }
193 else 189 else
194 { 190 {
195 startButton->setEnabled( false ); 191 startButton->setEnabled( false );
196 menuBar()->setItemEnabled( startID, false ); 192 menuBar()->setItemEnabled( startID, false );
197 } 193 }
198} 194}
199 195
200 196
201void WellenreiterMainWindow::changedSniffingState() 197void WellenreiterMainWindow::changedSniffingState()
202{ 198{
203 startButton->setEnabled( !mw->sniffing ); 199 startButton->setEnabled( !mw->sniffing );
204 menuBar()->setItemEnabled( startID, !mw->sniffing ); 200 menuBar()->setItemEnabled( startID, !mw->sniffing );
205 stopButton->setEnabled( mw->sniffing ); 201 stopButton->setEnabled( mw->sniffing );
206 menuBar()->setItemEnabled( stopID, mw->sniffing ); 202 menuBar()->setItemEnabled( stopID, mw->sniffing );
203
204 if ( !mw->sniffing )
205 {
206 menuBar()->setItemEnabled( uploadID, true );
207 uploadButton->setEnabled( true );
208 }
207} 209}
208 210
209 211
210WellenreiterMainWindow::~WellenreiterMainWindow() 212WellenreiterMainWindow::~WellenreiterMainWindow()
211{ 213{
212 delete infoIconSet; 214 qDebug( "Wellenreiter:: bye." );
213 delete settingsIconSet;
214 delete startIconSet;
215 delete stopIconSet;
216}; 215};
217 216
217
218void WellenreiterMainWindow::demoAddStations() 218void WellenreiterMainWindow::demoAddStations()
219{ 219{
220 //mw = 0; // test SIGSGV handling 220 //mw = 0; // test SIGSGV handling
221 221
222 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) ); 222 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:00:20:EF:A6:43"), true, 6, 80, GpsLocation( 10.10, 20.20 ) );
223 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) ); 223 mw->netView()->addNewItem( "managed", "Vanille", OMacAddress::fromString("00:30:6D:EF:A6:23"), true, 11, 10, GpsLocation( 0.0, 0.0 ) );
224 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) ); 224 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:A0:F8:E7:16:22"), false, 3, 10, GpsLocation( 5.5, 2.3 ) );
225 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) ); 225 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:AA:01:E7:56:62"), false, 3, 15, GpsLocation( 2.3, 5.5 ) );
226 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) ); 226 mw->netView()->addNewItem( "adhoc", "ELAN", OMacAddress::fromString("00:B0:8E:E7:56:E2"), false, 3, 20, GpsLocation( -10.0, -20.5 ) );
227} 227}
228 228
229 229
@@ -334,34 +334,42 @@ void WellenreiterMainWindow::fileLoadSession()
334 QDataStream t( &f ); 334 QDataStream t( &f );
335 t >> *mw->netView(); 335 t >> *mw->netView();
336 f.close(); 336 f.close();
337 qDebug( "Loaded session from file '%s'", (const char*) fname ); 337 qDebug( "Loaded session from file '%s'", (const char*) fname );
338 } 338 }
339 else 339 else
340 { 340 {
341 qDebug( "Problem loading session from file '%s'", (const char*) fname ); 341 qDebug( "Problem loading session from file '%s'", (const char*) fname );
342 } 342 }
343 } 343 }
344} 344}
345 345
346
346void WellenreiterMainWindow::fileNew() 347void WellenreiterMainWindow::fileNew()
347{ 348{
348 mw->netView()->clear(); 349 mw->netView()->clear();
349 mw->logWindow()->clear(); 350 mw->logWindow()->clear();
350 mw->hexWindow()->clear(); 351 mw->hexWindow()->clear();
351} 352}
352 353
354
353void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) 355void WellenreiterMainWindow::closeEvent( QCloseEvent* e )
354{ 356{
355 if ( mw->isDaemonRunning() ) 357 if ( mw->isDaemonRunning() )
356 { 358 {
357 QMessageBox::warning( this, "Wellenreiter/Opie", 359 QMessageBox::warning( this, "Wellenreiter/Opie",
358 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); 360 tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) );
359 e->ignore(); 361 e->ignore();
360 } 362 }
361 else 363 else
362 { 364 {
363 QMainWindow::closeEvent( e ); 365 QMainWindow::closeEvent( e );
364 } 366 }
365} 367}
366 368
367 369
370void WellenreiterMainWindow::uploadSession()
371{
372 QMessageBox::warning( this, "Wellenreiter/Opie",
373 tr( "This feature is\nunder construction... ;-)" ) );
374}
375
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h
index 926bb0a..8d4e768 100644
--- a/noncore/net/wellenreiter/gui/mainwindow.h
+++ b/noncore/net/wellenreiter/gui/mainwindow.h
@@ -27,38 +27,36 @@ class WellenreiterMainWindow: public QMainWindow
27{ 27{
28 Q_OBJECT 28 Q_OBJECT
29 29
30 public: 30 public:
31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 ); 31 WellenreiterMainWindow( QWidget * parent = 0, const char * name = "mainwindow", WFlags f = 0 );
32 ~WellenreiterMainWindow(); 32 ~WellenreiterMainWindow();
33 QString getFileName( bool save ); 33 QString getFileName( bool save );
34 34
35 protected: 35 protected:
36 Wellenreiter* mw; 36 Wellenreiter* mw;
37 WellenreiterConfigWindow* cw; 37 WellenreiterConfigWindow* cw;
38 38
39 const QIconSet* startIconSet;
40 const QIconSet* stopIconSet;
41 const QIconSet* infoIconSet;
42 const QIconSet* settingsIconSet;
43
44 QToolButton* startButton; 39 QToolButton* startButton;
45 QToolButton* stopButton; 40 QToolButton* stopButton;
41 QToolButton* uploadButton;
46 int startID; 42 int startID;
47 int stopID; 43 int stopID;
44 int uploadID;
48 45
49 protected: 46 protected:
50 virtual void closeEvent( QCloseEvent* ); 47 virtual void closeEvent( QCloseEvent* );
51 void updateToolButtonState(); 48 void updateToolButtonState();
52 49
53 public slots: 50 public slots:
54 void showConfigure(); 51 void showConfigure();
55 void demoAddStations(); 52 void demoAddStations();
56 void fileSaveLog(); 53 void fileSaveLog();
57 void fileSaveHex(); 54 void fileSaveHex();
58 void fileSaveSession(); 55 void fileSaveSession();
59 void fileLoadSession(); 56 void fileLoadSession();
60 void fileNew(); 57 void fileNew();
58 void uploadSession();
61 void changedSniffingState(); 59 void changedSniffingState();
62}; 60};
63 61
64#endif 62#endif
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 1d4a98b..ec89f1e 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -293,25 +293,25 @@ QObject* Wellenreiter::childIfToParse( OPacket* p, const QString& protocol )
293 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" ) 293 if ( configwindow->parsePackets->protocolAction( protocol ) == "Discard!" )
294 return 0; 294 return 0;
295 295
296 return p->child( protocol ); 296 return p->child( protocol );
297} 297}
298 298
299 299
300bool Wellenreiter::checkDumpPacket( OPacket* p ) 300bool Wellenreiter::checkDumpPacket( OPacket* p )
301{ 301{
302 // go through all child packets and see if one is inside the child hierarchy for p 302 // go through all child packets and see if one is inside the child hierarchy for p
303 // if so, do what the user requested (protocolAction), e.g. pass or discard 303 // if so, do what the user requested (protocolAction), e.g. pass or discard
304 if ( !configwindow->writeCaptureFile->isChecked() ) 304 if ( !configwindow->writeCaptureFile->isChecked() )
305 return false; 305 return true; // semantic change - we're logging anyway now to /tmp/wellenreiter
306 306
307 QObjectList* l = p->queryList(); 307 QObjectList* l = p->queryList();
308 QObjectListIt it( *l ); 308 QObjectListIt it( *l );
309 QObject* o; 309 QObject* o;
310 310
311 while ( (o = it.current()) != 0 ) 311 while ( (o = it.current()) != 0 )
312 { 312 {
313 QString name = it.current()->name(); 313 QString name = it.current()->name();
314 if ( configwindow->capturePackets->isProtocolChecked( name ) ) 314 if ( configwindow->capturePackets->isProtocolChecked( name ) )
315 { 315 {
316 QString action = configwindow->capturePackets->protocolAction( name ); 316 QString action = configwindow->capturePackets->protocolAction( name );
317 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action ); 317 qDebug( "capturePackets-action for '%s' seems to be '%s'", (const char*) name, (const char*) action );
@@ -497,47 +497,47 @@ void Wellenreiter::startClicked()
497 return; 497 return;
498 } 498 }
499 } 499 }
500 500
501 // open GPS device 501 // open GPS device
502 if ( configwindow->enableGPS->isChecked() ) 502 if ( configwindow->enableGPS->isChecked() )
503 { 503 {
504 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 504 qDebug( "Wellenreiter:GPS enabled @ %s:%d", (const char*) configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
505 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() ); 505 gps->open( configwindow->gpsdHost->currentText(), configwindow->gpsdPort->value() );
506 } 506 }
507 507
508 // open pcap and start sniffing 508 // open pcap and start sniffing
509 if ( cardtype != DEVTYPE_FILE )
510 {
511 pcap->open( interface );
512 509
513 if ( configwindow->writeCaptureFile->isChecked() ) 510 QString dumpname;
514 { 511 if ( configwindow->writeCaptureFile->isChecked() ) // write to a user specified capture file?
515 QString dumpname( configwindow->captureFileName->text() ); 512 {
516 if ( dumpname.isEmpty() ) dumpname = "captureFile"; 513 dumpname = configwindow->captureFileName->text();
517 dumpname.append( '-' ); 514 if ( dumpname.isEmpty() ) dumpname = "captureFile";
518 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); 515 dumpname.append( '-' );
519 dumpname.append( ".wellenreiter" ); 516 dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) );
520 pcap->openDumpFile( dumpname ); 517 dumpname.append( ".wellenreiter" );
521 }
522 else
523 {
524 pcap->open( interface );
525 }
526 } 518 }
527 else 519 else // write it anyway ;)
528 { 520 {
529 pcap->open( QFile( interface ) ); 521 dumpname = "/var/log/dump.wellenreiter";
530 } 522 }
531 523
524 if ( cardtype != DEVTYPE_FILE )
525 pcap->open( interface );
526 else
527 pcap->open( QFile( interface ) );
528
529 qDebug( "Wellenreiter:: dumping to %s", (const char*) dumpname );
530 pcap->openDumpFile( dumpname );
531
532 if ( !pcap->isOpen() ) 532 if ( !pcap->isOpen() )
533 { 533 {
534 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg( 534 QMessageBox::warning( this, "Wellenreiter II", tr( "Can't open packet capturer for\n'%1':\n" ).arg(
535 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) )); 535 cardtype == DEVTYPE_FILE ? (const char*) interface : iface->name() ) + QString(strerror( errno ) ));
536 return; 536 return;
537 } 537 }
538 538
539 // set capturer to non-blocking mode 539 // set capturer to non-blocking mode
540 pcap->setBlocking( false ); 540 pcap->setBlocking( false );
541 541
542 // start channel hopper 542 // start channel hopper
543 if ( cardtype != DEVTYPE_FILE ) 543 if ( cardtype != DEVTYPE_FILE )