summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/load.cpp2
-rw-r--r--noncore/settings/sysinfo/memory.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesdetail.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp83
-rw-r--r--noncore/settings/sysinfo/modulesinfo.h14
-rw-r--r--noncore/settings/sysinfo/processdetail.cpp2
-rw-r--r--noncore/settings/sysinfo/storage.cpp28
-rw-r--r--noncore/settings/sysinfo/storage.h2
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro2
10 files changed, 80 insertions, 59 deletions
diff --git a/noncore/settings/sysinfo/load.cpp b/noncore/settings/sysinfo/load.cpp
index 900b3d3..d9d7a66 100644
--- a/noncore/settings/sysinfo/load.cpp
+++ b/noncore/settings/sysinfo/load.cpp
@@ -3,210 +3,210 @@
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <stdio.h> 21#include <stdio.h>
22 22
23#include <qfile.h> 23#include <qfile.h>
24#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qpainter.h> 26#include <qpainter.h>
27#include <qpixmap.h> 27#include <qpixmap.h>
28#include <qtextstream.h> 28#include <qtextstream.h>
29#include <qtimer.h> 29#include <qtimer.h>
30#include <qwhatsthis.h> 30#include <qwhatsthis.h>
31 31
32#include "load.h" 32#include "load.h"
33 33
34LoadInfo::LoadInfo( QWidget *parent, const char *name, WFlags f ) 34LoadInfo::LoadInfo( QWidget *parent, const char *name, WFlags f )
35 : QWidget( parent, name, f ) 35 : QWidget( parent, name, f )
36{ 36{
37 QVBoxLayout *vb = new QVBoxLayout( this, 6 ); 37 QVBoxLayout *vb = new QVBoxLayout( this, 6 );
38 38
39 QString cpuInfo = getCpuInfo(); 39 QString cpuInfo = getCpuInfo();
40 if ( !cpuInfo.isNull() ) 40 if ( !cpuInfo.isNull() )
41 vb->addWidget( new QLabel( cpuInfo, this ) ); 41 vb->addWidget( new QLabel( cpuInfo, this ) );
42 vb->addWidget( new Load( this ), 100 ); 42 vb->addWidget( new Load( this ), 100 );
43 QLabel *l = new QLabel( this ); 43 QLabel *l = new QLabel( this );
44 l->setPixmap( makeLabel( red, tr("Application CPU usage (%)") ) ); 44 l->setPixmap( makeLabel( red, tr("Application CPU usage (%)") ) );
45 vb->addWidget( l, 1 ); 45 vb->addWidget( l, 1 );
46 l = new QLabel( this ); 46 l = new QLabel( this );
47 l->setPixmap( makeLabel( green, tr("System CPU usage (%)") ) ); 47 l->setPixmap( makeLabel( green, tr("System CPU usage (%)") ) );
48 vb->addWidget( l, 1 ); 48 vb->addWidget( l, 1 );
49 vb->addStretch(50); 49 vb->addStretch(50);
50 50
51 QWhatsThis::add( this, tr( "This page shows how much this device's processor is being used." ) ); 51 QWhatsThis::add( this, tr( "This page shows how much this device's processor is being used." ) );
52} 52}
53 53
54QPixmap LoadInfo::makeLabel( const QColor &col, const QString &text ) 54QPixmap LoadInfo::makeLabel( const QColor &col, const QString &text )
55{ 55{
56 int h = fontMetrics().height(); 56 int h = fontMetrics().height();
57 QPixmap pm( 20 + fontMetrics().width( text ), h ); 57 QPixmap pm( 20 + fontMetrics().width( text ), h );
58 QPainter p( &pm ); 58 QPainter p( &pm );
59 p.fillRect( pm.rect(), colorGroup().background() ); 59 p.fillRect( pm.rect(), colorGroup().background() );
60 p.fillRect( 0, h/2-4, 18, h/2+3, black ); 60 p.fillRect( 0, h/2-4, 18, h/2+3, black );
61 p.setPen( col ); 61 p.setPen( col );
62 p.drawLine( 2, h/2, 15, h/2 ); 62 p.drawLine( 2, h/2, 15, h/2 );
63 p.setPen( colorGroup().text() ); 63 p.setPen( colorGroup().text() );
64 p.drawText( 20, fontMetrics().ascent(), text ); 64 p.drawText( 20, fontMetrics().ascent(), text );
65 65
66 return pm; 66 return pm;
67} 67}
68 68
69QString LoadInfo::getCpuInfo() 69QString LoadInfo::getCpuInfo()
70{ 70{
71 bool haveInfo = FALSE; 71 bool haveInfo = FALSE;
72 QString info = tr("Type: "); 72 QString info = tr("Type: ");
73 QFile f( "/proc/cpuinfo" ); 73 QFile f( "/proc/cpuinfo" );
74 if ( f.open( IO_ReadOnly ) ) { 74 if ( f.open( IO_ReadOnly ) ) {
75 QTextStream ts( &f ); 75 QTextStream ts( &f );
76 76
77 while ( !ts.atEnd() ) { 77 while ( !ts.atEnd() ) {
78 QString s = ts.readLine(); 78 QString s = ts.readLine();
79 if ( s.find( "model name" ) == 0 ) { 79 if ( s.find( "model name" ) == 0 ) {
80 info += s.mid( s.find( ':' ) + 2 ); 80 info += s.mid( s.find( ':' ) + 2 );
81 haveInfo = TRUE; 81 haveInfo = TRUE;
82 } else if ( s.find( "cpu MHz" ) == 0 ) { 82 } else if ( s.find( "cpu MHz" ) == 0 ) {
83 double mhz = s.mid( s.find( ':' ) + 2 ).toDouble(); 83 double mhz = s.mid( s.find( ':' ) + 2 ).toDouble();
84 info += " " + QString::number( mhz, 'f', 0 ); 84 info += " " + QString::number( mhz, 'f', 0 );
85 info += "MHz"; 85 info += "MHz";
86 break; 86 break;
87 } else if ( s.find( "Processor" ) == 0 ) { 87 } else if ( s.find( "Processor" ) == 0 ) {
88 info += s.mid( s.find( ':' ) + 2 ); 88 info += s.mid( s.find( ':' ) + 2 );
89 haveInfo = TRUE; 89 haveInfo = TRUE;
90 break; 90 break;
91#ifdef __MIPSEL__ 91#ifdef __MIPSEL__
92 } else if ( s.find( "cpu model" ) == 0 ) { 92 } else if ( s.find( "cpu model" ) == 0 ) {
93 info += " " + s.mid( s.find( ':' ) + 2 ); 93 info += " " + s.mid( s.find( ':' ) + 2 );
94 break; 94 break;
95 } else if ( s.find( "cpu" ) == 0 ) { 95 } else if ( s.find( "cpu" ) == 0 ) {
96 info += s.mid( s.find( ':' ) + 2 ); 96 info += s.mid( s.find( ':' ) + 2 );
97 haveInfo = TRUE; 97 haveInfo = TRUE;
98#endif 98#endif
99 } 99 }
100 } 100 }
101 } 101 }
102 102
103 if ( !haveInfo ) 103 if ( !haveInfo )
104 info = QString(); 104 info = QString();
105 105
106 return info; 106 return info;
107} 107}
108 108
109Load::Load( QWidget *parent, const char *name, WFlags f ) 109Load::Load( QWidget *parent, const char *name, WFlags f )
110 : QWidget( parent, name, f ) 110 : QWidget( parent, name, f )
111{ 111{
112 setMinimumHeight( 30 ); 112 setMinimumHeight( 30 );
113 setBackgroundColor( black ); 113 setBackgroundColor( black );
114 points = 100; 114 points = 100;
115 setMinimumWidth( points ); 115 setMinimumWidth( points );
116 userLoad = new double [points]; 116 userLoad = new double [points];
117 systemLoad = new double [points]; 117 systemLoad = new double [points];
118 for ( int i = 0; i < points; i++ ) { 118 for ( int i = 0; i < points; i++ ) {
119 userLoad[i] = 0.0; 119 userLoad[i] = 0.0;
120 systemLoad[i] = 0.0; 120 systemLoad[i] = 0.0;
121 } 121 }
122 maxLoad = 1.3; 122 maxLoad = 1.3;
123 QTimer *timer = new QTimer( this ); 123 QTimer *timer = new QTimer( this );
124 connect( timer, SIGNAL(timeout()), SLOT(timeout()) ); 124 connect( timer, SIGNAL(timeout()), SLOT(timeout()) );
125 timer->start( 2000 ); 125 timer->start( 2000 );
126 gettimeofday( &last, 0 ); 126 gettimeofday( &last, 0 );
127 first = TRUE; 127 first = TRUE;
128 timeout(); 128 timeout();
129} 129}
130 130
131void Load::paintEvent( QPaintEvent *ev ) 131void Load::paintEvent( QPaintEvent * )
132{ 132{
133 QPainter p( this ); 133 QPainter p( this );
134 134
135 int h = height() - 5; 135 int h = height() - 5;
136 136
137 int mult = (int)(h / maxLoad); 137 int mult = (int)(h / maxLoad);
138 138
139 p.setPen( gray ); 139 p.setPen( gray );
140 p.drawLine( 0, h - mult, width(), h - mult ); 140 p.drawLine( 0, h - mult, width(), h - mult );
141 p.drawText( 0, h - mult, "100" ); 141 p.drawText( 0, h - mult, "100" );
142 p.drawText( 0, h, "0" ); 142 p.drawText( 0, h, "0" );
143 143
144 p.setPen( green ); 144 p.setPen( green );
145 for ( int i = 1; i < points; i++ ) { 145 for ( int i = 1; i < points; i++ ) {
146 int x1 = (i - 1) * width() / points; 146 int x1 = (i - 1) * width() / points;
147 int x2 = i * width() / points; 147 int x2 = i * width() / points;
148 p.drawLine( x1, h - systemLoad[i-1] * mult, 148 p.drawLine( x1, h - systemLoad[i-1] * mult,
149 x2, h - systemLoad[i] * mult ); 149 x2, h - systemLoad[i] * mult );
150 } 150 }
151 151
152 p.setPen( red ); 152 p.setPen( red );
153 for ( int i = 1; i < points; i++ ) { 153 for ( int i = 1; i < points; i++ ) {
154 int x1 = (i - 1) * width() / points; 154 int x1 = (i - 1) * width() / points;
155 int x2 = i * width() / points; 155 int x2 = i * width() / points;
156 p.drawLine( x1, h - userLoad[i-1] * mult, 156 p.drawLine( x1, h - userLoad[i-1] * mult,
157 x2, h - userLoad[i] * mult ); 157 x2, h - userLoad[i] * mult );
158 } 158 }
159} 159}
160 160
161void Load::timeout() 161void Load::timeout()
162{ 162{
163 int user; 163 int user;
164 int usernice; 164 int usernice;
165 int sys; 165 int sys;
166 int idle; 166 int idle;
167 FILE *fp; 167 FILE *fp;
168 fp = fopen( "/proc/stat", "r" ); 168 fp = fopen( "/proc/stat", "r" );
169 fscanf( fp, "cpu %d %d %d %d", &user, &usernice, &sys, &idle ); 169 fscanf( fp, "cpu %d %d %d %d", &user, &usernice, &sys, &idle );
170 fclose( fp ); 170 fclose( fp );
171 struct timeval now; 171 struct timeval now;
172 gettimeofday( &now, 0 ); 172 gettimeofday( &now, 0 );
173 int tdiff = now.tv_usec - last.tv_usec; 173 int tdiff = now.tv_usec - last.tv_usec;
174 tdiff += (now.tv_sec - last.tv_sec) * 1000000; 174 tdiff += (now.tv_sec - last.tv_sec) * 1000000;
175 tdiff /= 10000; 175 tdiff /= 10000;
176 176
177 int udiff = user - lastUser; 177 int udiff = user - lastUser;
178 int sdiff = sys - lastSys; 178 int sdiff = sys - lastSys;
179 if ( tdiff > 0 ) { 179 if ( tdiff > 0 ) {
180 double uload = (double)udiff / (double)tdiff; 180 double uload = (double)udiff / (double)tdiff;
181 double sload = (double)sdiff / (double)tdiff; 181 double sload = (double)sdiff / (double)tdiff;
182 if ( !first ) { 182 if ( !first ) {
183 for ( int i = 1; i < points; i++ ) { 183 for ( int i = 1; i < points; i++ ) {
184 userLoad[i-1] = userLoad[i]; 184 userLoad[i-1] = userLoad[i];
185 systemLoad[i-1] = systemLoad[i]; 185 systemLoad[i-1] = systemLoad[i];
186 } 186 }
187 userLoad[points-1] = uload; 187 userLoad[points-1] = uload;
188 systemLoad[points-1] = sload; 188 systemLoad[points-1] = sload;
189 // scroll( -width()/points, 0, QRect( 0, 0, width() - width()/points + 1, height() ) ); 189 // scroll( -width()/points, 0, QRect( 0, 0, width() - width()/points + 1, height() ) );
190 repaint( TRUE ); 190 repaint( TRUE );
191 double ml = 1.3; 191 double ml = 1.3;
192 /* 192 /*
193 for ( int i = 0; i < points; i++ ) { 193 for ( int i = 0; i < points; i++ ) {
194 if ( userLoad[i] > ml ) 194 if ( userLoad[i] > ml )
195 ml = userLoad[i]; 195 ml = userLoad[i];
196 } 196 }
197 */ 197 */
198 if ( maxLoad != ml ) { 198 if ( maxLoad != ml ) {
199 maxLoad = ml; 199 maxLoad = ml;
200 update(); 200 update();
201 } 201 }
202 } 202 }
203 203
204 last = now; 204 last = now;
205 lastUser = user; 205 lastUser = user;
206 lastSys = sys; 206 lastSys = sys;
207 first = FALSE; 207 first = FALSE;
208 } else if ( tdiff < 0 ) { 208 } else if ( tdiff < 0 ) {
209 last = now; 209 last = now;
210 } 210 }
211} 211}
212 212
diff --git a/noncore/settings/sysinfo/memory.cpp b/noncore/settings/sysinfo/memory.cpp
index 30d42d5..4f612d8 100644
--- a/noncore/settings/sysinfo/memory.cpp
+++ b/noncore/settings/sysinfo/memory.cpp
@@ -1,98 +1,98 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qfile.h> 22#include <qfile.h>
23#include <qlayout.h> 23#include <qlayout.h>
24#include <qtextstream.h> 24#include <qtextstream.h>
25#include <qtimer.h> 25#include <qtimer.h>
26#include <qwhatsthis.h> 26#include <qwhatsthis.h>
27 27
28#include "graph.h" 28#include "graph.h"
29#include "memory.h" 29#include "memory.h"
30 30
31MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f ) 31MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags )
32 : QWidget( parent, name, WStyle_ContextHelp ) 32 : QWidget( parent, name, WStyle_ContextHelp )
33{ 33{
34 QVBoxLayout *vb = new QVBoxLayout( this, 5 ); 34 QVBoxLayout *vb = new QVBoxLayout( this, 5 );
35 35
36 totalMem = new QLabel( this ); 36 totalMem = new QLabel( this );
37 vb->addWidget( totalMem ); 37 vb->addWidget( totalMem );
38 38
39 data = new GraphData(); 39 data = new GraphData();
40// graph = new PieGraph( this ); 40// graph = new PieGraph( this );
41 graph = new BarGraph( this ); 41 graph = new BarGraph( this );
42 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 42 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
43 vb->addWidget( graph, 1 ); 43 vb->addWidget( graph, 1 );
44 graph->setData( data ); 44 graph->setData( data );
45 45
46 legend = new GraphLegend( this ); 46 legend = new GraphLegend( this );
47 vb->addWidget( legend ); 47 vb->addWidget( legend );
48 legend->setData( data ); 48 legend->setData( data );
49 49
50 vb->addStretch( 1 ); 50 vb->addStretch( 1 );
51 updateData(); 51 updateData();
52 52
53 QTimer *t = new QTimer( this ); 53 QTimer *t = new QTimer( this );
54 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 54 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
55 t->start( 5000 ); 55 t->start( 5000 );
56 56
57 QWhatsThis::add( this, tr( "This page shows how memory (i.e. RAM) is being allocated on your handheld device.\nMemory is categorized as follows:\n\n1. Used - memory used to by Opie and any running applications.\n2. Buffers - temporary storage used to improve performance\n3. Cached - information that has recently been used, but has not been freed yet.\n4. Free - memory not currently used by Opie or any running applications." ) ); 57 QWhatsThis::add( this, tr( "This page shows how memory (i.e. RAM) is being allocated on your handheld device.\nMemory is categorized as follows:\n\n1. Used - memory used to by Opie and any running applications.\n2. Buffers - temporary storage used to improve performance\n3. Cached - information that has recently been used, but has not been freed yet.\n4. Free - memory not currently used by Opie or any running applications." ) );
58} 58}
59 59
60MemoryInfo::~MemoryInfo() 60MemoryInfo::~MemoryInfo()
61{ 61{
62 delete data; 62 delete data;
63} 63}
64 64
65void MemoryInfo::updateData() 65void MemoryInfo::updateData()
66{ 66{
67 QFile file( "/proc/meminfo" ); 67 QFile file( "/proc/meminfo" );
68 68
69 if ( file.open( IO_ReadOnly ) ) { 69 if ( file.open( IO_ReadOnly ) ) {
70 QTextStream t( &file ); 70 QTextStream t( &file );
71 QString dummy = t.readLine();// title 71 QString dummy = t.readLine();// title
72 t >> dummy; 72 t >> dummy;
73 int total, used, memfree, shared, buffers, cached; 73 int total, used, memfree, shared, buffers, cached;
74 t >> total; 74 t >> total;
75 total /= 1000; 75 total /= 1000;
76 t >> used; 76 t >> used;
77 used /= 1000; 77 used /= 1000;
78 t >> memfree; 78 t >> memfree;
79 memfree /= 1000; 79 memfree /= 1000;
80 t >> shared; 80 t >> shared;
81 shared /= 1000; 81 shared /= 1000;
82 t >> buffers; 82 t >> buffers;
83 buffers /= 1000; 83 buffers /= 1000;
84 t >> cached; 84 t >> cached;
85 cached /= 1000; 85 cached /= 1000;
86 int realUsed = total - ( buffers + cached + memfree ); 86 int realUsed = total - ( buffers + cached + memfree );
87 data->clear(); 87 data->clear();
88 data->addItem( tr("Used (%1 kB)").arg(realUsed), realUsed ); 88 data->addItem( tr("Used (%1 kB)").arg(realUsed), realUsed );
89 data->addItem( tr("Buffers (%1 kB)").arg(buffers), buffers ); 89 data->addItem( tr("Buffers (%1 kB)").arg(buffers), buffers );
90 data->addItem( tr("Cached (%1 kB)").arg(cached), cached ); 90 data->addItem( tr("Cached (%1 kB)").arg(cached), cached );
91 data->addItem( tr("Free (%1 kB)").arg(memfree), memfree ); 91 data->addItem( tr("Free (%1 kB)").arg(memfree), memfree );
92 totalMem->setText( tr( "Total Memory: %1 kB" ).arg( total ) ); 92 totalMem->setText( tr( "Total Memory: %1 kB" ).arg( total ) );
93 graph->repaint( FALSE ); 93 graph->repaint( FALSE );
94 legend->update(); 94 legend->update();
95 } 95 }
96} 96}
97 97
98 98
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp
index ea5f352..ea9cdfa 100644
--- a/noncore/settings/sysinfo/modulesdetail.cpp
+++ b/noncore/settings/sysinfo/modulesdetail.cpp
@@ -1,89 +1,89 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesDetail 2** ModulesDetail
3** 3**
4** Display module information 4** Display module information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org> 10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include "modulesdetail.h" 22#include "modulesdetail.h"
23 23
24#include <sys/types.h> 24#include <sys/types.h>
25#include <stdio.h> 25#include <stdio.h>
26 26
27#include <qcombobox.h> 27#include <qcombobox.h>
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qlistview.h> 29#include <qlistview.h>
30#include <qmessagebox.h> 30#include <qmessagebox.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qtextview.h> 32#include <qtextview.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34 34
35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl ) 35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags )
36 : QWidget( parent, name, WStyle_ContextHelp ) 36 : QWidget( parent, name, WStyle_ContextHelp )
37{ 37{
38 modname = ""; 38 modname = "";
39 39
40 QGridLayout *layout = new QGridLayout( this ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 ); 41 layout->setSpacing( 4 );
42 layout->setMargin( 4 ); 42 layout->setMargin( 4 );
43 43
44 CommandCB = new QComboBox( FALSE, this, "CommandCB" ); 44 CommandCB = new QComboBox( FALSE, this, "CommandCB" );
45 CommandCB->insertItem( "modprobe -r" ); 45 CommandCB->insertItem( "modprobe -r" );
46 CommandCB->insertItem( "rmmod" ); 46 CommandCB->insertItem( "rmmod" );
47 // I can't think of other useful commands yet. Anyone? 47 // I can't think of other useful commands yet. Anyone?
48 layout->addWidget( CommandCB, 1, 0 ); 48 layout->addWidget( CommandCB, 1, 0 );
49 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command." ) ); 49 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command." ) );
50 50
51 ModulesView = new QTextView( this, "ModulesView" ); 51 ModulesView = new QTextView( this, "ModulesView" );
52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
53 QWhatsThis::add( ModulesView, tr( "This area shows detailed information about this module." ) ); 53 QWhatsThis::add( ModulesView, tr( "This area shows detailed information about this module." ) );
54 54
55 SendButton = new QPushButton( this, "SendButton" ); 55 SendButton = new QPushButton( this, "SendButton" );
56 SendButton->setMinimumSize( QSize( 50, 24 ) ); 56 SendButton->setMinimumSize( QSize( 50, 24 ) );
57 SendButton->setMaximumSize( QSize( 50, 24 ) ); 57 SendButton->setMaximumSize( QSize( 50, 24 ) );
58 SendButton->setText( tr( "Send" ) ); 58 SendButton->setText( tr( "Send" ) );
59 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 59 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
60 layout->addWidget( SendButton, 1, 1 ); 60 layout->addWidget( SendButton, 1, 1 );
61 QWhatsThis::add( SendButton, tr( "Click here to send the selected command to this module." ) ); 61 QWhatsThis::add( SendButton, tr( "Click here to send the selected command to this module." ) );
62} 62}
63 63
64ModulesDetail::~ModulesDetail() 64ModulesDetail::~ModulesDetail()
65{ 65{
66} 66}
67 67
68void ModulesDetail::slotSendClicked() 68void ModulesDetail::slotSendClicked()
69{ 69{
70 QString command = QString( "/sbin/" ) 70 QString command = QString( "/sbin/" )
71 + CommandCB->currentText() 71 + CommandCB->currentText()
72 + QString( " " ) + modname; 72 + QString( " " ) + modname;
73 73
74 if ( QMessageBox::warning( this, caption(), 74 if ( QMessageBox::warning( this, caption(),
75 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"), 75 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"),
76 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) 76 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
77 == QMessageBox::Yes ) 77 == QMessageBox::Yes )
78 { 78 {
79 FILE* stream = popen( command, "r" ); 79 FILE* stream = popen( command, "r" );
80 if ( stream ) 80 if ( stream )
81 pclose( stream ); 81 pclose( stream );
82 { 82 {
83 hide(); 83 hide();
84 } 84 }
85 } 85 }
86 86
87} 87}
88 88
89 89
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index a0d26c7..c558fad 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,122 +1,133 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesInfo 2** ModulesInfo
3** 3**
4** Display Modules information 4** Display Modules information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> 10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23 23
24#include <qcombobox.h>
24#include <qfile.h> 25#include <qfile.h>
25#include <qheader.h> 26#include <qheader.h>
26#include <qlayout.h> 27#include <qlayout.h>
27#include <qlistview.h> 28#include <qlistview.h>
29#include <qmessagebox.h>
30#include <qpushbutton.h>
31#include <qstring.h>
28#include <qtimer.h> 32#include <qtimer.h>
29#include <qwhatsthis.h> 33#include <qwhatsthis.h>
30 34
31#include "modulesinfo.h" 35#include "modulesinfo.h"
32 36
33ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 37ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
34 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, fl )
35{ 39{
36 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 );
42 layout->setMargin( 4 );
37 43
38 ModulesView = new QListView( this, "ModulesView" ); 44 ModulesView = new QListView( this );
39 int colnum = ModulesView->addColumn( tr( "Module" ) ); 45 int colnum = ModulesView->addColumn( tr( "Module" ) );
40 colnum = ModulesView->addColumn( tr( "Size" ) ); 46 colnum = ModulesView->addColumn( tr( "Size" ) );
41 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
42 colnum = ModulesView->addColumn( tr( "Use#" ) ); 48 colnum = ModulesView->addColumn( tr( "Use#" ) );
43 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 49 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
44 colnum = ModulesView->addColumn( tr( "Used By" ) ); 50 colnum = ModulesView->addColumn( tr( "Used By" ) );
45 ModulesView->setAllColumnsShowFocus( TRUE ); 51 ModulesView->setAllColumnsShowFocus( TRUE );
46 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
47 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
48 this, SLOT( viewModules( QListViewItem * ) ) );
49 layout->addWidget( ModulesView );
50 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); 53 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) );
51 54
55 CommandCB = new QComboBox( FALSE, this );
56 CommandCB->insertItem( "modprobe -r" );
57 CommandCB->insertItem( "rmmod" );
58 // I can't think of other useful commands yet. Anyone?
59 layout->addWidget( CommandCB, 1, 0 );
60 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) );
61
62 QPushButton *btn = new QPushButton( this );
63 btn->setMinimumSize( QSize( 50, 24 ) );
64 btn->setMaximumSize( QSize( 50, 24 ) );
65 btn->setText( tr( "Send" ) );
66 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
67 layout->addWidget( btn, 1, 1 );
68 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
69
52 QTimer *t = new QTimer( this ); 70 QTimer *t = new QTimer( this );
53 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 71 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
54 t->start( 5000 ); 72 t->start( 5000 );
55 73
56 updateData(); 74 updateData();
57
58 ModulesDtl = new ModulesDetail( 0, 0, 0 );
59 ModulesDtl->ModulesView->setTextFormat( PlainText );
60} 75}
61 76
62ModulesInfo::~ModulesInfo() 77ModulesInfo::~ModulesInfo()
63{ 78{
64} 79}
65 80
66void ModulesInfo::updateData() 81void ModulesInfo::updateData()
67{ 82{
68 char modname[64]; 83 char modname[64];
69 char usage[200]; 84 char usage[200];
70 int modsize, usecount; 85 int modsize, usecount;
71 86
72 ModulesView->clear(); 87 ModulesView->clear();
73 88
74 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 89 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
75 90
76 if ( procfile ) 91 if ( procfile )
77 { 92 {
78 while ( true ) { 93 while ( true ) {
79 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 94 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
80 95
81 if ( success == EOF ) 96 if ( success == EOF )
82 break; 97 break;
83 98
84 QString qmodname = QString( modname ); 99 QString qmodname = QString( modname );
85 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 100 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
86 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 101 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
87 QString qusage = QString( usage ); 102 QString qusage = QString( usage );
88 103
89 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 104 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
90 } 105 }
91 106
92 fclose( procfile ); 107 fclose( procfile );
93 } 108 }
94} 109}
95 110
96void ModulesInfo::viewModules( QListViewItem *modules ) 111void ModulesInfo::slotSendClicked()
97{ 112{
98 QString modname = modules->text( 0 ); 113 QString capstr = tr( "You really want to execute\n" );
99 ModulesDtl->setCaption( QString( "Module: " ) + modname ); 114 capstr.append( CommandCB->currentText() );
100 ModulesDtl->modname = modname; 115 capstr.append( "\nfor this module?" );
101 QString command = QString( "/sbin/modinfo " ) + modules->text( 0 ); 116
102 117 if ( QMessageBox::warning( this, caption(), capstr,
103 FILE* modinfo = popen( command, "r" ); 118 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
104
105 if ( modinfo )
106 { 119 {
107 char line[200]; 120 QString command = "/sbin/";
108 ModulesDtl->ModulesView->setText( " Details:\n------------\n" ); 121 command.append( CommandCB->currentText() );
109 122 command.append( " " );
110 while( true ) 123 command.append( ModulesView->currentItem()->text( 0 ) );
111 { 124
112 int success = fscanf( modinfo, "%[^\n]\n", line ); 125 FILE* stream = popen( command, "r" );
113 if ( success == EOF ) 126 if ( stream )
114 break; 127 pclose( stream );
115 ModulesDtl->ModulesView->append( line ); 128 //{
116 } 129 // hide();
117 130 //}
118 pclose( modinfo );
119 } 131 }
120 132
121 ModulesDtl->showMaximized();
122} 133}
diff --git a/noncore/settings/sysinfo/modulesinfo.h b/noncore/settings/sysinfo/modulesinfo.h
index c702f24..ef1f805 100644
--- a/noncore/settings/sysinfo/modulesinfo.h
+++ b/noncore/settings/sysinfo/modulesinfo.h
@@ -1,46 +1,46 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesInfo 2** ModulesInfo
3** 3**
4** Display modules information 4** Display modules information
5** 5**
6** Copyright (C) 2002, Michael Lauer 6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de 7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de 8** http://www.Vanille.de
9** 9**
10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org> 10** Based on ProcessInfo by Dan Williams <williamsdr@acm.org>
11** 11**
12** This file may be distributed and/or modified under the terms of the 12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software 13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the 14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file. 15** packaging of this file.
16** 16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef MODULESINFO_H 22#ifndef MODULESINFO_H
23#define MODULESINFO_H 23#define MODULESINFO_H
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qlistview.h>
27 26
28#include "modulesdetail.h" 27class QComboBox;
28class QListView;
29 29
30class ModulesInfo : public QWidget 30class ModulesInfo : public QWidget
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 34 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
35 ~ModulesInfo(); 35 ~ModulesInfo();
36 36
37private slots:
38 void updateData();
39 void viewModules( QListViewItem * );
40
41private: 37private:
42 QListView* ModulesView; 38 QListView* ModulesView;
43 ModulesDetail *ModulesDtl; 39 QComboBox* CommandCB;
40
41private slots:
42 void updateData();
43 void slotSendClicked();
44}; 44};
45 45
46#endif 46#endif
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp
index 661e32c..fcb871f 100644
--- a/noncore/settings/sysinfo/processdetail.cpp
+++ b/noncore/settings/sysinfo/processdetail.cpp
@@ -1,92 +1,92 @@
1/********************************************************************** 1/**********************************************************************
2** ProcessDetail 2** ProcessDetail
3** 3**
4** Display process information 4** Display process information
5** 5**
6** Copyright (C) 2002, Dan Williams 6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org 7** williamsdr@acm.org
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 "processdetail.h" 20#include "processdetail.h"
21 21
22#include <sys/types.h> 22#include <sys/types.h>
23#include <signal.h> 23#include <signal.h>
24 24
25#include <qcombobox.h> 25#include <qcombobox.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistview.h> 27#include <qlistview.h>
28#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qpushbutton.h> 29#include <qpushbutton.h>
30#include <qtextview.h> 30#include <qtextview.h>
31#include <qwhatsthis.h> 31#include <qwhatsthis.h>
32 32
33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl ) 33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags )
34 : QWidget( parent, name, WStyle_ContextHelp ) 34 : QWidget( parent, name, WStyle_ContextHelp )
35{ 35{
36 pid = 0; 36 pid = 0;
37 37
38 QGridLayout *layout = new QGridLayout( this ); 38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 ); 39 layout->setSpacing( 4 );
40 layout->setMargin( 4 ); 40 layout->setMargin( 4 );
41 41
42 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 42 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
43 SignalCB->insertItem( " 1: SIGHUP" ); 43 SignalCB->insertItem( " 1: SIGHUP" );
44 SignalCB->insertItem( " 2: SIGINT" ); 44 SignalCB->insertItem( " 2: SIGINT" );
45 SignalCB->insertItem( " 3: SIGQUIT" ); 45 SignalCB->insertItem( " 3: SIGQUIT" );
46 SignalCB->insertItem( " 5: SIGTRAP" ); 46 SignalCB->insertItem( " 5: SIGTRAP" );
47 SignalCB->insertItem( " 6: SIGABRT" ); 47 SignalCB->insertItem( " 6: SIGABRT" );
48 SignalCB->insertItem( " 9: SIGKILL" ); 48 SignalCB->insertItem( " 9: SIGKILL" );
49 SignalCB->insertItem( "14: SIGALRM" ); 49 SignalCB->insertItem( "14: SIGALRM" );
50 SignalCB->insertItem( "15: SIGTERM" ); 50 SignalCB->insertItem( "15: SIGTERM" );
51 SignalCB->insertItem( "18: SIGCONT" ); 51 SignalCB->insertItem( "18: SIGCONT" );
52 SignalCB->insertItem( "19: SIGSTOP" ); 52 SignalCB->insertItem( "19: SIGSTOP" );
53 layout->addWidget( SignalCB, 1, 0 ); 53 layout->addWidget( SignalCB, 1, 0 );
54 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); 54 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
55 55
56 ProcessView = new QTextView( this, "ProcessView" ); 56 ProcessView = new QTextView( this, "ProcessView" );
57 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 57 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
58 QWhatsThis::add( ProcessView, tr( "This area shows detailed information about this process." ) ); 58 QWhatsThis::add( ProcessView, tr( "This area shows detailed information about this process." ) );
59 59
60 SendButton = new QPushButton( this, "SendButton" ); 60 SendButton = new QPushButton( this, "SendButton" );
61 SendButton->setMinimumSize( QSize( 50, 24 ) ); 61 SendButton->setMinimumSize( QSize( 50, 24 ) );
62 SendButton->setMaximumSize( QSize( 50, 24 ) ); 62 SendButton->setMaximumSize( QSize( 50, 24 ) );
63 SendButton->setText( tr( "Send" ) ); 63 SendButton->setText( tr( "Send" ) );
64 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 64 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
65 layout->addWidget( SendButton, 1, 1 ); 65 layout->addWidget( SendButton, 1, 1 );
66 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); 66 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
67} 67}
68 68
69ProcessDetail::~ProcessDetail() 69ProcessDetail::~ProcessDetail()
70{ 70{
71} 71}
72 72
73void ProcessDetail::slotSendClicked() 73void ProcessDetail::slotSendClicked()
74{ 74{
75 QString sigstr = SignalCB->currentText(); 75 QString sigstr = SignalCB->currentText();
76 sigstr.truncate(2); 76 sigstr.truncate(2);
77 int sigid = sigstr.toUInt(); 77 int sigid = sigstr.toUInt();
78 78
79 if ( QMessageBox::warning( this, caption(), 79 if ( QMessageBox::warning( this, caption(),
80 tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"), 80 tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"),
81 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) 81 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
82 == QMessageBox::Yes ) 82 == QMessageBox::Yes )
83 { 83 {
84 if ( kill( pid, sigid ) == 0 ) 84 if ( kill( pid, sigid ) == 0 )
85 { 85 {
86 hide(); 86 hide();
87 } 87 }
88 } 88 }
89 89
90} 90}
91 91
92 92
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index c33663e..5d6cd1b 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -1,251 +1,261 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// additions copyright 2002 by L.J. Potter 20// additions copyright 2002 by L.J. Potter
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qscrollview.h>
23#include <qtimer.h> 24#include <qtimer.h>
24#include <qwhatsthis.h> 25#include <qwhatsthis.h>
25 26
26#include "graph.h" 27#include "graph.h"
27#include "storage.h" 28#include "storage.h"
28 29
29#include <stdio.h> 30#include <stdio.h>
30 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 31 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
31#include <sys/vfs.h> 32#include <sys/vfs.h>
32#include <mntent.h> 33#include <mntent.h>
33 #endif 34 #endif
34 35
35StorageInfo::StorageInfo( QWidget *parent, const char *name ) 36StorageInfo::StorageInfo( QWidget *parent, const char *name )
36 : QWidget( parent, name ) 37 : QWidget( parent, name )
37{ 38{
38 vb = 0; 39 QVBoxLayout *tmpvb = new QVBoxLayout( this );
39 disks.setAutoDelete(TRUE); 40 QScrollView *sv = new QScrollView( this );
41 tmpvb->addWidget( sv, 0, 0 );
42 sv->setResizePolicy( QScrollView::AutoOneFit );
43 sv->setFrameStyle( QFrame::NoFrame );
44 container = new QWidget( sv->viewport() );
45 sv->addChild( container );
46 vb = 0x0;
47
48 disks.setAutoDelete(TRUE);
40 lines.setAutoDelete(TRUE); 49 lines.setAutoDelete(TRUE);
41 updateMounts(); 50 updateMounts();
42 startTimer( 5000 ); 51 startTimer( 5000 );
43} 52}
44 53
45void StorageInfo::timerEvent(QTimerEvent*) 54void StorageInfo::timerEvent(QTimerEvent*)
46{ 55{
47 updateMounts(); 56 updateMounts();
48} 57}
49 58
50static bool isCF(const QString& m) 59static bool isCF(const QString& m)
51{ 60{
52 FILE* f = fopen("/var/run/stab", "r"); 61 FILE* f = fopen("/var/run/stab", "r");
53 if (!f) f = fopen("/var/state/pcmcia/stab", "r"); 62 if (!f) f = fopen("/var/state/pcmcia/stab", "r");
54 if (!f) f = fopen("/var/lib/pcmcia/stab", "r"); 63 if (!f) f = fopen("/var/lib/pcmcia/stab", "r");
55 if ( f ) { 64 if ( f ) {
56 char line[1024]; 65 char line[1024];
57 char devtype[80]; 66 char devtype[80];
58 char devname[80]; 67 char devname[80];
59 while ( fgets( line, 1024, f ) ) { 68 while ( fgets( line, 1024, f ) ) {
60 // 0 ide ide-cs 0 hda 3 0 69 // 0 ide ide-cs 0 hda 3 0
61 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) { 70 if ( sscanf(line,"%*d %s %*s %*s %s", devtype, devname )==2 ) {
62 if ( QString(devtype) == "ide" && m.find(devname)>0 ) { 71 if ( QString(devtype) == "ide" && m.find(devname)>0 ) {
63 fclose(f); 72 fclose(f);
64 return TRUE; 73 return TRUE;
65 } 74 }
66 } 75 }
67 } 76 }
68 fclose(f); 77 fclose(f);
69 } 78 }
70 return FALSE; 79 return FALSE;
71} 80}
72 81
73void StorageInfo::updateMounts() 82void StorageInfo::updateMounts()
74{ 83{
75#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 84#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
76 struct mntent *me; 85 struct mntent *me;
77 FILE *mntfp = setmntent( "/etc/mtab", "r" ); 86 FILE *mntfp = setmntent( "/etc/mtab", "r" );
78 QStringList curdisks; 87 QStringList curdisks;
79 QStringList curfs; 88 QStringList curfs;
80 QStringList mountList; 89 QStringList mountList;
81 QStringList fsT; 90 QStringList fsT;
82 bool rebuild = FALSE; 91 bool rebuild = FALSE;
83 int n=0; 92 int n=0;
84 if ( mntfp ) { 93 if ( mntfp ) {
85 while ( (me = getmntent( mntfp )) != 0 ) { 94 while ( (me = getmntent( mntfp )) != 0 ) {
86 QString fs = me->mnt_fsname; 95 QString fs = me->mnt_fsname;
87 qDebug(fs+" "+(QString)me->mnt_type);
88 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" 96 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
89 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" 97 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
90 || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { 98 || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs" || fs.left(5) == "tmpfs" ) {
91 n++; 99 n++;
92 curdisks.append(fs); 100 curdisks.append(fs);
93 QString d = me->mnt_dir; 101 QString d = me->mnt_dir;
94 curfs.append(d); 102 curfs.append(d);
95 QString mount = me->mnt_dir; 103 QString mount = me->mnt_dir;
96 mountList.append(mount); 104 mountList.append(mount);
97 QString t = me->mnt_type; 105 QString t = me->mnt_type;
98 fsT.append(t); 106 fsT.append(t);
99 if ( !disks.find(d) ) 107 if ( !disks.find(d) )
100 rebuild = TRUE; 108 rebuild = TRUE;
101 } 109 }
102 } 110 }
103 endmntent( mntfp ); 111 endmntent( mntfp );
104 } 112 }
105 if ( rebuild || n != (int)disks.count() ) { 113 if ( rebuild || n != (int)disks.count() ) {
106 disks.clear(); 114 disks.clear();
107 lines.clear(); 115 lines.clear();
108 delete vb; 116 delete vb;
109 vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); 117 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
110 bool frst=TRUE; 118 bool frst=TRUE;
111 QStringList::ConstIterator it=curdisks.begin(); 119 QStringList::ConstIterator it=curdisks.begin();
112 QStringList::ConstIterator fsit=curfs.begin(); 120 QStringList::ConstIterator fsit=curfs.begin();
113 QStringList::ConstIterator fsmount=mountList.begin(); 121 QStringList::ConstIterator fsmount=mountList.begin();
114 QStringList::ConstIterator fsTit=fsT.begin(); 122 QStringList::ConstIterator fsTit=fsT.begin();
115 123
116 for (; it!=curdisks.end(); ++it, ++fsit) { 124 for (; it!=curdisks.end(); ++it, ++fsit) {
117 if ( !frst ) { 125 if ( !frst ) {
118 QFrame *f = new QFrame( this ); 126 QFrame *f = new QFrame( container );
119 vb->addWidget(f); 127 vb->addWidget(f);
120 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 128 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
121 lines.append(f); 129 lines.append(f);
122 f->show(); 130 f->show();
123 } frst=FALSE; 131 } frst=FALSE;
124 QString humanname=*it; 132 QString humanname=*it;
125// qDebug(humanname);
126 if ( isCF(humanname) ) 133 if ( isCF(humanname) )
127 humanname = tr( "CF Card: " ); 134 humanname = tr( "CF Card: " );
128 else if ( humanname == "/dev/hda1" ) 135 else if ( humanname == "/dev/hda1" )
129 humanname = tr( "Hard Disk " ); 136 humanname = tr( "Hard Disk " );
130 else if ( humanname.left(9) == "/dev/mmcd" ) 137 else if ( humanname.left(9) == "/dev/mmcd" )
131 humanname = tr( "SD Card " ); 138 humanname = tr( "SD Card " );
132 else if ( humanname.left(7) == "/dev/hd" ) 139 else if ( humanname.left(7) == "/dev/hd" )
133 humanname = tr( "Hard Disk /dev/hd " ); 140 humanname = tr( "Hard Disk /dev/hd " );
134 else if ( humanname.left(7) == "/dev/sd" ) 141 else if ( humanname.left(7) == "/dev/sd" )
135 humanname = tr( "SCSI Hard Disk /dev/sd " ); 142 humanname = tr( "SCSI Hard Disk /dev/sd " );
136 else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" ) 143 else if ( humanname == "/dev/mtdblock1" || humanname == "/dev/mtdblock/1" )
137 humanname = tr( "Int. Storage " ); 144 humanname = tr( "Int. Storage " );
138 else if ( humanname.left(14) == "/dev/mtdblock/" ) 145 else if ( humanname.left(14) == "/dev/mtdblock/" )
139 humanname = tr( "Int. Storage /dev/mtdblock/ " ); 146 humanname = tr( "Int. Storage /dev/mtdblock/ " );
140 else if ( humanname.left(13) == "/dev/mtdblock" ) 147 else if ( humanname.left(13) == "/dev/mtdblock" )
141 humanname = tr( "Int. Storage /dev/mtdblock " ); 148 humanname = tr( "Int. Storage /dev/mtdblock " );
142 else if ( humanname.left(9) == "/dev/root" ) 149 else if ( humanname.left(9) == "/dev/root" )
143 humanname = tr( "Int. Storage " ); 150 humanname = tr( "Int. Storage " );
151 else if ( humanname.left(5) == "tmpfs" )
152 humanname = tr( "RAM disk" );
144 // etc. 153 // etc.
145 humanname.append( *fsmount ); 154 humanname.append( *fsmount );
146 humanname.append( " " ); 155 humanname.append( " " );
147 humanname.append( *fsTit ); 156 humanname.append( *fsTit );
148 humanname.append( " " ); 157 humanname.append( " " );
149 158
150 MountInfo* mi = new MountInfo( *fsit, humanname, this ); 159 MountInfo* mi = new MountInfo( *fsit, humanname, container );
151 vb->addWidget(mi); 160 vb->addWidget(mi);
152 disks.insert(*fsit,mi); 161 disks.insert(*fsit,mi);
153 mi->show(); 162 mi->show();
154 fsmount++;fsTit++; 163 fsmount++;fsTit++;
155 QString tempstr = humanname.left( 2 ); 164 QString tempstr = humanname.left( 2 );
156 if ( tempstr == tr( "CF" ) ) 165 if ( tempstr == tr( "CF" ) )
157 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); 166 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) );
158 else if ( tempstr == tr( "Ha" ) ) 167 else if ( tempstr == tr( "Ha" ) )
159 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 168 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
160 else if ( tempstr == tr( "SD" ) ) 169 else if ( tempstr == tr( "SD" ) )
161 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); 170 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) );
162 else if ( tempstr == tr( "SC" ) ) 171 else if ( tempstr == tr( "SC" ) )
163 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 172 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
164 else if ( tempstr == tr( "In" ) ) 173 else if ( tempstr == tr( "In" ) )
165 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) ); 174 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) );
175 else if ( tempstr == tr( "RA" ) )
176 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) );
166 } 177 }
167 vb->addStretch(); 178 vb->addStretch();
168 } else { 179 } else {
169 // just update them 180 // just update them
170 for (QDictIterator<MountInfo> i(disks); i.current(); ++i) 181 for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
171 i.current()->updateData(); 182 i.current()->updateData();
172 } 183 }
173#endif 184#endif
174} 185}
175 186
176 187
177MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name ) 188MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent, const char *name )
178 : QWidget( parent, name ), title(ttl) 189 : QWidget( parent, name ), title(ttl)
179{ 190{
180 qDebug("new path is "+path);
181 fs = new FileSystem( path ); 191 fs = new FileSystem( path );
182 QVBoxLayout *vb = new QVBoxLayout( this, 3 ); 192 QVBoxLayout *vb = new QVBoxLayout( this, 3 );
183 193
184 totalSize = new QLabel( this ); 194 totalSize = new QLabel( this );
185 vb->addWidget( totalSize ); 195 vb->addWidget( totalSize );
186 196
187 data = new GraphData(); 197 data = new GraphData();
188 graph = new BarGraph( this ); 198 graph = new BarGraph( this );
189 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 199 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
190 vb->addWidget( graph, 1 ); 200 vb->addWidget( graph, 1 );
191 graph->setData( data ); 201 graph->setData( data );
192 202
193 legend = new GraphLegend( this ); 203 legend = new GraphLegend( this );
194 legend->setOrientation(Horizontal); 204 legend->setOrientation(Horizontal);
195 vb->addWidget( legend ); 205 vb->addWidget( legend );
196 legend->setData( data ); 206 legend->setData( data );
197 207
198 updateData(); 208 updateData();
199} 209}
200 210
201MountInfo::~MountInfo() 211MountInfo::~MountInfo()
202{ 212{
203 delete data; 213 delete data;
204 delete fs; 214 delete fs;
205} 215}
206 216
207void MountInfo::updateData() 217void MountInfo::updateData()
208{ 218{
209 fs->update(); 219 fs->update();
210 220
211 long mult = fs->blockSize() / 1024; 221 long mult = fs->blockSize() / 1024;
212 long div = 1024 / fs->blockSize(); 222 long div = 1024 / fs->blockSize();
213 if ( !mult ) mult = 1; 223 if ( !mult ) mult = 1;
214 if ( !div ) div = 1; 224 if ( !div ) div = 1;
215 long total = fs->totalBlocks() * mult / div; 225 long total = fs->totalBlocks() * mult / div;
216 long avail = fs->availBlocks() * mult / div; 226 long avail = fs->availBlocks() * mult / div;
217 long used = total - avail; 227 long used = total - avail;
218 totalSize->setText( title + tr(" : %1 kB").arg( total ) ); 228 totalSize->setText( title + tr(" : %1 kB").arg( total ) );
219 data->clear(); 229 data->clear();
220 data->addItem( tr("Used (%1 kB)").arg(used), used ); 230 data->addItem( tr("Used (%1 kB)").arg(used), used );
221 data->addItem( tr("Available (%1 kB)").arg(avail), avail ); 231 data->addItem( tr("Available (%1 kB)").arg(avail), avail );
222 graph->repaint( FALSE ); 232 graph->repaint( FALSE );
223 legend->update(); 233 legend->update();
224 graph->show(); 234 graph->show();
225 legend->show(); 235 legend->show();
226} 236}
227 237
228//--------------------------------------------------------------------------- 238//---------------------------------------------------------------------------
229 239
230FileSystem::FileSystem( const QString &p ) 240FileSystem::FileSystem( const QString &p )
231 : fspath( p ), blkSize(512), totalBlks(0), availBlks(0) 241 : fspath( p ), blkSize(512), totalBlks(0), availBlks(0)
232{ 242{
233 update(); 243 update();
234} 244}
235 245
236void FileSystem::update() 246void FileSystem::update()
237{ 247{
238#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 248#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
239 struct statfs fs; 249 struct statfs fs;
240 if ( !statfs( fspath.latin1(), &fs ) ) { 250 if ( !statfs( fspath.latin1(), &fs ) ) {
241 blkSize = fs.f_bsize; 251 blkSize = fs.f_bsize;
242 totalBlks = fs.f_blocks; 252 totalBlks = fs.f_blocks;
243 availBlks = fs.f_bavail; 253 availBlks = fs.f_bavail;
244 } else { 254 } else {
245 blkSize = 0; 255 blkSize = 0;
246 totalBlks = 0; 256 totalBlks = 0;
247 availBlks = 0; 257 availBlks = 0;
248 } 258 }
249#endif 259#endif
250} 260}
251 261
diff --git a/noncore/settings/sysinfo/storage.h b/noncore/settings/sysinfo/storage.h
index 3fa5b79..7e8b4e0 100644
--- a/noncore/settings/sysinfo/storage.h
+++ b/noncore/settings/sysinfo/storage.h
@@ -1,87 +1,89 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20#include <qwidget.h> 20#include <qwidget.h>
21#include <qframe.h> 21#include <qframe.h>
22#include <qlist.h> 22#include <qlist.h>
23#include <qdict.h> 23#include <qdict.h>
24 24
25class QLabel; 25class QLabel;
26class GraphData; 26class GraphData;
27class Graph; 27class Graph;
28class GraphLegend; 28class GraphLegend;
29class FileSystem; 29class FileSystem;
30class MountInfo; 30class MountInfo;
31class QVBoxLayout; 31class QVBoxLayout;
32class QWidget;
32 33
33 34
34class StorageInfo : public QWidget 35class StorageInfo : public QWidget
35{ 36{
36 Q_OBJECT 37 Q_OBJECT
37public: 38public:
38 StorageInfo( QWidget *parent=0, const char *name=0 ); 39 StorageInfo( QWidget *parent=0, const char *name=0 );
39 40
40protected: 41protected:
41 void timerEvent(QTimerEvent*); 42 void timerEvent(QTimerEvent*);
42 43
43private: 44private:
44 void updateMounts(); 45 void updateMounts();
45 QDict<MountInfo> disks; 46 QDict<MountInfo> disks;
46 QList<QFrame> lines; 47 QList<QFrame> lines;
47 QVBoxLayout *vb; 48 QVBoxLayout *vb;
49 QWidget *container;
48}; 50};
49 51
50class MountInfo : public QWidget 52class MountInfo : public QWidget
51{ 53{
52 Q_OBJECT 54 Q_OBJECT
53public: 55public:
54 MountInfo( const QString &path, const QString &ttl, QWidget *parent=0, const char *name=0 ); 56 MountInfo( const QString &path, const QString &ttl, QWidget *parent=0, const char *name=0 );
55 ~MountInfo(); 57 ~MountInfo();
56 58
57 void updateData(); 59 void updateData();
58 60
59private: 61private:
60 QString title; 62 QString title;
61 FileSystem *fs; 63 FileSystem *fs;
62 QLabel *totalSize; 64 QLabel *totalSize;
63 GraphData *data; 65 GraphData *data;
64 Graph *graph; 66 Graph *graph;
65 GraphLegend *legend; 67 GraphLegend *legend;
66}; 68};
67 69
68class FileSystem 70class FileSystem
69{ 71{
70public: 72public:
71 FileSystem( const QString &p ); 73 FileSystem( const QString &p );
72 74
73 void update(); 75 void update();
74 76
75 const QString &path() const { return fspath; } 77 const QString &path() const { return fspath; }
76 long blockSize() const { return blkSize; } 78 long blockSize() const { return blkSize; }
77 long totalBlocks() const { return totalBlks; } 79 long totalBlocks() const { return totalBlks; }
78 long availBlocks() const { return availBlks; } 80 long availBlocks() const { return availBlks; }
79 81
80private: 82private:
81 QString fspath; 83 QString fspath;
82 long blkSize; 84 long blkSize;
83 long totalBlks; 85 long totalBlks;
84 long availBlks; 86 long availBlks;
85}; 87};
86 88
87 89
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index 6d2a64f..872492e 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -1,70 +1,70 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19********************************************************************** 19**********************************************************************
20** 20**
21** Enhancements by: Dan Williams, <williamsdr@acm.org> 21** Enhancements by: Dan Williams, <williamsdr@acm.org>
22** 22**
23**********************************************************************/ 23**********************************************************************/
24 24
25#include "memory.h" 25#include "memory.h"
26#include "load.h" 26#include "load.h"
27#include "storage.h" 27#include "storage.h"
28#include "processinfo.h" 28#include "processinfo.h"
29#include "modulesinfo.h" 29#include "modulesinfo.h"
30#include "versioninfo.h" 30#include "versioninfo.h"
31#include "sysinfo.h" 31#include "sysinfo.h"
32 32
33#include <opie/otabwidget.h> 33#include <opie/otabwidget.h>
34 34
35#include <qpe/config.h> 35#include <qpe/config.h>
36#include <qpe/resource.h> 36#include <qpe/resource.h>
37 37
38#include <qlayout.h> 38#include <qlayout.h>
39 39
40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) 40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags )
41 : QWidget( parent, name, WStyle_ContextHelp ) 41 : QWidget( parent, name, WStyle_ContextHelp )
42{ 42{
43 setIcon( Resource::loadPixmap( "system_icon" ) ); 43 setIcon( Resource::loadPixmap( "system_icon" ) );
44 setCaption( tr("System Info") ); 44 setCaption( tr("System Info") );
45 45
46 resize( 220, 180 ); 46 resize( 220, 180 );
47 47
48 Config config( "qpe" ); 48 Config config( "qpe" );
49 config.setGroup( "Appearance" ); 49 config.setGroup( "Appearance" );
50 bool advanced = config.readBoolEntry( "Advanced", TRUE ); 50 bool advanced = config.readBoolEntry( "Advanced", TRUE );
51 51
52 QVBoxLayout *lay = new QVBoxLayout( this ); 52 QVBoxLayout *lay = new QVBoxLayout( this );
53 OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global ); 53 OTabWidget *tab = new OTabWidget( this, "tabwidget", OTabWidget::Global );
54 lay->addWidget( tab ); 54 lay->addWidget( tab );
55 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") ); 55 tab->addTab( new MemoryInfo( tab ), "sysinfo/memorytabicon.png", tr("Memory") );
56#if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 56#if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
57 tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") ); 57 tab->addTab( new StorageInfo( tab ), "sysinfo/storagetabicon.png", tr("Storage") );
58#endif 58#endif
59 tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") ); 59 tab->addTab( new LoadInfo( tab ), "sysinfo/cputabicon.png", tr("CPU") );
60 if ( advanced ) 60 if ( advanced )
61 { 61 {
62 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") ); 62 tab->addTab( new ProcessInfo( tab ), "sysinfo/processtabicon.png", tr("Process") );
63 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") ); 63 tab->addTab( new ModulesInfo( tab ), "sysinfo/moduletabicon.png", tr("Modules") );
64 } 64 }
65 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") ); 65 tab->addTab( new VersionInfo( tab ), "sysinfo/versiontabicon.png", tr("Version") );
66 66
67 tab->setCurrentTab( tr( "Memory" ) ); 67 tab->setCurrentTab( tr( "Memory" ) );
68} 68}
69 69
70 70
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index 236fc02..7e66451 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -1,46 +1,44 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3DESTDIR = $(OPIEDIR)/bin 3DESTDIR = $(OPIEDIR)/bin
4HEADERS = memory.h \ 4HEADERS = memory.h \
5 graph.h \ 5 graph.h \
6 load.h \ 6 load.h \
7 storage.h \ 7 storage.h \
8 processinfo.h \ 8 processinfo.h \
9 processdetail.h \ 9 processdetail.h \
10 modulesinfo.h \ 10 modulesinfo.h \
11 modulesdetail.h \
12 versioninfo.h \ 11 versioninfo.h \
13 sysinfo.h 12 sysinfo.h
14SOURCES = main.cpp \ 13SOURCES = main.cpp \
15 memory.cpp \ 14 memory.cpp \
16 graph.cpp \ 15 graph.cpp \
17 load.cpp \ 16 load.cpp \
18 storage.cpp \ 17 storage.cpp \
19 processinfo.cpp \ 18 processinfo.cpp \
20 modulesinfo.cpp \ 19 modulesinfo.cpp \
21 processdetail.cpp \ 20 processdetail.cpp \
22 modulesdetail.cpp \
23 versioninfo.cpp \ 21 versioninfo.cpp \
24 sysinfo.cpp 22 sysinfo.cpp
25INTERFACES = 23INTERFACES =
26INCLUDEPATH += $(OPIEDIR)/include 24INCLUDEPATH += $(OPIEDIR)/include
27DEPENDPATH += $(OPIEDIR)/include 25DEPENDPATH += $(OPIEDIR)/include
28LIBS += -lqpe -lopie 26LIBS += -lqpe -lopie
29TARGET = sysinfo 27TARGET = sysinfo
30 28
31TRANSLATIONS = ../../../i18n/de/sysinfo.ts \ 29TRANSLATIONS = ../../../i18n/de/sysinfo.ts \
32 ../../../i18n/xx/sysinfo.ts \ 30 ../../../i18n/xx/sysinfo.ts \
33 ../../../i18n/en/sysinfo.ts \ 31 ../../../i18n/en/sysinfo.ts \
34 ../../../i18n/es/sysinfo.ts \ 32 ../../../i18n/es/sysinfo.ts \
35 ../../../i18n/fr/sysinfo.ts \ 33 ../../../i18n/fr/sysinfo.ts \
36 ../../../i18n/hu/sysinfo.ts \ 34 ../../../i18n/hu/sysinfo.ts \
37 ../../../i18n/ja/sysinfo.ts \ 35 ../../../i18n/ja/sysinfo.ts \
38 ../../../i18n/ko/sysinfo.ts \ 36 ../../../i18n/ko/sysinfo.ts \
39 ../../../i18n/no/sysinfo.ts \ 37 ../../../i18n/no/sysinfo.ts \
40 ../../../i18n/pl/sysinfo.ts \ 38 ../../../i18n/pl/sysinfo.ts \
41 ../../../i18n/pt/sysinfo.ts \ 39 ../../../i18n/pt/sysinfo.ts \
42 ../../../i18n/pt_BR/sysinfo.ts \ 40 ../../../i18n/pt_BR/sysinfo.ts \
43 ../../../i18n/sl/sysinfo.ts \ 41 ../../../i18n/sl/sysinfo.ts \
44 ../../../i18n/zh_CN/sysinfo.ts \ 42 ../../../i18n/zh_CN/sysinfo.ts \
45 ../../../i18n/zh_TW/sysinfo.ts \ 43 ../../../i18n/zh_TW/sysinfo.ts \
46 ../../../i18n/da/sysinfo.ts 44 ../../../i18n/da/sysinfo.ts