Diffstat (limited to 'noncore/net/wellenreiter/gui/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
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 | |||
@@ -34,66 +34,66 @@ | |||
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 | } |