author | mickeyl <mickeyl> | 2003-05-08 13:37:06 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-05-08 13:37:06 (UTC) |
commit | 78c60031b506b85dc20bd555d83486aeb831bf38 (patch) (unidiff) | |
tree | 8bd0af604c911309162560fcac7bc2dcd9855d51 /noncore/net/wellenreiter/gui/main.cpp | |
parent | 08f9d5965b127b0b889b96cf16b7d34b5a9a6928 (diff) | |
download | opie-78c60031b506b85dc20bd555d83486aeb831bf38.zip opie-78c60031b506b85dc20bd555d83486aeb831bf38.tar.gz opie-78c60031b506b85dc20bd555d83486aeb831bf38.tar.bz2 |
- add more sanity checks and verbose error messages
- try to restart dhcp client after having killed it before
Diffstat (limited to 'noncore/net/wellenreiter/gui/main.cpp') (more/less context) (ignore 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 | |||
@@ -46,6 +46,7 @@ int main( int argc, char **argv ) | |||
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 | ||
@@ -65,6 +66,8 @@ int main( int argc, char **argv ) | |||
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 ); |
@@ -89,11 +92,23 @@ int main( int argc, char **argv ) | |||
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 | } |