summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/load.cpp2
-rw-r--r--noncore/settings/sysinfo/memory.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesdetail.cpp2
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp83
-rw-r--r--noncore/settings/sysinfo/modulesinfo.h14
-rw-r--r--noncore/settings/sysinfo/processdetail.cpp2
-rw-r--r--noncore/settings/sysinfo/storage.cpp28
-rw-r--r--noncore/settings/sysinfo/storage.h2
-rw-r--r--noncore/settings/sysinfo/sysinfo.cpp2
-rw-r--r--noncore/settings/sysinfo/sysinfo.pro2
10 files changed, 80 insertions, 59 deletions
diff --git a/noncore/settings/sysinfo/load.cpp b/noncore/settings/sysinfo/load.cpp
index 900b3d3..d9d7a66 100644
--- a/noncore/settings/sysinfo/load.cpp
+++ b/noncore/settings/sysinfo/load.cpp
@@ -130,3 +130,3 @@ Load::Load( QWidget *parent, const char *name, WFlags f )
130 130
131void Load::paintEvent( QPaintEvent *ev ) 131void Load::paintEvent( QPaintEvent * )
132{ 132{
diff --git a/noncore/settings/sysinfo/memory.cpp b/noncore/settings/sysinfo/memory.cpp
index 30d42d5..4f612d8 100644
--- a/noncore/settings/sysinfo/memory.cpp
+++ b/noncore/settings/sysinfo/memory.cpp
@@ -30,3 +30,3 @@
30 30
31MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags f ) 31MemoryInfo::MemoryInfo( QWidget *parent, const char *name, WFlags )
32 : QWidget( parent, name, WStyle_ContextHelp ) 32 : QWidget( parent, name, WStyle_ContextHelp )
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp
index ea5f352..ea9cdfa 100644
--- a/noncore/settings/sysinfo/modulesdetail.cpp
+++ b/noncore/settings/sysinfo/modulesdetail.cpp
@@ -34,3 +34,3 @@
34 34
35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl ) 35ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags )
36 : QWidget( parent, name, WStyle_ContextHelp ) 36 : QWidget( parent, name, WStyle_ContextHelp )
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index a0d26c7..c558fad 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -23,2 +23,3 @@
23 23
24#include <qcombobox.h>
24#include <qfile.h> 25#include <qfile.h>
@@ -27,2 +28,5 @@
27#include <qlistview.h> 28#include <qlistview.h>
29#include <qmessagebox.h>
30#include <qpushbutton.h>
31#include <qstring.h>
28#include <qtimer.h> 32#include <qtimer.h>
@@ -35,5 +39,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
35{ 39{
36 QVBoxLayout *layout = new QVBoxLayout( this, 5 ); 40 QGridLayout *layout = new QGridLayout( this );
41 layout->setSpacing( 4 );
42 layout->setMargin( 4 );
37 43
38 ModulesView = new QListView( this, "ModulesView" ); 44 ModulesView = new QListView( this );
39 int colnum = ModulesView->addColumn( tr( "Module" ) ); 45 int colnum = ModulesView->addColumn( tr( "Module" ) );
@@ -45,8 +51,20 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
45 ModulesView->setAllColumnsShowFocus( TRUE ); 51 ModulesView->setAllColumnsShowFocus( TRUE );
46 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 52 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
47 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
48 this, SLOT( viewModules( QListViewItem * ) ) );
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." ) ); 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." ) );
51 54
55 CommandCB = new QComboBox( FALSE, this );
56 CommandCB->insertItem( "modprobe -r" );
57 CommandCB->insertItem( "rmmod" );
58 // I can't think of other useful commands yet. Anyone?
59 layout->addWidget( CommandCB, 1, 0 );
60 QWhatsThis::add( CommandCB, tr( "Select a command here and then click the Send button to the right to send the command to module selected above." ) );
61
62 QPushButton *btn = new QPushButton( this );
63 btn->setMinimumSize( QSize( 50, 24 ) );
64 btn->setMaximumSize( QSize( 50, 24 ) );
65 btn->setText( tr( "Send" ) );
66 connect( btn, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
67 layout->addWidget( btn, 1, 1 );
68 QWhatsThis::add( btn, tr( "Click here to send the selected command to the module selected above." ) );
69
52 QTimer *t = new QTimer( this ); 70 QTimer *t = new QTimer( this );
@@ -56,5 +74,2 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
56 updateData(); 74 updateData();
57
58 ModulesDtl = new ModulesDetail( 0, 0, 0 );
59 ModulesDtl->ModulesView->setTextFormat( PlainText );
60} 75}
@@ -70,3 +85,3 @@ void ModulesInfo::updateData()
70 int modsize, usecount; 85 int modsize, usecount;
71 86
72 ModulesView->clear(); 87 ModulesView->clear();
@@ -77,5 +92,5 @@ void ModulesInfo::updateData()
77 { 92 {
78 while ( true ) { 93 while ( true ) {
79 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); 94 int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage );
80 95
81 if ( success == EOF ) 96 if ( success == EOF )
@@ -87,6 +102,6 @@ void ModulesInfo::updateData()
87 QString qusage = QString( usage ); 102 QString qusage = QString( usage );
88 103
89 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); 104 ( void ) new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage );
90 } 105 }
91 106
92 fclose( procfile ); 107 fclose( procfile );
@@ -95,28 +110,24 @@ void ModulesInfo::updateData()
95 110
96void ModulesInfo::viewModules( QListViewItem *modules ) 111void ModulesInfo::slotSendClicked()
97{ 112{
98 QString modname = modules->text( 0 ); 113 QString capstr = tr( "You really want to execute\n" );
99 ModulesDtl->setCaption( QString( "Module: " ) + modname ); 114 capstr.append( CommandCB->currentText() );
100 ModulesDtl->modname = modname; 115 capstr.append( "\nfor this module?" );
101 QString command = QString( "/sbin/modinfo " ) + modules->text( 0 ); 116
102 117 if ( QMessageBox::warning( this, caption(), capstr,
103 FILE* modinfo = popen( command, "r" ); 118 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
104
105 if ( modinfo )
106 { 119 {
107 char line[200]; 120 QString command = "/sbin/";
108 ModulesDtl->ModulesView->setText( " Details:\n------------\n" ); 121 command.append( CommandCB->currentText() );
109 122 command.append( " " );
110 while( true ) 123 command.append( ModulesView->currentItem()->text( 0 ) );
111 { 124
112 int success = fscanf( modinfo, "%[^\n]\n", line ); 125 FILE* stream = popen( command, "r" );
113 if ( success == EOF ) 126 if ( stream )
114 break; 127 pclose( stream );
115 ModulesDtl->ModulesView->append( line ); 128 //{
116 } 129 // hide();
117 130 //}
118 pclose( modinfo );
119 } 131 }
120 132
121 ModulesDtl->showMaximized();
122} 133}
diff --git a/noncore/settings/sysinfo/modulesinfo.h b/noncore/settings/sysinfo/modulesinfo.h
index c702f24..ef1f805 100644
--- a/noncore/settings/sysinfo/modulesinfo.h
+++ b/noncore/settings/sysinfo/modulesinfo.h
@@ -25,5 +25,5 @@
25#include <qwidget.h> 25#include <qwidget.h>
26#include <qlistview.h>
27 26
28#include "modulesdetail.h" 27class QComboBox;
28class QListView;
29 29
@@ -36,9 +36,9 @@ public:
36 36
37private slots:
38 void updateData();
39 void viewModules( QListViewItem * );
40
41private: 37private:
42 QListView* ModulesView; 38 QListView* ModulesView;
43 ModulesDetail *ModulesDtl; 39 QComboBox* CommandCB;
40
41private slots:
42 void updateData();
43 void slotSendClicked();
44}; 44};
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp
index 661e32c..fcb871f 100644
--- a/noncore/settings/sysinfo/processdetail.cpp
+++ b/noncore/settings/sysinfo/processdetail.cpp
@@ -32,3 +32,3 @@
32 32
33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags fl ) 33ProcessDetail::ProcessDetail( QWidget* parent, const char* name, WFlags )
34 : QWidget( parent, name, WStyle_ContextHelp ) 34 : QWidget( parent, name, WStyle_ContextHelp )
diff --git a/noncore/settings/sysinfo/storage.cpp b/noncore/settings/sysinfo/storage.cpp
index c33663e..5d6cd1b 100644
--- a/noncore/settings/sysinfo/storage.cpp
+++ b/noncore/settings/sysinfo/storage.cpp
@@ -22,2 +22,3 @@
22#include <qlayout.h> 22#include <qlayout.h>
23#include <qscrollview.h>
23#include <qtimer.h> 24#include <qtimer.h>
@@ -37,4 +38,12 @@ StorageInfo::StorageInfo( QWidget *parent, const char *name )
37{ 38{
38 vb = 0; 39 QVBoxLayout *tmpvb = new QVBoxLayout( this );
39 disks.setAutoDelete(TRUE); 40 QScrollView *sv = new QScrollView( this );
41 tmpvb->addWidget( sv, 0, 0 );
42 sv->setResizePolicy( QScrollView::AutoOneFit );
43 sv->setFrameStyle( QFrame::NoFrame );
44 container = new QWidget( sv->viewport() );
45 sv->addChild( container );
46 vb = 0x0;
47
48 disks.setAutoDelete(TRUE);
40 lines.setAutoDelete(TRUE); 49 lines.setAutoDelete(TRUE);
@@ -86,6 +95,5 @@ void StorageInfo::updateMounts()
86 QString fs = me->mnt_fsname; 95 QString fs = me->mnt_fsname;
87 qDebug(fs+" "+(QString)me->mnt_type);
88 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd" 96 if ( fs.left(7)=="/dev/hd" || fs.left(7)=="/dev/sd"
89 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd" 97 || fs.left(8)=="/dev/mtd" || fs.left(9) == "/dev/mmcd"
90 || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs") { 98 || fs.left(9) == "/dev/root" || fs.left(5) == "/ramfs" || fs.left(5) == "tmpfs" ) {
91 n++; 99 n++;
@@ -108,3 +116,3 @@ void StorageInfo::updateMounts()
108 delete vb; 116 delete vb;
109 vb = new QVBoxLayout( this, n > 3 ? 1 : 5 ); 117 vb = new QVBoxLayout( container/*, n > 3 ? 1 : 5*/ );
110 bool frst=TRUE; 118 bool frst=TRUE;
@@ -117,3 +125,3 @@ void StorageInfo::updateMounts()
117 if ( !frst ) { 125 if ( !frst ) {
118 QFrame *f = new QFrame( this ); 126 QFrame *f = new QFrame( container );
119 vb->addWidget(f); 127 vb->addWidget(f);
@@ -124,3 +132,2 @@ void StorageInfo::updateMounts()
124 QString humanname=*it; 132 QString humanname=*it;
125// qDebug(humanname);
126 if ( isCF(humanname) ) 133 if ( isCF(humanname) )
@@ -143,2 +150,4 @@ void StorageInfo::updateMounts()
143 humanname = tr( "Int. Storage " ); 150 humanname = tr( "Int. Storage " );
151 else if ( humanname.left(5) == "tmpfs" )
152 humanname = tr( "RAM disk" );
144 // etc. 153 // etc.
@@ -149,3 +158,3 @@ void StorageInfo::updateMounts()
149 158
150 MountInfo* mi = new MountInfo( *fsit, humanname, this ); 159 MountInfo* mi = new MountInfo( *fsit, humanname, container );
151 vb->addWidget(mi); 160 vb->addWidget(mi);
@@ -165,2 +174,4 @@ void StorageInfo::updateMounts()
165 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) ); 174 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the built-in memory (i.e. Flash memory) on this handheld device." ) );
175 else if ( tempstr == tr( "RA" ) )
176 QWhatsThis::add( mi, tr( "This graph represents how much memory is currently used of the temporary RAM disk." ) );
166 } 177 }
@@ -179,3 +190,2 @@ MountInfo::MountInfo( const QString &path, const QString &ttl, QWidget *parent,
179{ 190{
180 qDebug("new path is "+path);
181 fs = new FileSystem( path ); 191 fs = new FileSystem( path );
diff --git a/noncore/settings/sysinfo/storage.h b/noncore/settings/sysinfo/storage.h
index 3fa5b79..7e8b4e0 100644
--- a/noncore/settings/sysinfo/storage.h
+++ b/noncore/settings/sysinfo/storage.h
@@ -31,2 +31,3 @@ class MountInfo;
31class QVBoxLayout; 31class QVBoxLayout;
32class QWidget;
32 33
@@ -47,2 +48,3 @@ private:
47 QVBoxLayout *vb; 48 QVBoxLayout *vb;
49 QWidget *container;
48}; 50};
diff --git a/noncore/settings/sysinfo/sysinfo.cpp b/noncore/settings/sysinfo/sysinfo.cpp
index 6d2a64f..872492e 100644
--- a/noncore/settings/sysinfo/sysinfo.cpp
+++ b/noncore/settings/sysinfo/sysinfo.cpp
@@ -39,3 +39,3 @@
39 39
40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags f ) 40SystemInfo::SystemInfo( QWidget *parent, const char *name, WFlags )
41 : QWidget( parent, name, WStyle_ContextHelp ) 41 : QWidget( parent, name, WStyle_ContextHelp )
diff --git a/noncore/settings/sysinfo/sysinfo.pro b/noncore/settings/sysinfo/sysinfo.pro
index 236fc02..7e66451 100644
--- a/noncore/settings/sysinfo/sysinfo.pro
+++ b/noncore/settings/sysinfo/sysinfo.pro
@@ -10,3 +10,2 @@ HEADERS = memory.h \
10 modulesinfo.h \ 10 modulesinfo.h \
11 modulesdetail.h \
12 versioninfo.h \ 11 versioninfo.h \
@@ -21,3 +20,2 @@ SOURCES = main.cpp \
21 processdetail.cpp \ 20 processdetail.cpp \
22 modulesdetail.cpp \
23 versioninfo.cpp \ 21 versioninfo.cpp \