summaryrefslogtreecommitdiff
Side-by-side diff
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,5 +1,5 @@
/**********************************************************************
-** ModulesDetail
+** Detail
**
** Display module information
**
@@ -19,31 +19,32 @@
**
**********************************************************************/
-#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
@@ -19,8 +19,8 @@
**
**********************************************************************/
-#ifndef MODULESDETAIL_H
-#define MODULESDETAIL_H
+#ifndef DETAIL_H
+#define DETAIL_H
#include <qwidget.h>
#include <qcombo.h>
@@ -28,22 +28,15 @@
#include <qpushbutton.h>
#include <qlistview.h>
-class ModulesDetail : public QWidget
+class Detail : public QWidget
{
Q_OBJECT
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
@@ -33,6 +33,7 @@
#include <qwhatsthis.h>
#include "modulesinfo.h"
+#include "detail.h"
ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
@@ -51,6 +52,14 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
ModulesView->setAllColumnsShowFocus( TRUE );
layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
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 * ) ) );
+ }
CommandCB = new QComboBox( FALSE, this );
CommandCB->insertItem( "modprobe -r" );
@@ -70,8 +79,11 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
t->start( 5000 );
-
+
updateData();
+
+ ModulesDtl = new Detail();
+ QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
}
ModulesInfo::~ModulesInfo()
@@ -114,20 +126,49 @@ void ModulesInfo::slotSendClicked()
capstr.append( CommandCB->currentText() );
capstr.append( "\nfor this module?" );
- 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 )
{
QString command = "/sbin/";
command.append( CommandCB->currentText() );
command.append( " " );
- command.append( ModulesView->currentItem()->text( 0 ) );
+ command.append( modname );
FILE* stream = popen( command, "r" );
if ( stream )
pclose( stream );
- //{
- // hide();
- //}
}
}
+
+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
@@ -24,8 +24,10 @@
#include <qwidget.h>
+class Detail;
class QComboBox;
class QListView;
+class QListViewItem;
class ModulesInfo : public QWidget
{
@@ -35,12 +37,15 @@ public:
~ModulesInfo();
private:
- QListView* ModulesView;
+ QListView* ModulesView;
QComboBox* CommandCB;
+ Detail* ModulesDtl;
+
private slots:
void updateData();
void slotSendClicked();
+ void viewModules( QListViewItem * );
};
#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 @@
-/**********************************************************************
-** 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
@@ -24,15 +24,23 @@
#include <qheader.h>
#include <qlayout.h>
#include <qlistview.h>
+#include <qmessagebox.h>
#include <qtimer.h>
#include <qwhatsthis.h>
+#include <sys/types.h>
+#include <signal.h>
+
#include "processinfo.h"
+#include "detail.h"
ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
: QWidget( parent, name, fl )
{
- QVBoxLayout *layout = new QVBoxLayout( this, 5 );
+ QGridLayout *layout = new QGridLayout( this );
+ layout->setSpacing( 4 );
+ layout->setMargin( 4 );
+
ProcessView = new QListView( this, "ProcessView" );
int colnum = ProcessView->addColumn( tr( "PID" ) );
@@ -45,8 +53,30 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
QPEApplication::setStylusOperation( ProcessView->viewport(), QPEApplication::RightOnHold );
connect( ProcessView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
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." ) );
QTimer *t = new QTimer( this );
connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
@@ -54,8 +84,8 @@ ProcessInfo::ProcessInfo( QWidget* parent, const char* name, WFlags fl )
updateData();
- 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." ) );
}
ProcessInfo::~ProcessInfo()
@@ -112,21 +142,42 @@ void ProcessInfo::updateData()
delete procdir;
}
+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 )
{
QString pid= process->text( 0 ).stripWhiteSpace();
QString command = process->text( 1 );
ProcessDtl->setCaption( pid + " - " + command );
- ProcessDtl->pid = pid.toUInt();
FILE *statfile = fopen( ( QString ) ( "/proc/" + pid + "/status"), "r");
if ( statfile )
{
char line[81];
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 );
}
fclose( statfile );
}
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
@@ -23,7 +23,10 @@
#include <qwidget.h>
#include <qlistview.h>
-#include "processdetail.h"
+class Detail;
+class QComboBox;
+class QListView;
+class QListViewItem;
class ProcessInfo : public QWidget
{
@@ -32,13 +35,17 @@ public:
ProcessInfo( QWidget *parent = 0, const char *name = 0, WFlags f = 0 );
~ProcessInfo();
+private:
+ QListView* ProcessView;
+ QComboBox* SignalCB;
+ QPushButton* SendButton;
+
+ Detail *ProcessDtl;
+
private slots:
void updateData();
+ void slotSendClicked();
void viewProcess( QListViewItem * );
-
-private:
- QListView* ProcessView;
- ProcessDetail *ProcessDtl;
};
#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
@@ -6,8 +6,8 @@ HEADERS = memory.h \
load.h \
storage.h \
processinfo.h \
- processdetail.h \
modulesinfo.h \
+ detail.h \
versioninfo.h \
sysinfo.h
SOURCES = main.cpp \
@@ -17,7 +17,7 @@ SOURCES = main.cpp \
storage.cpp \
processinfo.cpp \
modulesinfo.cpp \
- processdetail.cpp \
+ detail.cpp \
versioninfo.cpp \
sysinfo.cpp
INTERFACES =