-rw-r--r-- | i18n/da/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/de/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/en/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/es/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/fr/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/hu/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/it/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/ja/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/ko/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/nl/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/no/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/pl/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/pt/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/pt_BR/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/sl/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/xx/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/zh_CN/wellenreiter.ts | 0 | ||||
-rw-r--r-- | i18n/zh_TW/wellenreiter.ts | 0 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 10 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/mainwindow.cpp | 43 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/scanlist.cpp | 18 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/statwindow.cpp | 4 | ||||
-rw-r--r-- | noncore/net/wellenreiter/gui/wellenreiter.cpp | 32 | ||||
-rw-r--r-- | noncore/net/wellenreiter/wellenreiter.pro | 18 |
24 files changed, 82 insertions, 43 deletions
diff --git a/i18n/da/wellenreiter.ts b/i18n/da/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/da/wellenreiter.ts | |||
diff --git a/i18n/de/wellenreiter.ts b/i18n/de/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/de/wellenreiter.ts | |||
diff --git a/i18n/en/wellenreiter.ts b/i18n/en/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/en/wellenreiter.ts | |||
diff --git a/i18n/es/wellenreiter.ts b/i18n/es/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/es/wellenreiter.ts | |||
diff --git a/i18n/fr/wellenreiter.ts b/i18n/fr/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/fr/wellenreiter.ts | |||
diff --git a/i18n/hu/wellenreiter.ts b/i18n/hu/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/hu/wellenreiter.ts | |||
diff --git a/i18n/it/wellenreiter.ts b/i18n/it/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/it/wellenreiter.ts | |||
diff --git a/i18n/ja/wellenreiter.ts b/i18n/ja/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/ja/wellenreiter.ts | |||
diff --git a/i18n/ko/wellenreiter.ts b/i18n/ko/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/ko/wellenreiter.ts | |||
diff --git a/i18n/nl/wellenreiter.ts b/i18n/nl/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/nl/wellenreiter.ts | |||
diff --git a/i18n/no/wellenreiter.ts b/i18n/no/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/no/wellenreiter.ts | |||
diff --git a/i18n/pl/wellenreiter.ts b/i18n/pl/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/pl/wellenreiter.ts | |||
diff --git a/i18n/pt/wellenreiter.ts b/i18n/pt/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/pt/wellenreiter.ts | |||
diff --git a/i18n/pt_BR/wellenreiter.ts b/i18n/pt_BR/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/pt_BR/wellenreiter.ts | |||
diff --git a/i18n/sl/wellenreiter.ts b/i18n/sl/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/sl/wellenreiter.ts | |||
diff --git a/i18n/xx/wellenreiter.ts b/i18n/xx/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/xx/wellenreiter.ts | |||
diff --git a/i18n/zh_CN/wellenreiter.ts b/i18n/zh_CN/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/zh_CN/wellenreiter.ts | |||
diff --git a/i18n/zh_TW/wellenreiter.ts b/i18n/zh_TW/wellenreiter.ts new file mode 100644 index 0000000..e69de29 --- a/dev/null +++ b/i18n/zh_TW/wellenreiter.ts | |||
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 03da135..96ebb3f 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp | |||
@@ -1,99 +1,99 @@ | |||
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 "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | #ifdef QWS | 17 | #ifdef QWS |
18 | #include <opie2/oapplication.h> | 18 | #include <opie2/oapplication.h> |
19 | #else | 19 | #else |
20 | #include <qapplication.h> | 20 | #include <qapplication.h> |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | 25 | ||
26 | // ==> OProcess | 26 | // ==> OProcess |
27 | #include <qdir.h> | 27 | #include <qdir.h> |
28 | #include <qfileinfo.h> | 28 | #include <qfileinfo.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qtextstream.h> | 30 | #include <qtextstream.h> |
31 | 31 | ||
32 | #include <errno.h> | 32 | #include <errno.h> |
33 | #include <signal.h> | 33 | #include <signal.h> |
34 | #include <string.h> | 34 | #include <string.h> |
35 | #include <unistd.h> | 35 | #include <unistd.h> |
36 | 36 | ||
37 | int main( int argc, char **argv ) | 37 | int main( int argc, char **argv ) |
38 | { | 38 | { |
39 | #ifdef QWS | 39 | #ifdef QWS |
40 | OApplication a( argc, argv, "Wellenreiter II" ); | 40 | OApplication a( argc, argv, "Wellenreiter II" ); |
41 | #else | 41 | #else |
42 | QApplication a( argc, argv ); | 42 | QApplication a( argc, argv ); |
43 | #endif | 43 | #endif |
44 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); | 44 | WellenreiterMainWindow* w = new WellenreiterMainWindow(); |
45 | #ifdef QWS | 45 | #ifdef QWS |
46 | a.showMainWidget( w ); | 46 | a.showMainWidget( w ); |
47 | #else | 47 | #else |
48 | a.setMainWidget( w ); | 48 | a.setMainWidget( w ); |
49 | w->show(); | 49 | w->show(); |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | a.processEvents(); // show the window before doing the safety checks | 52 | a.processEvents(); // show the window before doing the safety checks |
53 | int result = -1; | 53 | int result = -1; |
54 | 54 | ||
55 | // root check | 55 | // root check |
56 | if ( getuid() ) | 56 | if ( getuid() ) |
57 | { | 57 | { |
58 | qWarning( "Wellenreiter: trying to run as non-root!" ); | 58 | qWarning( QObject::tr( "Wellenreiter: trying to run as non-root!" ) ); |
59 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", "You have started Wellenreiter II\n" | 59 | result = QMessageBox::warning( w, " - Wellenreiter II - (non-root)", QObject::tr( "You have started Wellenreiter II\n" |
60 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?", | 60 | "as non-root. You will have\nonly limited functionality.\nProceed anyway?" ), |
61 | QMessageBox::Yes, QMessageBox::No ); | 61 | QMessageBox::Yes, QMessageBox::No ); |
62 | if ( result == QMessageBox::No ) return -1; | 62 | if ( result == QMessageBox::No ) return -1; |
63 | } | 63 | } |
64 | 64 | ||
65 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess | 65 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess |
66 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... | 66 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... |
67 | 67 | ||
68 | QString line; | 68 | QString line; |
69 | QDir d = QDir( "/proc" ); | 69 | QDir d = QDir( "/proc" ); |
70 | QStringList dirs = d.entryList( QDir::Dirs ); | 70 | QStringList dirs = d.entryList( QDir::Dirs ); |
71 | QStringList::Iterator it; | 71 | QStringList::Iterator it; |
72 | for ( it = dirs.begin(); it != dirs.end(); ++it ) | 72 | for ( it = dirs.begin(); it != dirs.end(); ++it ) |
73 | { | 73 | { |
74 | //qDebug( "next entry: %s", (const char*) *it ); | 74 | //qDebug( "next entry: %s", (const char*) *it ); |
75 | QFile file( "/proc/"+*it+"/cmdline" ); | 75 | QFile file( "/proc/"+*it+"/cmdline" ); |
76 | file.open( IO_ReadOnly ); | 76 | file.open( IO_ReadOnly ); |
77 | if ( !file.isOpen() ) continue; | 77 | if ( !file.isOpen() ) continue; |
78 | QTextStream t( &file ); | 78 | QTextStream t( &file ); |
79 | line = t.readLine(); | 79 | line = t.readLine(); |
80 | //qDebug( "cmdline = %s", (const char*) line ); | 80 | //qDebug( "cmdline = %s", (const char*) line ); |
81 | if ( line.contains( "dhcp" ) ) break; | 81 | if ( line.contains( "dhcp" ) ) break; |
82 | } | 82 | } |
83 | if ( line.contains( "dhcp" ) ) | 83 | if ( line.contains( "dhcp" ) ) |
84 | { | 84 | { |
85 | qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); | 85 | qWarning( "Wellenreiter: found dhcp process #%d", (*it).toInt() ); |
86 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", "You have a dhcp client running.\n" | 86 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" |
87 | "This can severly limit scanning!\nShould I kill it for you?", | 87 | "This can severly limit scanning!\nShould I kill it for you?" ), |
88 | QMessageBox::Yes, QMessageBox::No ); | 88 | QMessageBox::Yes, QMessageBox::No ); |
89 | if ( result == QMessageBox::Yes ) | 89 | if ( result == QMessageBox::Yes ) |
90 | { | 90 | { |
91 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) | 91 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) |
92 | qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) ); | 92 | qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) ); |
93 | } | 93 | } |
94 | } | 94 | } |
95 | 95 | ||
96 | a.exec(); | 96 | a.exec(); |
97 | delete w; | 97 | delete w; |
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
diff --git a/noncore/net/wellenreiter/gui/mainwindow.cpp b/noncore/net/wellenreiter/gui/mainwindow.cpp index 6cd364c..c4a8fbc 100644 --- a/noncore/net/wellenreiter/gui/mainwindow.cpp +++ b/noncore/net/wellenreiter/gui/mainwindow.cpp | |||
@@ -1,361 +1,362 @@ | |||
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 "configwindow.h" | 16 | #include "configwindow.h" |
17 | #include "logwindow.h" | 17 | #include "logwindow.h" |
18 | #include "hexwindow.h" | 18 | #include "hexwindow.h" |
19 | #include "mainwindow.h" | 19 | #include "mainwindow.h" |
20 | #include "wellenreiter.h" | 20 | #include "wellenreiter.h" |
21 | #include "scanlist.h" | 21 | #include "scanlist.h" |
22 | 22 | ||
23 | #include <qcombobox.h> | 23 | #include <qcombobox.h> |
24 | #include <qdatastream.h> | 24 | #include <qdatastream.h> |
25 | #include <qfile.h> | 25 | #include <qfile.h> |
26 | #include <qfileinfo.h> | 26 | #include <qfileinfo.h> |
27 | #include <qiconset.h> | 27 | #include <qiconset.h> |
28 | #include <qmenubar.h> | 28 | #include <qmenubar.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qpopupmenu.h> | 30 | #include <qpopupmenu.h> |
31 | #include <qstatusbar.h> | 31 | #include <qstatusbar.h> |
32 | #include <qtextstream.h> | 32 | #include <qtextstream.h> |
33 | #include <qtoolbutton.h> | 33 | #include <qtoolbutton.h> |
34 | 34 | ||
35 | #ifdef QWS | 35 | #ifdef QWS |
36 | #include <qpe/resource.h> | 36 | #include <qpe/resource.h> |
37 | #include <opie/ofiledialog.h> | 37 | #include <opie/ofiledialog.h> |
38 | #else | 38 | #else |
39 | #include "resource.h" | 39 | #include "resource.h" |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #include <qfiledialog.h> | 41 | #include <qfiledialog.h> |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) | 44 | WellenreiterMainWindow::WellenreiterMainWindow( QWidget * parent, const char * name, WFlags f ) |
45 | :QMainWindow( parent, name, f ) | 45 | :QMainWindow( parent, name, f ) |
46 | { | 46 | { |
47 | cw = new WellenreiterConfigWindow( this ); | 47 | cw = new WellenreiterConfigWindow( this ); |
48 | mw = new Wellenreiter( this ); | 48 | mw = new Wellenreiter( this ); |
49 | mw->setConfigWindow( cw ); | 49 | mw->setConfigWindow( cw ); |
50 | setCentralWidget( mw ); | 50 | setCentralWidget( mw ); |
51 | 51 | ||
52 | // setup application icon | 52 | // setup application icon |
53 | 53 | ||
54 | #ifndef QWS | 54 | #ifndef QWS |
55 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); | 55 | setIcon( Resource::loadPixmap( "wellenreiter/appicon-trans" ) ); |
56 | setIconText( "Wellenreiter/X11" ); | 56 | setIconText( "Wellenreiter/X11" ); |
57 | #endif | 57 | #endif |
58 | 58 | ||
59 | // setup icon sets | 59 | // setup icon sets |
60 | 60 | ||
61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); | 61 | infoIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/InfoIcon" ) ); |
62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); | 62 | settingsIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SettingsIcon" ) ); |
63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); | 63 | startIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/SearchIcon" ) ); |
64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); | 64 | stopIconSet = new QIconSet( Resource::loadPixmap( "wellenreiter/CancelIcon" ) ); |
65 | 65 | ||
66 | // setup tool buttons | 66 | // setup tool buttons |
67 | 67 | ||
68 | startButton = new QToolButton( 0 ); | 68 | startButton = new QToolButton( 0 ); |
69 | #ifdef QWS | 69 | #ifdef QWS |
70 | startButton->setAutoRaise( true ); | 70 | startButton->setAutoRaise( true ); |
71 | #endif | 71 | #endif |
72 | startButton->setIconSet( *startIconSet ); | 72 | startButton->setIconSet( *startIconSet ); |
73 | startButton->setEnabled( false ); | 73 | startButton->setEnabled( false ); |
74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); | 74 | connect( startButton, SIGNAL( clicked() ), mw, SLOT( startClicked() ) ); |
75 | 75 | ||
76 | stopButton = new QToolButton( 0 ); | 76 | stopButton = new QToolButton( 0 ); |
77 | #ifdef QWS | 77 | #ifdef QWS |
78 | stopButton->setAutoRaise( true ); | 78 | stopButton->setAutoRaise( true ); |
79 | #endif | 79 | #endif |
80 | stopButton->setIconSet( *stopIconSet ); | 80 | stopButton->setIconSet( *stopIconSet ); |
81 | stopButton->setEnabled( false ); | 81 | stopButton->setEnabled( false ); |
82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); | 82 | connect( stopButton, SIGNAL( clicked() ), mw, SLOT( stopClicked() ) ); |
83 | 83 | ||
84 | QToolButton* c = new QToolButton( 0 ); | 84 | QToolButton* c = new QToolButton( 0 ); |
85 | #ifdef QWS | 85 | #ifdef QWS |
86 | c->setAutoRaise( true ); | 86 | c->setAutoRaise( true ); |
87 | #endif | 87 | #endif |
88 | c->setIconSet( *infoIconSet ); | 88 | c->setIconSet( *infoIconSet ); |
89 | c->setEnabled( false ); | 89 | c->setEnabled( false ); |
90 | 90 | ||
91 | QToolButton* d = new QToolButton( 0 ); | 91 | QToolButton* d = new QToolButton( 0 ); |
92 | #ifdef QWS | 92 | #ifdef QWS |
93 | d->setAutoRaise( true ); | 93 | d->setAutoRaise( true ); |
94 | #endif | 94 | #endif |
95 | d->setIconSet( *settingsIconSet ); | 95 | d->setIconSet( *settingsIconSet ); |
96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); | 96 | connect( d, SIGNAL( clicked() ), this, SLOT( showConfigure() ) ); |
97 | 97 | ||
98 | // setup menu bar | 98 | // setup menu bar |
99 | 99 | ||
100 | int id; | 100 | int id; |
101 | 101 | ||
102 | QMenuBar* mb = menuBar(); | 102 | QMenuBar* mb = menuBar(); |
103 | 103 | ||
104 | QPopupMenu* fileSave = new QPopupMenu( mb ); | 104 | QPopupMenu* fileSave = new QPopupMenu( mb ); |
105 | fileSave->insertItem( "&Session...", this, SLOT( fileSaveSession() ) ); | 105 | fileSave->insertItem( tr( "&Session..." ), this, SLOT( fileSaveSession() ) ); |
106 | fileSave->insertItem( "&Text Log...", this, SLOT( fileSaveLog() ) ); | 106 | fileSave->insertItem( tr( "&Text Log..." ), this, SLOT( fileSaveLog() ) ); |
107 | fileSave->insertItem( "&Hex Log...", this, SLOT( fileSaveHex() ) ); | 107 | fileSave->insertItem( tr( "&Hex Log..." ), this, SLOT( fileSaveHex() ) ); |
108 | 108 | ||
109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); | 109 | QPopupMenu* fileLoad = new QPopupMenu( mb ); |
110 | fileLoad->insertItem( "&Session...", this, SLOT( fileLoadSession() ) ); | 110 | fileLoad->insertItem( tr( "&Session..." ), this, SLOT( fileLoadSession() ) ); |
111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); | 111 | //fileLoad->insertItem( "&Log", this, SLOT( fileLoadLog() ) ); |
112 | 112 | ||
113 | QPopupMenu* file = new QPopupMenu( mb ); | 113 | QPopupMenu* file = new QPopupMenu( mb ); |
114 | file->insertItem( "&New", this, SLOT( fileNew() ) ); | 114 | file->insertItem( tr( "&New" ), this, SLOT( fileNew() ) ); |
115 | id = file->insertItem( "&Load", fileLoad ); | 115 | id = file->insertItem( tr( "&Load" ), fileLoad ); |
116 | file->insertItem( "&Save", fileSave ); | 116 | file->insertItem( tr( "&Save" ), fileSave ); |
117 | file->insertSeparator(); | 117 | file->insertSeparator(); |
118 | file->insertItem( "&Exit", qApp, SLOT( quit() ) ); | 118 | file->insertItem( tr( "&Exit" ), qApp, SLOT( quit() ) ); |
119 | 119 | ||
120 | QPopupMenu* view = new QPopupMenu( mb ); | 120 | QPopupMenu* view = new QPopupMenu( mb ); |
121 | view->insertItem( "&Configure..." ); | 121 | view->insertItem( tr( "&Configure..." ) ); |
122 | 122 | ||
123 | QPopupMenu* sniffer = new QPopupMenu( mb ); | 123 | QPopupMenu* sniffer = new QPopupMenu( mb ); |
124 | sniffer->insertItem( "&Configure...", this, SLOT( showConfigure() ) ); | 124 | sniffer->insertItem( tr( "&Configure..." ), this, SLOT( showConfigure() ) ); |
125 | sniffer->insertSeparator(); | 125 | sniffer->insertSeparator(); |
126 | startID = sniffer->insertItem( "&Start", mw, SLOT( startClicked() ) ); | 126 | startID = sniffer->insertItem( tr( "&Start" ), mw, SLOT( startClicked() ) ); |
127 | sniffer->setItemEnabled( startID, false ); | 127 | sniffer->setItemEnabled( startID, false ); |
128 | stopID = sniffer->insertItem( "Sto&p", mw, SLOT( stopClicked() ) ); | 128 | stopID = sniffer->insertItem( tr( "Sto&p" ), mw, SLOT( stopClicked() ) ); |
129 | sniffer->setItemEnabled( stopID, false ); | 129 | sniffer->setItemEnabled( stopID, false ); |
130 | 130 | ||
131 | QPopupMenu* demo = new QPopupMenu( mb ); | 131 | QPopupMenu* demo = new QPopupMenu( mb ); |
132 | demo->insertItem( "&Add something", this, SLOT( demoAddStations() ) ); | 132 | demo->insertItem( tr( "&Add something" ), this, SLOT( demoAddStations() ) ); |
133 | 133 | ||
134 | id = mb->insertItem( "&File", file ); | 134 | id = mb->insertItem( tr( "&File" ), file ); |
135 | id = mb->insertItem( "&View", view ); | 135 | id = mb->insertItem( tr( "&View" ), view ); |
136 | mb->setItemEnabled( id, false ); | 136 | mb->setItemEnabled( id, false ); |
137 | id = mb->insertItem( "&Sniffer", sniffer ); | 137 | id = mb->insertItem( tr( "&Sniffer" ), sniffer ); |
138 | id = mb->insertItem( "&Demo", demo ); | 138 | id = mb->insertItem( tr( "&Demo" ), demo ); |
139 | mb->setItemEnabled( id, true ); | 139 | mb->setItemEnabled( id, true ); |
140 | 140 | ||
141 | #ifdef QWS | 141 | #ifdef QWS |
142 | mb->insertItem( startButton ); | 142 | mb->insertItem( startButton ); |
143 | mb->insertItem( stopButton ); | 143 | mb->insertItem( stopButton ); |
144 | mb->insertItem( c ); | 144 | mb->insertItem( c ); |
145 | mb->insertItem( d ); | 145 | mb->insertItem( d ); |
146 | #else // Qt3 changed the insertion order. It's now totally random :( | 146 | #else // Qt3 changed the insertion order. It's now totally random :( |
147 | mb->insertItem( d ); | 147 | mb->insertItem( d ); |
148 | mb->insertItem( c ); | 148 | mb->insertItem( c ); |
149 | mb->insertItem( stopButton ); | 149 | mb->insertItem( stopButton ); |
150 | mb->insertItem( startButton ); | 150 | mb->insertItem( startButton ); |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | updateToolButtonState(); | 153 | updateToolButtonState(); |
154 | 154 | ||
155 | // setup status bar (for now only on X11) | 155 | // setup status bar (for now only on X11) |
156 | 156 | ||
157 | #ifndef QWS | 157 | #ifndef QWS |
158 | statusBar()->message( "Ready." ); | 158 | statusBar()->message( tr( "Ready." ) ); |
159 | #endif | 159 | #endif |
160 | 160 | ||
161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); | 161 | connect( mw, SIGNAL( startedSniffing() ), this, SLOT( changedSniffingState() ) ); |
162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); | 162 | connect( mw, SIGNAL( stoppedSniffing() ), this, SLOT( changedSniffingState() ) ); |
163 | }; | 163 | }; |
164 | 164 | ||
165 | 165 | ||
166 | 166 | ||
167 | void WellenreiterMainWindow::showConfigure() | 167 | void WellenreiterMainWindow::showConfigure() |
168 | { | 168 | { |
169 | qDebug( "show configure..." ); | 169 | qDebug( "show configure..." ); |
170 | cw->setCaption( tr( "Configure" ) ); | 170 | cw->setCaption( tr( "Configure" ) ); |
171 | #ifdef QWS | 171 | #ifdef QWS |
172 | cw->showMaximized(); | 172 | cw->showMaximized(); |
173 | #endif | 173 | #endif |
174 | int result = cw->exec(); | 174 | int result = cw->exec(); |
175 | 175 | ||
176 | if ( result ) updateToolButtonState(); | 176 | if ( result ) updateToolButtonState(); |
177 | } | 177 | } |
178 | 178 | ||
179 | 179 | ||
180 | 180 | ||
181 | void WellenreiterMainWindow::updateToolButtonState() | 181 | void WellenreiterMainWindow::updateToolButtonState() |
182 | { | 182 | { |
183 | const QString& interface = cw->interfaceName->currentText(); | 183 | const QString& interface = cw->interfaceName->currentText(); |
184 | const int cardtype = cw->daemonDeviceType(); | 184 | const int cardtype = cw->daemonDeviceType(); |
185 | const int interval = cw->daemonHopInterval(); | 185 | const int interval = cw->daemonHopInterval(); |
186 | 186 | ||
187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) | 187 | if ( ( interface != "<select>" ) && ( cardtype != 0 ) ) |
188 | { | 188 | { |
189 | startButton->setEnabled( true ); | 189 | startButton->setEnabled( true ); |
190 | menuBar()->setItemEnabled( startID, true ); | 190 | menuBar()->setItemEnabled( startID, true ); |
191 | } | 191 | } |
192 | else | 192 | else |
193 | { | 193 | { |
194 | startButton->setEnabled( false ); | 194 | startButton->setEnabled( false ); |
195 | menuBar()->setItemEnabled( startID, false ); | 195 | menuBar()->setItemEnabled( startID, false ); |
196 | } | 196 | } |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | void WellenreiterMainWindow::changedSniffingState() | 200 | void WellenreiterMainWindow::changedSniffingState() |
201 | { | 201 | { |
202 | startButton->setEnabled( !mw->sniffing ); | 202 | startButton->setEnabled( !mw->sniffing ); |
203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); | 203 | menuBar()->setItemEnabled( startID, !mw->sniffing ); |
204 | stopButton->setEnabled( mw->sniffing ); | 204 | stopButton->setEnabled( mw->sniffing ); |
205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); | 205 | menuBar()->setItemEnabled( stopID, mw->sniffing ); |
206 | } | 206 | } |
207 | 207 | ||
208 | 208 | ||
209 | WellenreiterMainWindow::~WellenreiterMainWindow() | 209 | WellenreiterMainWindow::~WellenreiterMainWindow() |
210 | { | 210 | { |
211 | delete infoIconSet; | 211 | delete infoIconSet; |
212 | delete settingsIconSet; | 212 | delete settingsIconSet; |
213 | delete startIconSet; | 213 | delete startIconSet; |
214 | delete stopIconSet; | 214 | delete stopIconSet; |
215 | }; | 215 | }; |
216 | 216 | ||
217 | void WellenreiterMainWindow::demoAddStations() | 217 | void WellenreiterMainWindow::demoAddStations() |
218 | { | 218 | { |
219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); | 219 | mw->netView()->addNewItem( "managed", "Vanille", "00:00:20:EF:A6:43", true, 6, 80 ); |
220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); | 220 | mw->netView()->addNewItem( "managed", "Vanille", "00:30:6D:EF:A6:23", true, 11, 10 ); |
221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); | 221 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:A0:F8:E7:16:22", false, 3, 10 ); |
222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); | 222 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:AA:01:E7:56:62", false, 3, 15 ); |
223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); | 223 | mw->netView()->addNewItem( "adhoc", "ELAN", "00:B0:8E:E7:56:E2", false, 3, 20 ); |
224 | } | 224 | } |
225 | 225 | ||
226 | 226 | ||
227 | QString WellenreiterMainWindow::getFileName( bool save ) | 227 | QString WellenreiterMainWindow::getFileName( bool save ) |
228 | { | 228 | { |
229 | QMap<QString, QStringList> map; | 229 | QMap<QString, QStringList> map; |
230 | map.insert( tr("All"), QStringList() ); | 230 | map.insert( tr("All"), QStringList() ); |
231 | QStringList text; | 231 | QStringList text; |
232 | text << "text/*"; | 232 | text << "text/*"; |
233 | map.insert(tr("Text"), text ); | 233 | map.insert( tr("Text"), text ); |
234 | text << "*"; | 234 | text << "*"; |
235 | map.insert(tr("All"), text ); | 235 | map.insert( tr("All"), text ); |
236 | 236 | ||
237 | QString str; | 237 | QString str; |
238 | if ( save ) | 238 | if ( save ) |
239 | { | 239 | { |
240 | #ifdef QWS | 240 | #ifdef QWS |
241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); | 241 | str = OFileDialog::getSaveFileName( 2, "/", QString::null, map ); |
242 | #else | 242 | #else |
243 | str = QFileDialog::getSaveFileName(); | 243 | str = QFileDialog::getSaveFileName(); |
244 | #endif | 244 | #endif |
245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) | 245 | if ( str.isEmpty() || QFileInfo(str).isDir() ) |
246 | return ""; | 246 | return ""; |
247 | } | 247 | } |
248 | else | 248 | else |
249 | { | 249 | { |
250 | #ifdef QWS | 250 | #ifdef QWS |
251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); | 251 | str = OFileDialog::getOpenFileName( 2, "/", QString::null, map ); |
252 | #else | 252 | #else |
253 | str = QFileDialog::getOpenFileName(); | 253 | str = QFileDialog::getOpenFileName(); |
254 | #endif | 254 | #endif |
255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) | 255 | if ( str.isEmpty() || !QFile(str).exists() || QFileInfo(str).isDir() ) |
256 | return ""; | 256 | return ""; |
257 | } | 257 | } |
258 | return str; | 258 | return str; |
259 | } | 259 | } |
260 | 260 | ||
261 | 261 | ||
262 | void WellenreiterMainWindow::fileSaveLog() | 262 | void WellenreiterMainWindow::fileSaveLog() |
263 | { | 263 | { |
264 | QString fname = getFileName( true ); | 264 | QString fname = getFileName( true ); |
265 | if ( !fname.isEmpty() ) | 265 | if ( !fname.isEmpty() ) |
266 | { | 266 | { |
267 | QFile f( fname ); | 267 | QFile f( fname ); |
268 | if ( f.open(IO_WriteOnly) ) | 268 | if ( f.open(IO_WriteOnly) ) |
269 | { | 269 | { |
270 | QTextStream t( &f ); | 270 | QTextStream t( &f ); |
271 | t << mw->logWindow()->getLog(); | 271 | t << mw->logWindow()->getLog(); |
272 | f.close(); | 272 | f.close(); |
273 | qDebug( "Saved log to file '%s'", (const char*) fname ); | 273 | qDebug( "Saved log to file '%s'", (const char*) fname ); |
274 | } | 274 | } |
275 | else | 275 | else |
276 | { | 276 | { |
277 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); | 277 | qDebug( "Problem saving log to file '%s'", (const char*) fname ); |
278 | } | 278 | } |
279 | } | 279 | } |
280 | } | 280 | } |
281 | 281 | ||
282 | void WellenreiterMainWindow::fileSaveSession() | 282 | void WellenreiterMainWindow::fileSaveSession() |
283 | { | 283 | { |
284 | QString fname = getFileName( true ); | 284 | QString fname = getFileName( true ); |
285 | if ( !fname.isEmpty() ) | 285 | if ( !fname.isEmpty() ) |
286 | { | 286 | { |
287 | 287 | ||
288 | QFile f( fname ); | 288 | QFile f( fname ); |
289 | if ( f.open(IO_WriteOnly) ) | 289 | if ( f.open(IO_WriteOnly) ) |
290 | { | 290 | { |
291 | QDataStream t( &f ); | 291 | QDataStream t( &f ); |
292 | t << *mw->netView(); | 292 | t << *mw->netView(); |
293 | f.close(); | 293 | f.close(); |
294 | qDebug( "Saved session to file '%s'", (const char*) fname ); | 294 | qDebug( "Saved session to file '%s'", (const char*) fname ); |
295 | } | 295 | } |
296 | else | 296 | else |
297 | { | 297 | { |
298 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); | 298 | qDebug( "Problem saving session to file '%s'", (const char*) fname ); |
299 | } | 299 | } |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void WellenreiterMainWindow::fileSaveHex() | 303 | void WellenreiterMainWindow::fileSaveHex() |
304 | { | 304 | { |
305 | QString fname = getFileName( true ); | 305 | QString fname = getFileName( true ); |
306 | if ( !fname.isEmpty() ) | 306 | if ( !fname.isEmpty() ) |
307 | { | 307 | { |
308 | QFile f( fname ); | 308 | QFile f( fname ); |
309 | if ( f.open(IO_WriteOnly) ) | 309 | if ( f.open(IO_WriteOnly) ) |
310 | { | 310 | { |
311 | QTextStream t( &f ); | 311 | QTextStream t( &f ); |
312 | t << mw->hexWindow()->getLog(); | 312 | t << mw->hexWindow()->getLog(); |
313 | f.close(); | 313 | f.close(); |
314 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); | 314 | qDebug( "Saved hex log to file '%s'", (const char*) fname ); |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
318 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); | 318 | qDebug( "Problem saving hex log to file '%s'", (const char*) fname ); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | } | 321 | } |
322 | 322 | ||
323 | void WellenreiterMainWindow::fileLoadSession() | 323 | void WellenreiterMainWindow::fileLoadSession() |
324 | { | 324 | { |
325 | QString fname = getFileName( false ); | 325 | QString fname = getFileName( false ); |
326 | if ( !fname.isEmpty() ) | 326 | if ( !fname.isEmpty() ) |
327 | { | 327 | { |
328 | QFile f( fname ); | 328 | QFile f( fname ); |
329 | if ( f.open(IO_ReadOnly) ) | 329 | if ( f.open(IO_ReadOnly) ) |
330 | { | 330 | { |
331 | QDataStream t( &f ); | 331 | QDataStream t( &f ); |
332 | t >> *mw->netView(); | 332 | t >> *mw->netView(); |
333 | f.close(); | 333 | f.close(); |
334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); | 334 | qDebug( "Loaded session from file '%s'", (const char*) fname ); |
335 | } | 335 | } |
336 | else | 336 | else |
337 | { | 337 | { |
338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); | 338 | qDebug( "Problem loading session from file '%s'", (const char*) fname ); |
339 | } | 339 | } |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | void WellenreiterMainWindow::fileNew() | 343 | void WellenreiterMainWindow::fileNew() |
344 | { | 344 | { |
345 | mw->netView()->clear(); | 345 | mw->netView()->clear(); |
346 | mw->logWindow()->clear(); | 346 | mw->logWindow()->clear(); |
347 | mw->hexWindow()->clear(); | 347 | mw->hexWindow()->clear(); |
348 | } | 348 | } |
349 | 349 | ||
350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) | 350 | void WellenreiterMainWindow::closeEvent( QCloseEvent* e ) |
351 | { | 351 | { |
352 | if ( mw->isDaemonRunning() ) | 352 | if ( mw->isDaemonRunning() ) |
353 | { | 353 | { |
354 | QMessageBox::warning( this, "Wellenreiter/Opie", "Sniffing in progress!\nPlease stop sniffing before closing." ); | 354 | QMessageBox::warning( this, "Wellenreiter/Opie", |
355 | tr( "Sniffing in progress!\nPlease stop sniffing before closing." ) ); | ||
355 | e->ignore(); | 356 | e->ignore(); |
356 | } | 357 | } |
357 | else | 358 | else |
358 | { | 359 | { |
359 | QMainWindow::closeEvent( e ); | 360 | QMainWindow::closeEvent( e ); |
360 | } | 361 | } |
361 | } | 362 | } |
diff --git a/noncore/net/wellenreiter/gui/scanlist.cpp b/noncore/net/wellenreiter/gui/scanlist.cpp index 1cf49e0..3a6aa15 100644 --- a/noncore/net/wellenreiter/gui/scanlist.cpp +++ b/noncore/net/wellenreiter/gui/scanlist.cpp | |||
@@ -1,396 +1,408 @@ | |||
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 | 18 | ||
19 | #include <assert.h> | 19 | #include <assert.h> |
20 | #include "manufacturers.h" | 20 | #include "manufacturers.h" |
21 | #include <qdatetime.h> | 21 | #include <qdatetime.h> |
22 | #include <qtextstream.h> | 22 | #include <qtextstream.h> |
23 | 23 | ||
24 | #ifdef QWS | 24 | #ifdef QWS |
25 | #include <opie/odevice.h> | 25 | #include <opie/odevice.h> |
26 | using namespace Opie; | 26 | using namespace Opie; |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | 29 | ||
30 | #ifdef QWS | 30 | #ifdef QWS |
31 | #include <qpe/resource.h> | 31 | #include <qpe/resource.h> |
32 | #else | 32 | #else |
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | const int col_type = 0; | 36 | const int col_type = 0; |
37 | const int col_essid = 0; | 37 | const int col_essid = 0; |
38 | const int col_sig = 1; | 38 | const int col_sig = 1; |
39 | const int col_ap = 2; | 39 | const int col_ap = 2; |
40 | const int col_channel = 3; | 40 | const int col_channel = 3; |
41 | const int col_wep = 4; | 41 | const int col_wep = 4; |
42 | const int col_traffic = 5; | 42 | const int col_traffic = 5; |
43 | const int col_manuf = 6; | 43 | const int col_manuf = 6; |
44 | const int col_firstseen = 7; | 44 | const int col_firstseen = 7; |
45 | const int col_lastseen = 8; | 45 | const int col_lastseen = 8; |
46 | 46 | ||
47 | MScanListView::MScanListView( QWidget* parent, const char* name ) | 47 | MScanListView::MScanListView( QWidget* parent, const char* name ) |
48 | :OListView( parent, name ), _manufacturerdb( 0 ) | 48 | :OListView( parent, name ), _manufacturerdb( 0 ) |
49 | { | 49 | { |
50 | 50 | ||
51 | setFrameShape( QListView::StyledPanel ); | 51 | setFrameShape( QListView::StyledPanel ); |
52 | setFrameShadow( QListView::Sunken ); | 52 | setFrameShadow( QListView::Sunken ); |
53 | 53 | ||
54 | addColumn( tr( "Net/Station" ) ); | 54 | addColumn( tr( "Net/Station" ) ); |
55 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); | 55 | setColumnAlignment( 0, AlignLeft || AlignVCenter ); |
56 | addColumn( tr( "B" ) ); | 56 | addColumn( tr( "#" ) ); |
57 | setColumnAlignment( 1, AlignCenter ); | 57 | setColumnAlignment( 1, AlignCenter ); |
58 | addColumn( tr( "AP" ) ); | 58 | addColumn( tr( "MAC" ) ); |
59 | setColumnAlignment( 2, AlignCenter ); | 59 | setColumnAlignment( 2, AlignCenter ); |
60 | addColumn( tr( "Chn" ) ); | 60 | addColumn( tr( "Chn" ) ); |
61 | setColumnAlignment( 3, AlignCenter ); | 61 | setColumnAlignment( 3, AlignCenter ); |
62 | addColumn( tr( "W" ) ); | 62 | addColumn( tr( "W" ) ); |
63 | setColumnAlignment( 4, AlignCenter ); | 63 | setColumnAlignment( 4, AlignCenter ); |
64 | addColumn( tr( "T" ) ); | 64 | addColumn( tr( "T" ) ); |
65 | setColumnAlignment( 5, AlignCenter ); | 65 | setColumnAlignment( 5, AlignCenter ); |
66 | addColumn( tr( "Manufacturer" ) ); | 66 | addColumn( tr( "Manufacturer" ) ); |
67 | setColumnAlignment( 6, AlignCenter ); | 67 | setColumnAlignment( 6, AlignCenter ); |
68 | addColumn( tr( "First Seen" ) ); | 68 | addColumn( tr( "First Seen" ) ); |
69 | setColumnAlignment( 7, AlignCenter ); | 69 | setColumnAlignment( 7, AlignCenter ); |
70 | addColumn( tr( "Last Seen" ) ); | 70 | addColumn( tr( "Last Seen" ) ); |
71 | setColumnAlignment( 8, AlignCenter ); | 71 | setColumnAlignment( 8, AlignCenter ); |
72 | setRootIsDecorated( true ); | 72 | setRootIsDecorated( true ); |
73 | setAllColumnsShowFocus( true ); | 73 | setAllColumnsShowFocus( true ); |
74 | }; | 74 | }; |
75 | 75 | ||
76 | MScanListView::~MScanListView() | 76 | MScanListView::~MScanListView() |
77 | { | 77 | { |
78 | }; | 78 | }; |
79 | 79 | ||
80 | OListViewItem* MScanListView::childFactory() | 80 | OListViewItem* MScanListView::childFactory() |
81 | { | 81 | { |
82 | return new MScanListItem( this ); | 82 | return new MScanListItem( this ); |
83 | } | 83 | } |
84 | 84 | ||
85 | void MScanListView::serializeTo( QDataStream& s) const | 85 | void MScanListView::serializeTo( QDataStream& s) const |
86 | { | 86 | { |
87 | qDebug( "serializing MScanListView" ); | 87 | qDebug( "serializing MScanListView" ); |
88 | OListView::serializeTo( s ); | 88 | OListView::serializeTo( s ); |
89 | } | 89 | } |
90 | 90 | ||
91 | void MScanListView::serializeFrom( QDataStream& s) | 91 | void MScanListView::serializeFrom( QDataStream& s) |
92 | { | 92 | { |
93 | qDebug( "serializing MScanListView" ); | 93 | qDebug( "serializing MScanListView" ); |
94 | OListView::serializeFrom( s ); | 94 | OListView::serializeFrom( s ); |
95 | } | 95 | } |
96 | 96 | ||
97 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) | 97 | void MScanListView::setManufacturerDB( ManufacturerDB* manufacturerdb ) |
98 | { | 98 | { |
99 | _manufacturerdb = manufacturerdb; | 99 | _manufacturerdb = manufacturerdb; |
100 | } | 100 | } |
101 | 101 | ||
102 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 102 | void MScanListView::addNewItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
103 | { | 103 | { |
104 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) | 104 | // FIXME: scanlistitem needs a proper encapsulation and not such a damn dealing with text(...) |
105 | 105 | ||
106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", | 106 | qDebug( "MScanList::addNewItem( %s / %s / %s [%d]", |
107 | (const char*) type, | 107 | (const char*) type, |
108 | (const char*) essid, | 108 | (const char*) essid, |
109 | (const char*) macaddr, | 109 | (const char*) macaddr, |
110 | channel ); | 110 | channel ); |
111 | 111 | ||
112 | // search, if we already have seen this net | 112 | // search, if we already have seen this net |
113 | 113 | ||
114 | QString s; | 114 | QString s; |
115 | MScanListItem* network; | 115 | MScanListItem* network; |
116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); | 116 | MScanListItem* item = static_cast<MScanListItem*> ( firstChild() ); |
117 | 117 | ||
118 | while ( item && ( item->text( col_essid ) != essid ) ) | 118 | while ( item && ( item->text( col_essid ) != essid ) ) |
119 | { | 119 | { |
120 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); | 120 | qDebug( "itemtext: %s", (const char*) item->text( col_essid ) ); |
121 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 121 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
122 | } | 122 | } |
123 | if ( item ) | 123 | if ( item ) |
124 | { | 124 | { |
125 | // we have already seen this net, check all childs if MAC exists | 125 | // we have already seen this net, check all childs if MAC exists |
126 | 126 | ||
127 | network = item; | 127 | network = item; |
128 | 128 | ||
129 | item = static_cast<MScanListItem*> ( item->firstChild() ); | 129 | item = static_cast<MScanListItem*> ( item->firstChild() ); |
130 | assert( item ); // this shouldn't fail | 130 | assert( item ); // this shouldn't fail |
131 | 131 | ||
132 | while ( item && ( item->text( col_ap ) != macaddr ) ) | 132 | while ( item && ( item->text( col_ap ) != macaddr ) ) |
133 | { | 133 | { |
134 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); | 134 | qDebug( "subitemtext: %s", (const char*) item->text( col_ap ) ); |
135 | item = static_cast<MScanListItem*> ( item->nextSibling() ); | 135 | item = static_cast<MScanListItem*> ( item->nextSibling() ); |
136 | } | 136 | } |
137 | 137 | ||
138 | if ( item ) | 138 | if ( item ) |
139 | { | 139 | { |
140 | // we have already seen this item, it's a dupe | 140 | // we have already seen this item, it's a dupe |
141 | #ifdef DEBUG | 141 | #ifdef DEBUG |
142 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); | 142 | qDebug( "%s is a dupe - ignoring...", (const char*) macaddr ); |
143 | #endif | 143 | #endif |
144 | item->receivedBeacon(); | 144 | item->receivedBeacon(); |
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | } | 147 | } |
148 | else | 148 | else |
149 | { | 149 | { |
150 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); | 150 | s.sprintf( "(i) new network: '%s'", (const char*) essid ); |
151 | //TODO send s to logwindow | ||
151 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); | 152 | network = new MScanListItem( this, "network", essid, QString::null, 0, 0, 0 ); |
152 | } | 153 | } |
153 | 154 | ||
154 | 155 | ||
155 | // insert new station as child from network | 156 | // insert new station as child from network |
156 | |||
157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? | 157 | // no essid to reduce clutter, maybe later we have a nick or stationname to display!? |
158 | 158 | ||
159 | qDebug( "inserting new station %s", (const char*) macaddr ); | 159 | qDebug( "inserting new station %s", (const char*) macaddr ); |
160 | 160 | ||
161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); | 161 | MScanListItem* station = new MScanListItem( network, type, "", macaddr, wep, channel, signal ); |
162 | if ( _manufacturerdb ) | 162 | if ( _manufacturerdb ) |
163 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); | 163 | station->setManufacturer( _manufacturerdb->lookup( macaddr ) ); |
164 | 164 | ||
165 | if ( type == "managed" ) | 165 | if ( type == "managed" ) |
166 | { | 166 | { |
167 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); | 167 | s.sprintf( "(i) new AP in '%s' [%d]", (const char*) essid, channel ); |
168 | } | 168 | } |
169 | else | 169 | else |
170 | { | 170 | { |
171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); | 171 | s.sprintf( "(i) new adhoc station in '%s' [%d]", (const char*) essid, channel ); |
172 | } | 172 | } |
173 | //TODO send s to logwindow | ||
173 | 174 | ||
174 | } | 175 | } |
175 | 176 | ||
176 | 177 | ||
177 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) | 178 | void MScanListView::addIfNotExisting( MScanListItem* network, QString addr, const QString& type ) |
178 | { | 179 | { |
179 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); | 180 | MScanListItem* subitem = static_cast<MScanListItem*>( network->firstChild() ); |
180 | 181 | ||
181 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) | 182 | while ( subitem && ( subitem->text( col_ap ) != addr ) ) |
182 | { | 183 | { |
183 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); | 184 | qDebug( "subitemtext: %s", (const char*) subitem->text( col_ap ) ); |
184 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); | 185 | subitem = static_cast<MScanListItem*> ( subitem->nextSibling() ); |
185 | } | 186 | } |
186 | 187 | ||
187 | if ( subitem ) | 188 | if ( subitem ) |
188 | { | 189 | { |
189 | // we have already seen this item, it's a dupe | 190 | // we have already seen this item, it's a dupe |
190 | #ifdef DEBUG | 191 | #ifdef DEBUG |
191 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); | 192 | qDebug( "%s is a dupe - ignoring...", (const char*) addr ); |
192 | #endif | 193 | #endif |
193 | subitem->receivedBeacon(); //FIXME: sent data bit | 194 | subitem->receivedBeacon(); //FIXME: sent data bit |
194 | return; | 195 | return; |
195 | } | 196 | } |
196 | 197 | ||
197 | // Hey, it seems to be a new item :-D | 198 | // Hey, it seems to be a new item :-D |
198 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); | 199 | MScanListItem* station = new MScanListItem( network, type, /* network->text( col_essid ) */ "", addr, false, -1, -1 ); |
199 | if ( _manufacturerdb ) | 200 | if ( _manufacturerdb ) |
200 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); | 201 | station->setManufacturer( _manufacturerdb->lookup( addr ) ); |
202 | |||
203 | QString s; | ||
204 | if ( type == "station" ) | ||
205 | { | ||
206 | s.sprintf( "(i) new station in '%s' [??]", (const char*) network->text( col_essid ) ); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | s.sprintf( "(i) new wireless station in '%s' [??]", (const char*) network->text( col_essid ) ); | ||
211 | } | ||
212 | //TODO send s to logwindow | ||
201 | } | 213 | } |
202 | 214 | ||
203 | 215 | ||
204 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) | 216 | void MScanListView::WDStraffic( QString from, QString to, QString viaFrom, QString viaTo ) |
205 | { | 217 | { |
206 | QString s; | 218 | QString s; |
207 | MScanListItem* network; | 219 | MScanListItem* network; |
208 | 220 | ||
209 | QListViewItemIterator it( this ); | 221 | QListViewItemIterator it( this ); |
210 | while ( it.current() && | 222 | while ( it.current() && |
211 | it.current()->text( col_ap ) != viaFrom && | 223 | it.current()->text( col_ap ) != viaFrom && |
212 | it.current()->text( col_ap ) != viaTo ) ++it; | 224 | it.current()->text( col_ap ) != viaTo ) ++it; |
213 | 225 | ||
214 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 226 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
215 | 227 | ||
216 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations | 228 | if ( item ) // Either viaFrom or viaTo AP has shown up yet, so just add our two new stations |
217 | { | 229 | { |
218 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); | 230 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from ); |
219 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); | 231 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), to ); |
220 | } | 232 | } |
221 | else | 233 | else |
222 | { | 234 | { |
223 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); | 235 | qDebug( "D'Oh! Stations without AP... ignoring for now... will handle this in 1.1 version :-D" ); |
224 | } | 236 | } |
225 | } | 237 | } |
226 | 238 | ||
227 | 239 | ||
228 | void MScanListView::toDStraffic( QString from, QString to, QString via ) | 240 | void MScanListView::toDStraffic( QString from, QString to, QString via ) |
229 | { | 241 | { |
230 | QString s; | 242 | QString s; |
231 | MScanListItem* network; | 243 | MScanListItem* network; |
232 | 244 | ||
233 | QListViewItemIterator it( this ); | 245 | QListViewItemIterator it( this ); |
234 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 246 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
235 | 247 | ||
236 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 248 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
237 | 249 | ||
238 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 250 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
239 | { | 251 | { |
240 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); | 252 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "adhoc" ); |
241 | } | 253 | } |
242 | else | 254 | else |
243 | { | 255 | { |
244 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 256 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
245 | } | 257 | } |
246 | } | 258 | } |
247 | 259 | ||
248 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) | 260 | void MScanListView::fromDStraffic( QString from, QString to, QString via ) |
249 | { | 261 | { |
250 | QString s; | 262 | QString s; |
251 | MScanListItem* network; | 263 | MScanListItem* network; |
252 | 264 | ||
253 | QListViewItemIterator it( this ); | 265 | QListViewItemIterator it( this ); |
254 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; | 266 | while ( it.current() && it.current()->text( col_ap ) != via ) ++it; |
255 | 267 | ||
256 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); | 268 | MScanListItem* item = static_cast<MScanListItem*>( it.current() ); |
257 | 269 | ||
258 | if ( item ) // AP has shown up yet, so just add our new "from" - station | 270 | if ( item ) // AP has shown up yet, so just add our new "from" - station |
259 | { | 271 | { |
260 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); | 272 | addIfNotExisting( static_cast<MScanListItem*>(item->parent()), from, "station" ); |
261 | } | 273 | } |
262 | else | 274 | else |
263 | { | 275 | { |
264 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); | 276 | qDebug( "D'Oh! Station without AP... ignoring for now... will handle this in 1.1 :-D" ); |
265 | } | 277 | } |
266 | } | 278 | } |
267 | 279 | ||
268 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) | 280 | void MScanListView::IBSStraffic( QString from, QString to, QString via ) |
269 | { | 281 | { |
270 | qWarning( "D'oh! Not yet implemented..." ); | 282 | qWarning( "D'oh! Not yet implemented..." ); |
271 | } | 283 | } |
272 | 284 | ||
273 | //============================================================ | 285 | //============================================================ |
274 | // MScanListItem | 286 | // MScanListItem |
275 | //============================================================ | 287 | //============================================================ |
276 | 288 | ||
277 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, | 289 | MScanListItem::MScanListItem( QListView* parent, QString type, QString essid, QString macaddr, |
278 | bool wep, int channel, int signal ) | 290 | bool wep, int channel, int signal ) |
279 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), | 291 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ), |
280 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), | 292 | _type( type ), _essid( essid ), _macaddr( macaddr ), _wep( wep ), |
281 | _channel( channel ), _signal( signal ), _beacons( 1 ) | 293 | _channel( channel ), _signal( signal ), _beacons( 1 ) |
282 | { | 294 | { |
283 | qDebug( "creating scanlist item" ); | 295 | qDebug( "creating scanlist item" ); |
284 | if ( WellenreiterConfigWindow::instance() && type == "network" ) | 296 | if ( WellenreiterConfigWindow::instance() && type == "network" ) |
285 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); | 297 | playSound( WellenreiterConfigWindow::instance()->soundOnNetwork() ); |
286 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 298 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
287 | } | 299 | } |
288 | 300 | ||
289 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, | 301 | MScanListItem::MScanListItem( QListViewItem* parent, QString type, QString essid, QString macaddr, |
290 | bool wep, int channel, int signal ) | 302 | bool wep, int channel, int signal ) |
291 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) | 303 | :OListViewItem( parent, essid, QString::null, macaddr, QString::null, QString::null ) |
292 | { | 304 | { |
293 | qDebug( "creating scanlist item" ); | 305 | qDebug( "creating scanlist item" ); |
294 | decorateItem( type, essid, macaddr, wep, channel, signal ); | 306 | decorateItem( type, essid, macaddr, wep, channel, signal ); |
295 | } | 307 | } |
296 | 308 | ||
297 | OListViewItem* MScanListItem::childFactory() | 309 | OListViewItem* MScanListItem::childFactory() |
298 | { | 310 | { |
299 | return new MScanListItem( this ); | 311 | return new MScanListItem( this ); |
300 | } | 312 | } |
301 | 313 | ||
302 | void MScanListItem::serializeTo( QDataStream& s ) const | 314 | void MScanListItem::serializeTo( QDataStream& s ) const |
303 | { | 315 | { |
304 | qDebug( "serializing MScanListItem" ); | 316 | qDebug( "serializing MScanListItem" ); |
305 | OListViewItem::serializeTo( s ); | 317 | OListViewItem::serializeTo( s ); |
306 | 318 | ||
307 | s << _type; | 319 | s << _type; |
308 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); | 320 | s << (Q_UINT8) ( _wep ? 'y' : 'n' ); |
309 | } | 321 | } |
310 | 322 | ||
311 | void MScanListItem::serializeFrom( QDataStream& s ) | 323 | void MScanListItem::serializeFrom( QDataStream& s ) |
312 | { | 324 | { |
313 | qDebug( "serializing MScanListItem" ); | 325 | qDebug( "serializing MScanListItem" ); |
314 | OListViewItem::serializeFrom( s ); | 326 | OListViewItem::serializeFrom( s ); |
315 | 327 | ||
316 | char wep; | 328 | char wep; |
317 | s >> _type; | 329 | s >> _type; |
318 | s >> (Q_UINT8) wep; | 330 | s >> (Q_UINT8) wep; |
319 | _wep = (wep == 'y'); | 331 | _wep = (wep == 'y'); |
320 | 332 | ||
321 | QString name; | 333 | QString name; |
322 | name.sprintf( "wellenreiter/%s", (const char*) _type ); | 334 | name.sprintf( "wellenreiter/%s", (const char*) _type ); |
323 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 335 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
324 | if ( _wep ) | 336 | if ( _wep ) |
325 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 337 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
326 | listView()->triggerUpdate(); | 338 | listView()->triggerUpdate(); |
327 | } | 339 | } |
328 | 340 | ||
329 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) | 341 | void MScanListItem::decorateItem( QString type, QString essid, QString macaddr, bool wep, int channel, int signal ) |
330 | { | 342 | { |
331 | qDebug( "decorating scanlist item %s / %s / %s [%d]", | 343 | qDebug( "decorating scanlist item %s / %s / %s [%d]", |
332 | (const char*) type, | 344 | (const char*) type, |
333 | (const char*) essid, | 345 | (const char*) essid, |
334 | (const char*) macaddr, | 346 | (const char*) macaddr, |
335 | channel ); | 347 | channel ); |
336 | 348 | ||
337 | // set icon for managed or adhoc mode | 349 | // set icon for managed or adhoc mode |
338 | QString name; | 350 | QString name; |
339 | name.sprintf( "wellenreiter/%s", (const char*) type ); | 351 | name.sprintf( "wellenreiter/%s", (const char*) type ); |
340 | setPixmap( col_type, Resource::loadPixmap( name ) ); | 352 | setPixmap( col_type, Resource::loadPixmap( name ) ); |
341 | 353 | ||
342 | // set icon for wep (wireless encryption protocol) | 354 | // set icon for wep (wireless encryption protocol) |
343 | if ( wep ) | 355 | if ( wep ) |
344 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! | 356 | setPixmap( col_wep, Resource::loadPixmap( "wellenreiter/cracked" ) ); //FIXME: rename the pixmap! |
345 | 357 | ||
346 | // set channel and signal text | 358 | // set channel and signal text |
347 | 359 | ||
348 | if ( signal != -1 ) | 360 | if ( signal != -1 ) |
349 | setText( col_sig, QString::number( signal ) ); | 361 | setText( col_sig, QString::number( signal ) ); |
350 | if ( channel != -1 ) | 362 | if ( channel != -1 ) |
351 | setText( col_channel, QString::number( channel ) ); | 363 | setText( col_channel, QString::number( channel ) ); |
352 | 364 | ||
353 | setText( col_firstseen, QTime::currentTime().toString() ); | 365 | setText( col_firstseen, QTime::currentTime().toString() ); |
354 | //setText( col_lastseen, QTime::currentTime().toString() ); | 366 | //setText( col_lastseen, QTime::currentTime().toString() ); |
355 | 367 | ||
356 | listView()->triggerUpdate(); | 368 | listView()->triggerUpdate(); |
357 | 369 | ||
358 | this->type = type; | 370 | this->type = type; |
359 | _type = type; | 371 | _type = type; |
360 | _essid = essid; | 372 | _essid = essid; |
361 | _macaddr = macaddr; | 373 | _macaddr = macaddr; |
362 | _channel = channel; | 374 | _channel = channel; |
363 | _beacons = 1; | 375 | _beacons = 1; |
364 | _signal = 0; | 376 | _signal = 0; |
365 | } | 377 | } |
366 | 378 | ||
367 | 379 | ||
368 | void MScanListItem::setManufacturer( const QString& manufacturer ) | 380 | void MScanListItem::setManufacturer( const QString& manufacturer ) |
369 | { | 381 | { |
370 | setText( col_manuf, manufacturer ); | 382 | setText( col_manuf, manufacturer ); |
371 | } | 383 | } |
372 | 384 | ||
373 | 385 | ||
374 | void MScanListItem::playSound( const QString& sound ) const | 386 | void MScanListItem::playSound( const QString& sound ) const |
375 | { | 387 | { |
376 | #ifdef QWS | 388 | #ifdef QWS |
377 | if ( sound == "Ignore" ) return; | 389 | if ( sound == "Ignore" ) return; |
378 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); | 390 | else if ( sound == "Touch" ) ODevice::inst()->touchSound(); |
379 | else if ( sound == "Key" ) ODevice::inst()->keySound(); | 391 | else if ( sound == "Key" ) ODevice::inst()->keySound(); |
380 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); | 392 | else if ( sound == "Alarm" ) ODevice::inst()->alarmSound(); |
381 | #endif | 393 | #endif |
382 | } | 394 | } |
383 | 395 | ||
384 | 396 | ||
385 | void MScanListItem::receivedBeacon() | 397 | void MScanListItem::receivedBeacon() |
386 | { | 398 | { |
387 | _beacons++; | 399 | _beacons++; |
388 | #ifdef DEBUG | 400 | #ifdef DEBUG |
389 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); | 401 | qDebug( "MScanListItem %s: received beacon #%d", (const char*) _macaddr, _beacons ); |
390 | #endif | 402 | #endif |
391 | setText( col_sig, QString::number( _beacons ) ); | 403 | setText( col_sig, QString::number( _beacons ) ); |
392 | setText( col_lastseen, QTime::currentTime().toString() ); | 404 | setText( col_lastseen, QTime::currentTime().toString() ); |
393 | if ( WellenreiterConfigWindow::instance() ) | 405 | if ( WellenreiterConfigWindow::instance() ) |
394 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); | 406 | playSound( WellenreiterConfigWindow::instance()->soundOnBeacon() ); |
395 | } | 407 | } |
396 | 408 | ||
diff --git a/noncore/net/wellenreiter/gui/statwindow.cpp b/noncore/net/wellenreiter/gui/statwindow.cpp index 2c8c774..a9ae661 100644 --- a/noncore/net/wellenreiter/gui/statwindow.cpp +++ b/noncore/net/wellenreiter/gui/statwindow.cpp | |||
@@ -1,43 +1,43 @@ | |||
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 "statwindow.h" | 16 | #include "statwindow.h" |
17 | #include <opie2/olistview.h> | 17 | #include <opie2/olistview.h> |
18 | 18 | ||
19 | MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f ) | 19 | MStatWindow::MStatWindow( QWidget * parent, const char * name, WFlags f ) |
20 | :QVBox( parent, name, f ) | 20 | :QVBox( parent, name, f ) |
21 | { | 21 | { |
22 | table = new OListView( this ); | 22 | table = new OListView( this ); |
23 | table->addColumn( "Protocol" ); | 23 | table->addColumn( tr( "Protocol" ) ); |
24 | table->addColumn( "Count" ); | 24 | table->addColumn( tr( "Count" ) ); |
25 | table->setItemMargin( 2 ); | 25 | table->setItemMargin( 2 ); |
26 | }; | 26 | }; |
27 | 27 | ||
28 | 28 | ||
29 | void MStatWindow::updateCounter( const QString& protocol, int counter ) | 29 | void MStatWindow::updateCounter( const QString& protocol, int counter ) |
30 | { | 30 | { |
31 | QListViewItemIterator it( table ); | 31 | QListViewItemIterator it( table ); |
32 | for ( ; it.current(); ++it ) | 32 | for ( ; it.current(); ++it ) |
33 | { | 33 | { |
34 | if ( it.current()->text( 0 ) == protocol ) | 34 | if ( it.current()->text( 0 ) == protocol ) |
35 | { | 35 | { |
36 | it.current()->setText( 1, QString::number( counter ) ); | 36 | it.current()->setText( 1, QString::number( counter ) ); |
37 | return; | 37 | return; |
38 | } | 38 | } |
39 | } | 39 | } |
40 | 40 | ||
41 | new OListViewItem( table, protocol, QString::number( counter ) ); | 41 | new OListViewItem( table, protocol, QString::number( counter ) ); |
42 | } | 42 | } |
43 | 43 | ||
diff --git a/noncore/net/wellenreiter/gui/wellenreiter.cpp b/noncore/net/wellenreiter/gui/wellenreiter.cpp index c061319..62bda91 100644 --- a/noncore/net/wellenreiter/gui/wellenreiter.cpp +++ b/noncore/net/wellenreiter/gui/wellenreiter.cpp | |||
@@ -1,389 +1,397 @@ | |||
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 | // Opie | 16 | // Opie |
17 | 17 | ||
18 | #ifdef QWS | 18 | #ifdef QWS |
19 | #include <opie/odevice.h> | 19 | #include <opie/odevice.h> |
20 | using namespace Opie; | 20 | using namespace Opie; |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | #ifdef QWS | 23 | #ifdef QWS |
24 | #include <opie2/oapplication.h> | 24 | #include <opie2/oapplication.h> |
25 | #else | 25 | #else |
26 | #include <qapplication.h> | 26 | #include <qapplication.h> |
27 | #endif | 27 | #endif |
28 | #include <opie2/onetwork.h> | 28 | #include <opie2/onetwork.h> |
29 | #include <opie2/opcap.h> | 29 | #include <opie2/opcap.h> |
30 | 30 | ||
31 | // Qt | 31 | // Qt |
32 | 32 | ||
33 | #include <qcheckbox.h> | 33 | #include <qcheckbox.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qdatetime.h> | 35 | #include <qdatetime.h> |
36 | #include <qpushbutton.h> | 36 | #include <qpushbutton.h> |
37 | #include <qlineedit.h> | 37 | #include <qlineedit.h> |
38 | #include <qmessagebox.h> | 38 | #include <qmessagebox.h> |
39 | #include <qregexp.h> | 39 | #include <qregexp.h> |
40 | #include <qspinbox.h> | 40 | #include <qspinbox.h> |
41 | #include <qtoolbutton.h> | 41 | #include <qtoolbutton.h> |
42 | #include <qmainwindow.h> | 42 | #include <qmainwindow.h> |
43 | 43 | ||
44 | // Standard | 44 | // Standard |
45 | 45 | ||
46 | #include <assert.h> | 46 | #include <assert.h> |
47 | #include <errno.h> | 47 | #include <errno.h> |
48 | #include <unistd.h> | 48 | #include <unistd.h> |
49 | #include <string.h> | 49 | #include <string.h> |
50 | #include <sys/types.h> | 50 | #include <sys/types.h> |
51 | #include <stdlib.h> | 51 | #include <stdlib.h> |
52 | 52 | ||
53 | // Local | 53 | // Local |
54 | 54 | ||
55 | #include "wellenreiter.h" | 55 | #include "wellenreiter.h" |
56 | #include "scanlist.h" | 56 | #include "scanlist.h" |
57 | #include "logwindow.h" | 57 | #include "logwindow.h" |
58 | #include "hexwindow.h" | 58 | #include "hexwindow.h" |
59 | #include "configwindow.h" | 59 | #include "configwindow.h" |
60 | #include "statwindow.h" | 60 | #include "statwindow.h" |
61 | #include "graphwindow.h" | 61 | #include "graphwindow.h" |
62 | #include "manufacturers.h" | 62 | #include "manufacturers.h" |
63 | 63 | ||
64 | Wellenreiter::Wellenreiter( QWidget* parent ) | 64 | Wellenreiter::Wellenreiter( QWidget* parent ) |
65 | : WellenreiterBase( parent, 0, 0 ), | 65 | : WellenreiterBase( parent, 0, 0 ), |
66 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) | 66 | sniffing( false ), iface( 0 ), manufacturerdb( 0 ), configwindow( 0 ) |
67 | { | 67 | { |
68 | 68 | ||
69 | // | 69 | // |
70 | // construct manufacturer database | 70 | // construct manufacturer database |
71 | // | 71 | // |
72 | 72 | ||
73 | QString manufile; | 73 | QString manufile; |
74 | #ifdef QWS | 74 | #ifdef QWS |
75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); | 75 | manufile.sprintf( "%s/share/wellenreiter/manufacturers.dat", (const char*) QPEApplication::qpeDir() ); |
76 | #else | 76 | #else |
77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); | 77 | manufile.sprintf( "/usr/local/share/wellenreiter/manufacturers.dat" ); |
78 | #endif | 78 | #endif |
79 | manufacturerdb = new ManufacturerDB( manufile ); | 79 | manufacturerdb = new ManufacturerDB( manufile ); |
80 | 80 | ||
81 | logwindow->log( "(i) Wellenreiter has been started." ); | 81 | logwindow->log( "(i) Wellenreiter has been started." ); |
82 | 82 | ||
83 | // | 83 | // |
84 | // detect operating system | 84 | // detect operating system |
85 | // | 85 | // |
86 | 86 | ||
87 | #ifdef QWS | 87 | #ifdef QWS |
88 | QString sys; | 88 | QString sys; |
89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); | 89 | sys.sprintf( "(i) Running on '%s'.", (const char*) ODevice::inst()->systemString() ); |
90 | _system = ODevice::inst()->system(); | 90 | _system = ODevice::inst()->system(); |
91 | logwindow->log( sys ); | 91 | logwindow->log( sys ); |
92 | #endif | 92 | #endif |
93 | 93 | ||
94 | // setup GUI | 94 | // setup GUI |
95 | netview->setColumnWidthMode( 1, QListView::Manual ); | 95 | netview->setColumnWidthMode( 1, QListView::Manual ); |
96 | 96 | ||
97 | if ( manufacturerdb ) | 97 | if ( manufacturerdb ) |
98 | netview->setManufacturerDB( manufacturerdb ); | 98 | netview->setManufacturerDB( manufacturerdb ); |
99 | 99 | ||
100 | pcap = new OPacketCapturer(); | 100 | pcap = new OPacketCapturer(); |
101 | 101 | ||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | Wellenreiter::~Wellenreiter() | 105 | Wellenreiter::~Wellenreiter() |
106 | { | 106 | { |
107 | // no need to delete child widgets, Qt does it all for us | 107 | // no need to delete child widgets, Qt does it all for us |
108 | 108 | ||
109 | delete manufacturerdb; | 109 | delete manufacturerdb; |
110 | delete pcap; | 110 | delete pcap; |
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) | 114 | void Wellenreiter::setConfigWindow( WellenreiterConfigWindow* cw ) |
115 | { | 115 | { |
116 | configwindow = cw; | 116 | configwindow = cw; |
117 | } | 117 | } |
118 | 118 | ||
119 | 119 | ||
120 | void Wellenreiter::channelHopped(int c) | 120 | void Wellenreiter::channelHopped(int c) |
121 | { | 121 | { |
122 | QString title = "Wellenreiter II -scan- ["; | 122 | QString title = "Wellenreiter II -scan- ["; |
123 | QString left; | 123 | QString left; |
124 | if ( c > 1 ) left.fill( '.', c-1 ); | 124 | if ( c > 1 ) left.fill( '.', c-1 ); |
125 | title.append( left ); | 125 | title.append( left ); |
126 | title.append( '|' ); | 126 | title.append( '|' ); |
127 | if ( c < iface->channels() ) | 127 | if ( c < iface->channels() ) |
128 | { | 128 | { |
129 | QString right; | 129 | QString right; |
130 | right.fill( '.', iface->channels()-c ); | 130 | right.fill( '.', iface->channels()-c ); |
131 | title.append( right ); | 131 | title.append( right ); |
132 | } | 132 | } |
133 | title.append( "]" ); | 133 | title.append( "]" ); |
134 | //title.append( QString().sprintf( " %02d", c ) ); | 134 | //title.append( QString().sprintf( " %02d", c ) ); |
135 | assert( parent() ); | 135 | assert( parent() ); |
136 | ( (QMainWindow*) parent() )->setCaption( title ); | 136 | ( (QMainWindow*) parent() )->setCaption( title ); |
137 | } | 137 | } |
138 | 138 | ||
139 | 139 | ||
140 | void Wellenreiter::receivePacket(OPacket* p) | 140 | void Wellenreiter::receivePacket(OPacket* p) |
141 | { | 141 | { |
142 | hexWindow()->log( p->dump( 8 ) ); | 142 | hexWindow()->log( p->dump( 8 ) ); |
143 | 143 | ||
144 | // check if we received a beacon frame | 144 | // check if we received a beacon frame |
145 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); | 145 | OWaveLanManagementPacket* beacon = static_cast<OWaveLanManagementPacket*>( p->child( "802.11 Management" ) ); |
146 | if ( beacon && beacon->managementType() == "Beacon" ) | 146 | if ( beacon && beacon->managementType() == "Beacon" ) |
147 | { | 147 | { |
148 | QString type; | 148 | QString type; |
149 | if ( beacon->canIBSS() ) | 149 | if ( beacon->canIBSS() ) |
150 | { | 150 | { |
151 | type = "adhoc"; | 151 | type = "adhoc"; |
152 | } | 152 | } |
153 | else if ( beacon->canESS() ) | 153 | else if ( beacon->canESS() ) |
154 | { | 154 | { |
155 | type = "managed"; | 155 | type = "managed"; |
156 | } | 156 | } |
157 | else | 157 | else |
158 | { | 158 | { |
159 | qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); | 159 | qDebug( "Wellenreiter::invalid frame detected: '%s'", (const char*) p->dump( 16 ) ); |
160 | return; | 160 | return; |
161 | } | 161 | } |
162 | 162 | ||
163 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); | 163 | OWaveLanManagementSSID* ssid = static_cast<OWaveLanManagementSSID*>( p->child( "802.11 SSID" ) ); |
164 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); | 164 | QString essid = ssid ? ssid->ID() : QString("<unknown>"); |
165 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); | 165 | OWaveLanManagementDS* ds = static_cast<OWaveLanManagementDS*>( p->child( "802.11 DS" ) ); |
166 | int channel = ds ? ds->channel() : -1; | 166 | int channel = ds ? ds->channel() : -1; |
167 | 167 | ||
168 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); | 168 | OWaveLanPacket* header = static_cast<OWaveLanPacket*>( p->child( "802.11" ) ); |
169 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); | 169 | netView()->addNewItem( type, essid, header->macAddress2().toString(), beacon->canPrivacy(), channel, 0 ); |
170 | 170 | ||
171 | // do we have a prism header? | 171 | // update graph window |
172 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); | 172 | if ( ds ) |
173 | if ( ds && prism ) | 173 | { |
174 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | 174 | OPrismHeaderPacket* prism = static_cast<OPrismHeaderPacket*>( p->child( "Prism" ) ); |
175 | 175 | if ( prism ) | |
176 | graphwindow->traffic( ds->channel(), prism->signalStrength() ); | ||
177 | else | ||
178 | graphwindow->traffic( ds->channel(), 95 ); | ||
179 | } | ||
176 | return; | 180 | return; |
177 | } | 181 | } |
178 | 182 | ||
179 | // check for a data frame | 183 | // check for a data frame |
180 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); | 184 | OWaveLanDataPacket* data = static_cast<OWaveLanDataPacket*>( p->child( "802.11 Data" ) ); |
181 | if ( data ) | 185 | if ( data ) |
182 | { | 186 | { |
183 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); | 187 | OWaveLanPacket* wlan = (OWaveLanPacket*) p->child( "802.11" ); |
184 | if ( wlan->fromDS() && !wlan->toDS() ) | 188 | if ( wlan->fromDS() && !wlan->toDS() ) |
185 | { | 189 | { |
186 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", | 190 | qDebug( "FromDS traffic: '%s' -> '%s' via '%s'", |
187 | (const char*) wlan->macAddress3().toString(true), | 191 | (const char*) wlan->macAddress3().toString(true), |
188 | (const char*) wlan->macAddress1().toString(true), | 192 | (const char*) wlan->macAddress1().toString(true), |
189 | (const char*) wlan->macAddress2().toString(true) ); | 193 | (const char*) wlan->macAddress2().toString(true) ); |
190 | netView()->fromDStraffic( wlan->macAddress3().toString(), | 194 | netView()->fromDStraffic( wlan->macAddress3().toString(), |
191 | wlan->macAddress1().toString(), | 195 | wlan->macAddress1().toString(), |
192 | wlan->macAddress2().toString() ); | 196 | wlan->macAddress2().toString() ); |
193 | } | 197 | } |
194 | else | 198 | else |
195 | if ( !wlan->fromDS() && wlan->toDS() ) | 199 | if ( !wlan->fromDS() && wlan->toDS() ) |
196 | { | 200 | { |
197 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", | 201 | qDebug( "ToDS traffic: '%s' -> '%s' via '%s'", |
198 | (const char*) wlan->macAddress2().toString(true), | 202 | (const char*) wlan->macAddress2().toString(true), |
199 | (const char*) wlan->macAddress3().toString(true), | 203 | (const char*) wlan->macAddress3().toString(true), |
200 | (const char*) wlan->macAddress1().toString(true) ); | 204 | (const char*) wlan->macAddress1().toString(true) ); |
201 | netView()->toDStraffic( wlan->macAddress2().toString(), | 205 | netView()->toDStraffic( wlan->macAddress2().toString(), |
202 | wlan->macAddress3().toString(), | 206 | wlan->macAddress3().toString(), |
203 | wlan->macAddress1().toString() ); | 207 | wlan->macAddress1().toString() ); |
204 | } | 208 | } |
205 | else | 209 | else |
206 | if ( wlan->fromDS() && wlan->toDS() ) | 210 | if ( wlan->fromDS() && wlan->toDS() ) |
207 | { | 211 | { |
208 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", | 212 | qDebug( "WDS(bridge) traffic: '%s' -> '%s' via '%s' and '%s'", |
209 | (const char*) wlan->macAddress4().toString(true), | 213 | (const char*) wlan->macAddress4().toString(true), |
210 | (const char*) wlan->macAddress3().toString(true), | 214 | (const char*) wlan->macAddress3().toString(true), |
211 | (const char*) wlan->macAddress1().toString(true), | 215 | (const char*) wlan->macAddress1().toString(true), |
212 | (const char*) wlan->macAddress2().toString(true) ); | 216 | (const char*) wlan->macAddress2().toString(true) ); |
213 | netView()->WDStraffic( wlan->macAddress4().toString(), | 217 | netView()->WDStraffic( wlan->macAddress4().toString(), |
214 | wlan->macAddress3().toString(), | 218 | wlan->macAddress3().toString(), |
215 | wlan->macAddress1().toString(), | 219 | wlan->macAddress1().toString(), |
216 | wlan->macAddress2().toString() ); | 220 | wlan->macAddress2().toString() ); |
217 | } | 221 | } |
218 | else | 222 | else |
219 | { | 223 | { |
220 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", | 224 | qDebug( "IBSS(AdHoc) traffic: '%s' -> '%s' (Cell: '%s')'", |
221 | (const char*) wlan->macAddress2().toString(true), | 225 | (const char*) wlan->macAddress2().toString(true), |
222 | (const char*) wlan->macAddress1().toString(true), | 226 | (const char*) wlan->macAddress1().toString(true), |
223 | (const char*) wlan->macAddress3().toString(true) ); | 227 | (const char*) wlan->macAddress3().toString(true) ); |
224 | netView()->IBSStraffic( wlan->macAddress2().toString(), | 228 | netView()->IBSStraffic( wlan->macAddress2().toString(), |
225 | wlan->macAddress1().toString(), | 229 | wlan->macAddress1().toString(), |
226 | wlan->macAddress3().toString() ); | 230 | wlan->macAddress3().toString() ); |
227 | } | 231 | } |
228 | return; | 232 | return; |
229 | } | 233 | } |
230 | } | 234 | } |
231 | 235 | ||
232 | 236 | ||
233 | void Wellenreiter::stopClicked() | 237 | void Wellenreiter::stopClicked() |
234 | { | 238 | { |
235 | if ( iface ) | 239 | if ( iface ) |
236 | { | 240 | { |
237 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 241 | disconnect( SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
238 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 242 | disconnect( SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
239 | iface->setChannelHopping(); // stop hopping channels | 243 | iface->setChannelHopping(); // stop hopping channels |
240 | } | 244 | } |
241 | else | 245 | else |
242 | killTimers(); | 246 | killTimers(); |
243 | 247 | ||
244 | pcap->close(); | 248 | pcap->close(); |
245 | sniffing = false; | 249 | sniffing = false; |
246 | 250 | ||
247 | if ( iface ) | 251 | if ( iface ) |
248 | { | 252 | { |
249 | // switch off monitor mode | 253 | // switch off monitor mode |
250 | iface->setMonitorMode( false ); | 254 | iface->setMonitorMode( false ); |
251 | // switch off promisc flag | 255 | // switch off promisc flag |
252 | iface->setPromiscuousMode( false ); | 256 | iface->setPromiscuousMode( false ); |
253 | 257 | ||
254 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess | 258 | system( "cardctl reset; sleep 1" ); //FIXME: Use OProcess |
255 | } | 259 | } |
256 | 260 | ||
257 | logwindow->log( "(i) Stopped Scanning." ); | 261 | logwindow->log( "(i) Stopped Scanning." ); |
258 | assert( parent() ); | 262 | assert( parent() ); |
259 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); | 263 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II" ); |
260 | 264 | ||
261 | // message the user | 265 | // message the user |
262 | QMessageBox::information( this, "Wellenreiter II", "Your wireless card\nshould now be usable again." ); | 266 | QMessageBox::information( this, "Wellenreiter II", |
267 | tr( "Your wireless card\nshould now be usable again." ) ); | ||
263 | 268 | ||
264 | sniffing = false; | 269 | sniffing = false; |
265 | emit( stoppedSniffing() ); | 270 | emit( stoppedSniffing() ); |
266 | 271 | ||
267 | // print out statistics | 272 | // print out statistics |
268 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) | 273 | for( QMap<QString,int>::ConstIterator it = pcap->statistics().begin(); it != pcap->statistics().end(); ++it ) |
269 | statwindow->updateCounter( it.key(), it.data() ); | 274 | statwindow->updateCounter( it.key(), it.data() ); |
270 | } | 275 | } |
271 | 276 | ||
272 | 277 | ||
273 | void Wellenreiter::startClicked() | 278 | void Wellenreiter::startClicked() |
274 | { | 279 | { |
275 | // get configuration from config window | 280 | // get configuration from config window |
276 | 281 | ||
277 | const QString& interface = configwindow->interfaceName->currentText(); | 282 | const QString& interface = configwindow->interfaceName->currentText(); |
278 | const int cardtype = configwindow->daemonDeviceType(); | 283 | const int cardtype = configwindow->daemonDeviceType(); |
279 | const int interval = configwindow->daemonHopInterval(); | 284 | const int interval = configwindow->daemonHopInterval(); |
280 | 285 | ||
281 | if ( ( interface == "" ) || ( cardtype == 0 ) ) | 286 | if ( ( interface == "" ) || ( cardtype == 0 ) ) |
282 | { | 287 | { |
283 | QMessageBox::information( this, "Wellenreiter II", "Your device is not\nproperly configured. Please reconfigure!" ); | 288 | QMessageBox::information( this, "Wellenreiter II", |
289 | tr( "Your device is not\nproperly configured. Please reconfigure!" ) ); | ||
284 | return; | 290 | return; |
285 | } | 291 | } |
286 | 292 | ||
287 | // configure device | 293 | // configure device |
288 | 294 | ||
289 | ONetwork* net = ONetwork::instance(); | 295 | ONetwork* net = ONetwork::instance(); |
290 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); | 296 | iface = static_cast<OWirelessNetworkInterface*>(net->interface( interface )); |
291 | 297 | ||
292 | // set monitor mode | 298 | // set monitor mode |
293 | 299 | ||
294 | switch ( cardtype ) | 300 | switch ( cardtype ) |
295 | { | 301 | { |
296 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; | 302 | case DEVTYPE_CISCO: iface->setMonitoring( new OCiscoMonitoringInterface( iface ) ); break; |
297 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; | 303 | case DEVTYPE_WLAN_NG: iface->setMonitoring( new OWlanNGMonitoringInterface( iface ) ); break; |
298 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; | 304 | case DEVTYPE_HOSTAP: iface->setMonitoring( new OHostAPMonitoringInterface( iface ) ); break; |
299 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; | 305 | case DEVTYPE_ORINOCO: iface->setMonitoring( new OOrinocoMonitoringInterface( iface ) ); break; |
300 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", "Bring your device into\nmonitor mode now." ); break; | 306 | case DEVTYPE_MANUAL: QMessageBox::information( this, "Wellenreiter II", tr( "Bring your device into\nmonitor mode now." ) ); break; |
301 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; | 307 | case DEVTYPE_FILE: qDebug( "Wellenreiter: Capturing from file '%s'", (const char*) interface ); break; |
302 | default: assert( 0 ); // shouldn't reach this | 308 | default: assert( 0 ); // shouldn't reach this |
303 | } | 309 | } |
304 | 310 | ||
305 | // switch device into monitor mode | 311 | // switch device into monitor mode |
306 | if ( cardtype < DEVTYPE_FILE ) | 312 | if ( cardtype < DEVTYPE_FILE ) |
307 | { | 313 | { |
308 | if ( cardtype != DEVTYPE_MANUAL ) | 314 | if ( cardtype != DEVTYPE_MANUAL ) |
309 | iface->setMonitorMode( true ); | 315 | iface->setMonitorMode( true ); |
310 | if ( !iface->monitorMode() ) | 316 | if ( !iface->monitorMode() ) |
311 | { | 317 | { |
312 | QMessageBox::warning( this, "Wellenreiter II", "Can't set device into monitor mode." ); | 318 | QMessageBox::warning( this, "Wellenreiter II", |
319 | tr( "Can't set device into monitor mode." ) ); | ||
313 | return; | 320 | return; |
314 | } | 321 | } |
315 | } | 322 | } |
316 | 323 | ||
317 | // open pcap and start sniffing | 324 | // open pcap and start sniffing |
318 | if ( cardtype != DEVTYPE_FILE ) | 325 | if ( cardtype != DEVTYPE_FILE ) |
319 | { | 326 | { |
320 | if ( configwindow->writeCaptureFile->isEnabled() ) | 327 | if ( configwindow->writeCaptureFile->isEnabled() ) //FIXME: bug!? |
321 | { | 328 | { |
322 | QString dumpname( configwindow->captureFileName->text() ); | 329 | QString dumpname( configwindow->captureFileName->text() ); |
323 | dumpname.append( '-' ); | 330 | dumpname.append( '-' ); |
324 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); | 331 | dumpname.append( QTime::currentTime().toString().replace( QRegExp( ":" ), "-" ) ); |
325 | dumpname.append( ".wellenreiter" ); | 332 | dumpname.append( ".wellenreiter" ); |
326 | pcap->open( interface, dumpname ); | 333 | pcap->open( interface, dumpname ); |
327 | } | 334 | } |
328 | else | 335 | else |
329 | { | 336 | { |
330 | pcap->open( interface ); | 337 | pcap->open( interface ); |
331 | } | 338 | } |
332 | } | 339 | } |
333 | else | 340 | else |
334 | { | 341 | { |
335 | pcap->open( QFile( interface ) ); | 342 | pcap->open( QFile( interface ) ); |
336 | } | 343 | } |
337 | 344 | ||
338 | if ( !pcap->isOpen() ) | 345 | if ( !pcap->isOpen() ) |
339 | { | 346 | { |
340 | QMessageBox::warning( this, "Wellenreiter II", "Can't open packet capturer:\n" + QString(strerror( errno ) )); | 347 | QMessageBox::warning( this, "Wellenreiter II", |
348 | tr( "Can't open packet capturer:\n" ) + QString(strerror( errno ) )); | ||
341 | return; | 349 | return; |
342 | } | 350 | } |
343 | 351 | ||
344 | // set capturer to non-blocking mode | 352 | // set capturer to non-blocking mode |
345 | pcap->setBlocking( false ); | 353 | pcap->setBlocking( false ); |
346 | 354 | ||
347 | // start channel hopper | 355 | // start channel hopper |
348 | if ( cardtype != DEVTYPE_FILE ) | 356 | if ( cardtype != DEVTYPE_FILE ) |
349 | iface->setChannelHopping( 1000 ); //use interval from config window | 357 | iface->setChannelHopping( 1000 ); //use interval from config window |
350 | 358 | ||
351 | if ( cardtype != DEVTYPE_FILE ) | 359 | if ( cardtype != DEVTYPE_FILE ) |
352 | { | 360 | { |
353 | // connect socket notifier and start channel hopper | 361 | // connect socket notifier and start channel hopper |
354 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | 362 | connect( pcap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); |
355 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); | 363 | connect( iface->channelHopper(), SIGNAL( hopped(int) ), this, SLOT( channelHopped(int) ) ); |
356 | } | 364 | } |
357 | else | 365 | else |
358 | { | 366 | { |
359 | // start timer for reading packets | 367 | // start timer for reading packets |
360 | startTimer( 100 ); | 368 | startTimer( 100 ); |
361 | } | 369 | } |
362 | 370 | ||
363 | logwindow->log( "(i) Started Scanning." ); | 371 | logwindow->log( "(i) Started Scanning." ); |
364 | sniffing = true; | 372 | sniffing = true; |
365 | emit( startedSniffing() ); | 373 | emit( startedSniffing() ); |
366 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title | 374 | if ( cardtype != DEVTYPE_FILE ) channelHopped( 6 ); // set title |
367 | else | 375 | else |
368 | { | 376 | { |
369 | assert( parent() ); | 377 | assert( parent() ); |
370 | ( (QMainWindow*) parent() )->setCaption( "Wellenreiter II - replaying capture file..." ); | 378 | ( (QMainWindow*) parent() )->setCaption( tr( "Wellenreiter II - replaying capture file..." ) ); |
371 | } | 379 | } |
372 | } | 380 | } |
373 | 381 | ||
374 | 382 | ||
375 | void Wellenreiter::timerEvent( QTimerEvent* ) | 383 | void Wellenreiter::timerEvent( QTimerEvent* ) |
376 | { | 384 | { |
377 | qDebug( "Wellenreiter::timerEvent()" ); | 385 | qDebug( "Wellenreiter::timerEvent()" ); |
378 | OPacket* p = pcap->next(); | 386 | OPacket* p = pcap->next(); |
379 | if ( !p ) // no more packets available | 387 | if ( !p ) // no more packets available |
380 | { | 388 | { |
381 | stopClicked(); | 389 | stopClicked(); |
382 | } | 390 | } |
383 | else | 391 | else |
384 | { | 392 | { |
385 | receivePacket( p ); | 393 | receivePacket( p ); |
386 | delete p; | 394 | delete p; |
387 | } | 395 | } |
388 | } | 396 | } |
389 | 397 | ||
diff --git a/noncore/net/wellenreiter/wellenreiter.pro b/noncore/net/wellenreiter/wellenreiter.pro index eb60c4a..7085c5a 100644 --- a/noncore/net/wellenreiter/wellenreiter.pro +++ b/noncore/net/wellenreiter/wellenreiter.pro | |||
@@ -1,14 +1,32 @@ | |||
1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
2 | 2 | ||
3 | !contains( platform, x11 ) { | 3 | !contains( platform, x11 ) { |
4 | message( Configuring Wellenreiter for build on Opie ) | 4 | message( Configuring Wellenreiter for build on Opie ) |
5 | SUBDIRS = gui | 5 | SUBDIRS = gui |
6 | include ( $(OPIEDIR)/include.pro ) | 6 | include ( $(OPIEDIR)/include.pro ) |
7 | } | 7 | } |
8 | 8 | ||
9 | contains( platform, x11 ) { | 9 | contains( platform, x11 ) { |
10 | message( Configuring Wellenreiter for build on Qt/X11 ) | 10 | message( Configuring Wellenreiter for build on Qt/X11 ) |
11 | SUBDIRS = lib gui | 11 | SUBDIRS = lib gui |
12 | system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics ) | 12 | system( mkdir -p $OPIEDIR/lib $OPIEDIR/bin $OPIEDIR/share/pics ) |
13 | } | 13 | } |
14 | 14 | ||
15 | TRANSLATIONS = ../../../i18n/de/wellenreiter.ts \ | ||
16 | ../../../i18n/nl/wellenreiter.ts \ | ||
17 | ../../../i18n/da/wellenreiter.ts \ | ||
18 | ../../../i18n/xx/wellenreiter.ts \ | ||
19 | ../../../i18n/en/wellenreiter.ts \ | ||
20 | ../../../i18n/es/wellenreiter.ts \ | ||
21 | ../../../i18n/fr/wellenreiter.ts \ | ||
22 | ../../../i18n/hu/wellenreiter.ts \ | ||
23 | ../../../i18n/ja/wellenreiter.ts \ | ||
24 | ../../../i18n/ko/wellenreiter.ts \ | ||
25 | ../../../i18n/no/wellenreiter.ts \ | ||
26 | ../../../i18n/pl/wellenreiter.ts \ | ||
27 | ../../../i18n/pt/wellenreiter.ts \ | ||
28 | ../../../i18n/pt_BR/wellenreiter.ts \ | ||
29 | ../../../i18n/sl/wellenreiter.ts \ | ||
30 | ../../../i18n/zh_CN/wellenreiter.ts \ | ||
31 | ../../../i18n/zh_TW/wellenreiter.ts | ||
32 | |||