summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/processinfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/processinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index af0fe26..2a90b0f 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -8,38 +8,41 @@
8** http://draknor.net 8** http://draknor.net
9** 9**
10** This file may be distributed and/or modified under the terms of the 10** This file may be distributed and/or modified under the terms of the
11** GNU General Public License version 2 as published by the Free Software 11** GNU General Public License version 2 as published by the Free Software
12** Foundation and appearing in the file LICENSE.GPL included in the 12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file. 13** packaging of this file.
14** 14**
15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 15** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 16** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17** 17**
18**********************************************************************/ 18**********************************************************************/
19 19
20#include "processinfo.h"
21#include "detail.h"
22
23/* OPIE */
20#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
21 25
26/* QT */
22#include <qdir.h> 27#include <qdir.h>
23#include <qlayout.h> 28#include <qlayout.h>
24#include <qmessagebox.h> 29#include <qmessagebox.h>
25#include <qtimer.h> 30#include <qtimer.h>
26#include <qwhatsthis.h> 31#include <qwhatsthis.h>
27 32
33/* STD */
28#include <sys/types.h> 34#include <sys/types.h>
29#include <signal.h> 35#include <signal.h>
30 36
31#include "processinfo.h"
32#include "detail.h"
33
34ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
35 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, fl )
36{ 39{
37 QGridLayout *layout = new QGridLayout( this ); 40 QGridLayout *layout = new QGridLayout( this );
38 layout->setSpacing( 4 ); 41 layout->setSpacing( 4 );
39 layout->setMargin( 4 ); 42 layout->setMargin( 4 );
40 43
41 44
42 ProcessView = new QListView( this, "ProcessView" ); 45 ProcessView = new QListView( this, "ProcessView" );
43 int colnum = ProcessView->addColumn( tr( "PID" ) ); 46 int colnum = ProcessView->addColumn( tr( "PID" ) );
44 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
45 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 48 colnum = ProcessView->addColumn( tr( "Command" ),96 );
@@ -77,26 +80,25 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
77 80
78 QTimer *t = new QTimer( this ); 81 QTimer *t = new QTimer( this );
79 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
80 t->start( 5000 ); 83 t->start( 5000 );
81 84
82 updateData(); 85 updateData();
83 86
84 ProcessDtl = new Detail(); 87 ProcessDtl = new Detail();
85 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." ) );
86} 89}
87 90
88ProcessInfo::~ProcessInfo() 91ProcessInfo::~ProcessInfo()
89{ 92{}
90}
91 93
92void ProcessInfo::updateData() 94void ProcessInfo::updateData()
93{ 95{
94 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 96 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
95 signal, blocked, sigignore, sigcatch; 97 signal, blocked, sigignore, sigcatch;
96 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 98 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
97 endcode, startstack, kstkesp, kstkeip, wchan; 99 endcode, startstack, kstkesp, kstkeip, wchan;
98 char state; 100 char state;
99 char comm[64]; 101 char comm[64];
100 102
101 QString selectedpid; 103 QString selectedpid;
102 QListViewItem *curritem = ProcessView->currentItem(); 104 QListViewItem *curritem = ProcessView->currentItem();
@@ -187,14 +189,14 @@ void ProcessInfo::viewProcess( QListViewItem *process )
187 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 189 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
188 if ( statfile ) 190 if ( statfile )
189 { 191 {
190 char line[81]; 192 char line[81];
191 fgets( line, 81, statfile ); 193 fgets( line, 81, statfile );
192 ProcessDtl->detailView->setText( line ); 194 ProcessDtl->detailView->setText( line );
193 while ( fgets( line, 81, statfile ) ) 195 while ( fgets( line, 81, statfile ) )
194 { 196 {
195 ProcessDtl->detailView->append( line ); 197 ProcessDtl->detailView->append( line );
196 } 198 }
197 fclose( statfile ); 199 fclose( statfile );
198 } 200 }
199 ProcessDtl->showMaximized(); 201 QPEApplication::showWidget( ProcessDtl );
200} 202}