Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 6d3469c..cdc2c48 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -11,31 +11,33 @@ | |||
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 "scanlist.h" | 16 | #include "scanlist.h" |
17 | #include "scanlistitem.h" | 17 | #include "scanlistitem.h" |
18 | 18 | ||
19 | #include <assert.h> | 19 | #include <assert.h> |
20 | 20 | ||
21 | #include "manufacturers.h" | 21 | #include "manufacturers.h" |
22 | 22 | ||
23 | #include <qtextstream.h> | ||
24 | |||
23 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 25 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
24 | :OListView( parent, name ), _manufacturerdb( 0 ) | 26 | :OListView( parent, name ), _manufacturerdb( 0 ) |
25 | { | 27 | { |
26 | 28 | ||
27 | setFrameShape( QListView::StyledPanel ); | 29 | setFrameShape( QListView::StyledPanel ); |
28 | setFrameShadow( QListView::Sunken ); | 30 | setFrameShadow( QListView::Sunken ); |
29 | 31 | ||
30 | addColumn( tr( "Net/Station" ) ); | 32 | addColumn( tr( "Net/Station" ) ); |
31 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); | 33 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); |
32 | addColumn( tr( "B" ) ); | 34 | addColumn( tr( "B" ) ); |
33 | setColumnAlignment( 1, AlignCenter ); | 35 | setColumnAlignment( 1, AlignCenter ); |
34 | addColumn( tr( "AP" ) ); | 36 | addColumn( tr( "AP" ) ); |
35 | setColumnAlignment( 2, AlignCenter ); | 37 | setColumnAlignment( 2, AlignCenter ); |
36 | addColumn( tr( "Chn" ) ); | 38 | addColumn( tr( "Chn" ) ); |
37 | setColumnAlignment( 3, AlignCenter ); | 39 | setColumnAlignment( 3, AlignCenter ); |
38 | addColumn( tr( "W" ) ); | 40 | addColumn( tr( "W" ) ); |
39 | setColumnAlignment( 4, AlignCenter ); | 41 | setColumnAlignment( 4, AlignCenter ); |
40 | addColumn( tr( "T" ) ); | 42 | addColumn( tr( "T" ) ); |
41 | setColumnAlignment( 5, AlignCenter ); | 43 | setColumnAlignment( 5, AlignCenter ); |
@@ -116,38 +118,50 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo | |||
116 | { | 118 | { |
117 | // we have already seen this item, it's a dupe | 119 | // we have already seen this item, it's a dupe |
118 | #ifdef DEBUG | 120 | #ifdef DEBUG |
119 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 121 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
120 | #endif | 122 | #endif |
121 | item->receivedBeacon(); | 123 | item->receivedBeacon(); |
122 | return; | 124 | return; |
123 | } | 125 | } |
124 | } | 126 | } |
125 | else | 127 | else |
126 | { | 128 | { |
127 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 129 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
128 | 130 | ||
129 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); | 131 | network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 ); |
130 | } | 132 | } |
131 | 133 | ||
132 | 134 | ||
133 | // insert new station as child from network | 135 | // insert new station as child from network |
134 | 136 | ||
135 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 137 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
136 | 138 | ||
137 | qDebug( "inserting new station %s", (const char*) macaddr ); | 139 | qDebug( "inserting new station %s", (const char*) macaddr ); |
138 | 140 | ||
139 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 141 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
140 | if ( _manufacturerdb ) | 142 | if ( _manufacturerdb ) |
141 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); | 143 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); |
142 | 144 | ||
143 | if ( type == "managed" ) | 145 | if ( type == "managed" ) |
144 | { | 146 | { |
145 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 147 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); |
146 | } | 148 | } |
147 | else | 149 | else |
148 | { | 150 | { |
149 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 151 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
150 | } | 152 | } |
151 | 153 | ||
152 | } | 154 | } |
153 | 155 | ||
156 | void MScanListView::dump( QTextStream& t ) const | ||
157 | { | ||
158 | qDebug( "dumping scanlist..." ); | ||
159 | |||
160 | QListViewItemIterator it( const_cast<MScanListView*>( this ) ); | ||
161 | for ( ; it.current(); ++it ) | ||
162 | { | ||
163 | static_cast<MScanListItem*>( it.current() )->dump( t ); | ||
164 | } | ||
165 | |||
166 | qDebug( "dump finished." ); | ||
167 | } | ||