summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp16
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp16
2 files changed, 30 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 7abad69..3d127a8 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -87,43 +87,57 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
87} 87}
88 88
89ModulesInfo::~ModulesInfo() 89ModulesInfo::~ModulesInfo()
90{ 90{
91} 91}
92 92
93void ModulesInfo::updateData() 93void ModulesInfo::updateData()
94{ 94{
95 char modname[64]; 95 char modname[64];
96 char usage[200]; 96 char usage[200];
97 int modsize, usecount; 97 int modsize, usecount;
98 98
99 QString selectedmod;
100 QListViewItem *curritem = ModulesView->currentItem();
101 if ( curritem )
102 {
103 selectedmod = curritem->text( 0 );
104 }
105
99 ModulesView->clear(); 106 ModulesView->clear();
100 107
101 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 108 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
102 109
103 if ( procfile ) 110 if ( procfile )
104 { 111 {
112 QListViewItem *newitem;
113 QListViewItem *selecteditem = 0x0;
105 while ( true ) { 114 while ( true ) {
106 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 115 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
107 116
108 if ( success == EOF ) 117 if ( success == EOF )
109 break; 118 break;
110 119
111 QString qmodname = QString( modname ); 120 QString qmodname = QString( modname );
112 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 121 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
113 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 122 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
114 QString qusage = QString( usage ); 123 QString qusage = QString( usage );
115 124
116 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 125 newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
126 if ( qmodname == selectedmod )
127 {
128 selecteditem = newitem;
129 }
117 } 130 }
131 ModulesView->setCurrentItem( selecteditem );
118 132
119 fclose( procfile ); 133 fclose( procfile );
120 } 134 }
121} 135}
122 136
123void ModulesInfo::slotSendClicked() 137void ModulesInfo::slotSendClicked()
124{ 138{
125 if ( !ModulesView->currentItem() ) 139 if ( !ModulesView->currentItem() )
126 { 140 {
127 return; 141 return;
128 } 142 }
129 143
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 769410f..2232771 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -92,26 +92,35 @@ ProcessInfo::~ProcessInfo()
92{ 92{
93} 93}
94 94
95void ProcessInfo::updateData() 95void ProcessInfo::updateData()
96{ 96{
97 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 97 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
98 signal, blocked, sigignore, sigcatch; 98 signal, blocked, sigignore, sigcatch;
99 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 99 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
100 endcode, startstack, kstkesp, kstkeip, wchan; 100 endcode, startstack, kstkesp, kstkeip, wchan;
101 char state; 101 char state;
102 char comm[64]; 102 char comm[64];
103 103
104 QString selectedpid;
105 QListViewItem *curritem = ProcessView->currentItem();
106 if ( curritem )
107 {
108 selectedpid = curritem->text( 0 );
109 }
110
104 ProcessView->clear(); 111 ProcessView->clear();
105 112
113 QListViewItem *newitem;
114 QListViewItem *selecteditem = 0x0;
106 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); 115 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
107 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 116 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
108 if ( proclist ) 117 if ( proclist )
109 { 118 {
110 QFileInfoListIterator it(*proclist); 119 QFileInfoListIterator it(*proclist);
111 QFileInfo *f; 120 QFileInfo *f;
112 while ( ( f = it.current() ) != 0 ) 121 while ( ( f = it.current() ) != 0 )
113 { 122 {
114 ++it; 123 ++it;
115 QString processnum = f->fileName(); 124 QString processnum = f->fileName();
116 if ( processnum >= "1" && processnum <= "99999" ) 125 if ( processnum >= "1" && processnum <= "99999" )
117 { 126 {
@@ -123,28 +132,33 @@ void ProcessInfo::updateData()
123 "%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", 132 "%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",
124 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, 133 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
125 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, 134 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
126 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, 135 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
127 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); 136 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
128 processnum = processnum.rightJustify( 5, ' ' ); 137 processnum = processnum.rightJustify( 5, ' ' );
129 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); 138 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
130 QString processstatus = QChar(state); 139 QString processstatus = QChar(state);
131 QString processtime = QString::number( ( utime + stime ) / 100 ); 140 QString processtime = QString::number( ( utime + stime ) / 100 );
132 processtime = processtime.rightJustify( 9, ' ' ); 141 processtime = processtime.rightJustify( 9, ' ' );
133 fclose( procfile ); 142 fclose( procfile );
134 143
135 ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); 144 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
145 if ( processnum == selectedpid )
146 {
147 selecteditem = newitem;
148 }
136 } 149 }
137 } 150 }
138 } 151 }
152 ProcessView->setCurrentItem( selecteditem );
139 } 153 }
140 154
141 delete proclist; 155 delete proclist;
142 delete procdir; 156 delete procdir;
143} 157}
144 158
145void ProcessInfo::slotSendClicked() 159void ProcessInfo::slotSendClicked()
146{ 160{
147 QListViewItem *currprocess = ProcessView->currentItem(); 161 QListViewItem *currprocess = ProcessView->currentItem();
148 if ( !currprocess ) 162 if ( !currprocess )
149 { 163 {
150 return; 164 return;