Diffstat (limited to 'noncore/settings/sysinfo/processinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index 4ecb704..225da63 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp | |||
@@ -25,8 +25,5 @@ | |||
25 | #include <qdir.h> | 25 | #include <qdir.h> |
26 | #include <qmessagebox.h> | ||
27 | |||
28 | #include <sys/types.h> | ||
29 | #include <signal.h> | ||
30 | 26 | ||
31 | #include "processinfo.h" | 27 | #include "processinfo.h" |
28 | #include "processdetail.h" | ||
32 | 29 | ||
@@ -35,3 +32,3 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) | |||
35 | { | 32 | { |
36 | QVBoxLayout *vb = new QVBoxLayout( this, 5 ); | 33 | QVBoxLayout *layout = new QVBoxLayout( this, 5 ); |
37 | 34 | ||
@@ -41,5 +38,3 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) | |||
41 | colnum = ProcessView->addColumn( tr( "Command" ),96 ); | 38 | colnum = ProcessView->addColumn( tr( "Command" ),96 ); |
42 | ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); | ||
43 | colnum = ProcessView->addColumn( tr( "Status" ) ); | 39 | colnum = ProcessView->addColumn( tr( "Status" ) ); |
44 | ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); | ||
45 | colnum = ProcessView->addColumn( tr( "Time" ) ); | 40 | colnum = ProcessView->addColumn( tr( "Time" ) ); |
@@ -49,3 +44,3 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) | |||
49 | 44 | ||
50 | vb->addWidget( ProcessView ); | 45 | layout->addWidget( ProcessView ); |
51 | 46 | ||
@@ -121,19 +116,22 @@ void ProcessInfo::viewProcess(QListViewItem *process) | |||
121 | { | 116 | { |
122 | QString pid= process->text(0); | 117 | QString pid= process->text(0).stripWhiteSpace(); |
123 | QString command = process->text(1); | 118 | QString command = process->text(1); |
124 | switch( QMessageBox::information( this, (tr("Kill Process?")), | 119 | ProcessDetail *processdtl = new ProcessDetail( this, 0, TRUE, 0); |
125 | (tr("You really want to kill\n"+command+" PID: "+pid+"?")), | 120 | processdtl->setCaption( pid + " - " + command ); |
126 | (tr("Yes")), (tr("No")), 0 )){ | 121 | processdtl->pid = pid.toUInt(); |
127 | case 0: // Yes clicked, | 122 | processdtl->ProcessView->setTextFormat( RichText ); |
123 | FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); | ||
124 | if ( statfile ) | ||
125 | { | ||
126 | char line[81]; | ||
127 | fgets( line, 81, statfile ); | ||
128 | processdtl->ProcessView->setText( line ); | ||
129 | while ( fgets( line, 81, statfile ) ) | ||
128 | { | 130 | { |
129 | bool ok; | 131 | processdtl->ProcessView->append( line ); |
130 | pid_t child=pid.toInt(&ok,10); | 132 | } |
131 | if((kill(child,SIGKILL)) < 0) | 133 | fclose( statfile ); |
132 | perror("kill:SIGKILL"); | 134 | } |
133 | } | 135 | |
134 | break; | 136 | processdtl->showMaximized(); |
135 | case 1: // Cancel | ||
136 | break; | ||
137 | }; | ||
138 | //printf("Double click for PID: %s\n", process->text(0).stripWhiteSpace().latin1()); | ||
139 | } | 137 | } |