summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
authormickeyl <mickeyl>2002-12-28 18:57:11 (UTC)
committer mickeyl <mickeyl>2002-12-28 18:57:11 (UTC)
commitf70916f3ab05917a3d0dda64beb8db5ac16448ab (patch) (unidiff)
treebd138c1a901de7ea49b012b32e48d3f4b8b073f8 /noncore/net/wellenreiter/gui/scanlist.cpp
parent1362726346f1ab497ad5822db1a9b284f5bdaa1a (diff)
downloadopie-f70916f3ab05917a3d0dda64beb8db5ac16448ab.zip
opie-f70916f3ab05917a3d0dda64beb8db5ac16448ab.tar.gz
opie-f70916f3ab05917a3d0dda64beb8db5ac16448ab.tar.bz2
- refactored a number of classes
- removed dumb polling ==> QSocketNotifier rocks - switched to parsing the daemon stuff in the gui, since libwellenreiter still has problems.
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index f907afc..6d032aa 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -14,4 +14,104 @@
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlist.h" 16#include "scanlist.h"
17#include "scanlistitem.h"
18
19#include <assert.h>
20
21MScanListView::MScanListView( QWidget* parent, const char* name )
22 :QListView( parent, name )
23{
24};
25
26MScanListView::~MScanListView()
27{
28};
29
30void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
31{
32 // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...)
33
34 qDebug( "MScanList::addNewItem( %s / %s / %s [%d]",
35 (const char*) type,
36 (const char*) essid,
37 (const char*) macaddr,
38 channel );
39
40 // search, if we already have seen this net
41
42 QString s;
43 MScanListItem* network;
44 MScanListItem* item = static_cast<MScanListItem*> ( firstChild() );
45
46 while ( item && ( item->text( 0 ) != essid ) )
47 {
48 qDebug( "itemtext: %s", (const char*) item->text( 0 ) );
49 item = static_cast<MScanListItem*> ( item->itemBelow() );
50 }
51 if ( item )
52 {
53 // animate the item
54
55 /*
56
57 const QPixmap* pixmap = item->pixmap( 0 );
58 const QPixmap* nextpixmap = ani2;
59 if ( pixmap == ani1 )
60 nextpixmap = ani2;
61 else if ( pixmap == ani2 )
62 nextpixmap = ani3;
63 else if ( pixmap == ani3 )
64 nextpixmap = ani4;
65 else if ( pixmap == ani4 )
66 nextpixmap = ani1;
67 item->setPixmap( 0, *nextpixmap ); */
68
69 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
70
71 // we have already seen this net, check all childs if MAC exists
72
73 network = item;
74
75 item = static_cast<MScanListItem*> ( item->firstChild() );
76 assert( item ); // this shouldn't fail
77
78 while ( item && ( item->text( 2 ) != macaddr ) )
79 {
80 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
81 item = static_cast<MScanListItem*> ( item->itemBelow() );
82 }
83
84 if ( item )
85 {
86 // we have already seen this item, it's a dupe
87 qDebug( "%s is a dupe - ignoring...", (const char*) macaddr );
88 return;
89 }
90 }
91 else
92 {
93 s.sprintf( "(i) new network: '%s'", (const char*) essid );
94
95 network = new MScanListItem( this, "networks", essid, QString::null, 0, 0, 0 );
96 }
97
98
99 // insert new station as child from network
100
101 // no essid to reduce clutter, maybe later we have a nick or stationname to display!?
102
103 qDebug( "inserting new station %s", (const char*) macaddr );
104
105 new MScanListItem( network, type, "", macaddr, wep, channel, signal );
106
107 if ( type == "managed" )
108 {
109 s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel );
110 }
111 else
112 {
113 s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel );
114 }
115
116}
17 117