-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 17 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 9 |
2 files changed, 11 insertions, 15 deletions
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index c605111..9e8aa72 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -108,50 +108,51 @@ void MScanListView::serializeTo( QDataStream& s) const | |||
108 | odebug << "serializing MScanListView" << oendl; | 108 | odebug << "serializing MScanListView" << oendl; |
109 | OListView::serializeTo( s ); | 109 | OListView::serializeTo( s ); |
110 | } | 110 | } |
111 | 111 | ||
112 | 112 | ||
113 | void MScanListView::serializeFrom( QDataStream& s) | 113 | void MScanListView::serializeFrom( QDataStream& s) |
114 | { | 114 | { |
115 | odebug << "serializing MScanListView" << oendl; | 115 | odebug << "serializing MScanListView" << oendl; |
116 | OListView::serializeFrom( s ); | 116 | OListView::serializeFrom( s ); |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | void MScanListView::addNewItem( const QString& type, | 120 | void MScanListView::addNewItem( const QString& type, |
121 | const QString& essid, | 121 | const QString& essid, |
122 | const OMacAddress& mac, | 122 | const OMacAddress& mac, |
123 | bool wep, | 123 | bool wep, |
124 | int channel, | 124 | int channel, |
125 | int signal, | 125 | int signal, |
126 | const GpsLocation& loc, | 126 | const GpsLocation& loc, |
127 | bool probe ) | 127 | bool probe ) |
128 | { | 128 | { |
129 | QString macaddr = mac.toString(true); | 129 | QString macaddr = mac.toString(true); |
130 | 130 | ||
131 | #ifdef DEBUG | 131 | #ifdef DEBUG |
132 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", (const char*) type, | 132 | odebug << "MScanList::addNewItem( " << (const char*) type << " / " |
133 | (const char*) essid, (const char*) macaddr, channel ); | 133 | << (const char*) essid << " / " << (const char*) macaddr |
134 | << " [" << channel << "]" << oendl; | ||
134 | #endif | 135 | #endif |
135 | 136 | ||
136 | // search, if we already have seen this net | 137 | // search, if we already have seen this net |
137 | 138 | ||
138 | QString s; | 139 | QString s; |
139 | MScanListItem* network; | 140 | MScanListItem* network; |
140 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 141 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
141 | 142 | ||
142 | while ( item && ( item->text( col_essid ) != essid ) ) | 143 | while ( item && ( item->text( col_essid ) != essid ) ) |
143 | { | 144 | { |
144 | #ifdef DEBUG | 145 | #ifdef DEBUG |
145 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; | 146 | odebug << "itemtext: " << item->text( col_essid ) << "" << oendl; |
146 | #endif | 147 | #endif |
147 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 148 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
148 | } | 149 | } |
149 | if ( item ) | 150 | if ( item ) |
150 | { | 151 | { |
151 | // we have already seen this net, check all childs if MAC exists | 152 | // we have already seen this net, check all childs if MAC exists |
152 | 153 | ||
153 | network = item; | 154 | network = item; |
154 | 155 | ||
155 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 156 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
156 | assert( item ); // this shouldn't fail | 157 | assert( item ); // this shouldn't fail |
157 | 158 | ||
@@ -373,50 +374,50 @@ void MScanListView::addService( const QString& name, const OMacAddress& macaddr, | |||
373 | subitem->receivedBeacon(); //FIXME: sent data bit | 374 | subitem->receivedBeacon(); //FIXME: sent data bit |
374 | return; | 375 | return; |
375 | } | 376 | } |
376 | 377 | ||
377 | // never seen that - add new item | 378 | // never seen that - add new item |
378 | 379 | ||
379 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); | 380 | MScanListItem* item = new MScanListItem( it.current(), "service", "N/A", " ", false, -1, -1 ); |
380 | item->setText( col_essid, name ); | 381 | item->setText( col_essid, name ); |
381 | 382 | ||
382 | return; | 383 | return; |
383 | } | 384 | } |
384 | } | 385 | } |
385 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; | 386 | odebug << "D'oh! Received identification, but item not yet in list... ==> Handle this!" << oendl; |
386 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", | 387 | MLogWindow::logwindow()->log( QString().sprintf( "WARNING: Unhandled service addition %s = %s!", |
387 | (const char*) macaddr.toString(), (const char*) ip ) ); | 388 | (const char*) macaddr.toString(), (const char*) ip ) ); |
388 | } | 389 | } |
389 | 390 | ||
390 | 391 | ||
391 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) | 392 | void MScanListView::contextMenuRequested( QListViewItem* item, const QPoint&, int col ) |
392 | { | 393 | { |
393 | if ( !item ) return; | 394 | if ( !item ) return; |
394 | 395 | ||
395 | MScanListItem* itm = static_cast<MScanListItem*>( item ); | 396 | MScanListItem* itm = static_cast<MScanListItem*>( item ); |
396 | 397 | ||
397 | qDebug( "contextMenuRequested on item '%s' (%s) in column: '%d'", | 398 | odebug << "contextMenuRequested on item '" << (const char*) itm->text(0) << "' (" |
398 | (const char*) itm->text(0), (const char*) itm->type, col ); | 399 | << (const char*) itm->type << ") in column: '" << col << "'" << oendl; |
399 | 400 | ||
400 | if ( itm->type == "adhoc" || itm->type == "managed" ) | 401 | if ( itm->type == "adhoc" || itm->type == "managed" ) |
401 | { | 402 | { |
402 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); | 403 | QString entry = QString().sprintf( "&Join %s Net '%s'...", (const char*) itm->type, (const char*) itm->essid() ); |
403 | 404 | ||
404 | QPopupMenu m( this ); | 405 | QPopupMenu m( this ); |
405 | m.insertItem( entry, 37773, 0 ); | 406 | m.insertItem( entry, 37773, 0 ); |
406 | int result = m.exec( QCursor::pos() ); | 407 | int result = m.exec( QCursor::pos() ); |
407 | if ( result == 37773 ) | 408 | if ( result == 37773 ) |
408 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); | 409 | emit joinNetwork( itm->type, itm->essid(), itm->channel(), itm->macaddr() ); |
409 | } | 410 | } |
410 | } | 411 | } |
411 | 412 | ||
412 | //============================================================ | 413 | //============================================================ |
413 | // MScanListItem | 414 | // MScanListItem |
414 | //============================================================ | 415 | //============================================================ |
415 | 416 | ||
416 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, | 417 | MScanListItem::MScanListItem( QListView* parent, const QString& type, const QString& essid, const QString& macaddr, |
417 | bool wep, int channel, int signal, bool probed ) | 418 | bool wep, int channel, int signal, bool probed ) |
418 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 419 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
419 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 420 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
420 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 421 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
421 | { | 422 | { |
422 | #ifdef DEBUG | 423 | #ifdef DEBUG |
@@ -468,53 +469,51 @@ void MScanListItem::serializeTo( QDataStream& s ) const | |||
468 | 469 | ||
469 | void MScanListItem::serializeFrom( QDataStream& s ) | 470 | void MScanListItem::serializeFrom( QDataStream& s ) |
470 | { | 471 | { |
471 | #ifdef DEBUG | 472 | #ifdef DEBUG |
472 | odebug << "serializing MScanListItem" << oendl; | 473 | odebug << "serializing MScanListItem" << oendl; |
473 | #endif | 474 | #endif |
474 | OListViewItem::serializeFrom( s ); | 475 | OListViewItem::serializeFrom( s ); |
475 | 476 | ||
476 | Q_UINT8 wep; | 477 | Q_UINT8 wep; |
477 | s >> _type; | 478 | s >> _type; |
478 | s >> wep; | 479 | s >> wep; |
479 | _wep = (wep == 'y'); | 480 | _wep = (wep == 'y'); |
480 | 481 | ||
481 | QString name; | 482 | QString name; |
482 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 483 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
483 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 484 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
484 | if ( _wep ) | 485 | if ( _wep ) |
485 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 486 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
486 | listView()->triggerUpdate(); | 487 | listView()->triggerUpdate(); |
487 | } | 488 | } |
488 | 489 | ||
489 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) | 490 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal, bool probed ) |
490 | { | 491 | { |
491 | #ifdef DEBUG | 492 | #ifdef DEBUG |
492 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 493 | odebug << "decorating scanlist item " << (const char*) type << " / " |
493 | (const char*) type, | 494 | << (const char*) essid << " / " << (const char*) macaddr |
494 | (const char*) essid, | 495 | << "[" << channel << "]" << oendl; |
495 | (const char*) macaddr, | ||
496 | channel ); | ||
497 | #endif | 496 | #endif |
498 | 497 | ||
499 | // set icon for managed or adhoc mode | 498 | // set icon for managed or adhoc mode |
500 | QString name; | 499 | QString name; |
501 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 500 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
502 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 501 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
503 | 502 | ||
504 | // special case for probed networks FIXME: This is ugly at present | 503 | // special case for probed networks FIXME: This is ugly at present |
505 | if ( type == "network" && probed ) | 504 | if ( type == "network" && probed ) |
506 | { | 505 | { |
507 | setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); | 506 | setPixmap( col_type, Resource::loadPixmap( "wellenreiter/network-probed.png" ) ); |
508 | } | 507 | } |
509 | 508 | ||
510 | // set icon for wep (wireless encryption protocol) | 509 | // set icon for wep (wireless encryption protocol) |
511 | if ( wep ) | 510 | if ( wep ) |
512 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 511 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
513 | 512 | ||
514 | // set channel and signal text | 513 | // set channel and signal text |
515 | 514 | ||
516 | if ( signal != -1 ) | 515 | if ( signal != -1 ) |
517 | setText( col_sig, QString::number( signal ) ); | 516 | setText( col_sig, QString::number( signal ) ); |
518 | if ( channel != -1 ) | 517 | if ( channel != -1 ) |
519 | setText( col_channel, QString::number( channel ) ); | 518 | setText( col_channel, QString::number( channel ) ); |
520 | 519 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 2f85790..e801ce7 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -721,49 +721,46 @@ void Wellenreiter::doAction( const QString& action, const QString& protocol, OPa | |||
721 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 721 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
722 | else if ( action == "MessageBox" ) | 722 | else if ( action == "MessageBox" ) |
723 | QMessageBox::information( this, "Notification!", | 723 | QMessageBox::information( this, "Notification!", |
724 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 724 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
725 | #else | 725 | #else |
726 | #warning Actions do not work with Qt/X11 yet | 726 | #warning Actions do not work with Qt/X11 yet |
727 | #endif | 727 | #endif |
728 | } | 728 | } |
729 | 729 | ||
730 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) | 730 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) |
731 | { | 731 | { |
732 | #ifdef QWS | 732 | #ifdef QWS |
733 | if ( !iface ) | 733 | if ( !iface ) |
734 | { | 734 | { |
735 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); | 735 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); |
736 | return; | 736 | return; |
737 | } | 737 | } |
738 | 738 | ||
739 | if ( sniffing ) | 739 | if ( sniffing ) |
740 | { | 740 | { |
741 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); | 741 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); |
742 | return; | 742 | return; |
743 | } | 743 | } |
744 | 744 | ||
745 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", | 745 | odebug << "joinNetwork() with Interface " << (const char*) iface->name() |
746 | (const char*) iface->name(), | 746 | << ": " << (const char*) type << ", " << (const char*) essid |
747 | (const char*) type, | 747 | << ", " << channel << ", " << (const char*) macaddr << oendl; |
748 | (const char*) essid, | ||
749 | channel, | ||
750 | (const char*) macaddr ); | ||
751 | 748 | ||
752 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 749 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
753 | int count = 3; | 750 | int count = 3; |
754 | odebug << "sending " << count << " messages" << oendl; | 751 | odebug << "sending " << count << " messages" << oendl; |
755 | msg << QString("count") << QString::number(count); | 752 | msg << QString("count") << QString::number(count); |
756 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; | 753 | odebug << "msg >" << iface->name() << "< Mode >" << type.latin1() << "<" << oendl; |
757 | msg << QString(iface->name()) << QString("Mode") << type; | 754 | msg << QString(iface->name()) << QString("Mode") << type; |
758 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; | 755 | odebug << "msg >" << iface->name() << "< essid >" << essid.latin1() << "<" << oendl; |
759 | msg << QString(iface->name()) << QString("ESSID") << essid; | 756 | msg << QString(iface->name()) << QString("ESSID") << essid; |
760 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; | 757 | odebug << "msg >" << iface->name() << "< channel >" << channel << "<" << oendl; |
761 | msg << QString(iface->name()) << QString("Channel") << channel; | 758 | msg << QString(iface->name()) << QString("Channel") << channel; |
762 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; | 759 | // odebug << "msg >" << iface->name() << "< mac >" << macaddr << "<" << oendl; |
763 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 760 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
764 | #else | 761 | #else |
765 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | 762 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); |
766 | #endif | 763 | #endif |
767 | 764 | ||
768 | } | 765 | } |
769 | 766 | ||