-rw-r--r-- | noncore/net/wellenreiter/gui/configwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp index ca53471..48fe89c 100644 --- a/noncore/net/wellenreiter/gui/configwindow.cpp +++ b/noncore/net/wellenreiter/gui/configwindow.cpp | |||
@@ -258,130 +258,130 @@ void WellenreiterConfigWindow::channelAllClicked(int state) | |||
258 | channel10->setChecked( b ); | 258 | channel10->setChecked( b ); |
259 | channel11->setChecked( b ); | 259 | channel11->setChecked( b ); |
260 | channel12->setChecked( b ); | 260 | channel12->setChecked( b ); |
261 | channel13->setChecked( b ); | 261 | channel13->setChecked( b ); |
262 | channel14->setChecked( b ); | 262 | channel14->setChecked( b ); |
263 | } | 263 | } |
264 | 264 | ||
265 | 265 | ||
266 | bool WellenreiterConfigWindow::useGPS() const | 266 | bool WellenreiterConfigWindow::useGPS() const |
267 | { | 267 | { |
268 | return enableGPS->isChecked(); | 268 | return enableGPS->isChecked(); |
269 | } | 269 | } |
270 | 270 | ||
271 | 271 | ||
272 | const QString WellenreiterConfigWindow::gpsHost() const | 272 | const QString WellenreiterConfigWindow::gpsHost() const |
273 | { | 273 | { |
274 | return useGPS() ? gpsdHost->currentText() : QString::null; | 274 | return useGPS() ? gpsdHost->currentText() : QString::null; |
275 | } | 275 | } |
276 | 276 | ||
277 | 277 | ||
278 | int WellenreiterConfigWindow::gpsPort() const | 278 | int WellenreiterConfigWindow::gpsPort() const |
279 | { | 279 | { |
280 | bool ok; | 280 | bool ok; |
281 | return useGPS() ? gpsdPort->value() : -1; | 281 | return useGPS() ? gpsdPort->value() : -1; |
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | void WellenreiterConfigWindow::performAction( const QString& type, | 285 | void WellenreiterConfigWindow::performAction( const QString& type, |
286 | const QString& essid, | 286 | const QString& essid, |
287 | const QString& mac, | 287 | const QString& mac, |
288 | bool wep, | 288 | bool wep, |
289 | int channel, | 289 | int channel, |
290 | int signal | 290 | int signal |
291 | /* , const GpsLocation& loc */ ) | 291 | /* , const GpsLocation& loc */ ) |
292 | { | 292 | { |
293 | int action; | 293 | int action; |
294 | QString script; | 294 | QString script; |
295 | 295 | ||
296 | if ( type == "network" ) | 296 | if ( type == "network" ) |
297 | { | 297 | { |
298 | action = newNetworkAction->currentItem(); | 298 | action = newNetworkAction->currentItem(); |
299 | script = newNetworkScript->text(); | 299 | script = newNetworkScript->text(); |
300 | } | 300 | } |
301 | else if ( type == "managed" || type == "adhoc" ) | 301 | else if ( type == "managed" || type == "adhoc" ) |
302 | { | 302 | { |
303 | action = newClientAction->currentItem(); | 303 | action = newClientAction->currentItem(); |
304 | script = newClientScript->text(); | 304 | script = newClientScript->text(); |
305 | } | 305 | } |
306 | else if ( type == "station" ) | 306 | else if ( type == "station" ) |
307 | { | 307 | { |
308 | action = newStationAction->currentItem(); | 308 | action = newStationAction->currentItem(); |
309 | script = newStationScript->text(); | 309 | script = newStationScript->text(); |
310 | } | 310 | } |
311 | else | 311 | else |
312 | { | 312 | { |
313 | qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); | 313 | qWarning( "WellenreiterConfigWindow::performAction(): unknown type '%s'", (const char*) type ); |
314 | return; | 314 | return; |
315 | } | 315 | } |
316 | 316 | ||
317 | qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); | 317 | qDebug( "for event '%s' I'm going to perform action %d (script='%s')", (const char*) type, action, (const char*) script ); |
318 | 318 | ||
319 | switch( action ) | 319 | switch( action ) |
320 | { | 320 | { |
321 | case 0: /* Ignore */ return; | 321 | case 0: /* Ignore */ return; |
322 | case 1: /* Play Alarm */ ODevice::inst()->alarmSound(); return; | 322 | case 1: /* Play Alarm */ ODevice::inst()->playAlarmSound(); return; |
323 | case 2: /* Play Click */ ODevice::inst()->touchSound(); return; | 323 | case 2: /* Play Click */ ODevice::inst()->playTouchSound(); return; |
324 | case 3: /* Blink LED */ break; //FIXME: Implement this | 324 | case 3: /* Blink LED */ break; //FIXME: Implement this |
325 | case 4: /* Run Script */ | 325 | case 4: /* Run Script */ |
326 | { | 326 | { |
327 | /** | 327 | /** |
328 | * | 328 | * |
329 | * Script Substitution Information: | 329 | * Script Substitution Information: |
330 | * | 330 | * |
331 | * $SSID = SSID | 331 | * $SSID = SSID |
332 | * $MAC = MAC | 332 | * $MAC = MAC |
333 | * $WEP = Wep | 333 | * $WEP = Wep |
334 | * $CHAN = Channel | 334 | * $CHAN = Channel |
335 | * | 335 | * |
336 | **/ | 336 | **/ |
337 | script = script.replace( QRegExp( "$SSID" ), essid ); | 337 | script = script.replace( QRegExp( "$SSID" ), essid ); |
338 | script = script.replace( QRegExp( "$MAC" ), mac ); | 338 | script = script.replace( QRegExp( "$MAC" ), mac ); |
339 | script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); | 339 | script = script.replace( QRegExp( "$WEP" ), wep ? QString( "true" ) : QString( "false" ) ); |
340 | script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); | 340 | script = script.replace( QRegExp( "$CHAN" ), QString::number( channel ) ); |
341 | 341 | ||
342 | qDebug( "going to call script '%s'", (const char*) script ); | 342 | qDebug( "going to call script '%s'", (const char*) script ); |
343 | ::system( script ); | 343 | ::system( script ); |
344 | qDebug( "script returned." ); | 344 | qDebug( "script returned." ); |
345 | return; | 345 | return; |
346 | } | 346 | } |
347 | default: assert( false ); | 347 | default: assert( false ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | 351 | ||
352 | void WellenreiterConfigWindow::load() | 352 | void WellenreiterConfigWindow::load() |
353 | { | 353 | { |
354 | #ifdef Q_WS_X11 | 354 | #ifdef Q_WS_X11 |
355 | #warning Persistent Configuration not yet implemented for standalone X11 build | 355 | #warning Persistent Configuration not yet implemented for standalone X11 build |
356 | performAutodetection(); | 356 | performAutodetection(); |
357 | #else | 357 | #else |
358 | qDebug( "loading configuration settings..." ); | 358 | qDebug( "loading configuration settings..." ); |
359 | 359 | ||
360 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ | 360 | /* This is dumb monkey typing stuff... We _need_ to do this automatically! */ |
361 | 361 | ||
362 | OConfig* c = oApp->config(); | 362 | OConfig* c = oApp->config(); |
363 | 363 | ||
364 | c->setGroup( "Interface" ); | 364 | c->setGroup( "Interface" ); |
365 | 365 | ||
366 | QString interface = c->readEntry( "name", "<none>" ); | 366 | QString interface = c->readEntry( "name", "<none>" ); |
367 | if ( interface != "<none>" ) | 367 | if ( interface != "<none>" ) |
368 | { | 368 | { |
369 | #if QT_VERSION < 300 | 369 | #if QT_VERSION < 300 |
370 | interfaceName->insertItem( interface, 0 ); | 370 | interfaceName->insertItem( interface, 0 ); |
371 | interfaceName->setCurrentItem( 0 ); | 371 | interfaceName->setCurrentItem( 0 ); |
372 | #else | 372 | #else |
373 | interfaceName->setCurrentText( interface ); | 373 | interfaceName->setCurrentText( interface ); |
374 | #endif | 374 | #endif |
375 | 375 | ||
376 | QString device = c->readEntry( "type", "<select>" ); | 376 | QString device = c->readEntry( "type", "<select>" ); |
377 | #if QT_VERSION < 300 | 377 | #if QT_VERSION < 300 |
378 | for ( int i = 0; i < deviceType->count(); ++i ) | 378 | for ( int i = 0; i < deviceType->count(); ++i ) |
379 | { | 379 | { |
380 | if ( deviceType->text( i ) == device ) | 380 | if ( deviceType->text( i ) == device ) |
381 | { | 381 | { |
382 | deviceType->setCurrentItem( i ); | 382 | deviceType->setCurrentItem( i ); |
383 | break; | 383 | break; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | #else | 386 | #else |
387 | deviceType->setCurrentText( device ); | 387 | deviceType->setCurrentText( device ); |
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index 43a04e3..db68e5b 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -593,123 +593,123 @@ void Wellenreiter::startClicked() | |||
593 | // set capturer to non-blocking mode | 593 | // set capturer to non-blocking mode |
594 | pcap->setBlocking( false ); | 594 | pcap->setBlocking( false ); |
595 | 595 | ||
596 | // start channel hopper | 596 | // start channel hopper |
597 | if ( cardtype != DEVTYPE_FILE ) | 597 | if ( cardtype != DEVTYPE_FILE ) |
598 | { | 598 | { |
599 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); | 599 | logwindow->log( QString().sprintf( "(i) Starting channel hopper (d=%d ms)", configwindow->hopInterval->value() ) ); |
600 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window | 600 | iface->setChannelHopping( configwindow->hopInterval->value() ); //use interval from config window |
601 | } | 601 | } |
602 | 602 | ||
603 | if ( cardtype != DEVTYPE_FILE ) | 603 | if ( cardtype != DEVTYPE_FILE ) |
604 | { | 604 | { |
605 | // connect socket notifier and start channel hopper | 605 | // connect socket notifier and start channel hopper |
606 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 606 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
607 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 607 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
608 | } | 608 | } |
609 | else | 609 | else |
610 | { | 610 | { |
611 | // start timer for reading packets | 611 | // start timer for reading packets |
612 | startTimer( 100 ); | 612 | startTimer( 100 ); |
613 | } | 613 | } |
614 | 614 | ||
615 | logwindow->log( "(i) Started Scanning." ); | 615 | logwindow->log( "(i) Started Scanning." ); |
616 | sniffing = true; | 616 | sniffing = true; |
617 | 617 | ||
618 | #ifdef QWS | 618 | #ifdef QWS |
619 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) | 619 | if ( WellenreiterConfigWindow::instance()->disablePM->isChecked() ) |
620 | { | 620 | { |
621 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; | 621 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Disable; |
622 | } | 622 | } |
623 | #else | 623 | #else |
624 | #warning FIXME: setScreenSaverMode is not operational on the X11 build | 624 | #warning FIXME: setScreenSaverMode is not operational on the X11 build |
625 | #endif | 625 | #endif |
626 | 626 | ||
627 | emit( startedSniffing() ); | 627 | emit( startedSniffing() ); |
628 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 628 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
629 | else | 629 | else |
630 | { | 630 | { |
631 | assert( parent() ); | 631 | assert( parent() ); |
632 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); | 632 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
633 | } | 633 | } |
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
637 | void Wellenreiter::timerEvent( QTimerEvent* ) | 637 | void Wellenreiter::timerEvent( QTimerEvent* ) |
638 | { | 638 | { |
639 | qDebug( "Wellenreiter::timerEvent()" ); | 639 | qDebug( "Wellenreiter::timerEvent()" ); |
640 | OPacket* p = pcap->next(); | 640 | OPacket* p = pcap->next(); |
641 | if ( !p ) // no more packets available | 641 | if ( !p ) // no more packets available |
642 | { | 642 | { |
643 | stopClicked(); | 643 | stopClicked(); |
644 | } | 644 | } |
645 | else | 645 | else |
646 | { | 646 | { |
647 | receivePacket( p ); | 647 | receivePacket( p ); |
648 | delete p; | 648 | delete p; |
649 | } | 649 | } |
650 | } | 650 | } |
651 | 651 | ||
652 | 652 | ||
653 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) | 653 | void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) |
654 | { | 654 | { |
655 | #ifdef QWS | 655 | #ifdef QWS |
656 | if ( action == "TouchSound" ) | 656 | if ( action == "TouchSound" ) |
657 | ODevice::inst()->touchSound(); | 657 | ODevice::inst()->playTouchSound(); |
658 | else if ( action == "AlarmSound" ) | 658 | else if ( action == "AlarmSound" ) |
659 | ODevice::inst()->alarmSound(); | 659 | ODevice::inst()->playAlarmSound(); |
660 | else if ( action == "KeySound" ) | 660 | else if ( action == "KeySound" ) |
661 | ODevice::inst()->keySound(); | 661 | ODevice::inst()->playKeySound(); |
662 | else if ( action == "LedOn" ) | 662 | else if ( action == "LedOn" ) |
663 | ODevice::inst()->setLedState( Led_Mail, Led_On ); | 663 | ODevice::inst()->setLedState( Led_Mail, Led_On ); |
664 | else if ( action == "LedOff" ) | 664 | else if ( action == "LedOff" ) |
665 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); | 665 | ODevice::inst()->setLedState( Led_Mail, Led_Off ); |
666 | else if ( action == "LogMessage" ) | 666 | else if ( action == "LogMessage" ) |
667 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 667 | logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
668 | else if ( action == "MessageBox" ) | 668 | else if ( action == "MessageBox" ) |
669 | QMessageBox::information( this, "Notification!", | 669 | QMessageBox::information( this, "Notification!", |
670 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); | 670 | QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); |
671 | #else | 671 | #else |
672 | #warning Actions do not work with Qt/X11 yet | 672 | #warning Actions do not work with Qt/X11 yet |
673 | #endif | 673 | #endif |
674 | } | 674 | } |
675 | 675 | ||
676 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) | 676 | void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) |
677 | { | 677 | { |
678 | #ifdef QWS | 678 | #ifdef QWS |
679 | if ( !iface ) | 679 | if ( !iface ) |
680 | { | 680 | { |
681 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); | 681 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); |
682 | return; | 682 | return; |
683 | } | 683 | } |
684 | 684 | ||
685 | if ( sniffing ) | 685 | if ( sniffing ) |
686 | { | 686 | { |
687 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); | 687 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); |
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | 690 | ||
691 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", | 691 | qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", |
692 | (const char*) iface->name(), | 692 | (const char*) iface->name(), |
693 | (const char*) type, | 693 | (const char*) type, |
694 | (const char*) essid, | 694 | (const char*) essid, |
695 | channel, | 695 | channel, |
696 | (const char*) macaddr ); | 696 | (const char*) macaddr ); |
697 | 697 | ||
698 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); | 698 | QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); |
699 | int count = 3; | 699 | int count = 3; |
700 | qDebug("sending %d messages",count); | 700 | qDebug("sending %d messages",count); |
701 | msg << QString("count") << QString::number(count); | 701 | msg << QString("count") << QString::number(count); |
702 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); | 702 | qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); |
703 | msg << QString(iface->name()) << QString("Mode") << type; | 703 | msg << QString(iface->name()) << QString("Mode") << type; |
704 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); | 704 | qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); |
705 | msg << QString(iface->name()) << QString("ESSID") << essid; | 705 | msg << QString(iface->name()) << QString("ESSID") << essid; |
706 | qDebug("msg >%s< channel >%d<", iface->name(),channel); | 706 | qDebug("msg >%s< channel >%d<", iface->name(),channel); |
707 | msg << QString(iface->name()) << QString("Channel") << channel; | 707 | msg << QString(iface->name()) << QString("Channel") << channel; |
708 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); | 708 | // qDebug("msg >%s< mac >%s<", iface->name(),macaddr); |
709 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; | 709 | // msg << QString(iface->name()) << QString("MacAddr") << macaddr; |
710 | #else | 710 | #else |
711 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); | 711 | QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) ); |
712 | #endif | 712 | #endif |
713 | 713 | ||
714 | } | 714 | } |
715 | 715 | ||