summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesdetail.cpp12
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp8
-rw-r--r--noncore/settings/sysinfo/processdetail.cpp10
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp9
-rw-r--r--noncore/settings/sysinfo/versioninfo.cpp41
5 files changed, 51 insertions, 29 deletions
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp
index 48d47f6..ea5f352 100644
--- a/noncore/settings/sysinfo/modulesdetail.cpp
+++ b/noncore/settings/sysinfo/modulesdetail.cpp
@@ -1,85 +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#include <qcombobox.h> 27#include <qcombobox.h>
27#include <qpushbutton.h>
28#include <qtextview.h>
29#include <qlayout.h> 28#include <qlayout.h>
30#include <qlistview.h> 29#include <qlistview.h>
31#include <qmessagebox.h> 30#include <qmessagebox.h>
31#include <qpushbutton.h>
32#include <qtextview.h>
33#include <qwhatsthis.h>
32 34
33ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl ) 35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl )
34 : QWidget( parent, name, fl ) 36 : QWidget( parent, name, WStyle_ContextHelp )
35{ 37{
36 modname = ""; 38 modname = "";
37 39
38 QGridLayout *layout = new QGridLayout( this ); 40 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 ); 41 layout->setSpacing( 4 );
40 layout->setMargin( 4 ); 42 layout->setMargin( 4 );
41 43
42 CommandCB = new QComboBox( FALSE, this, "CommandCB" ); 44 CommandCB = new QComboBox( FALSE, this, "CommandCB" );
43 CommandCB->insertItem( "modprobe -r" ); 45 CommandCB->insertItem( "modprobe -r" );
44 CommandCB->insertItem( "rmmod" ); 46 CommandCB->insertItem( "rmmod" );
45 // I can't think of other useful commands yet. Anyone? 47 // I can't think of other useful commands yet. Anyone?
46
47 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." ) );
48 50
49 ModulesView = new QTextView( this, "ModulesView" ); 51 ModulesView = new QTextView( this, "ModulesView" );
50 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." ) );
51 54
52 SendButton = new QPushButton( this, "SendButton" ); 55 SendButton = new QPushButton( this, "SendButton" );
53 SendButton->setMinimumSize( QSize( 50, 24 ) ); 56 SendButton->setMinimumSize( QSize( 50, 24 ) );
54 SendButton->setMaximumSize( QSize( 50, 24 ) ); 57 SendButton->setMaximumSize( QSize( 50, 24 ) );
55 SendButton->setText( tr( "Send" ) ); 58 SendButton->setText( tr( "Send" ) );
56 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 59 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
57 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." ) );
58} 62}
59 63
60ModulesDetail::~ModulesDetail() 64ModulesDetail::~ModulesDetail()
61{ 65{
62} 66}
63 67
64void ModulesDetail::slotSendClicked() 68void ModulesDetail::slotSendClicked()
65{ 69{
66 QString command = QString( "/sbin/" ) 70 QString command = QString( "/sbin/" )
67 + CommandCB->currentText() 71 + CommandCB->currentText()
68 + QString( " " ) + modname; 72 + QString( " " ) + modname;
69 73
70 if ( QMessageBox::warning( this, caption(), 74 if ( QMessageBox::warning( this, caption(),
71 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"), 75 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"),
72 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) 76 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
73 == QMessageBox::Yes ) 77 == QMessageBox::Yes )
74 { 78 {
75 FILE* stream = popen( command, "r" ); 79 FILE* stream = popen( command, "r" );
76 if ( stream ) 80 if ( stream )
77 pclose( stream ); 81 pclose( stream );
78 { 82 {
79 hide(); 83 hide();
80 } 84 }
81 } 85 }
82 86
83} 87}
84 88
85 89
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index 7a32c20..a0d26c7 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -1,120 +1,122 @@
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 <qfile.h>
24#include <qheader.h> 25#include <qheader.h>
25#include <qlistview.h>
26#include <qlayout.h> 26#include <qlayout.h>
27#include <qlistview.h>
27#include <qtimer.h> 28#include <qtimer.h>
28#include <qfile.h> 29#include <qwhatsthis.h>
29 30
30#include "modulesinfo.h" 31#include "modulesinfo.h"
31 32
32ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 33ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
33 : QWidget( parent, name, fl ) 34 : QWidget( parent, name, fl )
34{ 35{
35 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 36 QVBoxLayout *layout = new QVBoxLayout( this, 5 );
36 37
37 ModulesView = new QListView( this, "ModulesView" ); 38 ModulesView = new QListView( this, "ModulesView" );
38 int colnum = ModulesView->addColumn( tr( "Module" ) ); 39 int colnum = ModulesView->addColumn( tr( "Module" ) );
39 colnum = ModulesView->addColumn( tr( "Size" ) ); 40 colnum = ModulesView->addColumn( tr( "Size" ) );
40 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 41 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
41 colnum = ModulesView->addColumn( tr( "Use#" ) ); 42 colnum = ModulesView->addColumn( tr( "Use#" ) );
42 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 43 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
43 colnum = ModulesView->addColumn( tr( "Used By" ) ); 44 colnum = ModulesView->addColumn( tr( "Used By" ) );
44 ModulesView->setAllColumnsShowFocus( TRUE ); 45 ModulesView->setAllColumnsShowFocus( TRUE );
45 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 46 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
46 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 47 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
47 this, SLOT( viewModules( QListViewItem * ) ) ); 48 this, SLOT( viewModules( QListViewItem * ) ) );
48
49 layout->addWidget( ModulesView ); 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." ) );
51
50 QTimer *t = new QTimer( this ); 52 QTimer *t = new QTimer( this );
51 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 53 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
52 t->start( 5000 ); 54 t->start( 5000 );
53 55
54 updateData(); 56 updateData();
55 57
56 ModulesDtl = new ModulesDetail( 0, 0, 0 ); 58 ModulesDtl = new ModulesDetail( 0, 0, 0 );
57 ModulesDtl->ModulesView->setTextFormat( PlainText ); 59 ModulesDtl->ModulesView->setTextFormat( PlainText );
58} 60}
59 61
60ModulesInfo::~ModulesInfo() 62ModulesInfo::~ModulesInfo()
61{ 63{
62} 64}
63 65
64void ModulesInfo::updateData() 66void ModulesInfo::updateData()
65{ 67{
66 char modname[64]; 68 char modname[64];
67 char usage[200]; 69 char usage[200];
68 int modsize, usecount; 70 int modsize, usecount;
69 71
70 ModulesView->clear(); 72 ModulesView->clear();
71 73
72 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); 74 FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r");
73 75
74 if ( procfile ) 76 if ( procfile )
75 { 77 {
76 while ( true ) { 78 while ( true ) {
77 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 79 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
78 80
79 if ( success == EOF ) 81 if ( success == EOF )
80 break; 82 break;
81 83
82 QString qmodname = QString( modname ); 84 QString qmodname = QString( modname );
83 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); 85 QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' );
84 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); 86 QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' );
85 QString qusage = QString( usage ); 87 QString qusage = QString( usage );
86 88
87 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 89 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
88 } 90 }
89 91
90 fclose( procfile ); 92 fclose( procfile );
91 } 93 }
92} 94}
93 95
94void ModulesInfo::viewModules( QListViewItem *modules ) 96void ModulesInfo::viewModules( QListViewItem *modules )
95{ 97{
96 QString modname = modules->text( 0 ); 98 QString modname = modules->text( 0 );
97 ModulesDtl->setCaption( QString( "Module: " ) + modname ); 99 ModulesDtl->setCaption( QString( "Module: " ) + modname );
98 ModulesDtl->modname = modname; 100 ModulesDtl->modname = modname;
99 QString command = QString( "/sbin/modinfo " ) + modules->text( 0 ); 101 QString command = QString( "/sbin/modinfo " ) + modules->text( 0 );
100 102
101 FILE* modinfo = popen( command, "r" ); 103 FILE* modinfo = popen( command, "r" );
102 104
103 if ( modinfo ) 105 if ( modinfo )
104 { 106 {
105 char line[200]; 107 char line[200];
106 ModulesDtl->ModulesView->setText( " Details:\n------------\n" ); 108 ModulesDtl->ModulesView->setText( " Details:\n------------\n" );
107 109
108 while( true ) 110 while( true )
109 { 111 {
110 int success = fscanf( modinfo, "%[^\n]\n", line ); 112 int success = fscanf( modinfo, "%[^\n]\n", line );
111 if ( success == EOF ) 113 if ( success == EOF )
112 break; 114 break;
113 ModulesDtl->ModulesView->append( line ); 115 ModulesDtl->ModulesView->append( line );
114 } 116 }
115 117
116 pclose( modinfo ); 118 pclose( modinfo );
117 } 119 }
118 120
119 ModulesDtl->showMaximized(); 121 ModulesDtl->showMaximized();
120} 122}
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp
index 5c0d335..661e32c 100644
--- a/noncore/settings/sysinfo/processdetail.cpp
+++ b/noncore/settings/sysinfo/processdetail.cpp
@@ -1,88 +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 <qpushbutton.h>
27#include <qtextview.h>
28#include <qlayout.h> 26#include <qlayout.h>
29#include <qlistview.h> 27#include <qlistview.h>
30#include <qmessagebox.h> 28#include <qmessagebox.h>
29#include <qpushbutton.h>
30#include <qtextview.h>
31#include <qwhatsthis.h>
31 32
32ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl ) 33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl )
33 : QWidget( parent, name, fl ) 34 : QWidget( parent, name, WStyle_ContextHelp )
34{ 35{
35 pid = 0; 36 pid = 0;
36 37
37 QGridLayout *layout = new QGridLayout( this ); 38 QGridLayout *layout = new QGridLayout( this );
38 layout->setSpacing( 4 ); 39 layout->setSpacing( 4 );
39 layout->setMargin( 4 ); 40 layout->setMargin( 4 );
40 41
41 SignalCB = new QComboBox( FALSE, this, "SignalCB" ); 42 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
42 SignalCB->insertItem( " 1: SIGHUP" ); 43 SignalCB->insertItem( " 1: SIGHUP" );
43 SignalCB->insertItem( " 2: SIGINT" ); 44 SignalCB->insertItem( " 2: SIGINT" );
44 SignalCB->insertItem( " 3: SIGQUIT" ); 45 SignalCB->insertItem( " 3: SIGQUIT" );
45 SignalCB->insertItem( " 5: SIGTRAP" ); 46 SignalCB->insertItem( " 5: SIGTRAP" );
46 SignalCB->insertItem( " 6: SIGABRT" ); 47 SignalCB->insertItem( " 6: SIGABRT" );
47 SignalCB->insertItem( " 9: SIGKILL" ); 48 SignalCB->insertItem( " 9: SIGKILL" );
48 SignalCB->insertItem( "14: SIGALRM" ); 49 SignalCB->insertItem( "14: SIGALRM" );
49 SignalCB->insertItem( "15: SIGTERM" ); 50 SignalCB->insertItem( "15: SIGTERM" );
50 SignalCB->insertItem( "18: SIGCONT" ); 51 SignalCB->insertItem( "18: SIGCONT" );
51 SignalCB->insertItem( "19: SIGSTOP" ); 52 SignalCB->insertItem( "19: SIGSTOP" );
52 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." ) );
53 55
54 ProcessView = new QTextView( this, "ProcessView" ); 56 ProcessView = new QTextView( this, "ProcessView" );
55 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." ) );
56 59
57 SendButton = new QPushButton( this, "SendButton" ); 60 SendButton = new QPushButton( this, "SendButton" );
58 SendButton->setMinimumSize( QSize( 50, 24 ) ); 61 SendButton->setMinimumSize( QSize( 50, 24 ) );
59 SendButton->setMaximumSize( QSize( 50, 24 ) ); 62 SendButton->setMaximumSize( QSize( 50, 24 ) );
60 SendButton->setText( tr( "Send" ) ); 63 SendButton->setText( tr( "Send" ) );
61 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); 64 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
62 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." ) );
63} 67}
64 68
65ProcessDetail::~ProcessDetail() 69ProcessDetail::~ProcessDetail()
66{ 70{
67} 71}
68 72
69void ProcessDetail::slotSendClicked() 73void ProcessDetail::slotSendClicked()
70{ 74{
71 QString sigstr = SignalCB->currentText(); 75 QString sigstr = SignalCB->currentText();
72 sigstr.truncate(2); 76 sigstr.truncate(2);
73 int sigid = sigstr.toUInt(); 77 int sigid = sigstr.toUInt();
74 78
75 if ( QMessageBox::warning( this, caption(), 79 if ( QMessageBox::warning( this, caption(),
76 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?"),
77 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) 81 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
78 == QMessageBox::Yes ) 82 == QMessageBox::Yes )
79 { 83 {
80 if ( kill( pid, sigid ) == 0 ) 84 if ( kill( pid, sigid ) == 0 )
81 { 85 {
82 hide(); 86 hide();
83 } 87 }
84 } 88 }
85 89
86} 90}
87 91
88 92
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 0512141..86133a9 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -1,133 +1,134 @@
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>
23#include <qfile.h>
22#include <qheader.h> 24#include <qheader.h>
23#include <qlistview.h>
24#include <qlayout.h> 25#include <qlayout.h>
26#include <qlistview.h>
25#include <qtimer.h> 27#include <qtimer.h>
26#include <qfile.h> 28#include <qwhatsthis.h>
27#include <qdir.h>
28 29
29#include "processinfo.h" 30#include "processinfo.h"
30 31
31ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 32ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
32 : QWidget( parent, name, fl ) 33 : QWidget( parent, name, fl )
33{ 34{
34 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 35 QVBoxLayout *layout = new QVBoxLayout( this, 5 );
35 36
36 ProcessView = new QListView( this, "ProcessView" ); 37 ProcessView = new QListView( this, "ProcessView" );
37 int colnum = ProcessView->addColumn( tr( "PID" ) ); 38 int colnum = ProcessView->addColumn( tr( "PID" ) );
38 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 39 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
39 colnum = ProcessView->addColumn( tr( "Command" ),96 ); 40 colnum = ProcessView->addColumn( tr( "Command" ),96 );
40 colnum = ProcessView->addColumn( tr( "Status" ) ); 41 colnum = ProcessView->addColumn( tr( "Status" ) );
41 colnum = ProcessView->addColumn( tr( "Time" ) ); 42 colnum = ProcessView->addColumn( tr( "Time" ) );
42 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 43 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
43 ProcessView->setAllColumnsShowFocus( TRUE ); 44 ProcessView->setAllColumnsShowFocus( TRUE );
44 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 45 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
45 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 46 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
46 this, SLOT( viewProcess( QListViewItem * ) ) ); 47 this, SLOT( viewProcess( QListViewItem * ) ) );
47
48 layout->addWidget( ProcessView ); 48 layout->addWidget( ProcessView );
49 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." ) );
49 50
50 QTimer *t = new QTimer( this ); 51 QTimer *t = new QTimer( this );
51 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 52 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
52 t->start( 5000 ); 53 t->start( 5000 );
53 54
54 updateData(); 55 updateData();
55 56
56 ProcessDtl = new ProcessDetail( 0, 0, 0 ); 57 ProcessDtl = new ProcessDetail( 0, 0, 0 );
57 ProcessDtl->ProcessView->setTextFormat( RichText ); 58 ProcessDtl->ProcessView->setTextFormat( RichText );
58} 59}
59 60
60ProcessInfo::~ProcessInfo() 61ProcessInfo::~ProcessInfo()
61{ 62{
62} 63}
63 64
64void ProcessInfo::updateData() 65void ProcessInfo::updateData()
65{ 66{
66 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime, 67 int pid, ppid, pgrp, session, tty, tpgid, utime, stime, cutime, cstime, counter, priority, starttime,
67 signal, blocked, sigignore, sigcatch; 68 signal, blocked, sigignore, sigcatch;
68 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode, 69 uint flags, minflt, cminflt, majflt, cmajflt, timeout, itrealvalue, vsize, rss, rlim, startcode,
69 endcode, startstack, kstkesp, kstkeip, wchan; 70 endcode, startstack, kstkesp, kstkeip, wchan;
70 char state; 71 char state;
71 char comm[64]; 72 char comm[64];
72 73
73 ProcessView->clear(); 74 ProcessView->clear();
74 75
75 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs); 76 QDir *procdir = new QDir("/proc", 0, QDir::Name, QDir::Dirs);
76 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList())); 77 QFileInfoList *proclist = new QFileInfoList(*(procdir->entryInfoList()));
77 if ( proclist ) 78 if ( proclist )
78 { 79 {
79 QFileInfoListIterator it(*proclist); 80 QFileInfoListIterator it(*proclist);
80 QFileInfo *f; 81 QFileInfo *f;
81 while ( ( f = it.current() ) != 0 ) 82 while ( ( f = it.current() ) != 0 )
82 { 83 {
83 ++it; 84 ++it;
84 QString processnum = f->fileName(); 85 QString processnum = f->fileName();
85 if ( processnum >= "1" && processnum <= "99999" ) 86 if ( processnum >= "1" && processnum <= "99999" )
86 { 87 {
87 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r"); 88 FILE *procfile = fopen( ( QString ) ( "/proc/" + processnum + "/stat"), "r");
88 89
89 if ( procfile ) 90 if ( procfile )
90 { 91 {
91 fscanf( procfile, 92 fscanf( procfile,
92 "%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", 93 "%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",
93 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt, 94 &pid, comm, &state, &ppid, &pgrp, &session,&tty, &tpgid, &flags, &minflt, &cminflt,
94 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout, 95 &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, &counter, &priority, &timeout,
95 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack, 96 &itrealvalue, &starttime, &vsize, &rss, &rlim, &startcode, &endcode, &startstack,
96 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan ); 97 &kstkesp, &kstkeip, &signal, &blocked, &sigignore, &sigcatch, &wchan );
97 processnum = processnum.rightJustify( 5, ' ' ); 98 processnum = processnum.rightJustify( 5, ' ' );
98 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" ); 99 QString processcmd = QString( comm ).replace( QRegExp( "[()]" ), "" );
99 QString processstatus = QChar(state); 100 QString processstatus = QChar(state);
100 QString processtime = QString::number( ( utime + stime ) / 100 ); 101 QString processtime = QString::number( ( utime + stime ) / 100 );
101 processtime = processtime.rightJustify( 9, ' ' ); 102 processtime = processtime.rightJustify( 9, ' ' );
102 fclose( procfile ); 103 fclose( procfile );
103 104
104 ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime ); 105 ( void ) new QListViewItem( ProcessView, processnum, processcmd, processstatus, processtime );
105 } 106 }
106 } 107 }
107 } 108 }
108 } 109 }
109 110
110 delete proclist; 111 delete proclist;
111 delete procdir; 112 delete procdir;
112} 113}
113 114
114void ProcessInfo::viewProcess( QListViewItem *process ) 115void ProcessInfo::viewProcess( QListViewItem *process )
115{ 116{
116 QString pid= process->text( 0 ).stripWhiteSpace(); 117 QString pid= process->text( 0 ).stripWhiteSpace();
117 QString command = process->text( 1 ); 118 QString command = process->text( 1 );
118 ProcessDtl->setCaption( pid + " - " + command ); 119 ProcessDtl->setCaption( pid + " - " + command );
119 ProcessDtl->pid = pid.toUInt(); 120 ProcessDtl->pid = pid.toUInt();
120 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 121 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
121 if ( statfile ) 122 if ( statfile )
122 { 123 {
123 char line[81]; 124 char line[81];
124 fgets( line, 81, statfile ); 125 fgets( line, 81, statfile );
125 ProcessDtl->ProcessView->setText( line ); 126 ProcessDtl->ProcessView->setText( line );
126 while ( fgets( line, 81, statfile ) ) 127 while ( fgets( line, 81, statfile ) )
127 { 128 {
128 ProcessDtl->ProcessView->append( line ); 129 ProcessDtl->ProcessView->append( line );
129 } 130 }
130 fclose( statfile ); 131 fclose( statfile );
131 } 132 }
132 ProcessDtl->showMaximized(); 133 ProcessDtl->showMaximized();
133} 134}
diff --git a/noncore/settings/sysinfo/versioninfo.cpp b/noncore/settings/sysinfo/versioninfo.cpp
index 79e7fea..658f371 100644
--- a/noncore/settings/sysinfo/versioninfo.cpp
+++ b/noncore/settings/sysinfo/versioninfo.cpp
@@ -1,133 +1,144 @@
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> 25#include <qimage.h>
26#include <qlabel.h> 26#include <qlabel.h>
27#include <qlayout.h> 27#include <qlayout.h>
28#include <qpixmap.h> 28#include <qpixmap.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qtextstream.h> 30#include <qtextstream.h>
31#include <qtimer.h> 31#include <qtimer.h>
32#include <qwhatsthis.h> 32#include <qwhatsthis.h>
33 33
34#include "versioninfo.h" 34#include "versioninfo.h"
35 35
36#include <opie/odevice.h> 36#include <opie/odevice.h>
37 37
38using namespace Opie; 38using namespace Opie;
39 39
40VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f ) 40VersionInfo::VersionInfo( QWidget *parent, const char *name, WFlags f )
41 : QWidget( parent, name, f ) 41 : QWidget( parent, name, f )
42{ 42{
43 setMinimumSize( 200, 150 ); 43 setMinimumSize( 200, 150 );
44 44
45 QVBoxLayout *vb = new QVBoxLayout( this, 4 ); 45 QVBoxLayout *vb = new QVBoxLayout( this, 4 );
46 46
47 QString kernelVersionString; 47 QString kernelVersionString;
48 QFile file( "/proc/version" ); 48 QFile file( "/proc/version" );
49 if ( file.open( IO_ReadOnly ) ) { 49 if ( file.open( IO_ReadOnly ) ) {
50 QTextStream t( &file ); 50 QTextStream t( &file );
51 QString v; 51 QString v;
52 t >> v; t >> v; t >> v; 52 t >> v; t >> v; t >> v;
53 v = v.left( 20 ); 53 v = v.left( 20 );
54 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " ) + v + "<p>"; 54 kernelVersionString = tr( "<b>Linux Kernel</b><p>Version: " );
55 kernelVersionString.append( v );
56 kernelVersionString.append( "<p>" );
55 t >> v; 57 t >> v;
56 kernelVersionString += tr( "Compiled by: " ) + v; 58 kernelVersionString.append( tr( "Compiled by: " ) );
59 kernelVersionString.append( v );
57 file.close(); 60 file.close();
58 } 61 }
59 62
60 QString palmtopVersionString; 63 QString palmtopVersionString = tr( "<b>Opie</b><p>Version: " );
61 palmtopVersionString = tr( "<b>Opie</b><p>Version: " ) + QPE_VERSION + "<p>"; 64 palmtopVersionString.append( QPE_VERSION );
65 palmtopVersionString.append( "<p>" );
62#ifdef QPE_VENDOR 66#ifdef QPE_VENDOR
63 QString builder = QPE_VENDOR; 67 QString builder = QPE_VENDOR;
64#else 68#else
65 QString builder = "Unknown"; 69 QString builder = "Unknown";
66#endif 70#endif
67 palmtopVersionString += tr( "Compiled by: " ) + builder + "<p>"; 71 palmtopVersionString.append( tr( "Compiled by: " ) );
68 palmtopVersionString += tr( "Built on: " ) + __DATE__; 72 palmtopVersionString.append( builder );
73 palmtopVersionString.append( "<p>" );
74 palmtopVersionString.append( tr( "Built on: " ) );
75 palmtopVersionString.append( __DATE__ );
76
69 77
70
71 QHBoxLayout *hb1 = new QHBoxLayout( vb ); 78 QHBoxLayout *hb1 = new QHBoxLayout( vb );
72 hb1->setSpacing( 2 ); 79 hb1->setSpacing( 2 );
73 80
74 QLabel *palmtopLogo = new QLabel( this ); 81 QLabel *palmtopLogo = new QLabel( this );
75 QImage logo1 = Resource::loadImage( "logo/opielogo" ); 82 QImage logo1 = Resource::loadImage( "logo/opielogo" );
76 logo1 = logo1.smoothScale( 50, 55 ); 83 logo1 = logo1.smoothScale( 50, 55 );
77 QPixmap logo1Pixmap; 84 QPixmap logo1Pixmap;
78 logo1Pixmap.convertFromImage( logo1 ); 85 logo1Pixmap.convertFromImage( logo1 );
79 palmtopLogo->setPixmap( logo1Pixmap ); 86 palmtopLogo->setPixmap( logo1Pixmap );
80 palmtopLogo->setFixedSize( 60, 60 ); 87 palmtopLogo->setFixedSize( 60, 60 );
81 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 88 hb1->addWidget( palmtopLogo, 0, Qt::AlignTop + Qt::AlignLeft );
82 89
83 QLabel *palmtopVersion = new QLabel( this ); 90 QLabel *palmtopVersion = new QLabel( this );
84 palmtopVersion->setText( palmtopVersionString ); 91 palmtopVersion->setText( palmtopVersionString );
85 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 92 hb1->addWidget( palmtopVersion, 1, Qt::AlignTop + Qt::AlignLeft );
86 93
87 94
88 QHBoxLayout *hb2 = new QHBoxLayout( vb ); 95 QHBoxLayout *hb2 = new QHBoxLayout( vb );
89 hb1->setSpacing( 2 ); 96 hb1->setSpacing( 2 );
90 97
91 QLabel *linuxLogo = new QLabel( this ); 98 QLabel *linuxLogo = new QLabel( this );
92 QImage logo2 = Resource::loadImage( "logo/tux-logo" ); 99 QImage logo2 = Resource::loadImage( "logo/tux-logo" );
93 logo2 = logo2.smoothScale( 55, 60 ); 100 logo2 = logo2.smoothScale( 55, 60 );
94 QPixmap logo2Pixmap; 101 QPixmap logo2Pixmap;
95 logo2Pixmap.convertFromImage( logo2 ); 102 logo2Pixmap.convertFromImage( logo2 );
96 linuxLogo->setPixmap( logo2Pixmap ); 103 linuxLogo->setPixmap( logo2Pixmap );
97 linuxLogo->setFixedSize( 60, 60 ); 104 linuxLogo->setFixedSize( 60, 60 );
98 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft ); 105 hb2->addWidget( linuxLogo, 0, Qt::AlignTop + Qt::AlignLeft );
99 106
100 QLabel *kernelVersion = new QLabel( this ); 107 QLabel *kernelVersion = new QLabel( this );
101 kernelVersion->setText( kernelVersionString ); 108 kernelVersion->setText( kernelVersionString );
102 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 109 hb2->addWidget( kernelVersion, 1, Qt::AlignTop + Qt::AlignLeft );
103 110
104 111
105 QHBoxLayout *hb3 = new QHBoxLayout( vb ); 112 QHBoxLayout *hb3 = new QHBoxLayout( vb );
106 hb3->setSpacing( 2 ); 113 hb3->setSpacing( 2 );
107 114
108 QLabel *palmtopLogo3 = new QLabel( this ); 115 QLabel *palmtopLogo3 = new QLabel( this );
109 QImage logo3 = Resource::loadImage( "SystemInfo" ); 116 QImage logo3 = Resource::loadImage( "SystemInfo" );
110 logo3 = logo3.smoothScale( 50, 55 ); 117 logo3 = logo3.smoothScale( 50, 55 );
111 QPixmap logo3Pixmap; 118 QPixmap logo3Pixmap;
112 logo3Pixmap.convertFromImage( logo3 ); 119 logo3Pixmap.convertFromImage( logo3 );
113 palmtopLogo3->setPixmap( logo3Pixmap ); 120 palmtopLogo3->setPixmap( logo3Pixmap );
114 palmtopLogo3->setFixedSize( 60, 60 ); 121 palmtopLogo3->setFixedSize( 60, 60 );
115 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft ); 122 hb3->addWidget( palmtopLogo3, 0, Qt::AlignTop + Qt::AlignLeft );
116 123
117// QString systemString = tr( "<b>System</b><p>System: ") + ODevice::inst()->systemString() 124 QString systemString = "<b>";
118 QString systemString = "<b>"+ ODevice::inst()->systemString()+"</b>" 125 systemString.append( ODevice::inst()->systemString() );
119 +tr("<p>Version: " ) + ODevice::inst()->systemVersionString() 126 systemString.append( "</b>" );
120 +tr("<p>Model: ") + ODevice::inst()->modelString() 127 systemString.append( tr( "<p>Version: " ) );
121 +tr("<p>Vendor: ") + ODevice::inst()->vendorString(); 128 systemString.append( ODevice::inst()->systemVersionString() );
129 systemString.append( tr( "<p>Model: " ) );
130 systemString.append( ODevice::inst()->modelString() );
131 systemString.append( tr( "<p>Vendor: " ) );
132 systemString.append( ODevice::inst()->vendorString() );
122 133
123 QLabel *systemVersion = new QLabel( this ); 134 QLabel *systemVersion = new QLabel( this );
124 systemVersion->setText( systemString ); 135 systemVersion->setText( systemString );
125 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft ); 136 hb3->addWidget( systemVersion, 1, Qt::AlignTop + Qt::AlignLeft );
126 137
127 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) ); 138 QWhatsThis::add( this, tr( "This page shows the current versions of Opie, the Linux kernel and distribution running on this handheld device." ) );
128} 139}
129 140
130VersionInfo::~VersionInfo() 141VersionInfo::~VersionInfo()
131{ 142{
132} 143}
133 144