author | drw <drw> | 2003-02-01 02:15:18 (UTC) |
---|---|---|
committer | drw <drw> | 2003-02-01 02:15:18 (UTC) |
commit | 953cb6d9cb9da2829db8364bcfb4ff8af0b0ae26 (patch) (side-by-side diff) | |
tree | 12bf039826f1d2106d446677f1bedd28d77e227b | |
parent | 766f09a89eef17808e77836f76371aab8ebc4c1c (diff) | |
download | opie-953cb6d9cb9da2829db8364bcfb4ff8af0b0ae26.zip opie-953cb6d9cb9da2829db8364bcfb4ff8af0b0ae26.tar.gz opie-953cb6d9cb9da2829db8364bcfb4ff8af0b0ae26.tar.bz2 |
Fix display problem after killing a process
-rw-r--r-- | noncore/settings/sysinfo/processinfo.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp index 9a5446a..769410f 100644 --- a/noncore/settings/sysinfo/processinfo.cpp +++ b/noncore/settings/sysinfo/processinfo.cpp @@ -68,123 +68,120 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) SignalCB->insertItem( "18: SIGCONT" ); SignalCB->insertItem( "19: SIGSTOP" ); layout->addWidget( SignalCB, 1, 0 ); 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]; ProcessView->clear(); 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 ); ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); } } } } delete proclist; delete procdir; } void ProcessInfo::slotSendClicked() { QListViewItem *currprocess = ProcessView->currentItem(); if ( !currprocess ) { return; } QString capstr = tr( "You really want to send\n" ); capstr.append( SignalCB->currentText() ); capstr.append( "\nto this process?" ); if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { QString sigstr = SignalCB->currentText(); sigstr.truncate(2); int sigid = sigstr.toUInt(); - if ( kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ) == 0 ) - { - hide(); - } + 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(); } |