summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/modulesinfo.cpp
authordrw <drw>2002-12-16 01:55:56 (UTC)
committer drw <drw>2002-12-16 01:55:56 (UTC)
commit64bc40080abc56e6bd804dadb44d2510f25f2efa (patch) (unidiff)
tree20d1840b63dc76608aee6f80bf011811d392fbac /noncore/settings/sysinfo/modulesinfo.cpp
parente4057ee7fe74c83e2dc44f8b9870f65da60fc4fa (diff)
downloadopie-64bc40080abc56e6bd804dadb44d2510f25f2efa.zip
opie-64bc40080abc56e6bd804dadb44d2510f25f2efa.tar.gz
opie-64bc40080abc56e6bd804dadb44d2510f25f2efa.tar.bz2
1. Added RAM disk to storage tab (could someone verify works on Z?) 2. QScrollView for storage tab 3. Removed module detail dialog since it did not provide any useful information 4. Fix compiler warnings 5. Removed unneeded qDebugs
Diffstat (limited to 'noncore/settings/sysinfo/modulesinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesinfo.cpp71
1 files changed, 41 insertions, 30 deletions
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
@@ -18,48 +18,63 @@
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#include <qpe/qpeapplication.h> 22#include <qpe/qpeapplication.h>
23 23
24#include <qcombobox.h>
24#include <qfile.h> 25#include <qfile.h>
25#include <qheader.h> 26#include <qheader.h>
26#include <qlayout.h> 27#include <qlayout.h>
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>
29#include <qwhatsthis.h> 33#include <qwhatsthis.h>
30 34
31#include "modulesinfo.h" 35#include "modulesinfo.h"
32 36
33ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 37ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
34 : QWidget( parent, name, fl ) 38 : QWidget( parent, name, 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" ) );
40 colnum = ModulesView->addColumn( tr( "Size" ) ); 46 colnum = ModulesView->addColumn( tr( "Size" ) );
41 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 47 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
42 colnum = ModulesView->addColumn( tr( "Use#" ) ); 48 colnum = ModulesView->addColumn( tr( "Use#" ) );
43 ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); 49 ModulesView->setColumnAlignment( colnum, Qt::AlignRight );
44 colnum = ModulesView->addColumn( tr( "Used By" ) ); 50 colnum = ModulesView->addColumn( tr( "Used By" ) );
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 );
53 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) ); 71 connect( t, SIGNAL( timeout() ), this, SLOT( updateData() ) );
54 t->start( 5000 ); 72 t->start( 5000 );
55 73
56 updateData(); 74 updateData();
57
58 ModulesDtl = new ModulesDetail( 0, 0, 0 );
59 ModulesDtl->ModulesView->setTextFormat( PlainText );
60} 75}
61 76
62ModulesInfo::~ModulesInfo() 77ModulesInfo::~ModulesInfo()
63{ 78{
64} 79}
65 80
@@ -90,33 +105,29 @@ void ModulesInfo::updateData()
90 } 105 }
91 106
92 fclose( procfile ); 107 fclose( procfile );
93 } 108 }
94} 109}
95 110
96void ModulesInfo::viewModules( QListViewItem *modules ) 111void ModulesInfo::slotSendClicked()
97{
98 QString modname = modules->text( 0 );
99 ModulesDtl->setCaption( QString( "Module: " ) + modname );
100 ModulesDtl->modname = modname;
101 QString command = QString( "/sbin/modinfo " ) + modules->text( 0 );
102
103 FILE* modinfo = popen( command, "r" );
104
105 if ( modinfo )
106 { 112 {
107 char line[200]; 113 QString capstr = tr( "You really want to execute\n" );
108 ModulesDtl->ModulesView->setText( " Details:\n------------\n" ); 114 capstr.append( CommandCB->currentText() );
115 capstr.append( "\nfor this module?" );
109 116
110 while( true ) 117 if ( QMessageBox::warning( this, caption(), capstr,
118 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
111 { 119 {
112 int success = fscanf( modinfo, "%[^\n]\n", line ); 120 QString command = "/sbin/";
113 if ( success == EOF ) 121 command.append( CommandCB->currentText() );
114 break; 122 command.append( " " );
115 ModulesDtl->ModulesView->append( line ); 123 command.append( ModulesView->currentItem()->text( 0 ) );
116 } 124
117 125 FILE* stream = popen( command, "r" );
118 pclose( modinfo ); 126 if ( stream )
127 pclose( stream );
128 //{
129 // hide();
130 //}
119 } 131 }
120 132
121 ModulesDtl->showMaximized();
122} 133}