author | mickeyl <mickeyl> | 2003-03-02 18:59:21 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-02 18:59:21 (UTC) |
commit | 6657040ae54afb2f2378f4db7bfc9e616e6d7b83 (patch) (unidiff) | |
tree | 96617a7e6664c71c20f8ec9bd6a4cca779d54dea | |
parent | e1761268c8820ff24dcb73dbcd4b82bc1e1e34a1 (diff) | |
download | opie-6657040ae54afb2f2378f4db7bfc9e616e6d7b83.zip opie-6657040ae54afb2f2378f4db7bfc9e616e6d7b83.tar.gz opie-6657040ae54afb2f2378f4db7bfc9e616e6d7b83.tar.bz2 |
use filedialogs before loading and saving sessions and logs
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 116 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 3 |
2 files changed, 83 insertions, 36 deletions
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 0ef89d4..9065351 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,266 +1,310 @@ | |||
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 "mainwindow.h" | 18 | #include "mainwindow.h" |
19 | #include "wellenreiter.h" | 19 | #include "wellenreiter.h" |
20 | 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 <qiconset.h> | 27 | #include <qiconset.h> |
27 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
28 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
29 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
30 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
31 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
32 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
33 | 34 | ||
34 | #ifdef QWS | 35 | #ifdef QWS |
35 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <opie/ofiledialog.h> | ||
36 | #else | 38 | #else |
37 | #include "resource.h" | 39 | #include "resource.h" |
40 | #include <qfiledialog.h> | ||
38 | #endif | 41 | #endif |
39 | 42 | ||
40 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 43 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
41 | :QMainWindow( parent, name, f ) | 44 | :QMainWindow( parent, name, f ) |
42 | { | 45 | { |
43 | cw = new WellenreiterConfigWindow( this ); | 46 | cw = new WellenreiterConfigWindow( this ); |
44 | mw = new Wellenreiter( this ); | 47 | mw = new Wellenreiter( this ); |
45 | mw->setConfigWindow( cw ); | 48 | mw->setConfigWindow( cw ); |
46 | setCentralWidget( mw ); | 49 | setCentralWidget( mw ); |
47 | 50 | ||
48 | // setup application icon | 51 | // setup application icon |
49 | 52 | ||
50 | #ifndef QWS | 53 | #ifndef QWS |
51 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 54 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
52 | setIconText( "Wellenreiter/X11" ); | 55 | setIconText( "Wellenreiter/X11" ); |
53 | #endif | 56 | #endif |
54 | 57 | ||
55 | // setup icon sets | 58 | // setup icon sets |
56 | 59 | ||
57 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 60 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
58 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 61 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
59 | #ifdef QWS | 62 | #ifdef QWS |
60 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 63 | searchIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
61 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 64 | cancelIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
62 | #else | 65 | #else |
63 | startStopIconSet = new QIconSet(); | 66 | startStopIconSet = new QIconSet(); |
64 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); | 67 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/SearchIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::Off ); |
65 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); | 68 | startStopIconSet->setPixmap( Resource::loadPixmap( "wellenreiter/CancelIcon" ), QIconSet::Automatic, QIconSet::Normal, QIconSet::On ); |
66 | #endif | 69 | #endif |
67 | 70 | ||
68 | // setup tool buttons | 71 | // setup tool buttons |
69 | 72 | ||
70 | startStopButton = new QToolButton( 0 ); | 73 | startStopButton = new QToolButton( 0 ); |
71 | #ifdef QWS | 74 | #ifdef QWS |
72 | startStopButton->setAutoRaise( true ); | 75 | startStopButton->setAutoRaise( true ); |
73 | #endif | 76 | #endif |
74 | #ifdef QWS | 77 | #ifdef QWS |
75 | startStopButton->setOnIconSet( *cancelIconSet ); | 78 | startStopButton->setOnIconSet( *cancelIconSet ); |
76 | startStopButton->setOffIconSet( *searchIconSet ); | 79 | startStopButton->setOffIconSet( *searchIconSet ); |
77 | #else | 80 | #else |
78 | startStopButton->setIconSet( *startStopIconSet ); | 81 | startStopButton->setIconSet( *startStopIconSet ); |
79 | #endif | 82 | #endif |
80 | startStopButton->setToggleButton( true ); | 83 | startStopButton->setToggleButton( true ); |
81 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); | 84 | connect( startStopButton, SIGNAL( clicked() ), mw, SLOT( startStopClicked() ) ); |
82 | startStopButton->setEnabled( false ); | 85 | startStopButton->setEnabled( false ); |
83 | 86 | ||
84 | QToolButton* c = new QToolButton( 0 ); | 87 | QToolButton* c = new QToolButton( 0 ); |
85 | #ifdef QWS | 88 | #ifdef QWS |
86 | c->setAutoRaise( true ); | 89 | c->setAutoRaise( true ); |
87 | #endif | 90 | #endif |
88 | c->setIconSet( *infoIconSet ); | 91 | c->setIconSet( *infoIconSet ); |
89 | c->setEnabled( false ); | 92 | c->setEnabled( false ); |
90 | 93 | ||
91 | QToolButton* d = new QToolButton( 0 ); | 94 | QToolButton* d = new QToolButton( 0 ); |
92 | #ifdef QWS | 95 | #ifdef QWS |
93 | d->setAutoRaise( true ); | 96 | d->setAutoRaise( true ); |
94 | #endif | 97 | #endif |
95 | d->setIconSet( *settingsIconSet ); | 98 | d->setIconSet( *settingsIconSet ); |
96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 99 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
97 | 100 | ||
98 | // setup menu bar | 101 | // setup menu bar |
99 | 102 | ||
100 | int id; | 103 | int id; |
101 | 104 | ||
102 | QMenuBar* mb = menuBar(); | 105 | QMenuBar* mb = menuBar(); |
103 | 106 | ||
104 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 107 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
105 | fileSave->insertItem( "&Session", this, SLOT( fileSaveSession() ) ); | 108 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( "&Log", this, SLOT( fileSaveLog() ) ); | 109 | fileSave->insertItem( "&Log...", this, SLOT( fileSaveLog() ) ); |
107 | 110 | ||
108 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 111 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
109 | fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); | 112 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); |
110 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 113 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
111 | 114 | ||
112 | QPopupMenu* file = new QPopupMenu( mb ); | 115 | QPopupMenu* file = new QPopupMenu( mb ); |
113 | id = file->insertItem( "&Load", fileLoad ); | 116 | id = file->insertItem( "&Load", fileLoad ); |
114 | file->insertItem( "&Save", fileSave ); | 117 | file->insertItem( "&Save", fileSave ); |
115 | 118 | ||
116 | QPopupMenu* view = new QPopupMenu( mb ); | 119 | QPopupMenu* view = new QPopupMenu( mb ); |
117 | view->insertItem( "&Configure..." ); | 120 | view->insertItem( "&Configure..." ); |
118 | 121 | ||
119 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 122 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
120 | sniffer->insertItem( "&Configure..." ); | 123 | sniffer->insertItem( "&Configure..." ); |
121 | sniffer->insertSeparator(); | 124 | sniffer->insertSeparator(); |
122 | 125 | ||
123 | QPopupMenu* demo = new QPopupMenu( mb ); | 126 | QPopupMenu* demo = new QPopupMenu( mb ); |
124 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 127 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); |
125 | 128 | ||
126 | id = mb->insertItem( "&File", file ); | 129 | id = mb->insertItem( "&File", file ); |
127 | id = mb->insertItem( "&View", view ); | 130 | id = mb->insertItem( "&View", view ); |
128 | mb->setItemEnabled( id, false ); | 131 | mb->setItemEnabled( id, false ); |
129 | id = mb->insertItem( "&Sniffer", sniffer ); | 132 | id = mb->insertItem( "&Sniffer", sniffer ); |
130 | mb->setItemEnabled( id, false ); | 133 | mb->setItemEnabled( id, false ); |
131 | id = mb->insertItem( "&Demo", demo ); | 134 | id = mb->insertItem( "&Demo", demo ); |
132 | mb->setItemEnabled( id, true ); | 135 | mb->setItemEnabled( id, true ); |
133 | 136 | ||
134 | #ifdef QWS | 137 | #ifdef QWS |
135 | mb->insertItem( startStopButton ); | 138 | mb->insertItem( startStopButton ); |
136 | mb->insertItem( c ); | 139 | mb->insertItem( c ); |
137 | mb->insertItem( d ); | 140 | mb->insertItem( d ); |
138 | #else // Qt3 changed the insertion order. It's now totally random :( | 141 | #else // Qt3 changed the insertion order. It's now totally random :( |
139 | mb->insertItem( d ); | 142 | mb->insertItem( d ); |
140 | mb->insertItem( c ); | 143 | mb->insertItem( c ); |
141 | mb->insertItem( startStopButton ); | 144 | mb->insertItem( startStopButton ); |
142 | #endif | 145 | #endif |
143 | 146 | ||
144 | // setup status bar (for now only on X11) | 147 | // setup status bar (for now only on X11) |
145 | 148 | ||
146 | #ifndef QWS | 149 | #ifndef QWS |
147 | statusBar()->message( "Ready." ); | 150 | statusBar()->message( "Ready." ); |
148 | #endif | 151 | #endif |
149 | 152 | ||
150 | }; | 153 | }; |
151 | 154 | ||
152 | void WellenreiterMainWindow::showConfigure() | 155 | void WellenreiterMainWindow::showConfigure() |
153 | { | 156 | { |
154 | qDebug( "show configure..." ); | 157 | qDebug( "show configure..." ); |
155 | cw->setCaption( tr( "Configure" ) ); | 158 | cw->setCaption( tr( "Configure" ) ); |
156 | #ifdef QWS | 159 | #ifdef QWS |
157 | cw->showMaximized(); | 160 | cw->showMaximized(); |
158 | #endif | 161 | #endif |
159 | int result = cw->exec(); | 162 | int result = cw->exec(); |
160 | 163 | ||
161 | if ( result ) | 164 | if ( result ) |
162 | { | 165 | { |
163 | // check configuration from config window | 166 | // check configuration from config window |
164 | 167 | ||
165 | const QString& interface = cw->interfaceName->currentText(); | 168 | const QString& interface = cw->interfaceName->currentText(); |
166 | const int cardtype = cw->daemonDeviceType(); | 169 | const int cardtype = cw->daemonDeviceType(); |
167 | const int interval = cw->daemonHopInterval(); | 170 | const int interval = cw->daemonHopInterval(); |
168 | 171 | ||
169 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 172 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
170 | startStopButton->setEnabled( true ); | 173 | startStopButton->setEnabled( true ); |
171 | //TODO ... | 174 | //TODO ... |
172 | else | 175 | else |
173 | startStopButton->setEnabled( false ); | 176 | startStopButton->setEnabled( false ); |
174 | //TODO ... | 177 | //TODO ... |
175 | } | 178 | } |
176 | } | 179 | } |
177 | 180 | ||
178 | WellenreiterMainWindow::~WellenreiterMainWindow() | 181 | WellenreiterMainWindow::~WellenreiterMainWindow() |
179 | { | 182 | { |
180 | 183 | ||
181 | delete infoIconSet; | 184 | delete infoIconSet; |
182 | delete settingsIconSet; | 185 | delete settingsIconSet; |
183 | #ifdef QWS | 186 | #ifdef QWS |
184 | delete searchIconSet; | 187 | delete searchIconSet; |
185 | delete cancelIconSet; | 188 | delete cancelIconSet; |
186 | #else | 189 | #else |
187 | delete startStopIconSet; | 190 | delete startStopIconSet; |
188 | #endif | 191 | #endif |
189 | 192 | ||
190 | }; | 193 | }; |
191 | 194 | ||
192 | void WellenreiterMainWindow::demoAddStations() | 195 | void WellenreiterMainWindow::demoAddStations() |
193 | { | 196 | { |
194 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 197 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
195 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 198 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
196 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 199 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
197 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 200 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
198 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 201 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
199 | } | 202 | } |
200 | 203 | ||
201 | void WellenreiterMainWindow::fileSaveLog() | 204 | QString WellenreiterMainWindow::getFileName( bool save ) |
202 | { | 205 | { |
203 | const QString fname( "/tmp/log.txt" ); | 206 | QMap<QString, QStringList> map; |
204 | QFile f( fname ); | 207 | map.insert( tr("All"), QStringList() ); |
205 | if ( f.open(IO_WriteOnly) ) | 208 | QStringList text; |
209 | text << "text/*"; | ||
210 | map.insert(tr("Text"), text ); | ||
211 | text << "*"; | ||
212 | map.insert(tr("All"), text ); | ||
213 | |||
214 | QString str; | ||
215 | if ( save ) | ||
206 | { | 216 | { |
207 | QTextStream t( &f ); | 217 | #ifdef QWS |
208 | t << mw->logWindow()->getLog(); | 218 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
209 | f.close(); | 219 | #else |
210 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 220 | str = QFileDialog::getSaveFileName(); |
221 | #endif | ||
222 | if ( str.isEmpty() || QFileInfo(str).isDir() ) | ||
223 | return ""; | ||
211 | } | 224 | } |
212 | else | 225 | else |
213 | { | 226 | { |
214 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 227 | #ifdef QWS |
228 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | ||
229 | #else | ||
230 | str = QFileDialog::getOpenFileName(); | ||
231 | #endif | ||
232 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | ||
233 | return ""; | ||
215 | } | 234 | } |
216 | 235 | return str; | |
217 | } | 236 | } |
218 | 237 | ||
219 | void WellenreiterMainWindow::fileSaveSession() | 238 | void WellenreiterMainWindow::fileSaveLog() |
220 | { | 239 | { |
221 | const QString fname( "/tmp/session.xml" ); | 240 | QString fname = getFileName( true ); |
222 | QFile f( fname ); | 241 | if ( !fname.isEmpty() ) |
223 | if ( f.open(IO_WriteOnly) ) | ||
224 | { | 242 | { |
225 | QDataStream t( &f ); | 243 | QFile f( fname ); |
226 | t << *mw->netView(); | 244 | if ( f.open(IO_WriteOnly) ) |
227 | f.close(); | 245 | { |
228 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 246 | QTextStream t( &f ); |
247 | t << mw->logWindow()->getLog(); | ||
248 | f.close(); | ||
249 | qDebug( "Saved log to file '%s'", (const char*) fname ); | ||
250 | } | ||
251 | else | ||
252 | { | ||
253 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | ||
254 | } | ||
229 | } | 255 | } |
230 | else | 256 | } |
257 | |||
258 | void WellenreiterMainWindow::fileSaveSession() | ||
259 | { | ||
260 | QString fname = getFileName( true ); | ||
261 | if ( !fname.isEmpty() ) | ||
231 | { | 262 | { |
232 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 263 | |
264 | QFile f( fname ); | ||
265 | if ( f.open(IO_WriteOnly) ) | ||
266 | { | ||
267 | QDataStream t( &f ); | ||
268 | t << *mw->netView(); | ||
269 | f.close(); | ||
270 | qDebug( "Saved session to file '%s'", (const char*) fname ); | ||
271 | } | ||
272 | else | ||
273 | { | ||
274 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | ||
275 | } | ||
233 | } | 276 | } |
234 | } | 277 | } |
235 | 278 | ||
236 | void WellenreiterMainWindow::fileLoadSession() | 279 | void WellenreiterMainWindow::fileLoadSession() |
237 | { | 280 | { |
238 | const QString fname( "/tmp/session.xml" ); | 281 | QString fname = getFileName( false ); |
239 | QFile f( fname ); | 282 | if ( !fname.isEmpty() ) |
240 | |||
241 | if ( f.open(IO_ReadOnly) ) | ||
242 | { | 283 | { |
243 | QDataStream t( &f ); | 284 | QFile f( fname ); |
244 | t >> *mw->netView(); | 285 | if ( f.open(IO_ReadOnly) ) |
245 | f.close(); | 286 | { |
246 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 287 | QDataStream t( &f ); |
247 | } | 288 | t >> *mw->netView(); |
248 | else | 289 | f.close(); |
249 | { | 290 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
250 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 291 | } |
292 | else | ||
293 | { | ||
294 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | ||
295 | } | ||
251 | } | 296 | } |
252 | |||
253 | } | 297 | } |
254 | 298 | ||
255 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 299 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
256 | { | 300 | { |
257 | if ( mw->isDaemonRunning() ) | 301 | if ( mw->isDaemonRunning() ) |
258 | { | 302 | { |
259 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); | 303 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); |
260 | e->ignore(); | 304 | e->ignore(); |
261 | } | 305 | } |
262 | else | 306 | else |
263 | { | 307 | { |
264 | QMainWindow::closeEvent( e ); | 308 | QMainWindow::closeEvent( e ); |
265 | } | 309 | } |
266 | } | 310 | } |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 59f259d..850a343 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -1,57 +1,60 @@ | |||
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 | #ifndef MAINWINDOW_H | 16 | #ifndef MAINWINDOW_H |
17 | #define MAINWINDOW_H | 17 | #define MAINWINDOW_H |
18 | 18 | ||
19 | #include <qmainwindow.h> | 19 | #include <qmainwindow.h> |
20 | 20 | ||
21 | class Wellenreiter; | 21 | class Wellenreiter; |
22 | class WellenreiterConfigWindow; | 22 | class WellenreiterConfigWindow; |
23 | class QIconSet; | 23 | class QIconSet; |
24 | class QToolButton; | 24 | class QToolButton; |
25 | 25 | ||
26 | class WellenreiterMainWindow: public QMainWindow | 26 | 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 | 33 | ||
34 | protected: | 34 | protected: |
35 | Wellenreiter* mw; | 35 | Wellenreiter* mw; |
36 | WellenreiterConfigWindow* cw; | 36 | WellenreiterConfigWindow* cw; |
37 | 37 | ||
38 | QIconSet* startStopIconSet; | 38 | QIconSet* startStopIconSet; |
39 | const QIconSet* searchIconSet; | 39 | const QIconSet* searchIconSet; |
40 | const QIconSet* infoIconSet; | 40 | const QIconSet* infoIconSet; |
41 | const QIconSet* settingsIconSet; | 41 | const QIconSet* settingsIconSet; |
42 | const QIconSet* cancelIconSet; | 42 | const QIconSet* cancelIconSet; |
43 | 43 | ||
44 | QToolButton* startStopButton; | 44 | QToolButton* startStopButton; |
45 | 45 | ||
46 | protected: | 46 | protected: |
47 | virtual void closeEvent( QCloseEvent* ); | 47 | virtual void closeEvent( QCloseEvent* ); |
48 | 48 | ||
49 | private: | ||
50 | QString getFileName( bool save ); | ||
51 | |||
49 | public slots: | 52 | public slots: |
50 | void showConfigure(); | 53 | void showConfigure(); |
51 | void demoAddStations(); | 54 | void demoAddStations(); |
52 | void fileSaveLog(); | 55 | void fileSaveLog(); |
53 | void fileSaveSession(); | 56 | void fileSaveSession(); |
54 | void fileLoadSession(); | 57 | void fileLoadSession(); |
55 | }; | 58 | }; |
56 | 59 | ||
57 | #endif | 60 | #endif |