summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 8dec9be..709158d 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -27,65 +27,65 @@
27#include <qmessagebox.h> 27#include <qmessagebox.h>
28#include <qtimer.h> 28#include <qtimer.h>
29#include <qwhatsthis.h> 29#include <qwhatsthis.h>
30 30
31#include <sys/types.h> 31#include <sys/types.h>
32#include <signal.h> 32#include <signal.h>
33 33
34#include "processinfo.h" 34#include "processinfo.h"
35#include "detail.h" 35#include "detail.h"
36 36
37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
38 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, fl )
39{ 39{
40 QGridLayout *layout = new QGridLayout( this ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 ); 41 layout->setSpacing( 4 );
42 layout->setMargin( 4 ); 42 layout->setMargin( 4 );
43 43
44 44
45 ProcessView = new QListView( this, "ProcessView" ); 45 ProcessView = new QListView( this, "ProcessView" );
46 int colnum = ProcessView->addColumn( tr( "PID" ) ); 46 int colnum = ProcessView->addColumn( tr( "PID" ) );
47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 48 colnum = ProcessView->addColumn( tr( "Command" ),96 );
49 colnum = ProcessView->addColumn( tr( "Status" ) ); 49 colnum = ProcessView->addColumn( tr( "Status" ) );
50 colnum = ProcessView->addColumn( tr( "Time" ) ); 50 colnum = ProcessView->addColumn( tr( "Time" ) );
51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
52 ProcessView->setAllColumnsShowFocus( TRUE ); 52 ProcessView->setAllColumnsShowFocus( TRUE );
53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
54 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 54 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
55 this, SLOT( viewProcess( QListViewItem * ) ) ); 55 this, SLOT( viewProcess( QListViewItem * ) ) );
56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
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." ) ); 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 58
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 59 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" ); 60 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" ); 61 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" ); 62 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" ); 63 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" ); 64 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" ); 65 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" ); 66 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" ); 67 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" ); 68 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" ); 69 SignalCB->insertItem( "19: SIGSTOP" );
70 layout->addWidget( SignalCB, 1, 0 ); 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." ) ); 71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
72 72
73 SendButton = new QPushButton( this, "SendButton" ); 73 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) ); 74 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) ); 75 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) ); 76 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 ); 78 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); 79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
80 80
81 QTimer *t = new QTimer( this ); 81 QTimer *t = new QTimer( this );
82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
83 t->start( 5000 ); 83 t->start( 5000 );
84 84
85 updateData(); 85 updateData();
86 86
87 ProcessDtl = new Detail(); 87 ProcessDtl = new Detail();
88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); 88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
89} 89}
90 90
91ProcessInfo::~ProcessInfo() 91ProcessInfo::~ProcessInfo()
@@ -135,65 +135,65 @@ void ProcessInfo::updateData()
135 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, 135 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
136 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); 136 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
137 processnum = processnum.rightJustify( 5, ' ' ); 137 processnum = processnum.rightJustify( 5, ' ' );
138 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); 138 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
139 QString processstatus = QChar(state); 139 QString processstatus = QChar(state);
140 QString processtime = QString::number( ( utime + stime ) / 100 ); 140 QString processtime = QString::number( ( utime + stime ) / 100 );
141 processtime = processtime.rightJustify( 9, ' ' ); 141 processtime = processtime.rightJustify( 9, ' ' );
142 fclose( procfile ); 142 fclose( procfile );
143 143
144 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); 144 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
145 if ( processnum == selectedpid ) 145 if ( processnum == selectedpid )
146 { 146 {
147 selecteditem = newitem; 147 selecteditem = newitem;
148 } 148 }
149 } 149 }
150 } 150 }
151 } 151 }
152 ProcessView->setCurrentItem( selecteditem ); 152 ProcessView->setCurrentItem( selecteditem );
153 } 153 }
154 154
155 delete proclist; 155 delete proclist;
156 delete procdir; 156 delete procdir;
157} 157}
158 158
159void ProcessInfo::slotSendClicked() 159void ProcessInfo::slotSendClicked()
160{ 160{
161 QListViewItem *currprocess = ProcessView->currentItem(); 161 QListViewItem *currprocess = ProcessView->currentItem();
162 if ( !currprocess ) 162 if ( !currprocess )
163 { 163 {
164 return; 164 return;
165 } 165 }
166 166
167 QString capstr = tr( "You really want to send %1 to this process?" ).arg( SignalCB->currentText() ); 167 QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() );
168 168
169 169
170 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, 170 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
171 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 171 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
172 { 172 {
173 currprocess = ProcessView->currentItem(); 173 currprocess = ProcessView->currentItem();
174 if ( currprocess ) 174 if ( currprocess )
175 { 175 {
176 QString sigstr = SignalCB->currentText(); 176 QString sigstr = SignalCB->currentText();
177 sigstr.truncate(2); 177 sigstr.truncate(2);
178 int sigid = sigstr.toUInt(); 178 int sigid = sigstr.toUInt();
179 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ); 179 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid );
180 } 180 }
181 } 181 }
182 182
183} 183}
184 184
185void ProcessInfo::viewProcess( QListViewItem *process ) 185void ProcessInfo::viewProcess( QListViewItem *process )
186{ 186{
187 QString pid= process->text( 0 ).stripWhiteSpace(); 187 QString pid= process->text( 0 ).stripWhiteSpace();
188 QString command = process->text( 1 ); 188 QString command = process->text( 1 );
189 ProcessDtl->setCaption( pid + " - " + command ); 189 ProcessDtl->setCaption( pid + " - " + command );
190 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 190 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
191 if ( statfile ) 191 if ( statfile )
192 { 192 {
193 char line[81]; 193 char line[81];
194 fgets( line, 81, statfile ); 194 fgets( line, 81, statfile );
195 ProcessDtl->detailView->setText( line ); 195 ProcessDtl->detailView->setText( line );
196 while ( fgets( line, 81, statfile ) ) 196 while ( fgets( line, 81, statfile ) )
197 { 197 {
198 ProcessDtl->detailView->append( line ); 198 ProcessDtl->detailView->append( line );
199 } 199 }