summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/processinfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/processinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp65
1 files changed, 58 insertions, 7 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 86133a9..35d7ba1 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -26,2 +26,3 @@
26#include <qlistview.h> 26#include <qlistview.h>
27#include <qmessagebox.h>
27#include <qtimer.h> 28#include <qtimer.h>
@@ -29,3 +30,7 @@
29 30
31#include <sys/types.h>
32#include <signal.h>
33
30#include "processinfo.h" 34#include "processinfo.h"
35#include "detail.h"
31 36
@@ -34,3 +39,6 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
34{ 39{
35 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 );
42 layout->setMargin( 4 );
43
36 44
@@ -47,4 +55,26 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
47 this, SLOT( viewProcess( QListViewItem * ) ) ); 55 this, SLOT( viewProcess( QListViewItem * ) ) );
48 layout->addWidget( ProcessView ); 56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
49 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); 57 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) );
58
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" );
70 layout->addWidget( SignalCB, 1, 0 );
71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
72
73 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
50 80
@@ -56,4 +86,4 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
56 86
57 ProcessDtl = new ProcessDetail( 0, 0, 0 ); 87 ProcessDtl = new Detail();
58 ProcessDtl->ProcessView->setTextFormat( RichText ); 88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
59} 89}
@@ -114,2 +144,24 @@ void ProcessInfo::updateData()
114 144
145void ProcessInfo::slotSendClicked()
146{
147 QString capstr = tr( "You really want to send\n" );
148 capstr.append( SignalCB->currentText() );
149 capstr.append( "\nto this process?" );
150
151 QListViewItem *currprocess = ProcessView->currentItem();
152
153 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
154 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
155 {
156 QString sigstr = SignalCB->currentText();
157 sigstr.truncate(2);
158 int sigid = sigstr.toUInt();
159 if ( kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ) == 0 )
160 {
161 hide();
162 }
163 }
164
165}
166
115void ProcessInfo::viewProcess( QListViewItem *process ) 167void ProcessInfo::viewProcess( QListViewItem *process )
@@ -119,3 +171,2 @@ void ProcessInfo::viewProcess( QListViewItem *process )
119 ProcessDtl->setCaption( pid + " - " + command ); 171 ProcessDtl->setCaption( pid + " - " + command );
120 ProcessDtl->pid = pid.toUInt();
121 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 172 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
@@ -125,6 +176,6 @@ void ProcessInfo::viewProcess( QListViewItem *process )
125 fgets( line, 81, statfile ); 176 fgets( line, 81, statfile );
126 ProcessDtl->ProcessView->setText( line ); 177 ProcessDtl->detailView->setText( line );
127 while ( fgets( line, 81, statfile ) ) 178 while ( fgets( line, 81, statfile ) )
128 { 179 {
129 ProcessDtl->ProcessView->append( line ); 180 ProcessDtl->detailView->append( line );
130 } 181 }