summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/detail.cpp6
-rw-r--r--noncore/settings/sysinfo/main.cpp1
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp5
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp3
-rw-r--r--noncore/settings/sysinfo/storage.cpp1
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp16
6 files changed, 6 insertions, 26 deletions
diff --git a/noncore/settings/sysinfo/detail.cpp b/noncore/settings/sysinfo/detail.cpp
index 2c5fdc4..79daa2b 100644
--- a/noncore/settings/sysinfo/detail.cpp
+++ b/noncore/settings/sysinfo/detail.cpp
@@ -1,50 +1,44 @@
1/********************************************************************** 1/**********************************************************************
2** Detail 2** Detail
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 "detail.h" 22#include "detail.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>
28#include <qlayout.h> 27#include <qlayout.h>
29#include <qlistview.h>
30#include <qmessagebox.h>
31#include <qpushbutton.h>
32#include <qtextview.h>
33#include <qwhatsthis.h>
34 28
35Detail::Detail( QWidget* parent, const char* name, WFlags ) 29Detail::Detail( QWidget* parent, const char* name, WFlags )
36 : QWidget( parent, name, WStyle_ContextHelp ) 30 : QWidget( parent, name, WStyle_ContextHelp )
37{ 31{
38 QVBoxLayout *layout = new QVBoxLayout( this ); 32 QVBoxLayout *layout = new QVBoxLayout( this );
39 33
40 detailView = new QTextView( this ); 34 detailView = new QTextView( this );
41 detailView->setTextFormat( PlainText ); 35 detailView->setTextFormat( PlainText );
42 36
43 layout->addWidget( detailView ); 37 layout->addWidget( detailView );
44} 38}
45 39
46Detail::~Detail() 40Detail::~Detail()
47{ 41{
48} 42}
49 43
50 44
diff --git a/noncore/settings/sysinfo/main.cpp b/noncore/settings/sysinfo/main.cpp
index 02b1098..d071f71 100644
--- a/noncore/settings/sysinfo/main.cpp
+++ b/noncore/settings/sysinfo/main.cpp
@@ -1,27 +1,26 @@
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 "sysinfo.h" 21#include "sysinfo.h"
22 22
23#include <qpe/qpeapplication.h>
24#include <opie/oapplicationfactory.h> 23#include <opie/oapplicationfactory.h>
25 24
26 25
27OPIE_EXPORT_APP( OApplicationFactory<SystemInfo> ) 26OPIE_EXPORT_APP( OApplicationFactory<SystemInfo> )
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 0bf51e8..566b179 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,193 +1,188 @@
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>
25#include <qfile.h> 24#include <qfile.h>
26#include <qheader.h>
27#include <qlayout.h> 25#include <qlayout.h>
28#include <qlistview.h>
29#include <qmessagebox.h> 26#include <qmessagebox.h>
30#include <qpushbutton.h>
31#include <qstring.h>
32#include <qtimer.h> 27#include <qtimer.h>
33#include <qwhatsthis.h> 28#include <qwhatsthis.h>
34 29
35#include "modulesinfo.h" 30#include "modulesinfo.h"
36#include "detail.h" 31#include "detail.h"
37 32
38ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 33ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
39 : QWidget( parent, name, fl ) 34 : QWidget( parent, name, fl )
40{ 35{
41 QGridLayout *layout = new QGridLayout( this ); 36 QGridLayout *layout = new QGridLayout( this );
42 layout->setSpacing( 4 ); 37 layout->setSpacing( 4 );
43 layout->setMargin( 4 ); 38 layout->setMargin( 4 );
44 39
45 ModulesView = new QListView( this ); 40 ModulesView = new QListView( this );
46 int colnum = ModulesView->addColumn( tr( "Module" ) ); 41 int colnum = ModulesView->addColumn( tr( "Module" ) );
47 colnum = ModulesView->addColumn( tr( "Size" ) ); 42 colnum = ModulesView->addColumn( tr( "Size" ) );
48 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 43 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
49 colnum = ModulesView->addColumn( tr( "Use#" ) ); 44 colnum = ModulesView->addColumn( tr( "Use#" ) );
50 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 45 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
51 colnum = ModulesView->addColumn( tr( "Used by" ) ); 46 colnum = ModulesView->addColumn( tr( "Used by" ) );
52 ModulesView->setAllColumnsShowFocus( TRUE ); 47 ModulesView->setAllColumnsShowFocus( TRUE );
53 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 48 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
54 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." ) ); 49 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." ) );
55 50
56 // Test if we have /sbin/modinfo, and if so, allow module detail window 51 // Test if we have /sbin/modinfo, and if so, allow module detail window
57 if ( QFile::exists( "/sbin/modinfo" ) ) 52 if ( QFile::exists( "/sbin/modinfo" ) )
58 { 53 {
59 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 54 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
60 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 55 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
61 this, SLOT( viewModules( QListViewItem * ) ) ); 56 this, SLOT( viewModules( QListViewItem * ) ) );
62 } 57 }
63 58
64 CommandCB = new QComboBox( FALSE, this ); 59 CommandCB = new QComboBox( FALSE, this );
65 CommandCB->insertItem( "modprobe -r" ); 60 CommandCB->insertItem( "modprobe -r" );
66 CommandCB->insertItem( "rmmod" ); 61 CommandCB->insertItem( "rmmod" );
67 // I can't think of other useful commands yet. Anyone? 62 // I can't think of other useful commands yet. Anyone?
68 layout->addWidget( CommandCB, 1, 0 ); 63 layout->addWidget( CommandCB, 1, 0 );
69 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." ) ); 64 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." ) );
70 65
71 QPushButton *btn = new QPushButton( this ); 66 QPushButton *btn = new QPushButton( this );
72 btn->setMinimumSize( QSize( 50, 24 ) ); 67 btn->setMinimumSize( QSize( 50, 24 ) );
73 btn->setMaximumSize( QSize( 50, 24 ) ); 68 btn->setMaximumSize( QSize( 50, 24 ) );
74 btn->setText( tr( "Send" ) ); 69 btn->setText( tr( "Send" ) );
75 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 70 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
76 layout->addWidget( btn, 1, 1 ); 71 layout->addWidget( btn, 1, 1 );
77 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) ); 72 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
78 73
79 QTimer *t = new QTimer( this ); 74 QTimer *t = new QTimer( this );
80 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 75 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
81 t->start( 5000 ); 76 t->start( 5000 );
82 77
83 updateData(); 78 updateData();
84 79
85 ModulesDtl = new Detail(); 80 ModulesDtl = new Detail();
86 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); 81 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
87} 82}
88 83
89ModulesInfo::~ModulesInfo() 84ModulesInfo::~ModulesInfo()
90{ 85{
91} 86}
92 87
93void ModulesInfo::updateData() 88void ModulesInfo::updateData()
94{ 89{
95 char modname[64]; 90 char modname[64];
96 char usage[200]; 91 char usage[200];
97 int modsize, usecount; 92 int modsize, usecount;
98 93
99 QString selectedmod; 94 QString selectedmod;
100 QListViewItem *curritem = ModulesView->currentItem(); 95 QListViewItem *curritem = ModulesView->currentItem();
101 if ( curritem ) 96 if ( curritem )
102 { 97 {
103 selectedmod = curritem->text( 0 ); 98 selectedmod = curritem->text( 0 );
104 } 99 }
105 100
106 ModulesView->clear(); 101 ModulesView->clear();
107 102
108 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 103 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
109 104
110 if ( procfile ) 105 if ( procfile )
111 { 106 {
112 QListViewItem *newitem; 107 QListViewItem *newitem;
113 QListViewItem *selecteditem = 0x0; 108 QListViewItem *selecteditem = 0x0;
114 while ( true ) { 109 while ( true ) {
115 modname[0] = '\0'; 110 modname[0] = '\0';
116 usage[0] = '\0'; 111 usage[0] = '\0';
117 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 112 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
118 113
119 if ( success == EOF ) 114 if ( success == EOF )
120 break; 115 break;
121 116
122 QString qmodname = QString( modname ); 117 QString qmodname = QString( modname );
123 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 118 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
124 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 119 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
125 QString qusage = QString( usage ); 120 QString qusage = QString( usage );
126 121
127 newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 122 newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
128 if ( qmodname == selectedmod ) 123 if ( qmodname == selectedmod )
129 { 124 {
130 selecteditem = newitem; 125 selecteditem = newitem;
131 } 126 }
132 } 127 }
133 ModulesView->setCurrentItem( selecteditem ); 128 ModulesView->setCurrentItem( selecteditem );
134 129
135 fclose( procfile ); 130 fclose( procfile );
136 } 131 }
137} 132}
138 133
139void ModulesInfo::slotSendClicked() 134void ModulesInfo::slotSendClicked()
140{ 135{
141 if ( !ModulesView->currentItem() ) 136 if ( !ModulesView->currentItem() )
142 { 137 {
143 return; 138 return;
144 } 139 }
145 140
146 QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() ); 141 QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() );
147 142
148 QString modname = ModulesView->currentItem()->text( 0 ); 143 QString modname = ModulesView->currentItem()->text( 0 );
149 144
150 if ( QMessageBox::warning( this, modname, capstr, 145 if ( QMessageBox::warning( this, modname, capstr,
151 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 146 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
152 { 147 {
153 QString command = "/sbin/"; 148 QString command = "/sbin/";
154 command.append( CommandCB->currentText() ); 149 command.append( CommandCB->currentText() );
155 command.append( " " ); 150 command.append( " " );
156 command.append( modname ); 151 command.append( modname );
157 152
158 FILE* stream = popen( command, "r" ); 153 FILE* stream = popen( command, "r" );
159 if ( stream ) 154 if ( stream )
160 pclose( stream ); 155 pclose( stream );
161 } 156 }
162 157
163} 158}
164 159
165void ModulesInfo::viewModules( QListViewItem *modules ) 160void ModulesInfo::viewModules( QListViewItem *modules )
166{ 161{
167 QString modname = modules->text( 0 ); 162 QString modname = modules->text( 0 );
168 QString capstr = "Module: "; 163 QString capstr = "Module: ";
169 capstr.append( modname ); 164 capstr.append( modname );
170 ModulesDtl->setCaption( capstr ); 165 ModulesDtl->setCaption( capstr );
171 QString command = "/sbin/modinfo "; 166 QString command = "/sbin/modinfo ";
172 command.append( modname ); 167 command.append( modname );
173 FILE* modinfo = popen( command, "r" ); 168 FILE* modinfo = popen( command, "r" );
174 169
175 if ( modinfo ) 170 if ( modinfo )
176 { 171 {
177 char line[200]; 172 char line[200];
178 ModulesDtl->detailView->setText( " Details:\n------------\n" ); 173 ModulesDtl->detailView->setText( " Details:\n------------\n" );
179 174
180 while( true ) 175 while( true )
181 { 176 {
182 int success = fscanf( modinfo, "%[^\n]\n", line ); 177 int success = fscanf( modinfo, "%[^\n]\n", line );
183 if ( success == EOF ) 178 if ( success == EOF )
184 break; 179 break;
185 ModulesDtl->detailView->append( line ); 180 ModulesDtl->detailView->append( line );
186 } 181 }
187 182
188 pclose( modinfo ); 183 pclose( modinfo );
189 } 184 }
190 185
191 ModulesDtl->showMaximized(); 186 ModulesDtl->showMaximized();
192} 187}
193 188
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 709158d..af0fe26 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -1,203 +1,200 @@
1/********************************************************************** 1/**********************************************************************
2** ProcessInfo 2** ProcessInfo
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 <qpe/qpeapplication.h> 20#include <qpe/qpeapplication.h>
21 21
22#include <qdir.h> 22#include <qdir.h>
23#include <qfile.h>
24#include <qheader.h>
25#include <qlayout.h> 23#include <qlayout.h>
26#include <qlistview.h>
27#include <qmessagebox.h> 24#include <qmessagebox.h>
28#include <qtimer.h> 25#include <qtimer.h>
29#include <qwhatsthis.h> 26#include <qwhatsthis.h>
30 27
31#include <sys/types.h> 28#include <sys/types.h>
32#include <signal.h> 29#include <signal.h>
33 30
34#include "processinfo.h" 31#include "processinfo.h"
35#include "detail.h" 32#include "detail.h"
36 33
37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 34ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
38 : QWidget( parent, name, fl ) 35 : QWidget( parent, name, fl )
39{ 36{
40 QGridLayout *layout = new QGridLayout( this ); 37 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 ); 38 layout->setSpacing( 4 );
42 layout->setMargin( 4 ); 39 layout->setMargin( 4 );
43 40
44 41
45 ProcessView = new QListView( this, "ProcessView" ); 42 ProcessView = new QListView( this, "ProcessView" );
46 int colnum = ProcessView->addColumn( tr( "PID" ) ); 43 int colnum = ProcessView->addColumn( tr( "PID" ) );
47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 44 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
48 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 45 colnum = ProcessView->addColumn( tr( "Command" ),96 );
49 colnum = ProcessView->addColumn( tr( "Status" ) ); 46 colnum = ProcessView->addColumn( tr( "Status" ) );
50 colnum = ProcessView->addColumn( tr( "Time" ) ); 47 colnum = ProcessView->addColumn( tr( "Time" ) );
51 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 48 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
52 ProcessView->setAllColumnsShowFocus( TRUE ); 49 ProcessView->setAllColumnsShowFocus( TRUE );
53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 50 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
54 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 51 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
55 this, SLOT( viewProcess( QListViewItem * ) ) ); 52 this, SLOT( viewProcess( QListViewItem * ) ) );
56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); 53 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
57 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) ); 54 QWhatsThis::add( ProcessView, tr( "This is a list of all the processes on this handheld device.\n\nClick and hold on a process to see additional information about the process, or to send a signal to it." ) );
58 55
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 56 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" ); 57 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" ); 58 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" ); 59 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" ); 60 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" ); 61 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" ); 62 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" ); 63 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" ); 64 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" ); 65 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" ); 66 SignalCB->insertItem( "19: SIGSTOP" );
70 layout->addWidget( SignalCB, 1, 0 ); 67 layout->addWidget( SignalCB, 1, 0 );
71 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) ); 68 QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
72 69
73 SendButton = new QPushButton( this, "SendButton" ); 70 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) ); 71 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) ); 72 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) ); 73 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 74 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 ); 75 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) ); 76 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
80 77
81 QTimer *t = new QTimer( this ); 78 QTimer *t = new QTimer( this );
82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 79 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
83 t->start( 5000 ); 80 t->start( 5000 );
84 81
85 updateData(); 82 updateData();
86 83
87 ProcessDtl = new Detail(); 84 ProcessDtl = new Detail();
88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) ); 85 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
89} 86}
90 87
91ProcessInfo::~ProcessInfo() 88ProcessInfo::~ProcessInfo()
92{ 89{
93} 90}
94 91
95void ProcessInfo::updateData() 92void ProcessInfo::updateData()
96{ 93{
97 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 94 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
98 signal, blocked, sigignore, sigcatch; 95 signal, blocked, sigignore, sigcatch;
99 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 96 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
100 endcode, startstack, kstkesp, kstkeip, wchan; 97 endcode, startstack, kstkesp, kstkeip, wchan;
101 char state; 98 char state;
102 char comm[64]; 99 char comm[64];
103 100
104 QString selectedpid; 101 QString selectedpid;
105 QListViewItem *curritem = ProcessView->currentItem(); 102 QListViewItem *curritem = ProcessView->currentItem();
106 if ( curritem ) 103 if ( curritem )
107 { 104 {
108 selectedpid = curritem->text( 0 ); 105 selectedpid = curritem->text( 0 );
109 } 106 }
110 107
111 ProcessView->clear(); 108 ProcessView->clear();
112 109
113 QListViewItem *newitem; 110 QListViewItem *newitem;
114 QListViewItem *selecteditem = 0x0; 111 QListViewItem *selecteditem = 0x0;
115 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); 112 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
116 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 113 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
117 if ( proclist ) 114 if ( proclist )
118 { 115 {
119 QFileInfoListIterator it(*proclist); 116 QFileInfoListIterator it(*proclist);
120 QFileInfo *f; 117 QFileInfo *f;
121 while ( ( f = it.current() ) != 0 ) 118 while ( ( f = it.current() ) != 0 )
122 { 119 {
123 ++it; 120 ++it;
124 QString processnum = f->fileName(); 121 QString processnum = f->fileName();
125 if ( processnum >= "1" && processnum <= "99999" ) 122 if ( processnum >= "1" && processnum <= "99999" )
126 { 123 {
127 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); 124 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r");
128 125
129 if ( procfile ) 126 if ( procfile )
130 { 127 {
131 fscanf( procfile, 128 fscanf( procfile,
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", 129 "%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",
133 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, 130 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
134 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, 131 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
135 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, 132 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
136 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); 133 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
137 processnum = processnum.rightJustify( 5, ' ' ); 134 processnum = processnum.rightJustify( 5, ' ' );
138 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); 135 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
139 QString processstatus = QChar(state); 136 QString processstatus = QChar(state);
140 QString processtime = QString::number( ( utime + stime ) / 100 ); 137 QString processtime = QString::number( ( utime + stime ) / 100 );
141 processtime = processtime.rightJustify( 9, ' ' ); 138 processtime = processtime.rightJustify( 9, ' ' );
142 fclose( procfile ); 139 fclose( procfile );
143 140
144 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); 141 newitem = new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
145 if ( processnum == selectedpid ) 142 if ( processnum == selectedpid )
146 { 143 {
147 selecteditem = newitem; 144 selecteditem = newitem;
148 } 145 }
149 } 146 }
150 } 147 }
151 } 148 }
152 ProcessView->setCurrentItem( selecteditem ); 149 ProcessView->setCurrentItem( selecteditem );
153 } 150 }
154 151
155 delete proclist; 152 delete proclist;
156 delete procdir; 153 delete procdir;
157} 154}
158 155
159void ProcessInfo::slotSendClicked() 156void ProcessInfo::slotSendClicked()
160{ 157{
161 QListViewItem *currprocess = ProcessView->currentItem(); 158 QListViewItem *currprocess = ProcessView->currentItem();
162 if ( !currprocess ) 159 if ( !currprocess )
163 { 160 {
164 return; 161 return;
165 } 162 }
166 163
167 QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() ); 164 QString capstr = tr( "Really want to send %1\nto this process?" ).arg( SignalCB->currentText() );
168 165
169 166
170 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr, 167 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
171 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 168 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
172 { 169 {
173 currprocess = ProcessView->currentItem(); 170 currprocess = ProcessView->currentItem();
174 if ( currprocess ) 171 if ( currprocess )
175 { 172 {
176 QString sigstr = SignalCB->currentText(); 173 QString sigstr = SignalCB->currentText();
177 sigstr.truncate(2); 174 sigstr.truncate(2);
178 int sigid = sigstr.toUInt(); 175 int sigid = sigstr.toUInt();
179 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ); 176 kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid );
180 } 177 }
181 } 178 }
182 179
183} 180}
184 181
185void ProcessInfo::viewProcess( QListViewItem *process ) 182void ProcessInfo::viewProcess( QListViewItem *process )
186{ 183{
187 QString pid= process->text( 0 ).stripWhiteSpace(); 184 QString pid= process->text( 0 ).stripWhiteSpace();
188 QString command = process->text( 1 ); 185 QString command = process->text( 1 );
189 ProcessDtl->setCaption( pid + " - " + command ); 186 ProcessDtl->setCaption( pid + " - " + command );
190 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 187 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
191 if ( statfile ) 188 if ( statfile )
192 { 189 {
193 char line[81]; 190 char line[81];
194 fgets( line, 81, statfile ); 191 fgets( line, 81, statfile );
195 ProcessDtl->detailView->setText( line ); 192 ProcessDtl->detailView->setText( line );
196 while ( fgets( line, 81, statfile ) ) 193 while ( fgets( line, 81, statfile ) )
197 { 194 {
198 ProcessDtl->detailView->append( line ); 195 ProcessDtl->detailView->append( line );
199 } 196 }
200 fclose( statfile ); 197 fclose( statfile );
201 } 198 }
202 ProcessDtl->showMaximized(); 199 ProcessDtl->showMaximized();
203} 200}
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index 4ef7122..fc583e3 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -1,178 +1,177 @@
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 21
22#include <qpe/storage.h> 22#include <qpe/storage.h>
23 23
24#include <qlabel.h> 24#include <qlabel.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qscrollview.h> 26#include <qscrollview.h>
27#include <qtimer.h>
28#include <qwhatsthis.h> 27#include <qwhatsthis.h>
29 28
30#include "graph.h" 29#include "graph.h"
31#include "storage.h" 30#include "storage.h"
32 31
33#include <stdio.h> 32#include <stdio.h>
34 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX) 33 #if defined(_OS_LINUX_) || defined(Q_OS_LINUX)
35#include <sys/vfs.h> 34#include <sys/vfs.h>
36#include <mntent.h> 35#include <mntent.h>
37 #endif 36 #endif
38 37
39FileSysInfo::FileSysInfo( QWidget *parent, const char *name ) 38FileSysInfo::FileSysInfo( QWidget *parent, const char *name )
40 : QWidget( parent, name ) 39 : QWidget( parent, name )
41{ 40{
42 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 41 QVBoxLayout *tmpvb = new QVBoxLayout( this );
43 QScrollView *sv = new QScrollView( this ); 42 QScrollView *sv = new QScrollView( this );
44 tmpvb->addWidget( sv, 0, 0 ); 43 tmpvb->addWidget( sv, 0, 0 );
45 sv->setResizePolicy( QScrollView::AutoOneFit ); 44 sv->setResizePolicy( QScrollView::AutoOneFit );
46 sv->setFrameStyle( QFrame::NoFrame ); 45 sv->setFrameStyle( QFrame::NoFrame );
47 container = new QWidget( sv->viewport() ); 46 container = new QWidget( sv->viewport() );
48 sv->addChild( container ); 47 sv->addChild( container );
49 vb = 0x0; 48 vb = 0x0;
50 49
51 storage = new StorageInfo( this ); 50 storage = new StorageInfo( this );
52 connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) ); 51 connect( storage, SIGNAL( disksChanged() ), this, SLOT( disksChanged() ) );
53 52
54 lines.setAutoDelete(TRUE); 53 lines.setAutoDelete(TRUE);
55 54
56 rebuildDisks = TRUE; 55 rebuildDisks = TRUE;
57 updateMounts(); 56 updateMounts();
58 startTimer( 5000 ); 57 startTimer( 5000 );
59} 58}
60 59
61 60
62void FileSysInfo::timerEvent(QTimerEvent*) 61void FileSysInfo::timerEvent(QTimerEvent*)
63{ 62{
64 updateMounts(); 63 updateMounts();
65} 64}
66 65
67void FileSysInfo::updateMounts() 66void FileSysInfo::updateMounts()
68{ 67{
69 storage->update(); 68 storage->update();
70 69
71 if ( rebuildDisks ) 70 if ( rebuildDisks )
72 { 71 {
73 disks.clear(); 72 disks.clear();
74 lines.clear(); 73 lines.clear();
75 74
76 delete vb; 75 delete vb;
77 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ ); 76 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
78 77
79 bool frst=TRUE; 78 bool frst=TRUE;
80 79
81 FileSystem *fs; 80 FileSystem *fs;
82 for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it ) 81 for ( QListIterator<FileSystem> it(storage->fileSystems()); it.current(); ++it )
83 { 82 {
84 fs = it.current(); 83 fs = it.current();
85 84
86 if ( !frst ) 85 if ( !frst )
87 { 86 {
88 QFrame *f = new QFrame( container ); 87 QFrame *f = new QFrame( container );
89 vb->addWidget(f); 88 vb->addWidget(f);
90 f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); 89 f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
91 lines.append(f); 90 lines.append(f);
92 f->show(); 91 f->show();
93 } 92 }
94 frst = FALSE; 93 frst = FALSE;
95 94
96 MountInfo *mi = new MountInfo( fs, container ); 95 MountInfo *mi = new MountInfo( fs, container );
97 vb->addWidget( mi ); 96 vb->addWidget( mi );
98 disks.insert( fs->path(), mi ); 97 disks.insert( fs->path(), mi );
99 mi->show(); 98 mi->show();
100 QString tempstr = fs->name().left( 2 ); 99 QString tempstr = fs->name().left( 2 );
101 if ( tempstr == tr( "CF" ) ) 100 if ( tempstr == tr( "CF" ) )
102 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) ); 101 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Compact Flash memory card." ) );
103 else if ( tempstr == tr( "Ha" ) ) 102 else if ( tempstr == tr( "Ha" ) )
104 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 103 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
105 else if ( tempstr == tr( "SD" ) ) 104 else if ( tempstr == tr( "SD" ) )
106 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) ); 105 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used on this Secure Digital memory card." ) );
107 else if ( tempstr == tr( "SC" ) ) 106 else if ( tempstr == tr( "SC" ) )
108 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) ); 107 QWhatsThis::add( mi, tr( "This graph represents how much storage is currently used on this hard drive." ) );
109 else if ( tempstr == tr( "In" ) ) 108 else if ( tempstr == tr( "In" ) )
110 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." ) ); 109 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." ) );
111 else if ( tempstr == tr( "RA" ) ) 110 else if ( tempstr == tr( "RA" ) )
112 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) ); 111 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) );
113 } 112 }
114 vb->addStretch(); 113 vb->addStretch();
115 } 114 }
116 else 115 else
117 { 116 {
118 for (QDictIterator<MountInfo> i(disks); i.current(); ++i) 117 for (QDictIterator<MountInfo> i(disks); i.current(); ++i)
119 i.current()->updateData(); 118 i.current()->updateData();
120 } 119 }
121 120
122 rebuildDisks = FALSE; 121 rebuildDisks = FALSE;
123} 122}
124 123
125void FileSysInfo::disksChanged() 124void FileSysInfo::disksChanged()
126{ 125{
127 rebuildDisks = TRUE; 126 rebuildDisks = TRUE;
128} 127}
129 128
130MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name ) 129MountInfo::MountInfo( FileSystem *filesys, QWidget *parent, const char *name )
131 : QWidget( parent, name ) 130 : QWidget( parent, name )
132{ 131{
133 QVBoxLayout *vb = new QVBoxLayout( this, 3 ); 132 QVBoxLayout *vb = new QVBoxLayout( this, 3 );
134 133
135 totalSize = new QLabel( this ); 134 totalSize = new QLabel( this );
136 vb->addWidget( totalSize ); 135 vb->addWidget( totalSize );
137 136
138 fs = filesys; 137 fs = filesys;
139 title = fs->name(); 138 title = fs->name();
140 139
141 data = new GraphData(); 140 data = new GraphData();
142 graph = new BarGraph( this ); 141 graph = new BarGraph( this );
143 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 142 graph->setFrameStyle( QFrame::Panel | QFrame::Sunken );
144 vb->addWidget( graph, 1 ); 143 vb->addWidget( graph, 1 );
145 graph->setData( data ); 144 graph->setData( data );
146 145
147 legend = new GraphLegend( this ); 146 legend = new GraphLegend( this );
148 legend->setOrientation(Horizontal); 147 legend->setOrientation(Horizontal);
149 vb->addWidget( legend ); 148 vb->addWidget( legend );
150 legend->setData( data ); 149 legend->setData( data );
151 150
152 updateData(); 151 updateData();
153} 152}
154 153
155MountInfo::~MountInfo() 154MountInfo::~MountInfo()
156{ 155{
157 delete data; 156 delete data;
158} 157}
159 158
160void MountInfo::updateData() 159void MountInfo::updateData()
161{ 160{
162 long mult = fs->blockSize() / 1024; 161 long mult = fs->blockSize() / 1024;
163 long div = 1024 / fs->blockSize(); 162 long div = 1024 / fs->blockSize();
164 if ( !mult ) mult = 1; 163 if ( !mult ) mult = 1;
165 if ( !div ) div = 1; 164 if ( !div ) div = 1;
166 long total = fs->totalBlocks() * mult / div; 165 long total = fs->totalBlocks() * mult / div;
167 long avail = fs->availBlocks() * mult / div; 166 long avail = fs->availBlocks() * mult / div;
168 long used = total - avail; 167 long used = total - avail;
169 totalSize->setText( title + tr(" : %1 kB").arg( total ) ); 168 totalSize->setText( title + tr(" : %1 kB").arg( total ) );
170 data->clear(); 169 data->clear();
171 data->addItem( tr("Used (%1 kB)").arg(used), used ); 170 data->addItem( tr("Used (%1 kB)").arg(used), used );
172 data->addItem( tr("Available (%1 kB)").arg(avail), avail ); 171 data->addItem( tr("Available (%1 kB)").arg(avail), avail );
173 graph->repaint( FALSE ); 172 graph->repaint( FALSE );
174 legend->update(); 173 legend->update();
175 graph->show(); 174 graph->show();
176 legend->show(); 175 legend->show();
177} 176}
178 177
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 1984823..c44a05a 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,175 +1,171 @@
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 <qpe/resource.h> 21#include <qpe/resource.h>
22#include <qpe/version.h> 22#include <qpe/version.h>
23 23
24#include <qfile.h> 24#include <qfile.h>
25#include <qimage.h>
26#include <qlabel.h> 25#include <qlabel.h>
27#include <qlayout.h> 26#include <qlayout.h>
28#include <qpixmap.h>
29#include <qpainter.h>
30#include <qscrollview.h> 27#include <qscrollview.h>
31#include <qtextstream.h> 28#include <qtextstream.h>
32#include <qtimer.h>
33#include <qwhatsthis.h> 29#include <qwhatsthis.h>
34 30
35#include "versioninfo.h" 31#include "versioninfo.h"
36 32
37#include <opie/odevice.h> 33#include <opie/odevice.h>
38 34
39using namespace Opie; 35using namespace Opie;
40 36
41VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 37VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
42 : QWidget( parent, name, f ) 38 : QWidget( parent, name, f )
43{ 39{
44 setMinimumSize( 200, 150 ); 40 setMinimumSize( 200, 150 );
45 41
46 QVBoxLayout *tmpvb = new QVBoxLayout( this ); 42 QVBoxLayout *tmpvb = new QVBoxLayout( this );
47 QScrollView *sv = new QScrollView( this ); 43 QScrollView *sv = new QScrollView( this );
48 tmpvb->addWidget( sv, 0, 0 ); 44 tmpvb->addWidget( sv, 0, 0 );
49 sv->setResizePolicy( QScrollView::AutoOneFit ); 45 sv->setResizePolicy( QScrollView::AutoOneFit );
50 sv->setFrameStyle( QFrame::NoFrame ); 46 sv->setFrameStyle( QFrame::NoFrame );
51 QWidget *container = new QWidget( sv->viewport() ); 47 QWidget *container = new QWidget( sv->viewport() );
52 sv->addChild( container ); 48 sv->addChild( container );
53 49
54 QVBoxLayout *vb = new QVBoxLayout( container, 3 ); 50 QVBoxLayout *vb = new QVBoxLayout( container, 3 );
55 51
56 QString kernelVersionString; 52 QString kernelVersionString;
57 QFile file( "/proc/version" ); 53 QFile file( "/proc/version" );
58 if ( file.open( IO_ReadOnly ) ) 54 if ( file.open( IO_ReadOnly ) )
59 { 55 {
60 QTextStream t( &file ); 56 QTextStream t( &file );
61 QString v; 57 QStringList strList;
62 t >> v; t >> v; t >> v; 58
63 v = v.left( 20 ); 59 strList = QStringList::split( " " , t.read(), false );
60
64 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " ); 61 kernelVersionString = "<qt>" + tr( "<b>Linux Kernel</b><p>Version: " );
65 kernelVersionString.append( v ); 62 kernelVersionString.append( strList[2] );
66 kernelVersionString.append( "<br>" ); 63 kernelVersionString.append( "<br>" );
67 t >> v;
68 kernelVersionString.append( tr( "Compiled by: " ) ); 64 kernelVersionString.append( tr( "Compiled by: " ) );
69 kernelVersionString.append( v ); 65 kernelVersionString.append( strList[3] );
70 kernelVersionString.append("</qt>"); 66 kernelVersionString.append("</qt>");
71 file.close(); 67 file.close();
72 } 68 }
73 69
74 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " ); 70 QString palmtopVersionString = "<qt>" + tr( "<b>Opie</b><p>Version: " );
75 palmtopVersionString.append( QPE_VERSION ); 71 palmtopVersionString.append( QPE_VERSION );
76 palmtopVersionString.append( "<br>" ); 72 palmtopVersionString.append( "<br>" );
77#ifdef QPE_VENDOR 73#ifdef QPE_VENDOR
78 QString builder = QPE_VENDOR; 74 QString builder = QPE_VENDOR;
79#else 75#else
80 QString builder = "Unknown"; 76 QString builder = "Unknown";
81#endif 77#endif
82 palmtopVersionString.append( tr( "Compiled by: " ) ); 78 palmtopVersionString.append( tr( "Compiled by: " ) );
83 palmtopVersionString.append( builder ); 79 palmtopVersionString.append( builder );
84 palmtopVersionString.append( "<br>" ); 80 palmtopVersionString.append( "<br>" );
85 palmtopVersionString.append( tr( "Built on: " ) ); 81 palmtopVersionString.append( tr( "Built on: " ) );
86 palmtopVersionString.append( __DATE__ ); 82 palmtopVersionString.append( __DATE__ );
87 palmtopVersionString.append( "</qt>" ); 83 palmtopVersionString.append( "</qt>" );
88 84
89 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 85 QHBoxLayout *hb1 = new QHBoxLayout( vb );
90 hb1->setSpacing( 2 ); 86 hb1->setSpacing( 2 );
91 87
92 QLabel *palmtopLogo = new QLabel( container ); 88 QLabel *palmtopLogo = new QLabel( container );
93 QImage logo1 = Resource::loadImage( "logo/opielogo" ); 89 QImage logo1 = Resource::loadImage( "logo/opielogo" );
94 logo1 = logo1.smoothScale( 50, 55 ); 90 logo1 = logo1.smoothScale( 50, 55 );
95 QPixmap logo1Pixmap; 91 QPixmap logo1Pixmap;
96 logo1Pixmap.convertFromImage( logo1 ); 92 logo1Pixmap.convertFromImage( logo1 );
97 palmtopLogo->setPixmap( logo1Pixmap ); 93 palmtopLogo->setPixmap( logo1Pixmap );
98 palmtopLogo->setFixedSize( 60, 60 ); 94 palmtopLogo->setFixedSize( 60, 60 );
99 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 95 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
100 96
101 QLabel *palmtopVersion = new QLabel( container ); 97 QLabel *palmtopVersion = new QLabel( container );
102 palmtopVersion->setText( palmtopVersionString ); 98 palmtopVersion->setText( palmtopVersionString );
103 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 99 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
104 100
105 101
106 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 102 QHBoxLayout *hb2 = new QHBoxLayout( vb );
107 hb1->setSpacing( 2 ); 103 hb1->setSpacing( 2 );
108 104
109 QLabel *linuxLogo = new QLabel( container ); 105 QLabel *linuxLogo = new QLabel( container );
110 QImage logo2 = Resource::loadImage( "logo/tux-logo" ); 106 QImage logo2 = Resource::loadImage( "logo/tux-logo" );
111 logo2 = logo2.smoothScale( 55, 60 ); 107 logo2 = logo2.smoothScale( 55, 60 );
112 QPixmap logo2Pixmap; 108 QPixmap logo2Pixmap;
113 logo2Pixmap.convertFromImage( logo2 ); 109 logo2Pixmap.convertFromImage( logo2 );
114 linuxLogo->setPixmap( logo2Pixmap ); 110 linuxLogo->setPixmap( logo2Pixmap );
115 linuxLogo->setFixedSize( 60, 60 ); 111 linuxLogo->setFixedSize( 60, 60 );
116 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 112 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
117 113
118 QLabel *kernelVersion = new QLabel( container ); 114 QLabel *kernelVersion = new QLabel( container );
119 kernelVersion->setText( kernelVersionString ); 115 kernelVersion->setText( kernelVersionString );
120 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 116 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
121 117
122 118
123 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 119 QHBoxLayout *hb3 = new QHBoxLayout( vb );
124 hb3->setSpacing( 2 ); 120 hb3->setSpacing( 2 );
125 121
126 QLabel *palmtopLogo3 = new QLabel( container ); 122 QLabel *palmtopLogo3 = new QLabel( container );
127 123
128 OModel model = ODevice::inst()->model(); 124 OModel model = ODevice::inst()->model();
129 QString modelPixmap = "sysinfo/"; 125 QString modelPixmap = "sysinfo/";
130 if ( model == Model_Zaurus_SLC7x0 ) 126 if ( model == Model_Zaurus_SLC7x0 )
131 modelPixmap += "zaurusc700"; 127 modelPixmap += "zaurusc700";
132 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 ) 128 else if ( model >= Model_Zaurus_SL5000 && model <= Model_Zaurus_SLB600 )
133 modelPixmap += "zaurus5500"; 129 modelPixmap += "zaurus5500";
134 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx ) 130 else if ( model >= Model_iPAQ_H31xx && model <= Model_iPAQ_H5xxx )
135 modelPixmap += "ipaq3600"; 131 modelPixmap += "ipaq3600";
136 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus ) 132 else if ( model >= Model_SIMpad_CL4 && model <= Model_SIMpad_TSinus )
137 modelPixmap += "simpad"; 133 modelPixmap += "simpad";
138 else 134 else
139 modelPixmap += "pda"; 135 modelPixmap += "pda";
140 136
141 QImage logo3 = Resource::loadImage( modelPixmap ); 137 QImage logo3 = Resource::loadImage( modelPixmap );
142 138
143 int width = logo3.width(); 139 int width = logo3.width();
144 int height = logo3.height(); 140 int height = logo3.height();
145 float aspect = float( height ) / width; 141 float aspect = float( height ) / width;
146 logo3 = logo3.smoothScale( 50, 50.0 * aspect ); 142 logo3 = logo3.smoothScale( 50, 50.0 * aspect );
147 143
148 QPixmap logo3Pixmap; 144 QPixmap logo3Pixmap;
149 logo3Pixmap.convertFromImage( logo3 ); 145 logo3Pixmap.convertFromImage( logo3 );
150 palmtopLogo3->setPixmap( logo3Pixmap ); 146 palmtopLogo3->setPixmap( logo3Pixmap );
151 palmtopLogo3->setFixedSize( 60, 100 ); 147 palmtopLogo3->setFixedSize( 60, 100 );
152 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 148 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
153 149
154 QString systemString = "<qt><b>"; 150 QString systemString = "<qt><b>";
155 systemString.append( ODevice::inst()->systemString() ); 151 systemString.append( ODevice::inst()->systemString() );
156 systemString.append( "</b>" ); 152 systemString.append( "</b>" );
157 systemString.append( tr( "<p>Version: " ) ); 153 systemString.append( tr( "<p>Version: " ) );
158 systemString.append( ODevice::inst()->systemVersionString() ); 154 systemString.append( ODevice::inst()->systemVersionString() );
159 systemString.append( tr( "<br>Model: " ) ); 155 systemString.append( tr( "<br>Model: " ) );
160 systemString.append( ODevice::inst()->modelString() ); 156 systemString.append( ODevice::inst()->modelString() );
161 systemString.append( tr( "<br>Vendor: " ) ); 157 systemString.append( tr( "<br>Vendor: " ) );
162 systemString.append( ODevice::inst()->vendorString() ); 158 systemString.append( ODevice::inst()->vendorString() );
163 systemString.append("</qt>"); 159 systemString.append("</qt>");
164 160
165 QLabel *systemVersion = new QLabel( container ); 161 QLabel *systemVersion = new QLabel( container );
166 systemVersion->setText( systemString ); 162 systemVersion->setText( systemString );
167 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 163 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
168 164
169 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 165 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
170} 166}
171 167
172VersionInfo::~VersionInfo() 168VersionInfo::~VersionInfo()
173{ 169{
174} 170}
175 171