Diffstat (limited to 'noncore/net/wellenreiter/gui/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 10 |
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 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "logwindow.h" | 17 | #include "logwindow.h" |
18 | #include "hexwindow.h" | ||
18 | #include "mainwindow.h" | 19 | #include "mainwindow.h" |
19 | #include "wellenreiter.h" | 20 | #include "wellenreiter.h" |
20 | |||
21 | #include "scanlist.h" | 21 | #include "scanlist.h" |
22 | 22 | ||
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qdatastream.h> | 24 | #include <qdatastream.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
27 | #include <qiconset.h> | 27 | #include <qiconset.h> |
28 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <opie/ofiledialog.h> | 37 | #include <opie/ofiledialog.h> |
38 | #else | 38 | #else |
39 | #include "resource.h" | 39 | #include "resource.h" |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfiledialog.h> | 41 | #include <qfiledialog.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
@@ -93,48 +93,49 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
93 | c->setEnabled( false ); | 93 | c->setEnabled( false ); |
94 | 94 | ||
95 | QToolButton* d = new QToolButton( 0 ); | 95 | QToolButton* d = new QToolButton( 0 ); |
96 | #ifdef QWS | 96 | #ifdef QWS |
97 | d->setAutoRaise( true ); | 97 | d->setAutoRaise( true ); |
98 | #endif | 98 | #endif |
99 | d->setIconSet( *settingsIconSet ); | 99 | d->setIconSet( *settingsIconSet ); |
100 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 100 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
101 | 101 | ||
102 | // setup menu bar | 102 | // setup menu bar |
103 | 103 | ||
104 | int id; | 104 | int id; |
105 | 105 | ||
106 | QMenuBar* mb = menuBar(); | 106 | QMenuBar* mb = menuBar(); |
107 | 107 | ||
108 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 108 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
109 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); | 109 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); |
110 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); | 110 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); |
111 | 111 | ||
112 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 112 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
113 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); | 113 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); |
114 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 114 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
115 | 115 | ||
116 | QPopupMenu* file = new QPopupMenu( mb ); | 116 | QPopupMenu* file = new QPopupMenu( mb ); |
117 | file->insertItem( "&New", this, SLOT( fileNew() ) ); | ||
117 | id = file->insertItem( "&Load", fileLoad ); | 118 | id = file->insertItem( "&Load", fileLoad ); |
118 | file->insertItem( "&Save", fileSave ); | 119 | file->insertItem( "&Save", fileSave ); |
119 | file->insertSeparator(); | 120 | file->insertSeparator(); |
120 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | 121 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); |
121 | 122 | ||
122 | QPopupMenu* view = new QPopupMenu( mb ); | 123 | QPopupMenu* view = new QPopupMenu( mb ); |
123 | view->insertItem( "&Configure..." ); | 124 | view->insertItem( "&Configure..." ); |
124 | 125 | ||
125 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 126 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
126 | sniffer->insertItem( "&Configure..." ); | 127 | sniffer->insertItem( "&Configure..." ); |
127 | sniffer->insertSeparator(); | 128 | sniffer->insertSeparator(); |
128 | 129 | ||
129 | QPopupMenu* demo = new QPopupMenu( mb ); | 130 | QPopupMenu* demo = new QPopupMenu( mb ); |
130 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 131 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); |
131 | 132 | ||
132 | id = mb->insertItem( "&File", file ); | 133 | id = mb->insertItem( "&File", file ); |
133 | id = mb->insertItem( "&View", view ); | 134 | id = mb->insertItem( "&View", view ); |
134 | mb->setItemEnabled( id, false ); | 135 | mb->setItemEnabled( id, false ); |
135 | id = mb->insertItem( "&Sniffer", sniffer ); | 136 | id = mb->insertItem( "&Sniffer", sniffer ); |
136 | mb->setItemEnabled( id, false ); | 137 | mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( "&Demo", demo ); | 138 | id = mb->insertItem( "&Demo", demo ); |
138 | mb->setItemEnabled( id, true ); | 139 | mb->setItemEnabled( id, true ); |
139 | 140 | ||
140 | #ifdef QWS | 141 | #ifdef QWS |
@@ -278,36 +279,43 @@ void WellenreiterMainWindow::fileSaveSession() | |||
278 | } | 279 | } |
279 | } | 280 | } |
280 | } | 281 | } |
281 | 282 | ||
282 | void WellenreiterMainWindow::fileLoadSession() | 283 | void WellenreiterMainWindow::fileLoadSession() |
283 | { | 284 | { |
284 | QString fname = getFileName( false ); | 285 | QString fname = getFileName( false ); |
285 | if ( !fname.isEmpty() ) | 286 | if ( !fname.isEmpty() ) |
286 | { | 287 | { |
287 | QFile f( fname ); | 288 | QFile f( fname ); |
288 | if ( f.open(IO_ReadOnly) ) | 289 | if ( f.open(IO_ReadOnly) ) |
289 | { | 290 | { |
290 | QDataStream t( &f ); | 291 | QDataStream t( &f ); |
291 | t >> *mw->netView(); | 292 | t >> *mw->netView(); |
292 | f.close(); | 293 | f.close(); |
293 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 294 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
294 | } | 295 | } |
295 | else | 296 | else |
296 | { | 297 | { |
297 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 298 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
298 | } | 299 | } |
299 | } | 300 | } |
300 | } | 301 | } |
301 | 302 | ||
303 | void WellenreiterMainWindow::fileNew() | ||
304 | { | ||
305 | mw->netView()->clear(); | ||
306 | mw->logWindow()->clear(); | ||
307 | mw->hexWindow()->clear(); | ||
308 | } | ||
309 | |||
302 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 310 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
303 | { | 311 | { |
304 | if ( mw->isDaemonRunning() ) | 312 | if ( mw->isDaemonRunning() ) |
305 | { | 313 | { |
306 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); | 314 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); |
307 | e->ignore(); | 315 | e->ignore(); |
308 | } | 316 | } |
309 | else | 317 | else |
310 | { | 318 | { |
311 | QMainWindow::closeEvent( e ); | 319 | QMainWindow::closeEvent( e ); |
312 | } | 320 | } |
313 | } | 321 | } |