summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/modulesinfo.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/modulesinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp
index dfe48e1..71cefcb 100644
--- a/noncore/settings/sysinfo/modulesinfo.cpp
+++ b/noncore/settings/sysinfo/modulesinfo.cpp
@@ -27,48 +27,49 @@
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29/* QT */ 29/* QT */
30#include <qcombobox.h> 30#include <qcombobox.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qlayout.h> 32#include <qlayout.h>
33#include <qmessagebox.h> 33#include <qmessagebox.h>
34#include <qpushbutton.h> 34#include <qpushbutton.h>
35#include <qtextview.h> 35#include <qtextview.h>
36#include <qtimer.h> 36#include <qtimer.h>
37#include <qwhatsthis.h> 37#include <qwhatsthis.h>
38 38
39using namespace Opie::Ui;
39ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 40ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
40 : QWidget( parent, name, fl ) 41 : QWidget( parent, name, fl )
41{ 42{
42 QGridLayout *layout = new QGridLayout( this ); 43 QGridLayout *layout = new QGridLayout( this );
43 layout->setSpacing( 4 ); 44 layout->setSpacing( 4 );
44 layout->setMargin( 4 ); 45 layout->setMargin( 4 );
45 46
46 ModulesView = new OListView( this ); 47 ModulesView = new OListView( this );
47 int colnum = ModulesView->addColumn( tr( "Module" ) ); 48 int colnum = ModulesView->addColumn( tr( "Module" ) );
48 colnum = ModulesView->addColumn( tr( "Size" ) ); 49 colnum = ModulesView->addColumn( tr( "Size" ) );
49 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 50 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
50 colnum = ModulesView->addColumn( tr( "Use#" ) ); 51 colnum = ModulesView->addColumn( tr( "Use#" ) );
51 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 52 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
52 colnum = ModulesView->addColumn( tr( "Used by" ) ); 53 colnum = ModulesView->addColumn( tr( "Used by" ) );
53 ModulesView->setAllColumnsShowFocus( TRUE ); 54 ModulesView->setAllColumnsShowFocus( TRUE );
54 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 ); 55 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
55 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." ) ); 56 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." ) );
56 57
57 // Test if we have /sbin/modinfo, and if so, allow module detail window 58 // Test if we have /sbin/modinfo, and if so, allow module detail window
58 if ( QFile::exists( "/sbin/modinfo" ) ) 59 if ( QFile::exists( "/sbin/modinfo" ) )
59 { 60 {
60 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold ); 61 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
61 connect( ModulesView, SIGNAL( rightButtonPressed(OListViewItem*,const QPoint&,int) ), 62 connect( ModulesView, SIGNAL( rightButtonPressed(QListViewItem*,const QPoint&,int) ),
62 this, SLOT( viewModules(OListViewItem*) ) ); 63 this, SLOT( viewModules(QListViewItem*) ) );
63 } 64 }
64 65
65 CommandCB = new QComboBox( FALSE, this ); 66 CommandCB = new QComboBox( FALSE, this );
66 CommandCB->insertItem( "modprobe -r" ); 67 CommandCB->insertItem( "modprobe -r" );
67 CommandCB->insertItem( "rmmod" ); 68 CommandCB->insertItem( "rmmod" );
68 // I can't think of other useful commands yet. Anyone? 69 // I can't think of other useful commands yet. Anyone?
69 layout->addWidget( CommandCB, 1, 0 ); 70 layout->addWidget( CommandCB, 1, 0 );
70 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." ) ); 71 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." ) );
71 72
72 QPushButton *btn = new QPushButton( this ); 73 QPushButton *btn = new QPushButton( this );
73 btn->setMinimumSize( QSize( 50, 24 ) ); 74 btn->setMinimumSize( QSize( 50, 24 ) );
74 btn->setMaximumSize( QSize( 50, 24 ) ); 75 btn->setMaximumSize( QSize( 50, 24 ) );
@@ -154,24 +155,29 @@ void ModulesInfo::slotSendClicked()
154 QString command = "/sbin/"; 155 QString command = "/sbin/";
155 command.append( CommandCB->currentText() ); 156 command.append( CommandCB->currentText() );
156 command.append( " " ); 157 command.append( " " );
157 command.append( modname ); 158 command.append( modname );
158 159
159 FILE* stream = popen( command, "r" ); 160 FILE* stream = popen( command, "r" );
160 if ( stream ) 161 if ( stream )
161 pclose( stream ); 162 pclose( stream );
162 } 163 }
163 164
164} 165}
165 166
167void ModulesInfo::viewModules( QListViewItem *module ) {
168 if ( !module )
169 return;
170 viewModules( static_cast<OListViewItem*>( module ) );
171}
166void ModulesInfo::viewModules( OListViewItem *modules ) 172void ModulesInfo::viewModules( OListViewItem *modules )
167{ 173{
168 QString modname = modules->text( 0 ); 174 QString modname = modules->text( 0 );
169 QString capstr = "Module: "; 175 QString capstr = "Module: ";
170 capstr.append( modname ); 176 capstr.append( modname );
171 ModulesDtl->setCaption( capstr ); 177 ModulesDtl->setCaption( capstr );
172 QString command = "/sbin/modinfo "; 178 QString command = "/sbin/modinfo ";
173 command.append( modname ); 179 command.append( modname );
174 FILE* modinfo = popen( command, "r" ); 180 FILE* modinfo = popen( command, "r" );
175 181
176 if ( modinfo ) 182 if ( modinfo )
177 { 183 {