summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2002-12-09 19:37:47 (UTC)
committer mickeyl <mickeyl>2002-12-09 19:37:47 (UTC)
commit046f040efcb0f313818d1dbb1dc1db9021678175 (patch) (unidiff)
tree7fe87d0cfecc6a61856285e307dfc592bbd55fbd
parent711d8c1af3ebdd6f88ff3e9ffa46624c9b63badd (diff)
downloadopie-046f040efcb0f313818d1dbb1dc1db9021678175.zip
opie-046f040efcb0f313818d1dbb1dc1db9021678175.tar.gz
opie-046f040efcb0f313818d1dbb1dc1db9021678175.tar.bz2
improved display logic
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/logwindow.cpp1
-rw-r--r--noncore/net/wellenreiter/gui/scanlistitem.cpp6
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp81
3 files changed, 65 insertions, 23 deletions
diff --git a/noncore/net/wellenreiter/gui/logwindow.cpp b/noncore/net/wellenreiter/gui/logwindow.cpp
index dafb429..c355f09 100644
--- a/noncore/net/wellenreiter/gui/logwindow.cpp
+++ b/noncore/net/wellenreiter/gui/logwindow.cpp
@@ -34,2 +34,3 @@ void MLogWindow::log( QString text )
34 ledit->append( line ); 34 ledit->append( line );
35 qDebug( line );
35 36
diff --git a/noncore/net/wellenreiter/gui/scanlistitem.cpp b/noncore/net/wellenreiter/gui/scanlistitem.cpp
index 189a12d..398b42d 100644
--- a/noncore/net/wellenreiter/gui/scanlistitem.cpp
+++ b/noncore/net/wellenreiter/gui/scanlistitem.cpp
@@ -46,3 +46,7 @@ void MScanListItem::decorateItem( QString type, QString essid, QString macaddr,
46{ 46{
47 qDebug( "decorating scanlist item" ); 47 qDebug( "decorating scanlist item %s / %s / %s [%d]",
48 (const char*) type,
49 (const char*) essid,
50 (const char*) macaddr,
51 channel );
48 52
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index 9c8630f..6d62fa8 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -21,2 +21,3 @@
21 21
22#include <assert.h>
22#include <unistd.h> 23#include <unistd.h>
@@ -86,3 +87,3 @@ typedef struct {
86 87
87 qDebug( "Sniffer sent: '%s'", (const char*) &buffer ); 88 // qDebug( "Sniffer sent: '%s'", (const char*) buffer );
88 hexwindow->log( (const char*) &buffer ); 89 hexwindow->log( (const char*) &buffer );
@@ -91,3 +92,2 @@ typedef struct {
91 { 92 {
92 logwindow->log( "(i) found new network" );
93 qDebug( "Sniffer said: new network found." ); 93 qDebug( "Sniffer said: new network found." );
@@ -102,3 +102,3 @@ typedef struct {
102 QString type; 102 QString type;
103 103
104 if ( n.net_type == 1 ) 104 if ( n.net_type == 1 )
@@ -107,3 +107,3 @@ typedef struct {
107 type = "adhoc"; 107 type = "adhoc";
108 108
109 addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 ); 109 addNewItem( type, n.bssid, QString( (const char*) &n.mac ), n.wep, n.channel, 0 );
@@ -140,3 +140,6 @@ void Wellenreiter::timerEvent( QTimerEvent* e )
140 140
141 if ( hasMessage() ) 141 int result = hasMessage();
142 qDebug( "hasMessage() returned %d", result );
143
144 if ( result )
142 { 145 {
@@ -153,7 +156,15 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
153 // FIXME: this code belongs in customized QListView, not into this class 156 // FIXME: this code belongs in customized QListView, not into this class
157 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
154 158
155 // search, if we had an item with this essid once before 159 qDebug( "Wellenreiter::addNewItem( %s / %s / %s [%d]",
156 160 (const char*) type,
157 //MScanListItem* item = dynamic_cast<MScanListItem*>( netview->firstChild() ); 161 (const char*) essid,
158 MScanListItem* item = static_cast<MScanListItem*>( netview->firstChild() ); 162 (const char*) macaddr,
163 channel );
164
165 // search, if we already have seen this net
166
167 QString s;
168 MScanListItem* network;
169 MScanListItem* item = (MScanListItem*) netview->firstChild();
159 170
@@ -162,3 +173,3 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
162 qDebug( "itemtext: %s", (const char*) item->text( 0 ) ); 173 qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
163 item = dynamic_cast<MScanListItem*>( item->itemBelow() ); 174 item = item->itemBelow();
164 } 175 }
@@ -166,24 +177,50 @@ void Wellenreiter::addNewItem( QString type, QString essid, QString macaddr, boo
166 { 177 {
167 qDebug( "found!" ); 178 // we have already seen this net, check all childs if MAC exists
168 179
169 // check, if it is the same item (based on MACaddr) 180 network = item;
170 181
171 if ( macaddr == item->text( 2 ) ) 182 item = item->firstChild();
183 assert( item ); // this shouldn't fail
184
185 while ( item && ( item->text( 2 ) != macaddr ) )
172 { 186 {
173 qDebug( "already had item with mac %s", (const char*) item->text( 2 ) ); 187 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
174 return; 188 item = item->itemBelow();
175 } 189 }
176
177 // another item belonging to the same net, so: insert the new item as child
178 190
179 new MScanListItem( item, type, essid, macaddr, wep, channel, signal ); 191 if ( item )
192 {
193 // we have already seen this item, it's a dupe
194 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
195 return;
196 }
180 } 197 }
181
182 else 198 else
183 { 199 {
184 qDebug( "inserting new network" ); 200 s.sprintf( "(i) new network: '%s'", (const char*) essid );
185 MScanListItem* network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 ); 201 logwindow->log( s );
202
203 network = new MScanListItem( netview, "networks", essid, QString::null, 0, 0, 0 );
204 }
205
206
207 // insert new station as child from network
208
209 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
210
211 qDebug( "inserting new station %s", (const char*) macaddr );
186 212
187 new MScanListItem( network, type, essid, macaddr, wep, channel, signal ); 213 new MScanListItem( network, type, "", macaddr, wep, channel, signal );
214
215 if ( type == "managed" )
216 {
217 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
218 }
219 else
220 {
221 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
188 } 222 }
223
224 logwindow->log( s );
225
189} 226}