Diffstat (limited to 'noncore/settings/sysinfo/modulesinfo.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.cpp | 53 |
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 @@ #include "modulesinfo.h" +#include "detail.h" @@ -53,2 +54,10 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) 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 * ) ) ); + } @@ -72,4 +81,7 @@ ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) t->start( 5000 ); - + updateData(); + + ModulesDtl = new Detail(); + QWhatsThis::add( ModulesDtl->detailView, tr( "This area shows detailed information about this module." ) ); } @@ -116,3 +128,5 @@ void ModulesInfo::slotSendClicked() - 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 ) @@ -122,3 +136,3 @@ void ModulesInfo::slotSendClicked() command.append( " " ); - command.append( ModulesView->currentItem()->text( 0 ) ); + command.append( modname ); @@ -127,5 +141,2 @@ void ModulesInfo::slotSendClicked() pclose( stream ); - //{ - // hide(); - //} } @@ -133 +144,31 @@ void ModulesInfo::slotSendClicked() } + +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(); +} + |