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.cpp53
1 files changed, 47 insertions, 6 deletions
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 @@
35#include "modulesinfo.h" 35#include "modulesinfo.h"
36#include "detail.h"
36 37
@@ -53,2 +54,10 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
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." ) ); 54 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." ) );
55
56 // Test if we have /sbin/modinfo, and if so, allow module detail window
57 if ( QFile::exists( "/sbin/modinfo" ) )
58 {
59 QPEApplication::setStylusOperation( ModulesView->viewport(), QPEApplication::RightOnHold );
60 connect( ModulesView, SIGNAL( rightButtonPressed( QListViewItem *, const QPoint &, int ) ),
61 this, SLOT( viewModules( QListViewItem * ) ) );
62 }
54 63
@@ -72,4 +81,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl )
72 t->start( 5000 ); 81 t->start( 5000 );
73 82
74 updateData(); 83 updateData();
84
85 ModulesDtl = new Detail();
86 QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) );
75} 87}
@@ -116,3 +128,5 @@ void ModulesInfo::slotSendClicked()
116 128
117 if ( QMessageBox::warning( this, caption(), capstr, 129 QString modname = ModulesView->currentItem()->text( 0 );
130
131 if ( QMessageBox::warning( this, modname, capstr,
118 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) 132 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes )
@@ -122,3 +136,3 @@ void ModulesInfo::slotSendClicked()
122 command.append( " " ); 136 command.append( " " );
123 command.append( ModulesView->currentItem()->text( 0 ) ); 137 command.append( modname );
124 138
@@ -127,5 +141,2 @@ void ModulesInfo::slotSendClicked()
127 pclose( stream ); 141 pclose( stream );
128 //{
129 // hide();
130 //}
131 } 142 }
@@ -133 +144,31 @@ void ModulesInfo::slotSendClicked()
133} 144}
145
146void ModulesInfo::viewModules( QListViewItem *modules )
147{
148 QString modname = modules->text( 0 );
149 QString capstr = "Module: ";
150 capstr.append( modname );
151 ModulesDtl->setCaption( capstr );
152 QString command = "/sbin/modinfo -nad ";
153 command.append( modname );
154 FILE* modinfo = popen( command, "r" );
155
156 if ( modinfo )
157 {
158 char line[200];
159 ModulesDtl->detailView->setText( " Details:\n------------\n" );
160
161 while( true )
162 {
163 int success = fscanf( modinfo, "%[^\n]\n", line );
164 if ( success == EOF )
165 break;
166 ModulesDtl->detailView->append( line );
167 }
168
169 pclose( modinfo );
170 }
171
172 ModulesDtl->showMaximized();
173}
174