summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/olistview.h2
-rw-r--r--noncore/net/wellenreiter/gui/configwindow.cpp2
-rw-r--r--noncore/net/wellenreiter/gui/scanlist.cpp1
-rw-r--r--noncore/net/wellenreiter/gui/wellenreiter.cpp9
4 files changed, 12 insertions, 2 deletions
diff --git a/libopie2/opieui/olistview.h b/libopie2/opieui/olistview.h
index 1bbdd5b..109e309 100644
--- a/libopie2/opieui/olistview.h
+++ b/libopie2/opieui/olistview.h
@@ -1,104 +1,106 @@
1/* 1/*
2                 This file is part of the Opie Project 2                 This file is part of the Opie Project
3 3
4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 4 =. (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 .=l. 5 .=l.
6           .>+-= 6           .>+-=
7 _;:,     .>    :=|. This program is free software; you can 7 _;:,     .>    :=|. This program is free software; you can
8.> <`_,   >  .   <= redistribute it and/or modify it under 8.> <`_,   >  .   <= redistribute it and/or modify it under
9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public 9:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
10.="- .-=="i,     .._ License as published by the Free Software 10.="- .-=="i,     .._ License as published by the Free Software
11 - .   .-<_>     .<> Foundation; either version 2 of the License, 11 - .   .-<_>     .<> Foundation; either version 2 of the License,
12     ._= =}       : or (at your option) any later version. 12     ._= =}       : or (at your option) any later version.
13    .%`+i>       _;_. 13    .%`+i>       _;_.
14    .i_,=:_.      -<s. This program is distributed in the hope that 14    .i_,=:_.      -<s. This program is distributed in the hope that
15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 15     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
16    : ..    .:,     . . . without even the implied warranty of 16    : ..    .:,     . . . without even the implied warranty of
17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 17    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 18  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
19..}^=.=       =       ; Library General Public License for more 19..}^=.=       =       ; Library General Public License for more
20++=   -.     .`     .: details. 20++=   -.     .`     .: details.
21 :     =  ...= . :.=- 21 :     =  ...= . :.=-
22 -.   .:....=;==+<; You should have received a copy of the GNU 22 -.   .:....=;==+<; You should have received a copy of the GNU
23  -_. . .   )=.  = Library General Public License along with 23  -_. . .   )=.  = Library General Public License along with
24    --        :-=` this library; see the file COPYING.LIB. 24    --        :-=` this library; see the file COPYING.LIB.
25 If not, write to the Free Software Foundation, 25 If not, write to the Free Software Foundation,
26 Inc., 59 Temple Place - Suite 330, 26 Inc., 59 Temple Place - Suite 330,
27 Boston, MA 02111-1307, USA. 27 Boston, MA 02111-1307, USA.
28 28
29*/ 29*/
30 30
31#ifndef OLISTVIEW_H 31#ifndef OLISTVIEW_H
32#define OLISTVIEW_H 32#define OLISTVIEW_H
33 33
34#include <qcolor.h> 34#include <qcolor.h>
35#include <qlistview.h> 35#include <qlistview.h>
36#include <qpen.h> 36#include <qpen.h>
37#include <qdatastream.h> 37#include <qdatastream.h>
38#include <qstringlist.h>
38 39
39class OListViewItem; 40class OListViewItem;
40 41
42
41/*====================================================================================== 43/*======================================================================================
42 * OListView 44 * OListView
43 *======================================================================================*/ 45 *======================================================================================*/
44 46
45/** 47/**
46 * @brief A list/tree widget. 48 * @brief A list/tree widget.
47 * 49 *
48 * A @ref QListView variant featuring visual and functional enhancements 50 * A @ref QListView variant featuring visual and functional enhancements
49 * like an alternate background for odd rows, an autostretch mode 51 * like an alternate background for odd rows, an autostretch mode
50 * for the width of the widget ( >= Qt 3 only ) and persistence capabilities. 52 * for the width of the widget ( >= Qt 3 only ) and persistence capabilities.
51 * 53 *
52 * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> 54 * @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
53 */ 55 */
54class OListView: public QListView 56class OListView: public QListView
55{ 57{
56 public: 58 public:
57 /** 59 /**
58 * Constructor. 60 * Constructor.
59 * 61 *
60 * The parameters @a parent and @a name are handled by 62 * The parameters @a parent and @a name are handled by
61 * @ref QListView, as usual. 63 * @ref QListView, as usual.
62 */ 64 */
63 OListView( QWidget* parent = 0, const char* name = 0 ); 65 OListView( QWidget* parent = 0, const char* name = 0 );
64 /** 66 /**
65 * Destructor. 67 * Destructor.
66 */ 68 */
67 virtual ~OListView(); 69 virtual ~OListView();
68 /** 70 /**
69 * Let the last column fit exactly all the available width. 71 * Let the last column fit exactly all the available width.
70 */ 72 */
71 void setFullWidth( bool fullWidth ); 73 void setFullWidth( bool fullWidth );
72 /** 74 /**
73 * Returns whether the last column is set to fit the available width. 75 * Returns whether the last column is set to fit the available width.
74 */ 76 */
75 bool fullWidth() const; 77 bool fullWidth() const;
76 /** 78 /**
77 * Reimplemented for full width support 79 * Reimplemented for full width support
78 */ 80 */
79 virtual int addColumn( const QString& label, int width = -1 ); 81 virtual int addColumn( const QString& label, int width = -1 );
80 /** 82 /**
81 * Reimplemented for full width support 83 * Reimplemented for full width support
82 */ 84 */
83 virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 ); 85 virtual int addColumn( const QIconSet& iconset, const QString& label, int width = -1 );
84 /** 86 /**
85 * Reimplemented for full width support 87 * Reimplemented for full width support
86 */ 88 */
87 virtual void removeColumn(int index); 89 virtual void removeColumn(int index);
88 /** 90 /**
89 * Set the alternate background background @a color. 91 * Set the alternate background background @a color.
90 * Set to an invalid color to disable alternate colors. 92 * Set to an invalid color to disable alternate colors.
91 * This only has an effect if the items are OListViewItems 93 * This only has an effect if the items are OListViewItems
92 */ 94 */
93 void setAlternateBackground( const QColor& color ); 95 void setAlternateBackground( const QColor& color );
94 /** 96 /**
95 * Sets the column separator @a pen. 97 * Sets the column separator @a pen.
96 */ 98 */
97 void setColumnSeparator( const QPen& pen ); 99 void setColumnSeparator( const QPen& pen );
98 100
99 /** 101 /**
100 * @returns the alternate background color 102 * @returns the alternate background color
101 */ 103 */
102 const QColor& alternateBackground() const; 104 const QColor& alternateBackground() const;
103 /** 105 /**
104 * @return the column separator pen 106 * @return the column separator pen
diff --git a/noncore/net/wellenreiter/gui/configwindow.cpp b/noncore/net/wellenreiter/gui/configwindow.cpp
index 5bec7ed..11394d7 100644
--- a/noncore/net/wellenreiter/gui/configwindow.cpp
+++ b/noncore/net/wellenreiter/gui/configwindow.cpp
@@ -20,129 +20,129 @@
20/* QT */ 20/* QT */
21#include <qapplication.h> 21#include <qapplication.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qcombobox.h> 23#include <qcombobox.h>
24#include <qfile.h> 24#include <qfile.h>
25#include <qlineedit.h> 25#include <qlineedit.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qmap.h> 27#include <qmap.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qtoolbutton.h> 29#include <qtoolbutton.h>
30#include <qspinbox.h> 30#include <qspinbox.h>
31#include <qtextstream.h> 31#include <qtextstream.h>
32 32
33/* OPIE */ 33/* OPIE */
34#include <opie2/onetwork.h> 34#include <opie2/onetwork.h>
35 35
36WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0; 36WellenreiterConfigWindow* WellenreiterConfigWindow::_instance = 0;
37 37
38WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f ) 38WellenreiterConfigWindow::WellenreiterConfigWindow( QWidget * parent, const char * name, WFlags f )
39 :WellenreiterConfigBase( parent, name, true, f ) 39 :WellenreiterConfigBase( parent, name, true, f )
40{ 40{
41 _devicetype[ "cisco" ] = DEVTYPE_CISCO; 41 _devicetype[ "cisco" ] = DEVTYPE_CISCO;
42 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG; 42 _devicetype[ "wlan-ng" ] = DEVTYPE_WLAN_NG;
43 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP; 43 _devicetype[ "hostap" ] = DEVTYPE_HOSTAP;
44 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO; 44 _devicetype[ "orinoco" ] = DEVTYPE_ORINOCO;
45 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL; 45 _devicetype[ "<manual>" ] = DEVTYPE_MANUAL;
46 _devicetype[ "<file>" ] = DEVTYPE_FILE; 46 _devicetype[ "<file>" ] = DEVTYPE_FILE;
47 47
48 // gather possible interface names from ONetwork 48 // gather possible interface names from ONetwork
49 ONetwork* net = ONetwork::instance(); 49 ONetwork* net = ONetwork::instance();
50 ONetwork::InterfaceIterator it = net->iterator(); 50 ONetwork::InterfaceIterator it = net->iterator();
51 while ( it.current() ) 51 while ( it.current() )
52 { 52 {
53 if ( it.current()->isWireless() ) 53 if ( it.current()->isWireless() )
54 interfaceName->insertItem( it.current()->name() ); 54 interfaceName->insertItem( it.current()->name() );
55 ++it; 55 ++it;
56 } 56 }
57 57
58 // try to guess device type 58 // try to guess device type
59 QFile m( "/proc/modules" ); 59 QFile m( "/proc/modules" );
60 if ( m.open( IO_ReadOnly ) ) 60 if ( m.open( IO_ReadOnly ) )
61 { 61 {
62 int devicetype(0); 62 int devicetype(0);
63 QString line; 63 QString line;
64 QTextStream modules( &m ); 64 QTextStream modules( &m );
65 while( !modules.atEnd() && !devicetype ) 65 while( !modules.atEnd() && !devicetype )
66 { 66 {
67 modules >> line; 67 modules >> line;
68 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO; 68 if ( line.contains( "cisco" ) ) devicetype = DEVTYPE_CISCO;
69 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP; 69 else if ( line.contains( "hostap" ) ) devicetype = DEVTYPE_HOSTAP;
70 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG; 70 else if ( line.contains( "prism" ) ) devicetype = DEVTYPE_WLAN_NG;
71 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO; 71 else if ( line.contains( "orinoco" ) ) devicetype = DEVTYPE_ORINOCO;
72 } 72 }
73 if ( devicetype ) 73 if ( devicetype )
74 { 74 {
75 deviceType->setCurrentItem( devicetype ); 75 deviceType->setCurrentItem( devicetype );
76 _guess = devicetype; 76 _guess = devicetype;
77 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype ); 77 qDebug( "Wellenreiter: guessed device type to be #%d", devicetype );
78 } 78 }
79 } 79 }
80 80
81 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here 81 #ifdef Q_WS_X11 // We're on X11: adding an Ok-Button for the Dialog here
82 QPushButton* okButton = new QPushButton( "ok", this ); 82 QPushButton* okButton = new QPushButton( "ok", this );
83 okButton->show(); 83 okButton->show();
84 Layout5_2->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui 84 WellenreiterConfigBaseLayout->addWidget( okButton, 0, 3 ); //FIXME: rename this in configbase.ui
85 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) ); 85 connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
86 #endif 86 #endif
87 87
88 WellenreiterConfigWindow::_instance = this; 88 WellenreiterConfigWindow::_instance = this;
89 89
90 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) ); 90 connect( deviceType, SIGNAL( activated(int) ), this, SLOT( changedDeviceType(int) ) );
91 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) ); 91 connect( getCaptureFileName, SIGNAL( clicked() ), this, SLOT( getCaptureFileNameClicked() ) );
92 92
93 // make the checkbox 'channelAll' control all other channels 93 // make the checkbox 'channelAll' control all other channels
94 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) ); 94 connect( channelAll, SIGNAL( stateChanged(int) ), this, SLOT( channelAllClicked(int) ) );
95}; 95};
96 96
97 97
98int WellenreiterConfigWindow::driverType() const 98int WellenreiterConfigWindow::driverType() const
99{ 99{
100 QString name = deviceType->currentText(); 100 QString name = deviceType->currentText();
101 if ( _devicetype.contains( name ) ) 101 if ( _devicetype.contains( name ) )
102 { 102 {
103 return _devicetype[name]; 103 return _devicetype[name];
104 } 104 }
105 else 105 else
106 { 106 {
107 return 0; 107 return 0;
108 } 108 }
109}; 109};
110 110
111 111
112int WellenreiterConfigWindow::hoppingInterval() const 112int WellenreiterConfigWindow::hoppingInterval() const
113{ 113{
114 return hopInterval->cleanText().toInt(); 114 return hopInterval->cleanText().toInt();
115} 115}
116 116
117 117
118bool WellenreiterConfigWindow::usePrismHeader() const 118bool WellenreiterConfigWindow::usePrismHeader() const
119{ 119{
120 return prismHeader->isOn(); 120 return prismHeader->isOn();
121} 121}
122 122
123 123
124bool WellenreiterConfigWindow::isChannelChecked( int channel ) const 124bool WellenreiterConfigWindow::isChannelChecked( int channel ) const
125{ 125{
126 switch ( channel ) 126 switch ( channel )
127 { 127 {
128 case 1: return channel1->isOn(); 128 case 1: return channel1->isOn();
129 case 2: return channel2->isOn(); 129 case 2: return channel2->isOn();
130 case 3: return channel3->isOn(); 130 case 3: return channel3->isOn();
131 case 4: return channel4->isOn(); 131 case 4: return channel4->isOn();
132 case 5: return channel5->isOn(); 132 case 5: return channel5->isOn();
133 case 6: return channel6->isOn(); 133 case 6: return channel6->isOn();
134 case 7: return channel7->isOn(); 134 case 7: return channel7->isOn();
135 case 8: return channel8->isOn(); 135 case 8: return channel8->isOn();
136 case 9: return channel9->isOn(); 136 case 9: return channel9->isOn();
137 case 10: return channel10->isOn(); 137 case 10: return channel10->isOn();
138 case 11: return channel11->isOn(); 138 case 11: return channel11->isOn();
139 case 12: return channel12->isOn(); 139 case 12: return channel12->isOn();
140 case 13: return channel13->isOn(); 140 case 13: return channel13->isOn();
141 case 14: return channel14->isOn(); 141 case 14: return channel14->isOn();
142 } 142 }
143} 143}
144 144
145 145
146void WellenreiterConfigWindow::changedDeviceType(int t) 146void WellenreiterConfigWindow::changedDeviceType(int t)
147{ 147{
148 if ( t != DEVTYPE_FILE ) return; 148 if ( t != DEVTYPE_FILE ) return;
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp
index 085eec4..f4cfe52 100644
--- a/noncore/net/wellenreiter/gui/scanlist.cpp
+++ b/noncore/net/wellenreiter/gui/scanlist.cpp
@@ -1,84 +1,85 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. 2** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved.
3** 3**
4** This file is part of Opie Environment. 4** This file is part of Opie Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14**********************************************************************/ 14**********************************************************************/
15 15
16#include "scanlist.h" 16#include "scanlist.h"
17#include "configwindow.h" 17#include "configwindow.h"
18#include "logwindow.h" 18#include "logwindow.h"
19 19
20#include <assert.h> 20#include <assert.h>
21#include <qcursor.h>
21#include <qdatetime.h> 22#include <qdatetime.h>
22#include <qtextstream.h> 23#include <qtextstream.h>
23#include <qpopupmenu.h> 24#include <qpopupmenu.h>
24 25
25#ifdef QWS 26#ifdef QWS
26#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
27#include <opie/odevice.h> 28#include <opie/odevice.h>
28using namespace Opie; 29using namespace Opie;
29#endif 30#endif
30 31
31 32
32#ifdef QWS 33#ifdef QWS
33#include <qpe/resource.h> 34#include <qpe/resource.h>
34#else 35#else
35#include "resource.h" 36#include "resource.h"
36#endif 37#endif
37 38
38const int col_type = 0; 39const int col_type = 0;
39const int col_essid = 0; 40const int col_essid = 0;
40const int col_sig = 1; 41const int col_sig = 1;
41const int col_ap = 2; 42const int col_ap = 2;
42const int col_channel = 3; 43const int col_channel = 3;
43const int col_wep = 4; 44const int col_wep = 4;
44const int col_traffic = 5; 45const int col_traffic = 5;
45const int col_ip = 6; 46const int col_ip = 6;
46const int col_manuf = 7; 47const int col_manuf = 7;
47const int col_firstseen = 8; 48const int col_firstseen = 8;
48const int col_lastseen = 9; 49const int col_lastseen = 9;
49 50
50MScanListView::MScanListView( QWidget* parent, const char* name ) 51MScanListView::MScanListView( QWidget* parent, const char* name )
51 :OListView( parent, name ) 52 :OListView( parent, name )
52{ 53{
53 54
54 setFrameShape( QListView::StyledPanel ); 55 setFrameShape( QListView::StyledPanel );
55 setFrameShadow( QListView::Sunken ); 56 setFrameShadow( QListView::Sunken );
56 57
57 addColumn( tr( "Net/Station" ) ); 58 addColumn( tr( "Net/Station" ) );
58 setColumnAlignment( col_essid, AlignLeft || AlignVCenter ); 59 setColumnAlignment( col_essid, AlignLeft || AlignVCenter );
59 addColumn( tr( "#" ) ); 60 addColumn( tr( "#" ) );
60 setColumnAlignment( col_sig, AlignCenter ); 61 setColumnAlignment( col_sig, AlignCenter );
61 addColumn( tr( "MAC" ) ); 62 addColumn( tr( "MAC" ) );
62 setColumnAlignment( col_ap, AlignCenter ); 63 setColumnAlignment( col_ap, AlignCenter );
63 addColumn( tr( "Chn" ) ); 64 addColumn( tr( "Chn" ) );
64 setColumnAlignment( col_channel, AlignCenter ); 65 setColumnAlignment( col_channel, AlignCenter );
65 addColumn( tr( "W" ) ); 66 addColumn( tr( "W" ) );
66 setColumnAlignment( col_wep, AlignCenter ); 67 setColumnAlignment( col_wep, AlignCenter );
67 addColumn( tr( "T" ) ); 68 addColumn( tr( "T" ) );
68 setColumnAlignment( col_traffic, AlignCenter ); 69 setColumnAlignment( col_traffic, AlignCenter );
69 addColumn( tr( "IP" ) ); 70 addColumn( tr( "IP" ) );
70 setColumnAlignment( col_ip, AlignCenter ); 71 setColumnAlignment( col_ip, AlignCenter );
71 addColumn( tr( "Manufacturer" ) ); 72 addColumn( tr( "Manufacturer" ) );
72 setColumnAlignment( col_manuf, AlignCenter ); 73 setColumnAlignment( col_manuf, AlignCenter );
73 addColumn( tr( "First Seen" ) ); 74 addColumn( tr( "First Seen" ) );
74 setColumnAlignment( col_firstseen, AlignCenter ); 75 setColumnAlignment( col_firstseen, AlignCenter );
75 addColumn( tr( "Last Seen" ) ); 76 addColumn( tr( "Last Seen" ) );
76 setColumnAlignment( col_lastseen, AlignCenter ); 77 setColumnAlignment( col_lastseen, AlignCenter );
77 setRootIsDecorated( true ); 78 setRootIsDecorated( true );
78 setAllColumnsShowFocus( true ); 79 setAllColumnsShowFocus( true );
79 80
80 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), 81 connect( this, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ),
81 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) ); 82 this, SLOT( contextMenuRequested(QListViewItem*,const QPoint&,int) ) );
82 83
83 #ifdef QWS 84 #ifdef QWS
84 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold ); 85 QPEApplication::setStylusOperation( viewport(), QPEApplication::RightOnHold );
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp
index dcf796f..96733ff 100644
--- a/noncore/net/wellenreiter/gui/wellenreiter.cpp
+++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp
@@ -413,118 +413,125 @@ void Wellenreiter::startClicked()
413 pcap->open( interface ); 413 pcap->open( interface );
414 } 414 }
415 } 415 }
416 else 416 else
417 { 417 {
418 pcap->open( QFile( interface ) ); 418 pcap->open( QFile( interface ) );
419 } 419 }
420 420
421 if ( !pcap->isOpen() ) 421 if ( !pcap->isOpen() )
422 { 422 {
423 QMessageBox::warning( this, "Wellenreiter II", 423 QMessageBox::warning( this, "Wellenreiter II",
424 tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) )); 424 tr( "Can't open packet capturer for '%1':\n" ).arg( iface->name() ) + QString(strerror( errno ) ));
425 return; 425 return;
426 } 426 }
427 427
428 // set capturer to non-blocking mode 428 // set capturer to non-blocking mode
429 pcap->setBlocking( false ); 429 pcap->setBlocking( false );
430 430
431 // start channel hopper 431 // start channel hopper
432 if ( cardtype != DEVTYPE_FILE ) 432 if ( cardtype != DEVTYPE_FILE )
433 iface->setChannelHopping( 1000 ); //use interval from config window 433 iface->setChannelHopping( 1000 ); //use interval from config window
434 434
435 if ( cardtype != DEVTYPE_FILE ) 435 if ( cardtype != DEVTYPE_FILE )
436 { 436 {
437 // connect socket notifier and start channel hopper 437 // connect socket notifier and start channel hopper
438 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); 438 connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) );
439 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); 439 connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) );
440 } 440 }
441 else 441 else
442 { 442 {
443 // start timer for reading packets 443 // start timer for reading packets
444 startTimer( 100 ); 444 startTimer( 100 );
445 } 445 }
446 446
447 logwindow->log( "(i) Started Scanning." ); 447 logwindow->log( "(i) Started Scanning." );
448 sniffing = true; 448 sniffing = true;
449 emit( startedSniffing() ); 449 emit( startedSniffing() );
450 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title 450 if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title
451 else 451 else
452 { 452 {
453 assert( parent() ); 453 assert( parent() );
454 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); 454 ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) );
455 } 455 }
456} 456}
457 457
458 458
459void Wellenreiter::timerEvent( QTimerEvent* ) 459void Wellenreiter::timerEvent( QTimerEvent* )
460{ 460{
461 qDebug( "Wellenreiter::timerEvent()" ); 461 qDebug( "Wellenreiter::timerEvent()" );
462 OPacket* p = pcap->next(); 462 OPacket* p = pcap->next();
463 if ( !p ) // no more packets available 463 if ( !p ) // no more packets available
464 { 464 {
465 stopClicked(); 465 stopClicked();
466 } 466 }
467 else 467 else
468 { 468 {
469 receivePacket( p ); 469 receivePacket( p );
470 delete p; 470 delete p;
471 } 471 }
472} 472}
473 473
474 474
475void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p ) 475void Wellenreiter::doAction( const QString& action, const QString& protocol, OPacket* p )
476{ 476{
477 #ifdef QWS
477 if ( action == "TouchSound" ) 478 if ( action == "TouchSound" )
478 ODevice::inst()->touchSound(); 479 ODevice::inst()->touchSound();
479 else if ( action == "AlarmSound" ) 480 else if ( action == "AlarmSound" )
480 ODevice::inst()->alarmSound(); 481 ODevice::inst()->alarmSound();
481 else if ( action == "KeySound" ) 482 else if ( action == "KeySound" )
482 ODevice::inst()->keySound(); 483 ODevice::inst()->keySound();
483 else if ( action == "LedOn" ) 484 else if ( action == "LedOn" )
484 ODevice::inst()->setLedState( Led_Mail, Led_On ); 485 ODevice::inst()->setLedState( Led_Mail, Led_On );
485 else if ( action == "LedOff" ) 486 else if ( action == "LedOff" )
486 ODevice::inst()->setLedState( Led_Mail, Led_Off ); 487 ODevice::inst()->setLedState( Led_Mail, Led_Off );
487 else if ( action == "LogMessage" ) 488 else if ( action == "LogMessage" )
488 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 489 logwindow->log( QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
489 else if ( action == "MessageBox" ) 490 else if ( action == "MessageBox" )
490 QMessageBox::information( this, "Notification!", 491 QMessageBox::information( this, "Notification!",
491 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) ); 492 QString().sprintf( "Got packet with protocol '%s'", (const char*) protocol ) );
493 #else
494 #warning Actions do not work with Qt/X11 yet
495 #endif
492} 496}
493 497
494void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr) 498void Wellenreiter::joinNetwork(const QString& type, const QString& essid, int channel, const QString& macaddr)
495{ 499{
500 #ifdef QWS
496 if ( !iface ) 501 if ( !iface )
497 { 502 {
498 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) ); 503 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "No wireless\ninterface available." ) );
499 return; 504 return;
500 } 505 }
501 506
502 if ( sniffing ) 507 if ( sniffing )
503 { 508 {
504 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) ); 509 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Stop sniffing before\njoining a net." ) );
505 return; 510 return;
506 } 511 }
507 512
508 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s", 513 qDebug( "joinNetwork() with Interface %s: %s, %s, %d, %s",
509 (const char*) iface->name(), 514 (const char*) iface->name(),
510 (const char*) type, 515 (const char*) type,
511 (const char*) essid, 516 (const char*) essid,
512 channel, 517 channel,
513 (const char*) macaddr ); 518 (const char*) macaddr );
514 519
515 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" ); 520 QCopEnvelope msg( "QPE/Application/networksettings", "wlan(QString,QString,QString)" );
516 int count = 3; 521 int count = 3;
517 qDebug("sending %d messages",count); 522 qDebug("sending %d messages",count);
518 msg << QString("count") << QString::number(count); 523 msg << QString("count") << QString::number(count);
519 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() ); 524 qDebug("msg >%s< Mode >%s<", iface->name(),type.latin1() );
520 msg << QString(iface->name()) << QString("Mode") << type; 525 msg << QString(iface->name()) << QString("Mode") << type;
521 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1()); 526 qDebug("msg >%s< essid >%s<", iface->name(),essid.latin1());
522 msg << QString(iface->name()) << QString("ESSID") << essid; 527 msg << QString(iface->name()) << QString("ESSID") << essid;
523 qDebug("msg >%s< channel >%d<", iface->name(),channel); 528 qDebug("msg >%s< channel >%d<", iface->name(),channel);
524 msg << QString(iface->name()) << QString("Channel") << channel; 529 msg << QString(iface->name()) << QString("Channel") << channel;
525// qDebug("msg >%s< mac >%s<", iface->name(),macaddr); 530// qDebug("msg >%s< mac >%s<", iface->name(),macaddr);
526// msg << QString(iface->name()) << QString("MacAddr") << macaddr; 531// msg << QString(iface->name()) << QString("MacAddr") << macaddr;
527 532 #else
533 QMessageBox::warning( this, tr( "Can't do that!" ), tr( "Function only available on Embedded build" ) );
534 #endif
528 535
529} 536}
530 537