summaryrefslogtreecommitdiff
authordrw <drw>2002-12-20 01:36:55 (UTC)
committer drw <drw>2002-12-20 01:36:55 (UTC)
commit3e556ed5f8c8b1236b9c6155b609930103d17b21 (patch) (side-by-side diff)
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,3 +1,3 @@
/**********************************************************************
-** ModulesDetail
+** Detail
**
@@ -21,29 +21,30 @@
-#ifndef MODULESDETAIL_H
-#define MODULESDETAIL_H
+#include "detail.h"
-#include <qwidget.h>
-#include <qcombo.h>
-#include <qtextview.h>
-#include <qpushbutton.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+#include <qcombobox.h>
+#include <qlayout.h>
#include <qlistview.h>
+#include <qmessagebox.h>
+#include <qpushbutton.h>
+#include <qtextview.h>
+#include <qwhatsthis.h>
-class ModulesDetail : public QWidget
+Detail::Detail( QWidget* parent, const char* name, WFlags )
+ : QWidget( parent, name, WStyle_ContextHelp )
{
- Q_OBJECT
+ QVBoxLayout *layout = new QVBoxLayout( this );
-public:
- ModulesDetail( QWidget* parent, const char* name, WFlags fl );
- ~ModulesDetail();
+ detailView = new QTextView( this );
+ detailView->setTextFormat( PlainText );
- QComboBox* CommandCB;
- QTextView* ModulesView;
- QPushButton* SendButton;
+ layout->addWidget( detailView );
+}
- QString modname;
+Detail::~Detail()
+{
+}
-private slots:
- void slotSendClicked();
-};
-#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
@@ -21,4 +21,4 @@
-#ifndef MODULESDETAIL_H
-#define MODULESDETAIL_H
+#ifndef DETAIL_H
+#define DETAIL_H
@@ -30,3 +30,3 @@
-class ModulesDetail : public QWidget
+class Detail : public QWidget
{
@@ -35,15 +35,8 @@ class ModulesDetail : public QWidget
public:
- ModulesDetail( QWidget* parent, const char* name, WFlags fl );
- ~ModulesDetail();
+ Detail( QWidget * = 0x0, const char * = 0x0, WFlags = 0 );
+ ~Detail();
- QComboBox* CommandCB;
- QTextView* ModulesView;
- QPushButton* SendButton;
-
- QString modname;
-
-private slots:
- void slotSendClicked();
+ QTextView* detailView;
};
-#endif // MODULESDETAIL_H
+#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 @@
-/**********************************************************************
-** ModulesDetail
-**
-** Display module information
-**
-** Copyright (C) 2002, Michael Lauer
-** mickey@tm.informatik.uni-frankfurt.de
-** http://www.Vanille.de
-**
-** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-**********************************************************************/
-
-#include "modulesdetail.h"
-
-#include <sys/types.h>
-#include <stdio.h>
-
-#include <qcombobox.h>
-#include <qlayout.h>
-#include <qlistview.h>
-#include <qmessagebox.h>
-#include <qpushbutton.h>
-#include <qtextview.h>
-#include <qwhatsthis.h>
-
-ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags )
- : QWidget( parent, name, WStyle_ContextHelp )
-{
- modname = "";
-
- QGridLayout *layout = new QGridLayout( this );
- layout->setSpacing( 4 );
- layout->setMargin( 4 );
-
- CommandCB = new QComboBox( FALSE, this, "CommandCB" );
- CommandCB->insertItem( "modprobe -r" );
- CommandCB->insertItem( "rmmod" );
- // I can't think of other useful commands yet. Anyone?
- layout->addWidget( CommandCB, 1, 0 );
- QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command." ) );
-
- ModulesView = new QTextView( this, "ModulesView" );
- layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
- QWhatsThis::add( ModulesView, tr( "This area shows detailed information about this module." ) );
-
- SendButton = new QPushButton( this, "SendButton" );
- SendButton->setMinimumSize( QSize( 50, 24 ) );
- SendButton->setMaximumSize( QSize( 50, 24 ) );
- SendButton->setText( tr( "Send" ) );
- connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
- layout->addWidget( SendButton, 1, 1 );
- QWhatsThis::add( SendButton, tr( "Click here to send the selected command to this module." ) );
-}
-
-ModulesDetail::~ModulesDetail()
-{
-}
-
-void ModulesDetail::slotSendClicked()
-{
- QString command = QString( "/sbin/" )
- + CommandCB->currentText()
- + QString( " " ) + modname;
-
- if ( QMessageBox::warning( this, caption(),
- tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"),
- QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
- == QMessageBox::Yes )
- {
- FILE* stream = popen( command, "r" );
- if ( stream )
- pclose( stream );
- {
- hide();
- }
- }
-
-}
-
-
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
@@ -35,2 +35,3 @@
#include "modulesinfo.h"
+#include "detail.h"
@@ -53,2 +54,10 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
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." ) );
+
+ // Test if we have /sbin/modinfo, and if so, allow module detail window
+ if ( QFile::exists( "/sbin/modinfo" ) )
+ {
+ QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
+ connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
+ this, SLOT( viewModules( QListViewItem * ) ) );
+ }
@@ -72,4 +81,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
t->start( 5000 );
-
+
updateData();
+
+ ModulesDtl = new Detail();
+ QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
}
@@ -116,3 +128,5 @@ void ModulesInfo::slotSendClicked()
- if ( QMessageBox::warning( this, caption(), capstr,
+ QString modname = ModulesView->currentItem()->text( 0 );
+
+ if ( QMessageBox::warning( this, modname, capstr,
QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
@@ -122,3 +136,3 @@ void ModulesInfo::slotSendClicked()
command.append( " " );
- command.append( ModulesView->currentItem()->text( 0 ) );
+ command.append( modname );
@@ -127,5 +141,2 @@ void ModulesInfo::slotSendClicked()
pclose( stream );
- //{
- // hide();
- //}
}
@@ -133 +144,31 @@ void ModulesInfo::slotSendClicked()
}
+
+void ModulesInfo::viewModules( QListViewItem *modules )
+{
+ QString modname = modules->text( 0 );
+ QString capstr = "Module: ";
+ capstr.append( modname );
+ ModulesDtl->setCaption( capstr );
+ QString command = "/sbin/modinfo -nad ";
+ command.append( modname );
+ FILE* modinfo = popen( command, "r" );
+
+ if ( modinfo )
+ {
+ char line[200];
+ ModulesDtl->detailView->setText( " Details:\n------------\n" );
+
+ while( true )
+ {
+ int success = fscanf( modinfo, "%[^\n]\n", line );
+ if ( success == EOF )
+ break;
+ ModulesDtl->detailView->append( line );
+ }
+
+ pclose( modinfo );
+ }
+
+ ModulesDtl->showMaximized();
+}
+
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
@@ -26,4 +26,6 @@
+class Detail;
class QComboBox;
class QListView;
+class QListViewItem;
@@ -37,5 +39,7 @@ public:
private:
- QListView* ModulesView;
+ QListView* ModulesView;
QComboBox* CommandCB;
+ Detail* ModulesDtl;
+
private slots:
@@ -43,2 +47,3 @@ private slots:
void slotSendClicked();
+ void viewModules( QListViewItem * );
};
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 @@
-/**********************************************************************
-** ProcessDetail
-**
-** Display process information
-**
-** Copyright (C) 2002, Dan Williams
-** williamsdr@acm.org
-** http://draknor.net
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-**********************************************************************/
-
-#include "processdetail.h"
-
-#include <sys/types.h>
-#include <signal.h>
-
-#include <qcombobox.h>
-#include <qlayout.h>
-#include <qlistview.h>
-#include <qmessagebox.h>
-#include <qpushbutton.h>
-#include <qtextview.h>
-#include <qwhatsthis.h>
-
-ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags )
- : QWidget( parent, name, WStyle_ContextHelp )
-{
- pid = 0;
-
- QGridLayout *layout = new QGridLayout( this );
- layout->setSpacing( 4 );
- layout->setMargin( 4 );
-
- SignalCB = new QComboBox( FALSE, this, "SignalCB" );
- SignalCB->insertItem( " 1: SIGHUP" );
- SignalCB->insertItem( " 2: SIGINT" );
- SignalCB->insertItem( " 3: SIGQUIT" );
- SignalCB->insertItem( " 5: SIGTRAP" );
- SignalCB->insertItem( " 6: SIGABRT" );
- SignalCB->insertItem( " 9: SIGKILL" );
- SignalCB->insertItem( "14: SIGALRM" );
- SignalCB->insertItem( "15: SIGTERM" );
- SignalCB->insertItem( "18: SIGCONT" );
- SignalCB->insertItem( "19: SIGSTOP" );
- layout->addWidget( SignalCB, 1, 0 );
- QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
-
- ProcessView = new QTextView( this, "ProcessView" );
- layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
- QWhatsThis::add( ProcessView, tr( "This area shows detailed information about this process." ) );
-
- SendButton = new QPushButton( this, "SendButton" );
- SendButton->setMinimumSize( QSize( 50, 24 ) );
- SendButton->setMaximumSize( QSize( 50, 24 ) );
- SendButton->setText( tr( "Send" ) );
- connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
- layout->addWidget( SendButton, 1, 1 );
- QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
-}
-
-ProcessDetail::~ProcessDetail()
-{
-}
-
-void ProcessDetail::slotSendClicked()
-{
- QString sigstr = SignalCB->currentText();
- sigstr.truncate(2);
- int sigid = sigstr.toUInt();
-
- if ( QMessageBox::warning( this, caption(),
- tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?"),
- QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
- == QMessageBox::Yes )
- {
- if ( kill( pid, sigid ) == 0 )
- {
- hide();
- }
- }
-
-}
-
-
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 @@
-/**********************************************************************
-** ProcessDetail
-**
-** Display process information
-**
-** Copyright (C) 2002, Dan Williams
-** williamsdr@acm.org
-** http://draknor.net
-**
-** This file may be distributed and/or modified under the terms of the
-** GNU General Public License version 2 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file.
-**
-** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
-** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-**
-**********************************************************************/
-
-#ifndef PROCESSDETAIL_H
-#define PROCESSDETAIL_H
-
-#include <qwidget.h>
-#include <qcombo.h>
-#include <qtextview.h>
-#include <qpushbutton.h>
-#include <qlistview.h>
-
-class ProcessDetail : public QWidget
-{
- Q_OBJECT
-
-public:
- ProcessDetail( QWidget* parent, const char* name, WFlags fl );
- ~ProcessDetail();
-
- QComboBox* SignalCB;
- QTextView* ProcessView;
- QPushButton* SendButton;
-
- int pid;
-
-private slots:
- void slotSendClicked();
-};
-
-#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
@@ -26,2 +26,3 @@
#include <qlistview.h>
+#include <qmessagebox.h>
#include <qtimer.h>
@@ -29,3 +30,7 @@
+#include <sys/types.h>
+#include <signal.h>
+
#include "processinfo.h"
+#include "detail.h"
@@ -34,3 +39,6 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
{
- QVBoxLayout *layout = new QVBoxLayout( this, 5 );
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 4 );
+ layout->setMargin( 4 );
+
@@ -47,4 +55,26 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
this, SLOT( viewProcess( QListViewItem * ) ) );
- layout->addWidget( ProcessView );
+ layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 );
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." ) );
+
+ SignalCB = new QComboBox( FALSE, this, "SignalCB" );
+ SignalCB->insertItem( " 1: SIGHUP" );
+ SignalCB->insertItem( " 2: SIGINT" );
+ SignalCB->insertItem( " 3: SIGQUIT" );
+ SignalCB->insertItem( " 5: SIGTRAP" );
+ SignalCB->insertItem( " 6: SIGABRT" );
+ SignalCB->insertItem( " 9: SIGKILL" );
+ SignalCB->insertItem( "14: SIGALRM" );
+ SignalCB->insertItem( "15: SIGTERM" );
+ SignalCB->insertItem( "18: SIGCONT" );
+ SignalCB->insertItem( "19: SIGSTOP" );
+ layout->addWidget( SignalCB, 1, 0 );
+ QWhatsThis::add( SignalCB, tr( "Select a signal here and then click the Send button to the right to send to this process." ) );
+
+ SendButton = new QPushButton( this, "SendButton" );
+ SendButton->setMinimumSize( QSize( 50, 24 ) );
+ SendButton->setMaximumSize( QSize( 50, 24 ) );
+ SendButton->setText( tr( "Send" ) );
+ connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
+ layout->addWidget( SendButton, 1, 1 );
+ QWhatsThis::add( SendButton, tr( "Click here to send the selected signal to this process." ) );
@@ -56,4 +86,4 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
- ProcessDtl = new ProcessDetail( 0, 0, 0 );
- ProcessDtl->ProcessView->setTextFormat( RichText );
+ ProcessDtl = new Detail();
+ QWhatsThis::add( ProcessDtl->detailView, tr( "This area shows detailed information about this process." ) );
}
@@ -114,2 +144,24 @@ void ProcessInfo::updateData()
+void ProcessInfo::slotSendClicked()
+{
+ QString capstr = tr( "You really want to send\n" );
+ capstr.append( SignalCB->currentText() );
+ capstr.append( "\nto this process?" );
+
+ QListViewItem *currprocess = ProcessView->currentItem();
+
+ if ( QMessageBox::warning( this, currprocess->text( 1 ), capstr,
+ QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
+ {
+ QString sigstr = SignalCB->currentText();
+ sigstr.truncate(2);
+ int sigid = sigstr.toUInt();
+ if ( kill( currprocess->text( 0 ).stripWhiteSpace().toUInt(), sigid ) == 0 )
+ {
+ hide();
+ }
+ }
+
+}
+
void ProcessInfo::viewProcess( QListViewItem *process )
@@ -119,3 +171,2 @@ void ProcessInfo::viewProcess( QListViewItem *process )
ProcessDtl->setCaption( pid + " - " + command );
- ProcessDtl->pid = pid.toUInt();
FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
@@ -125,6 +176,6 @@ void ProcessInfo::viewProcess( QListViewItem *process )
fgets( line, 81, statfile );
- ProcessDtl->ProcessView->setText( line );
+ ProcessDtl->detailView->setText( line );
while ( fgets( line, 81, statfile ) )
{
- ProcessDtl->ProcessView->append( line );
+ ProcessDtl->detailView->append( line );
}
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
@@ -25,3 +25,6 @@
-#include "processdetail.h"
+class Detail;
+class QComboBox;
+class QListView;
+class QListViewItem;
@@ -34,9 +37,13 @@ public:
+private:
+ QListView* ProcessView;
+ QComboBox* SignalCB;
+ QPushButton* SendButton;
+
+ Detail *ProcessDtl;
+
private slots:
void updateData();
+ void slotSendClicked();
void viewProcess( QListViewItem * );
-
-private:
- QListView* ProcessView;
- ProcessDetail *ProcessDtl;
};
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
@@ -8,4 +8,4 @@ HEADERS = memory.h \
processinfo.h \
- processdetail.h \
modulesinfo.h \
+ detail.h \
versioninfo.h \
@@ -19,3 +19,3 @@ SOURCES = main.cpp \
modulesinfo.cpp \
- processdetail.cpp \
+ detail.cpp \
versioninfo.cpp \