author | mickeyl <mickeyl> | 2003-12-06 16:17:57 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-06 16:17:57 (UTC) |
commit | efb9bf44691e6555a45f0a45f570eb56f1b180d3 (patch) (side-by-side diff) | |
tree | 457464227c5dd82044cc4f3ecddb249766b01bd8 | |
parent | 72336536db05459e3802b3be5032e55607985d0c (diff) | |
download | opie-efb9bf44691e6555a45f0a45f570eb56f1b180d3.zip opie-efb9bf44691e6555a45f0a45f570eb56f1b180d3.tar.gz opie-efb9bf44691e6555a45f0a45f570eb56f1b180d3.tar.bz2 |
\n
-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 2 |
1 files changed, 1 insertions, 1 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 @@ -71,133 +71,133 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); SendButton = new QPushButton( this, "SendButton" ); SendButton->setMinimumSize( QSize( 50, 24 ) ); SendButton->setMaximumSize( QSize( 50, 24 ) ); SendButton->setText( tr( "Send" ) ); connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); layout->addWidget( SendButton, 1, 1 ); QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); QTimer *t = new QTimer( this ); connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); t->start( 5000 ); updateData(); ProcessDtl = new Detail(); QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); } ProcessInfo::~ProcessInfo() { } void ProcessInfo::updateData() { int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, signal, blocked, sigignore, sigcatch; uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, endcode, startstack, kstkesp, kstkeip, wchan; char state; char comm[64]; QString selectedpid; QListViewItem *curritem = ProcessView->currentItem(); if ( curritem ) { selectedpid = curritem->text( 0 ); } ProcessView->clear(); QListViewItem *newitem; QListViewItem *selecteditem = 0x0; QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); if ( proclist ) { QFileInfoListIterator it(*proclist); QFileInfo *f; while ( ( f = it.current() ) != 0 ) { ++it; QString processnum = f->fileName(); if ( processnum >= "1" && processnum <= "99999" ) { FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); if ( procfile ) { fscanf( procfile, "%d %s %c %d %d %d %d %d %u %u %u %u %u %d %d %d %d %d %d %u %u %d %u %u %u %u %u %u %u %u %d %d %d %d %u", &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); processnum = processnum.rightJustify( 5, ' ' ); QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); QString processstatus = QChar(state); QString processtime = QString::number( ( utime + stime ) / 100 ); processtime = processtime.rightJustify( 9, ' ' ); fclose( procfile ); newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); if ( processnum == selectedpid ) { selecteditem = newitem; } } } } ProcessView->setCurrentItem( selecteditem ); } delete proclist; delete procdir; } void ProcessInfo::slotSendClicked() { QListViewItem *currprocess = ProcessView->currentItem(); if ( !currprocess ) { return; } - QString capstr = tr( "You really want to send %1 to this process?" ).arg( SignalCB->currentText() ); + QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() ); if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { currprocess = ProcessView->currentItem(); if ( currprocess ) { QString sigstr = SignalCB->currentText(); sigstr.truncate(2); int sigid = sigstr.toUInt(); kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ); } } } void ProcessInfo::viewProcess( QListViewItem *process ) { QString pid= process->text( 0 ).stripWhiteSpace(); QString command = process->text( 1 ); ProcessDtl->setCaption( pid + " - " + command ); FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); if ( statfile ) { char line[81]; fgets( line, 81, statfile ); ProcessDtl->detailView->setText( line ); while ( fgets( line, 81, statfile ) ) { ProcessDtl->detailView->append( line ); } fclose( statfile ); } ProcessDtl->showMaximized(); } |