summaryrefslogtreecommitdiff
authordrw <drw>2002-12-20 01:36:55 (UTC)
committer drw <drw>2002-12-20 01:36:55 (UTC)
commit3e556ed5f8c8b1236b9c6155b609930103d17b21 (patch) (unidiff)
tree859cc1e4f3097276ab77cac4cff5b24fde26ba11
parent876e1a4724a7bd75dc642e295de354241096e028 (diff)
downloadopie-3e556ed5f8c8b1236b9c6155b609930103d17b21.zip
opie-3e556ed5f8c8b1236b9c6155b609930103d17b21.tar.gz
opie-3e556ed5f8c8b1236b9c6155b609930103d17b21.tar.bz2
1. Added check for /sbin/modinfo, and if exists will display module details again. 2. Combined process and module detail viewers into one common class. 3. Move process signal sending to main process tab.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/detail.cpp (copied from noncore/settings/sysinfo/modulesdetail.h)41
-rw-r--r--noncore/settings/sysinfo/detail.h (renamed from noncore/settings/sysinfo/modulesdetail.h)21
-rw-r--r--noncore/settings/sysinfo/modulesdetail.cpp89
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp53
-rw-r--r--noncore/settings/sysinfo/modulesinfo.h7
-rw-r--r--noncore/settings/sysinfo/processdetail.cpp92
-rw-r--r--noncore/settings/sysinfo/processdetail.h47
-rw-r--r--noncore/settings/sysinfo/processinfo.cpp65
-rw-r--r--noncore/settings/sysinfo/processinfo.h17
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro4
10 files changed, 153 insertions, 283 deletions
diff --git a/noncore/settings/sysinfo/modulesdetail.h b/noncore/settings/sysinfo/detail.cpp
index 5515c4b..2c5fdc4 100644
--- a/noncore/settings/sysinfo/modulesdetail.h
+++ b/noncore/settings/sysinfo/detail.cpp
@@ -1,6 +1,6 @@
1/********************************************************************** 1/**********************************************************************
2** ModulesDetail 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
@@ -18,32 +18,33 @@
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef MODULESDETAIL_H 22#include "detail.h"
23#define MODULESDETAIL_H
24 23
25#include <qwidget.h> 24#include <sys/types.h>
26#include <qcombo.h> 25#include <stdio.h>
27#include <qtextview.h> 26
28#include <qpushbutton.h> 27#include <qcombobox.h>
28#include <qlayout.h>
29#include <qlistview.h> 29#include <qlistview.h>
30#include <qmessagebox.h>
31#include <qpushbutton.h>
32#include <qtextview.h>
33#include <qwhatsthis.h>
30 34
31class ModulesDetail : public QWidget 35Detail::Detail( QWidget* parent, const char* name, WFlags )
36 : QWidget( parent, name, WStyle_ContextHelp )
32{ 37{
33 Q_OBJECT 38 QVBoxLayout *layout = new QVBoxLayout( this );
34 39
35public: 40 detailView = new QTextView( this );
36 ModulesDetail( QWidget* parent, const char* name, WFlags fl ); 41 detailView->setTextFormat( PlainText );
37 ~ModulesDetail();
38 42
39 QComboBox* CommandCB; 43 layout->addWidget( detailView );
40 QTextView* ModulesView; 44}
41 QPushButton* SendButton;
42 45
43 QString modname; 46Detail::~Detail()
47{
48}
44 49
45private slots:
46 void slotSendClicked();
47};
48 50
49#endif // MODULESDETAIL_H
diff --git a/noncore/settings/sysinfo/modulesdetail.h b/noncore/settings/sysinfo/detail.h
index 5515c4b..7ca9d45 100644
--- a/noncore/settings/sysinfo/modulesdetail.h
+++ b/noncore/settings/sysinfo/detail.h
@@ -18,32 +18,25 @@
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19** 19**
20**********************************************************************/ 20**********************************************************************/
21 21
22#ifndef MODULESDETAIL_H 22#ifndef DETAIL_H
23#define MODULESDETAIL_H 23#define DETAIL_H
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qcombo.h> 26#include <qcombo.h>
27#include <qtextview.h> 27#include <qtextview.h>
28#include <qpushbutton.h> 28#include <qpushbutton.h>
29#include <qlistview.h> 29#include <qlistview.h>
30 30
31class ModulesDetail : public QWidget 31class Detail : public QWidget
32{ 32{
33 Q_OBJECT 33 Q_OBJECT
34 34
35public: 35public:
36 ModulesDetail( QWidget* parent, const char* name, WFlags fl ); 36 Detail( QWidget * = 0x0, const char * = 0x0, WFlags = 0 );
37 ~ModulesDetail(); 37 ~Detail();
38 38
39 QComboBox* CommandCB; 39 QTextView* detailView;
40 QTextView* ModulesView;
41 QPushButton* SendButton;
42
43 QString modname;
44
45private slots:
46 void slotSendClicked();
47}; 40};
48 41
49#endif // MODULESDETAIL_H 42#endif // DETAIL_H
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp
deleted file mode 100644
index ea9cdfa..0000000
--- a/noncore/settings/sysinfo/modulesdetail.cpp
+++ b/dev/null
@@ -1,89 +0,0 @@
1/**********************************************************************
2** ModulesDetail
3**
4** Display module information
5**
6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de
9**
10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
11**
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
14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file.
16**
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.
19**
20**********************************************************************/
21
22#include "modulesdetail.h"
23
24#include <sys/types.h>
25#include <stdio.h>
26
27#include <qcombobox.h>
28#include <qlayout.h>
29#include <qlistview.h>
30#include <qmessagebox.h>
31#include <qpushbutton.h>
32#include <qtextview.h>
33#include <qwhatsthis.h>
34
35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags )
36 : QWidget( parent, name, WStyle_ContextHelp )
37{
38 modname = "";
39
40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 );
42 layout->setMargin( 4 );
43
44 CommandCB = new QComboBox( FALSE, this, "CommandCB" );
45 CommandCB->insertItem( "modprobe -r" );
46 CommandCB->insertItem( "rmmod" );
47 // I can't think of other useful commands yet. Anyone?
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." ) );
50
51 ModulesView = new QTextView( this, "ModulesView" );
52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
53 QWhatsThis::add( ModulesView, tr( "This area shows detailed information about this module." ) );
54
55 SendButton = new QPushButton( this, "SendButton" );
56 SendButton->setMinimumSize( QSize( 50, 24 ) );
57 SendButton->setMaximumSize( QSize( 50, 24 ) );
58 SendButton->setText( tr( "Send" ) );
59 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
60 layout->addWidget( SendButton, 1, 1 );
61 QWhatsThis::add( SendButton, tr( "Click here to send the selected command to this module." ) );
62}
63
64ModulesDetail::~ModulesDetail()
65{
66}
67
68void ModulesDetail::slotSendClicked()
69{
70 QString command = QString( "/sbin/" )
71 + CommandCB->currentText()
72 + QString( " " ) + modname;
73
74 if ( QMessageBox::warning( this, caption(),
75 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"),
76 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
77 == QMessageBox::Yes )
78 {
79 FILE* stream = popen( command, "r" );
80 if ( stream )
81 pclose( stream );
82 {
83 hide();
84 }
85 }
86
87}
88
89
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index c558fad..8b58fe9 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -32,8 +32,9 @@
32#include <qtimer.h> 32#include <qtimer.h>
33#include <qwhatsthis.h> 33#include <qwhatsthis.h>
34 34
35#include "modulesinfo.h" 35#include "modulesinfo.h"
36#include "detail.h"
36 37
37ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 38ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
38 : QWidget( parent, name, fl ) 39 : QWidget( parent, name, fl )
39{ 40{
@@ -50,8 +51,16 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
50 colnum = ModulesView->addColumn( tr( "Used By" ) ); 51 colnum = ModulesView->addColumn( tr( "Used By" ) );
51 ModulesView->setAllColumnsShowFocus( TRUE ); 52 ModulesView->setAllColumnsShowFocus( TRUE );
52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 53 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
53 QWhatsThis::add( ModulesView, tr( "This is a list of all the kernel modules currently loaded on this handheld device.\n\nClick and hold on a module to see additional information about the module, or to unload it." ) ); 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." ) );
55
56 // Test if we have /sbin/modinfo, and if so, allow module detail window
57 if ( QFile::exists( "/sbin/modinfo" ) )
58 {
59 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
60 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
61 this, SLOT( viewModules( QListViewItem * ) ) );
62 }
54 63
55 CommandCB = new QComboBox( FALSE, this ); 64 CommandCB = new QComboBox( FALSE, this );
56 CommandCB->insertItem( "modprobe -r" ); 65 CommandCB->insertItem( "modprobe -r" );
57 CommandCB->insertItem( "rmmod" ); 66 CommandCB->insertItem( "rmmod" );
@@ -69,10 +78,13 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
69 78
70 QTimer *t = new QTimer( this ); 79 QTimer *t = new QTimer( this );
71 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 80 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
72 t->start( 5000 ); 81 t->start( 5000 );
73 82
74 updateData(); 83 updateData();
84
85 ModulesDtl = new Detail();
86 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
75} 87}
76 88
77ModulesInfo::~ModulesInfo() 89ModulesInfo::~ModulesInfo()
78{ 90{
@@ -113,21 +125,50 @@ void ModulesInfo::slotSendClicked()
113 QString capstr = tr( "You really want to execute\n" ); 125 QString capstr = tr( "You really want to execute\n" );
114 capstr.append( CommandCB->currentText() ); 126 capstr.append( CommandCB->currentText() );
115 capstr.append( "\nfor this module?" ); 127 capstr.append( "\nfor this module?" );
116 128
117 if ( QMessageBox::warning( this, caption(), capstr, 129 QString modname = ModulesView->currentItem()->text( 0 );
130
131 if ( QMessageBox::warning( this, modname, capstr,
118 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 132 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
119 { 133 {
120 QString command = "/sbin/"; 134 QString command = "/sbin/";
121 command.append( CommandCB->currentText() ); 135 command.append( CommandCB->currentText() );
122 command.append( " " ); 136 command.append( " " );
123 command.append( ModulesView->currentItem()->text( 0 ) ); 137 command.append( modname );
124 138
125 FILE* stream = popen( command, "r" ); 139 FILE* stream = popen( command, "r" );
126 if ( stream ) 140 if ( stream )
127 pclose( stream ); 141 pclose( stream );
128 //{
129 // hide();
130 //}
131 } 142 }
132 143
133} 144}
145
146void ModulesInfo::viewModules( QListViewItem *modules )
147{
148 QString modname = modules->text( 0 );
149 QString capstr = "Module: ";
150 capstr.append( modname );
151 ModulesDtl->setCaption( capstr );
152 QString command = "/sbin/modinfo -nad ";
153 command.append( modname );
154 FILE* modinfo = popen( command, "r" );
155
156 if ( modinfo )
157 {
158 char line[200];
159 ModulesDtl->detailView->setText( " Details:\n------------\n" );
160
161 while( true )
162 {
163 int success = fscanf( modinfo, "%[^\n]\n", line );
164 if ( success == EOF )
165 break;
166 ModulesDtl->detailView->append( line );
167 }
168
169 pclose( modinfo );
170 }
171
172 ModulesDtl->showMaximized();
173}
174
diff --git a/noncore/settings/sysinfo/modulesinfo.h b/noncore/settings/sysinfo/modulesinfo.h
index ef1f805..e974610 100644
--- a/noncore/settings/sysinfo/modulesinfo.h
+++ b/noncore/settings/sysinfo/modulesinfo.h
@@ -23,10 +23,12 @@
23#define MODULESINFO_H 23#define MODULESINFO_H
24 24
25#include <qwidget.h> 25#include <qwidget.h>
26 26
27class Detail;
27class QComboBox; 28class QComboBox;
28class QListView; 29class QListView;
30class QListViewItem;
29 31
30class ModulesInfo : public QWidget 32class ModulesInfo : public QWidget
31{ 33{
32 Q_OBJECT 34 Q_OBJECT
@@ -34,13 +36,16 @@ public:
34 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 36 ModulesInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
35 ~ModulesInfo(); 37 ~ModulesInfo();
36 38
37private: 39private:
38 QListView* ModulesView; 40 QListView* ModulesView;
39 QComboBox* CommandCB; 41 QComboBox* CommandCB;
40 42
43 Detail* ModulesDtl;
44
41private slots: 45private slots:
42 void updateData(); 46 void updateData();
43 void slotSendClicked(); 47 void slotSendClicked();
48 void viewModules( QListViewItem * );
44}; 49};
45 50
46#endif 51#endif
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp
deleted file mode 100644
index fcb871f..0000000
--- a/noncore/settings/sysinfo/processdetail.cpp
+++ b/dev/null
@@ -1,92 +0,0 @@
1/**********************************************************************
2** ProcessDetail
3**
4** Display process information
5**
6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org
8** http://draknor.net
9**
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
12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file.
14**
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.
17**
18**********************************************************************/
19
20#include "processdetail.h"
21
22#include <sys/types.h>
23#include <signal.h>
24
25#include <qcombobox.h>
26#include <qlayout.h>
27#include <qlistview.h>
28#include <qmessagebox.h>
29#include <qpushbutton.h>
30#include <qtextview.h>
31#include <qwhatsthis.h>
32
33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags )
34 : QWidget( parent, name, WStyle_ContextHelp )
35{
36 pid = 0;
37
38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 );
40 layout->setMargin( 4 );
41
42 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
43 SignalCB->insertItem( " 1: SIGHUP" );
44 SignalCB->insertItem( " 2: SIGINT" );
45 SignalCB->insertItem( " 3: SIGQUIT" );
46 SignalCB->insertItem( " 5: SIGTRAP" );
47 SignalCB->insertItem( " 6: SIGABRT" );
48 SignalCB->insertItem( " 9: SIGKILL" );
49 SignalCB->insertItem( "14: SIGALRM" );
50 SignalCB->insertItem( "15: SIGTERM" );
51 SignalCB->insertItem( "18: SIGCONT" );
52 SignalCB->insertItem( "19: SIGSTOP" );
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." ) );
55
56 ProcessView = new QTextView( this, "ProcessView" );
57 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
58 QWhatsThis::add( ProcessView, tr( "This area shows detailed information about this process." ) );
59
60 SendButton = new QPushButton( this, "SendButton" );
61 SendButton->setMinimumSize( QSize( 50, 24 ) );
62 SendButton->setMaximumSize( QSize( 50, 24 ) );
63 SendButton->setText( tr( "Send" ) );
64 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
65 layout->addWidget( SendButton, 1, 1 );
66 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
67}
68
69ProcessDetail::~ProcessDetail()
70{
71}
72
73void ProcessDetail::slotSendClicked()
74{
75 QString sigstr = SignalCB->currentText();
76 sigstr.truncate(2);
77 int sigid = sigstr.toUInt();
78
79 if ( QMessageBox::warning( this, caption(),
80 tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"),
81 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
82 == QMessageBox::Yes )
83 {
84 if ( kill( pid, sigid ) == 0 )
85 {
86 hide();
87 }
88 }
89
90}
91
92
diff --git a/noncore/settings/sysinfo/processdetail.h b/noncore/settings/sysinfo/processdetail.h
deleted file mode 100644
index 22e196f..0000000
--- a/noncore/settings/sysinfo/processdetail.h
+++ b/dev/null
@@ -1,47 +0,0 @@
1/**********************************************************************
2** ProcessDetail
3**
4** Display process information
5**
6** Copyright (C) 2002, Dan Williams
7** williamsdr@acm.org
8** http://draknor.net
9**
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
12** Foundation and appearing in the file LICENSE.GPL included in the
13** packaging of this file.
14**
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.
17**
18**********************************************************************/
19
20#ifndef PROCESSDETAIL_H
21#define PROCESSDETAIL_H
22
23#include <qwidget.h>
24#include <qcombo.h>
25#include <qtextview.h>
26#include <qpushbutton.h>
27#include <qlistview.h>
28
29class ProcessDetail : public QWidget
30{
31 Q_OBJECT
32
33public:
34 ProcessDetail( QWidget* parent, const char* name, WFlags fl );
35 ~ProcessDetail();
36
37 QComboBox* SignalCB;
38 QTextView* ProcessView;
39 QPushButton* SendButton;
40
41 int pid;
42
43private slots:
44 void slotSendClicked();
45};
46
47#endif // PROCESSDETAIL_H
diff --git a/noncore/settings/sysinfo/processinfo.cpp b/noncore/settings/sysinfo/processinfo.cpp
index 86133a9..35d7ba1 100644
--- a/noncore/settings/sysinfo/processinfo.cpp
+++ b/noncore/settings/sysinfo/processinfo.cpp
@@ -23,17 +23,25 @@
23#include <qfile.h> 23#include <qfile.h>
24#include <qheader.h> 24#include <qheader.h>
25#include <qlayout.h> 25#include <qlayout.h>
26#include <qlistview.h> 26#include <qlistview.h>
27#include <qmessagebox.h>
27#include <qtimer.h> 28#include <qtimer.h>
28#include <qwhatsthis.h> 29#include <qwhatsthis.h>
29 30
31#include <sys/types.h>
32#include <signal.h>
33
30#include "processinfo.h" 34#include "processinfo.h"
35#include "detail.h"
31 36
32ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl ) 37ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
33 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, fl )
34{ 39{
35 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 );
42 layout->setMargin( 4 );
43
36 44
37 ProcessView = new QListView( this, "ProcessView" ); 45 ProcessView = new QListView( this, "ProcessView" );
38 int colnum = ProcessView->addColumn( tr( "PID" ) ); 46 int colnum = ProcessView->addColumn( tr( "PID" ) );
39 ProcessView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ProcessView->setColumnAlignment( colnum, Qt::AlignRight );
@@ -44,19 +52,41 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
44 ProcessView->setAllColumnsShowFocus( TRUE ); 52 ProcessView->setAllColumnsShowFocus( TRUE );
45 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold ); 53 QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
46 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ), 54 connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
47 this, SLOT( viewProcess( QListViewItem * ) ) ); 55 this, SLOT( viewProcess( QListViewItem * ) ) );
48 layout->addWidget( ProcessView ); 56 layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
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." ) ); 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." ) );
58
59 SignalCB = new QComboBox( FALSE, this, "SignalCB" );
60 SignalCB->insertItem( " 1: SIGHUP" );
61 SignalCB->insertItem( " 2: SIGINT" );
62 SignalCB->insertItem( " 3: SIGQUIT" );
63 SignalCB->insertItem( " 5: SIGTRAP" );
64 SignalCB->insertItem( " 6: SIGABRT" );
65 SignalCB->insertItem( " 9: SIGKILL" );
66 SignalCB->insertItem( "14: SIGALRM" );
67 SignalCB->insertItem( "15: SIGTERM" );
68 SignalCB->insertItem( "18: SIGCONT" );
69 SignalCB->insertItem( "19: SIGSTOP" );
70 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." ) );
72
73 SendButton = new QPushButton( this, "SendButton" );
74 SendButton->setMinimumSize( QSize( 50, 24 ) );
75 SendButton->setMaximumSize( QSize( 50, 24 ) );
76 SendButton->setText( tr( "Send" ) );
77 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
78 layout->addWidget( SendButton, 1, 1 );
79 QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
50 80
51 QTimer *t = new QTimer( this ); 81 QTimer *t = new QTimer( this );
52 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 82 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
53 t->start( 5000 ); 83 t->start( 5000 );
54 84
55 updateData(); 85 updateData();
56 86
57 ProcessDtl = new ProcessDetail( 0, 0, 0 ); 87 ProcessDtl = new Detail();
58 ProcessDtl->ProcessView->setTextFormat( RichText ); 88 QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
59} 89}
60 90
61ProcessInfo::~ProcessInfo() 91ProcessInfo::~ProcessInfo()
62{ 92{
@@ -111,23 +141,44 @@ void ProcessInfo::updateData()
111 delete proclist; 141 delete proclist;
112 delete procdir; 142 delete procdir;
113} 143}
114 144
145void ProcessInfo::slotSendClicked()
146{
147 QString capstr = tr( "You really want to send\n" );
148 capstr.append( SignalCB->currentText() );
149 capstr.append( "\nto this process?" );
150
151 QListViewItem *currprocess = ProcessView->currentItem();
152
153 if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
154 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
155 {
156 QString sigstr = SignalCB->currentText();
157 sigstr.truncate(2);
158 int sigid = sigstr.toUInt();
159 if ( kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ) == 0 )
160 {
161 hide();
162 }
163 }
164
165}
166
115void ProcessInfo::viewProcess( QListViewItem *process ) 167void ProcessInfo::viewProcess( QListViewItem *process )
116{ 168{
117 QString pid= process->text( 0 ).stripWhiteSpace(); 169 QString pid= process->text( 0 ).stripWhiteSpace();
118 QString command = process->text( 1 ); 170 QString command = process->text( 1 );
119 ProcessDtl->setCaption( pid + " - " + command ); 171 ProcessDtl->setCaption( pid + " - " + command );
120 ProcessDtl->pid = pid.toUInt();
121 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r"); 172 FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
122 if ( statfile ) 173 if ( statfile )
123 { 174 {
124 char line[81]; 175 char line[81];
125 fgets( line, 81, statfile ); 176 fgets( line, 81, statfile );
126 ProcessDtl->ProcessView->setText( line ); 177 ProcessDtl->detailView->setText( line );
127 while ( fgets( line, 81, statfile ) ) 178 while ( fgets( line, 81, statfile ) )
128 { 179 {
129 ProcessDtl->ProcessView->append( line ); 180 ProcessDtl->detailView->append( line );
130 } 181 }
131 fclose( statfile ); 182 fclose( statfile );
132 } 183 }
133 ProcessDtl->showMaximized(); 184 ProcessDtl->showMaximized();
diff --git a/noncore/settings/sysinfo/processinfo.h b/noncore/settings/sysinfo/processinfo.h
index 24b190e..687e080 100644
--- a/noncore/settings/sysinfo/processinfo.h
+++ b/noncore/settings/sysinfo/processinfo.h
@@ -22,23 +22,30 @@
22 22
23#include <qwidget.h> 23#include <qwidget.h>
24#include <qlistview.h> 24#include <qlistview.h>
25 25
26#include "processdetail.h" 26class Detail;
27class QComboBox;
28class QListView;
29class QListViewItem;
27 30
28class ProcessInfo : public QWidget 31class ProcessInfo : public QWidget
29{ 32{
30 Q_OBJECT 33 Q_OBJECT
31public: 34public:
32 ProcessInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 ); 35 ProcessInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
33 ~ProcessInfo(); 36 ~ProcessInfo();
34 37
38private:
39 QListView* ProcessView;
40 QComboBox* SignalCB;
41 QPushButton* SendButton;
42
43 Detail *ProcessDtl;
44
35private slots: 45private slots:
36 void updateData(); 46 void updateData();
47 void slotSendClicked();
37 void viewProcess( QListViewItem * ); 48 void viewProcess( QListViewItem * );
38
39private:
40 QListView* ProcessView;
41 ProcessDetail *ProcessDtl;
42}; 49};
43 50
44#endif 51#endif
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index 7e66451..b6217c3 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -5,10 +5,10 @@ HEADERS = memory.h \
5 graph.h \ 5 graph.h \
6 load.h \ 6 load.h \
7 storage.h \ 7 storage.h \
8 processinfo.h \ 8 processinfo.h \
9 processdetail.h \
10 modulesinfo.h \ 9 modulesinfo.h \
10 detail.h \
11 versioninfo.h \ 11 versioninfo.h \
12 sysinfo.h 12 sysinfo.h
13SOURCES = main.cpp \ 13SOURCES = main.cpp \
14 memory.cpp \ 14 memory.cpp \
@@ -16,9 +16,9 @@ SOURCES = main.cpp \
16 load.cpp \ 16 load.cpp \
17 storage.cpp \ 17 storage.cpp \
18 processinfo.cpp \ 18 processinfo.cpp \
19 modulesinfo.cpp \ 19 modulesinfo.cpp \
20 processdetail.cpp \ 20 detail.cpp \
21 versioninfo.cpp \ 21 versioninfo.cpp \
22 sysinfo.cpp 22 sysinfo.cpp
23INTERFACES = 23INTERFACES =
24INCLUDEPATH += $(OPIEDIR)/include 24INCLUDEPATH += $(OPIEDIR)/include