author | mickeyl <mickeyl> | 2003-03-02 16:38:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-03-02 16:38:17 (UTC) |
commit | d0e64d0c7961de1c3ecb886ae76c6701f268d767 (patch) (unidiff) | |
tree | 2ea00b7cd496bb0720b9730bbf993f2013a87d3e /noncore/net/wellenreiter/gui | |
parent | a0ae7d2b8cfef3f643c4aa536bdf25d7da510142 (diff) | |
download | opie-d0e64d0c7961de1c3ecb886ae76c6701f268d767.zip opie-d0e64d0c7961de1c3ecb886ae76c6701f268d767.tar.gz opie-d0e64d0c7961de1c3ecb886ae76c6701f268d767.tar.bz2 |
first attempt to add session persistence
-rw-r--r-- | noncore/net/wellenreiter/gui/gui.pro | 2 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 36 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 114 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.h | 75 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.cpp | 121 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlistitem.h | 83 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 8 |
8 files changed, 219 insertions, 221 deletions
diff --git a/noncore/net/wellenreiter/gui/gui.pro b/noncore/net/wellenreiter/gui/gui.pro index 6037661..8861a50 100644 --- a/noncore/net/wellenreiter/gui/gui.pro +++ b/noncore/net/wellenreiter/gui/gui.pro | |||
@@ -7,7 +7,6 @@ CONFIG = qt warn_on debug | |||
7 | HEADERS = wellenreiterbase.h \ | 7 | HEADERS = wellenreiterbase.h \ |
8 | mainwindow.h \ | 8 | mainwindow.h \ |
9 | wellenreiter.h \ | 9 | wellenreiter.h \ |
10 | scanlistitem.h \ | ||
11 | scanlist.h \ | 10 | scanlist.h \ |
12 | logwindow.h \ | 11 | logwindow.h \ |
13 | hexwindow.h \ | 12 | hexwindow.h \ |
@@ -20,7 +19,6 @@ SOURCES = main.cpp \ | |||
20 | mainwindow.cpp \ | 19 | mainwindow.cpp \ |
21 | wellenreiterbase.cpp \ | 20 | wellenreiterbase.cpp \ |
22 | wellenreiter.cpp \ | 21 | wellenreiter.cpp \ |
23 | scanlistitem.cpp \ | ||
24 | scanlist.cpp \ | 22 | scanlist.cpp \ |
25 | logwindow.cpp \ | 23 | logwindow.cpp \ |
26 | hexwindow.cpp \ | 24 | hexwindow.cpp \ |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index e388fc5..0ef89d4 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "scanlist.h" | 21 | #include "scanlist.h" |
22 | 22 | ||
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qdatastream.h> | ||
24 | #include <qfile.h> | 25 | #include <qfile.h> |
25 | #include <qiconset.h> | 26 | #include <qiconset.h> |
26 | #include <qmenubar.h> | 27 | #include <qmenubar.h> |
@@ -44,6 +45,13 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
44 | mw->setConfigWindow( cw ); | 45 | mw->setConfigWindow( cw ); |
45 | setCentralWidget( mw ); | 46 | setCentralWidget( mw ); |
46 | 47 | ||
48 | // setup application icon | ||
49 | |||
50 | #ifndef QWS | ||
51 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | ||
52 | setIconText( "Wellenreiter/X11" ); | ||
53 | #endif | ||
54 | |||
47 | // setup icon sets | 55 | // setup icon sets |
48 | 56 | ||
49 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 57 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
@@ -99,11 +107,10 @@ WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * n | |||
99 | 107 | ||
100 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 108 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
101 | fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); | 109 | fileLoad->insertItem( "&Session", this, SLOT( fileLoadSession() ) ); |
102 | fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 110 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
103 | 111 | ||
104 | QPopupMenu* file = new QPopupMenu( mb ); | 112 | QPopupMenu* file = new QPopupMenu( mb ); |
105 | id = file->insertItem( "&Load", fileLoad ); | 113 | id = file->insertItem( "&Load", fileLoad ); |
106 | file->setItemEnabled( id, false ); | ||
107 | file->insertItem( "&Save", fileSave ); | 114 | file->insertItem( "&Save", fileSave ); |
108 | 115 | ||
109 | QPopupMenu* view = new QPopupMenu( mb ); | 116 | QPopupMenu* view = new QPopupMenu( mb ); |
@@ -185,7 +192,7 @@ WellenreiterMainWindow::~WellenreiterMainWindow() | |||
185 | void WellenreiterMainWindow::demoAddStations() | 192 | void WellenreiterMainWindow::demoAddStations() |
186 | { | 193 | { |
187 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 194 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
188 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:1c:EF:A6:23", true, 11, 10 ); | 195 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
189 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 196 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
190 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 197 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
191 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 198 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
@@ -215,8 +222,8 @@ void WellenreiterMainWindow::fileSaveSession() | |||
215 | QFile f( fname ); | 222 | QFile f( fname ); |
216 | if ( f.open(IO_WriteOnly) ) | 223 | if ( f.open(IO_WriteOnly) ) |
217 | { | 224 | { |
218 | QTextStream t( &f ); | 225 | QDataStream t( &f ); |
219 | mw->netView()->dump( t ); | 226 | t << *mw->netView(); |
220 | f.close(); | 227 | f.close(); |
221 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 228 | qDebug( "Saved session to file '%s'", (const char*) fname ); |
222 | } | 229 | } |
@@ -226,6 +233,25 @@ void WellenreiterMainWindow::fileSaveSession() | |||
226 | } | 233 | } |
227 | } | 234 | } |
228 | 235 | ||
236 | void WellenreiterMainWindow::fileLoadSession() | ||
237 | { | ||
238 | const QString fname( "/tmp/session.xml" ); | ||
239 | QFile f( fname ); | ||
240 | |||
241 | if ( f.open(IO_ReadOnly) ) | ||
242 | { | ||
243 | QDataStream t( &f ); | ||
244 | t >> *mw->netView(); | ||
245 | f.close(); | ||
246 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | ||
247 | } | ||
248 | else | ||
249 | { | ||
250 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | ||
251 | } | ||
252 | |||
253 | } | ||
254 | |||
229 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 255 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
230 | { | 256 | { |
231 | if ( mw->isDaemonRunning() ) | 257 | if ( mw->isDaemonRunning() ) |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.h b/noncore/net/wellenreiter/gui/mainwindow.h index 8bfccf3..59f259d 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.h +++ b/noncore/net/wellenreiter/gui/mainwindow.h | |||
@@ -51,6 +51,7 @@ class WellenreiterMainWindow: public QMainWindow | |||
51 | void demoAddStations(); | 51 | void demoAddStations(); |
52 | void fileSaveLog(); | 52 | void fileSaveLog(); |
53 | void fileSaveSession(); | 53 | void fileSaveSession(); |
54 | void fileLoadSession(); | ||
54 | }; | 55 | }; |
55 | 56 | ||
56 | #endif | 57 | #endif |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index cdc2c48..58a04fb 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -14,12 +14,10 @@ | |||
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "scanlistitem.h" | ||
18 | 17 | ||
19 | #include <assert.h> | 18 | #include <assert.h> |
20 | |||
21 | #include "manufacturers.h" | 19 | #include "manufacturers.h" |
22 | 20 | #include <qdatetime.h> | |
23 | #include <qtextstream.h> | 21 | #include <qtextstream.h> |
24 | 22 | ||
25 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 23 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
@@ -55,6 +53,18 @@ MScanListView::~MScanListView() | |||
55 | { | 53 | { |
56 | }; | 54 | }; |
57 | 55 | ||
56 | void MScanListView::serializeTo( QDataStream& s) const | ||
57 | { | ||
58 | qDebug( "serializing MScanListView" ); | ||
59 | OListView::serializeTo( s ); | ||
60 | } | ||
61 | |||
62 | void MScanListView::serializeFrom( QDataStream& s) | ||
63 | { | ||
64 | qDebug( "serializing MScanListView" ); | ||
65 | OListView::serializeFrom( s ); | ||
66 | } | ||
67 | |||
58 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) | 68 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) |
59 | { | 69 | { |
60 | _manufacturerdb = manufacturerdb; | 70 | _manufacturerdb = manufacturerdb; |
@@ -153,15 +163,101 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
153 | 163 | ||
154 | } | 164 | } |
155 | 165 | ||
156 | void MScanListView::dump( QTextStream& t ) const | 166 | #ifdef QWS |
167 | #include <qpe/resource.h> | ||
168 | #else | ||
169 | #include "resource.h" | ||
170 | #endif | ||
171 | |||
172 | const int col_type = 0; | ||
173 | const int col_essid = 0; | ||
174 | const int col_sig = 1; | ||
175 | const int col_ap = 2; | ||
176 | const int col_channel = 3; | ||
177 | const int col_wep = 4; | ||
178 | const int col_traffic = 5; | ||
179 | const int col_manuf = 6; | ||
180 | const int col_firstseen = 7; | ||
181 | const int col_lastseen = 8; | ||
182 | |||
183 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | ||
184 | bool wep, int channel, int signal ) | ||
185 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | ||
186 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | ||
187 | _channel( channel ), _signal( signal ), _beacons( 0 ) | ||
188 | { | ||
189 | qDebug( "creating scanlist item" ); | ||
190 | decorateItem( type, essid, macaddr, wep, channel, signal ); | ||
191 | } | ||
192 | |||
193 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | ||
194 | bool wep, int channel, int signal ) | ||
195 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | ||
196 | { | ||
197 | qDebug( "creating scanlist item" ); | ||
198 | decorateItem( type, essid, macaddr, wep, channel, signal ); | ||
199 | } | ||
200 | |||
201 | void MScanListItem::serializeTo( QDataStream& s ) const | ||
202 | { | ||
203 | OListViewItem::serializeTo( s ); | ||
204 | } | ||
205 | |||
206 | void MScanListItem::serializeFrom( QDataStream& s ) | ||
207 | { | ||
208 | OListViewItem::serializeFrom( s ); | ||
209 | } | ||
210 | |||
211 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | ||
157 | { | 212 | { |
158 | qDebug( "dumping scanlist..." ); | 213 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
214 | (const char*) type, | ||
215 | (const char*) essid, | ||
216 | (const char*) macaddr, | ||
217 | channel ); | ||
218 | |||
219 | // set icon for managed or adhoc mode | ||
220 | QString name; | ||
221 | name.sprintf( "wellenreiter/%s", (const char*) type ); | ||
222 | setPixmap( col_type, Resource::loadPixmap( name ) ); | ||
223 | |||
224 | // set icon for wep (wireless encryption protocol) | ||
225 | if ( wep ) | ||
226 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | ||
227 | |||
228 | // set channel and signal text | ||
159 | 229 | ||
160 | QListViewItemIterator it( const_cast<MScanListView*>( this ) ); | 230 | if ( signal != -1 ) |
161 | for ( ; it.current(); ++it ) | 231 | setText( col_sig, QString::number( signal ) ); |
232 | if ( channel != -1 ) | ||
233 | setText( col_channel, QString::number( channel ) ); | ||
234 | |||
235 | setText( col_firstseen, QTime::currentTime().toString() ); | ||
236 | //setText( col_lastseen, QTime::currentTime().toString() ); | ||
237 | |||
238 | listView()->triggerUpdate(); | ||
239 | |||
240 | this->type = type; | ||
241 | _type = type; | ||
242 | _essid = essid; | ||
243 | _macaddr = macaddr; | ||
244 | _channel = channel; | ||
245 | _beacons = 0; | ||
246 | _signal = 0; | ||
247 | } | ||
248 | |||
249 | void MScanListItem::setManufacturer( const QString& manufacturer ) | ||
162 | { | 250 | { |
163 | static_cast<MScanListItem*>( it.current() )->dump( t ); | 251 | setText( col_manuf, manufacturer ); |
164 | } | 252 | } |
165 | 253 | ||
166 | qDebug( "dump finished." ); | 254 | void MScanListItem::receivedBeacon() |
255 | { | ||
256 | _beacons++; | ||
257 | #ifdef DEBUG | ||
258 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | ||
259 | #endif | ||
260 | setText( col_sig, QString::number( _beacons ) ); | ||
261 | setText( col_lastseen, QTime::currentTime().toString() ); | ||
167 | } | 262 | } |
263 | |||
diff --git a/noncore/net/wellenreiter/gui/scanlist.h b/noncore/net/wellenreiter/gui/scanlist.h index f06f251..66c701b 100644 --- a/noncore/net/wellenreiter/gui/scanlist.h +++ b/noncore/net/wellenreiter/gui/scanlist.h | |||
@@ -32,7 +32,9 @@ class MScanListView: public OListView | |||
32 | virtual ~MScanListView(); | 32 | virtual ~MScanListView(); |
33 | 33 | ||
34 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); | 34 | void setManufacturerDB( ManufacturerDB* manufacturerdb ); |
35 | void dump( QTextStream& t ) const; | 35 | |
36 | virtual void serializeTo( QDataStream& s ) const; | ||
37 | virtual void serializeFrom( QDataStream& s ); | ||
36 | 38 | ||
37 | public slots: | 39 | public slots: |
38 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | 40 | void addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); |
@@ -42,5 +44,76 @@ class MScanListView: public OListView | |||
42 | 44 | ||
43 | }; | 45 | }; |
44 | 46 | ||
47 | //****************************** MScanListItem **************************************************************** | ||
48 | |||
49 | class MScanListItem: public OListViewItem | ||
50 | { | ||
51 | public: | ||
52 | MScanListItem::MScanListItem( QListView* parent, | ||
53 | QString type, | ||
54 | QString essid, | ||
55 | QString macaddr, | ||
56 | bool wep, | ||
57 | int channel, | ||
58 | int signal ); | ||
59 | |||
60 | MScanListItem::MScanListItem( QListViewItem* parent, | ||
61 | QString type, | ||
62 | QString essid, | ||
63 | QString macaddr, | ||
64 | bool wep, | ||
65 | int channel, | ||
66 | int signal ); | ||
67 | |||
68 | |||
69 | protected: | ||
70 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | ||
71 | |||
72 | public: | ||
73 | QString type; | ||
74 | |||
75 | public: | ||
76 | //const QString& type() { return _type; }; | ||
77 | const QString& essid() { return _essid; }; | ||
78 | const QString& macaddr() { return _macaddr; }; | ||
79 | bool wep() { return _wep; }; | ||
80 | int channel() { return _channel; }; | ||
81 | int signal() { return _signal; }; | ||
82 | int beacons() { return _beacons; }; | ||
83 | |||
84 | void setSignal( int signal ) { /* TODO */ }; | ||
85 | void receivedBeacon(); | ||
86 | |||
87 | void setManufacturer( const QString& manufacturer ); | ||
88 | |||
89 | virtual void serializeTo( QDataStream& s ) const; | ||
90 | virtual void serializeFrom( QDataStream& s ); | ||
91 | |||
92 | private: | ||
93 | QString _type; | ||
94 | QString _essid; | ||
95 | QString _macaddr; | ||
96 | bool _wep; | ||
97 | int _channel; | ||
98 | int _signal; | ||
99 | int _beacons; | ||
100 | |||
101 | }; | ||
102 | |||
103 | //****************************** MScanListViewFactory **************************************************************** | ||
104 | |||
105 | /* | ||
106 | |||
107 | class MScanListViewFactory : public OListViewFactory | ||
108 | { | ||
109 | public: | ||
110 | virtual QListView* listViewFactory(); | ||
111 | virtual QListViewItem* listViewItemFactory( QListView* lv ); | ||
112 | virtual QListViewItem* listViewItemFactory( QListViewItem* lvi ); | ||
113 | virtual void setColumnText( int depth, QListViewItem* lvi, int column, const QString& text ); | ||
114 | virtual void setCustomData( int depth, QListViewItem* lvi, const QString& text ); | ||
115 | } | ||
116 | */ | ||
117 | |||
45 | #endif | 118 | #endif |
46 | 119 | ||
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp deleted file mode 100644 index 4aecd2b..0000000 --- a/noncore/net/wellenreiter/gui/scanlistitem.cpp +++ b/dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "scanlistitem.h" | ||
17 | #include <assert.h> | ||
18 | #include <qdatetime.h> | ||
19 | #include <qpixmap.h> | ||
20 | |||
21 | #ifdef QWS | ||
22 | #include <qpe/resource.h> | ||
23 | #else | ||
24 | #include "resource.h" | ||
25 | #endif | ||
26 | |||
27 | const int col_type = 0; | ||
28 | const int col_essid = 0; | ||
29 | const int col_sig = 1; | ||
30 | const int col_ap = 2; | ||
31 | const int col_channel = 3; | ||
32 | const int col_wep = 4; | ||
33 | const int col_traffic = 5; | ||
34 | const int col_manuf = 6; | ||
35 | const int col_firstseen = 7; | ||
36 | const int col_lastseen = 8; | ||
37 | |||
38 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | ||
39 | bool wep, int channel, int signal ) | ||
40 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | ||
41 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | ||
42 | _channel( channel ), _signal( signal ), _beacons( 0 ) | ||
43 | { | ||
44 | qDebug( "creating scanlist item" ); | ||
45 | decorateItem( type, essid, macaddr, wep, channel, signal ); | ||
46 | } | ||
47 | |||
48 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | ||
49 | bool wep, int channel, int signal ) | ||
50 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | ||
51 | { | ||
52 | qDebug( "creating scanlist item" ); | ||
53 | decorateItem( type, essid, macaddr, wep, channel, signal ); | ||
54 | } | ||
55 | |||
56 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | ||
57 | { | ||
58 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | ||
59 | (const char*) type, | ||
60 | (const char*) essid, | ||
61 | (const char*) macaddr, | ||
62 | channel ); | ||
63 | |||
64 | // set icon for managed or adhoc mode | ||
65 | QString name; | ||
66 | name.sprintf( "wellenreiter/%s", (const char*) type ); | ||
67 | setPixmap( col_type, Resource::loadPixmap( name ) ); | ||
68 | |||
69 | // set icon for wep (wireless encryption protocol) | ||
70 | if ( wep ) | ||
71 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | ||
72 | |||
73 | // set channel and signal text | ||
74 | |||
75 | if ( signal != -1 ) | ||
76 | setText( col_sig, QString::number( signal ) ); | ||
77 | if ( channel != -1 ) | ||
78 | setText( col_channel, QString::number( channel ) ); | ||
79 | |||
80 | setText( col_firstseen, QTime::currentTime().toString() ); | ||
81 | //setText( col_lastseen, QTime::currentTime().toString() ); | ||
82 | |||
83 | listView()->triggerUpdate(); | ||
84 | |||
85 | this->type = type; | ||
86 | _type = type; | ||
87 | _essid = essid; | ||
88 | _macaddr = macaddr; | ||
89 | _channel = channel; | ||
90 | _beacons = 0; | ||
91 | _signal = 0; | ||
92 | } | ||
93 | |||
94 | void MScanListItem::setManufacturer( const QString& manufacturer ) | ||
95 | { | ||
96 | setText( col_manuf, manufacturer ); | ||
97 | } | ||
98 | |||
99 | void MScanListItem::receivedBeacon() | ||
100 | { | ||
101 | _beacons++; | ||
102 | #ifdef DEBUG | ||
103 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | ||
104 | #endif | ||
105 | setText( col_sig, QString::number( _beacons ) ); | ||
106 | setText( col_lastseen, QTime::currentTime().toString() ); | ||
107 | } | ||
108 | |||
109 | void MScanListItem::dump( QTextStream& t ) const | ||
110 | { | ||
111 | qDebug( "dumping scanlistitem at <%d>", this ); | ||
112 | t << "<ITEM type=" << _type; | ||
113 | t << " ESSID='" << _essid; | ||
114 | t << "' MAC=" << _macaddr; | ||
115 | t << " WEP=" << _wep; | ||
116 | t << " CHANNEL=" << _channel; | ||
117 | t << " SIGNAL=" << _signal; | ||
118 | t << " BEACONS=" << _beacons; | ||
119 | t << ">\n"; | ||
120 | } | ||
121 | |||
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.h b/noncore/net/wellenreiter/gui/scanlistitem.h deleted file mode 100644 index 5f6ae40..0000000 --- a/noncore/net/wellenreiter/gui/scanlistitem.h +++ b/dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
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 | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
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. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef SCANLISTITEM_H | ||
17 | #define SCANLISTITEM_H | ||
18 | |||
19 | #include <cornucopia/olistview.h> | ||
20 | |||
21 | #include <qtextstream.h> | ||
22 | |||
23 | class QString; | ||
24 | |||
25 | class MScanListItem: public OListViewItem | ||
26 | { | ||
27 | public: | ||
28 | |||
29 | MScanListItem::MScanListItem( QListView* parent, | ||
30 | QString type, | ||
31 | QString essid, | ||
32 | QString macaddr, | ||
33 | bool wep, | ||
34 | int channel, | ||
35 | int signal ); | ||
36 | |||
37 | MScanListItem::MScanListItem( QListViewItem* parent, | ||
38 | QString type, | ||
39 | QString essid, | ||
40 | QString macaddr, | ||
41 | bool wep, | ||
42 | int channel, | ||
43 | int signal ); | ||
44 | |||
45 | |||
46 | protected: | ||
47 | |||
48 | virtual void decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ); | ||
49 | |||
50 | public: | ||
51 | |||
52 | QString type; | ||
53 | |||
54 | public: | ||
55 | |||
56 | //const QString& type() { return _type; }; | ||
57 | const QString& essid() { return _essid; }; | ||
58 | const QString& macaddr() { return _macaddr; }; | ||
59 | bool wep() { return _wep; }; | ||
60 | int channel() { return _channel; }; | ||
61 | int signal() { return _signal; }; | ||
62 | int beacons() { return _beacons; }; | ||
63 | |||
64 | void setSignal( int signal ) { /* TODO */ }; | ||
65 | void receivedBeacon(); | ||
66 | |||
67 | void setManufacturer( const QString& manufacturer ); | ||
68 | |||
69 | void dump( QTextStream& t ) const; | ||
70 | |||
71 | private: | ||
72 | QString _type; | ||
73 | QString _essid; | ||
74 | QString _macaddr; | ||
75 | bool _wep; | ||
76 | int _channel; | ||
77 | int _signal; | ||
78 | int _beacons; | ||
79 | |||
80 | }; | ||
81 | |||
82 | #endif | ||
83 | |||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 1ccf971..dd8a365 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -123,11 +123,19 @@ Wellenreiter::~Wellenreiter() | |||
123 | // no need to delete child widgets, Qt does it all for us | 123 | // no need to delete child widgets, Qt does it all for us |
124 | 124 | ||
125 | delete manufacturerdb; | 125 | delete manufacturerdb; |
126 | |||
127 | // X11-only - Hmm... Closing the socket here segfaults on exit, | ||
128 | // Maybe because the notifier still has a handle to it!? Seems not to | ||
129 | // occur on Qt/Embedded | ||
130 | |||
131 | #ifdef QWS | ||
126 | if ( daemon_fd != -1 ) | 132 | if ( daemon_fd != -1 ) |
127 | { | 133 | { |
128 | qDebug( "closing comm socket" ); | 134 | qDebug( "closing comm socket" ); |
129 | close( daemon_fd ); | 135 | close( daemon_fd ); |
130 | } | 136 | } |
137 | #endif | ||
138 | |||
131 | } | 139 | } |
132 | 140 | ||
133 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 141 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |