summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp32
1 files changed, 7 insertions, 25 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 7733934..b8aa81c 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -94,133 +94,115 @@ void MScanListView::serializeFrom( QDataStream& s)
94 OListView::serializeFrom( s ); 94 OListView::serializeFrom( s );
95} 95}
96 96
97void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) 97void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb )
98{ 98{
99 _manufacturerdb = manufacturerdb; 99 _manufacturerdb = manufacturerdb;
100} 100}
101 101
102void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 102void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
103{ 103{
104 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) 104 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
105 105
106 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", 106 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
107 (const char*) type, 107 (const char*) type,
108 (const char*) essid, 108 (const char*) essid,
109 (const char*) macaddr, 109 (const char*) macaddr,
110 channel ); 110 channel );
111 111
112 // search, if we already have seen this net 112 // search, if we already have seen this net
113 113
114 QString s; 114 QString s;
115 MScanListItem* network; 115 MScanListItem* network;
116 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); 116 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
117 117
118 while ( item && ( item->text( 0 ) != essid ) ) 118 while ( item && ( item->text( col_essid ) != essid ) )
119 { 119 {
120 qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); 120 qDebug( "itemtext: %s", (const char*) item->text( col_essid ) );
121 item = static_cast<MScanListItem*> ( item->itemBelow() ); 121 item = static_cast<MScanListItem*> ( item->nextSibling() );
122 } 122 }
123 if ( item ) 123 if ( item )
124 { 124 {
125 // animate the item
126
127 /*
128
129 const QPixmap* pixmap = item->pixmap( 0 );
130 const QPixmap* nextpixmap = ani2;
131 if ( pixmap == ani1 )
132 nextpixmap = ani2;
133 else if ( pixmap == ani2 )
134 nextpixmap = ani3;
135 else if ( pixmap == ani3 )
136 nextpixmap = ani4;
137 else if ( pixmap == ani4 )
138 nextpixmap = ani1;
139 item->setPixmap( 0, *nextpixmap ); */
140
141 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
142
143 // we have already seen this net, check all childs if MAC exists 125 // we have already seen this net, check all childs if MAC exists
144 126
145 network = item; 127 network = item;
146 128
147 item = static_cast<MScanListItem*> ( item->firstChild() ); 129 item = static_cast<MScanListItem*> ( item->firstChild() );
148 assert( item ); // this shouldn't fail 130 assert( item ); // this shouldn't fail
149 131
150 while ( item && ( item->text( 2 ) != macaddr ) ) 132 while ( item && ( item->text( col_ap ) != macaddr ) )
151 { 133 {
152 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); 134 qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) );
153 item = static_cast<MScanListItem*> ( item->itemBelow() ); 135 item = static_cast<MScanListItem*> ( item->nextSibling() );
154 } 136 }
155 137
156 if ( item ) 138 if ( item )
157 { 139 {
158 // we have already seen this item, it's a dupe 140 // we have already seen this item, it's a dupe
159 #ifdef DEBUG 141 #ifdef DEBUG
160 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); 142 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
161 #endif 143 #endif
162 item->receivedBeacon(); 144 item->receivedBeacon();
163 return; 145 return;
164 } 146 }
165 } 147 }
166 else 148 else
167 { 149 {
168 s.sprintf( "(i) new network: '%s'", (const char*) essid ); 150 s.sprintf( "(i) new network: '%s'", (const char*) essid );
169 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); 151 network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 );
170 } 152 }
171 153
172 154
173 // insert new station as child from network 155 // insert new station as child from network
174 156
175 // no essid to reduce clutter, maybe later we have a nick or stationname to display!? 157 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
176 158
177 qDebug( "inserting new station %s", (const char*) macaddr ); 159 qDebug( "inserting new station %s", (const char*) macaddr );
178 160
179 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); 161 MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal );
180 if ( _manufacturerdb ) 162 if ( _manufacturerdb )
181 station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); 163 station->setManufacturer( _manufacturerdb->lookup( macaddr ) );
182 164
183 if ( type == "managed" ) 165 if ( type == "managed" )
184 { 166 {
185 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); 167 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
186 } 168 }
187 else 169 else
188 { 170 {
189 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); 171 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
190 } 172 }
191 173
192} 174}
193 175
194 176
195void MScanListView::addIfNotExisting( MScanListItem* network, QString addr ) 177void MScanListView::addIfNotExisting( MScanListItem* network, QString addr )
196{ 178{
197 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); 179 MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() );
198 180
199 while ( subitem && ( subitem->text( col_ap ) != addr ) ) 181 while ( subitem && ( subitem->text( col_ap ) != addr ) )
200 { 182 {
201 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); 183 qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) );
202 subitem = static_cast<MScanListItem*> ( subitem->itemBelow() ); 184 subitem = static_cast<MScanListItem*> ( subitem->nextSibling() );
203 } 185 }
204 186
205 if ( subitem ) 187 if ( subitem )
206 { 188 {
207 // we have already seen this item, it's a dupe 189 // we have already seen this item, it's a dupe
208 #ifdef DEBUG 190 #ifdef DEBUG
209 qDebug( "%s is a dupe - ignoring...", (const char*) addr ); 191 qDebug( "%s is a dupe - ignoring...", (const char*) addr );
210 #endif 192 #endif
211 subitem->receivedBeacon(); //FIXME: sent data bit 193 subitem->receivedBeacon(); //FIXME: sent data bit
212 return; 194 return;
213 } 195 }
214 196
215 // Hey, it seems to be a new item :-D 197 // Hey, it seems to be a new item :-D
216 MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 ); 198 MScanListItem* station = new MScanListItem( network, "station", /* network->text( col_essid ) */ "", addr, false, -1, -1 );
217 if ( _manufacturerdb ) 199 if ( _manufacturerdb )
218 station->setManufacturer( _manufacturerdb->lookup( addr ) ); 200 station->setManufacturer( _manufacturerdb->lookup( addr ) );
219} 201}
220 202
221 203
222void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) 204void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo )
223{ 205{
224 QString s; 206 QString s;
225 MScanListItem* network; 207 MScanListItem* network;
226 208