summaryrefslogtreecommitdiff
authordrw <drw>2003-02-06 02:15:59 (UTC)
committer drw <drw>2003-02-06 02:15:59 (UTC)
commit51f39143a14b10b971670ad3a204af35be2564bb (patch) (unidiff)
tree72b9e104f25449f014d877f467f34fd3dba12443
parent79588befde53765db0a92977c6890a4d226096e7 (diff)
downloadopie-51f39143a14b10b971670ad3a204af35be2564bb.zip
opie-51f39143a14b10b971670ad3a204af35be2564bb.tar.gz
opie-51f39143a14b10b971670ad3a204af35be2564bb.tar.bz2
Fix to keep current selection for modules & processes. Would lose selection when lists were updated.
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
@@ -97,4 +97,11 @@ void ModulesInfo::updateData()
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
@@ -103,4 +110,6 @@ void ModulesInfo::updateData()
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 );
@@ -114,6 +123,11 @@ void ModulesInfo::updateData()
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 );
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
@@ -102,6 +102,15 @@ void ProcessInfo::updateData()
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()));
@@ -133,8 +142,13 @@ void ProcessInfo::updateData()
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