Diffstat (limited to 'noncore/net/wellenreiter/gui/main.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/gui/main.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/noncore/net/wellenreiter/gui/main.cpp b/noncore/net/wellenreiter/gui/main.cpp index 96ebb3f..55a5260 100644 --- a/noncore/net/wellenreiter/gui/main.cpp +++ b/noncore/net/wellenreiter/gui/main.cpp | |||
@@ -43,12 +43,13 @@ int main( int argc, char **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->setCaption( "Wellenreiter II" ); | ||
49 | w->show(); | 50 | w->show(); |
50 | #endif | 51 | #endif |
51 | 52 | ||
52 | a.processEvents(); // show the window before doing the safety checks | 53 | a.processEvents(); // show the window before doing the safety checks |
53 | int result = -1; | 54 | int result = -1; |
54 | 55 | ||
@@ -62,12 +63,14 @@ int main( int argc, char **argv ) | |||
62 | if ( result == QMessageBox::No ) return -1; | 63 | if ( result == QMessageBox::No ) return -1; |
63 | } | 64 | } |
64 | 65 | ||
65 | // dhcp check - NOT HERE! This really belongs as a static member to OProcess | 66 | // 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& ) ) ... | 67 | // and I want to call it like that: if ( OProcess::isRunning( QString& ) ) ... |
67 | 68 | ||
69 | static int killed = false; | ||
70 | |||
68 | QString line; | 71 | QString line; |
69 | QDir d = QDir( "/proc" ); | 72 | QDir d = QDir( "/proc" ); |
70 | QStringList dirs = d.entryList( QDir::Dirs ); | 73 | QStringList dirs = d.entryList( QDir::Dirs ); |
71 | QStringList::Iterator it; | 74 | QStringList::Iterator it; |
72 | for ( it = dirs.begin(); it != dirs.end(); ++it ) | 75 | for ( it = dirs.begin(); it != dirs.end(); ++it ) |
73 | { | 76 | { |
@@ -86,14 +89,26 @@ int main( int argc, char **argv ) | |||
86 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "You have a dhcp client running.\n" | 89 | 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?" ), | 90 | "This can severly limit scanning!\nShould I kill it for you?" ), |
88 | QMessageBox::Yes, QMessageBox::No ); | 91 | QMessageBox::Yes, QMessageBox::No ); |
89 | if ( result == QMessageBox::Yes ) | 92 | if ( result == QMessageBox::Yes ) |
90 | { | 93 | { |
91 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) | 94 | if ( -1 == ::kill( (*it).toInt(), SIGTERM ) ) |
92 | qWarning( "Wellenreiter: can't kill process (%s)", result, strerror( errno ) ); | 95 | qWarning( "Wellenreiter: can't kill process #%d (%s)", result, strerror( errno ) ); |
96 | else | ||
97 | killed = true; | ||
93 | } | 98 | } |
94 | } | 99 | } |
95 | 100 | ||
96 | a.exec(); | 101 | a.exec(); |
102 | |||
103 | if ( killed ) | ||
104 | { | ||
105 | result = QMessageBox::warning( w, " - Wellenreiter II - (dhcp)", QObject::tr( "Restart your dhcp client?" ), QMessageBox::Yes, QMessageBox::No ); | ||
106 | if ( result == QMessageBox::Yes ) | ||
107 | { | ||
108 | system( QString().sprintf( "dhclient &; udhcpcd &; dhcpcd &" ) ); | ||
109 | } | ||
110 | } | ||
111 | |||
97 | delete w; | 112 | delete w; |
98 | return 0; | 113 | return 0; |
99 | } | 114 | } |