summaryrefslogtreecommitdiff
path: root/noncore/net/wellenreiter/gui/scanlist.cpp
Unidiff
Diffstat (limited to 'noncore/net/wellenreiter/gui/scanlist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 58a04fb..be1245e 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -50,12 +50,17 @@ MScanListView::MScanListView( QWidget* parent, const char* name )
50}; 50};
51 51
52MScanListView::~MScanListView() 52MScanListView::~MScanListView()
53{ 53{
54}; 54};
55 55
56OListViewItem* MScanListView::childFactory()
57{
58 return new MScanListItem( this );
59}
60
56void MScanListView::serializeTo( QDataStream& s) const 61void MScanListView::serializeTo( QDataStream& s) const
57{ 62{
58 qDebug( "serializing MScanListView" ); 63 qDebug( "serializing MScanListView" );
59 OListView::serializeTo( s ); 64 OListView::serializeTo( s );
60} 65}
61 66
@@ -93,13 +98,13 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
93 } 98 }
94 if ( item ) 99 if ( item )
95 { 100 {
96 // animate the item 101 // animate the item
97 102
98 /* 103 /*
99 104
100 const QPixmap* pixmap = item->pixmap( 0 ); 105 const QPixmap* pixmap = item->pixmap( 0 );
101 const QPixmap* nextpixmap = ani2; 106 const QPixmap* nextpixmap = ani2;
102 if ( pixmap == ani1 ) 107 if ( pixmap == ani1 )
103 nextpixmap = ani2; 108 nextpixmap = ani2;
104 else if ( pixmap == ani2 ) 109 else if ( pixmap == ani2 )
105 nextpixmap = ani3; 110 nextpixmap = ani3;
@@ -109,18 +114,18 @@ void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bo
109 nextpixmap = ani1; 114 nextpixmap = ani1;
110 item->setPixmap( 0, *nextpixmap ); */ 115 item->setPixmap( 0, *nextpixmap ); */
111 116
112 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap ); 117 //qDebug( "current pixmap %d, next %d", pixmap, nextpixmap );
113 118
114 // we have already seen this net, check all childs if MAC exists 119 // we have already seen this net, check all childs if MAC exists
115 120
116 network = item; 121 network = item;
117 122
118 item = static_cast<MScanListItem*> ( item->firstChild() ); 123 item = static_cast<MScanListItem*> ( item->firstChild() );
119 assert( item ); // this shouldn't fail 124 assert( item ); // this shouldn't fail
120 125
121 while ( item && ( item->text( 2 ) != macaddr ) ) 126 while ( item && ( item->text( 2 ) != macaddr ) )
122 { 127 {
123 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) ); 128 qDebug( "subitemtext: %s", (const char*) item->text( 2 ) );
124 item = static_cast<MScanListItem*> ( item->itemBelow() ); 129 item = static_cast<MScanListItem*> ( item->itemBelow() );
125 } 130 }
126 131
@@ -195,20 +200,40 @@ MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid
195 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) 200 :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null )
196{ 201{
197 qDebug( "creating scanlist item" ); 202 qDebug( "creating scanlist item" );
198 decorateItem( type, essid, macaddr, wep, channel, signal ); 203 decorateItem( type, essid, macaddr, wep, channel, signal );
199} 204}
200 205
206OListViewItem* MScanListItem::childFactory()
207{
208 return new MScanListItem( this );
209}
210
201void MScanListItem::serializeTo( QDataStream& s ) const 211void MScanListItem::serializeTo( QDataStream& s ) const
202{ 212{
213 qDebug( "serializing MScanListItem" );
203 OListViewItem::serializeTo( s ); 214 OListViewItem::serializeTo( s );
215
216 s << _type;
217 s << (Q_UINT8) _wep;
204} 218}
205 219
206void MScanListItem::serializeFrom( QDataStream& s ) 220void MScanListItem::serializeFrom( QDataStream& s )
207{ 221{
222 qDebug( "serializing MScanListItem" );
208 OListViewItem::serializeFrom( s ); 223 OListViewItem::serializeFrom( s );
224
225 s >> _type;
226 s >> (Q_UINT8) _wep;
227
228 QString name;
229 name.sprintf( "wellenreiter/%s", (const char*) _type );
230 setPixmap( col_type, Resource::loadPixmap( name ) );
231 if ( _wep )
232 setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap!
233 listView()->triggerUpdate();
209} 234}
210 235
211void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) 236void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal )
212{ 237{
213 qDebug( "decorating scanlist item %s / %s / %s [%d]", 238 qDebug( "decorating scanlist item %s / %s / %s [%d]",
214 (const char*) type, 239 (const char*) type,