Diffstat (limited to 'noncore/settings/sysinfo/modulesinfo.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/modulesinfo.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/noncore/settings/sysinfo/modulesinfo.cpp b/noncore/settings/sysinfo/modulesinfo.cpp index e688a29..dfe48e1 100644 --- a/noncore/settings/sysinfo/modulesinfo.cpp +++ b/noncore/settings/sysinfo/modulesinfo.cpp @@ -20,29 +20,33 @@ **********************************************************************/ #include "modulesinfo.h" #include "detail.h" /* OPIE */ +#include <opie2/olistview.h> #include <qpe/qpeapplication.h> /* QT */ +#include <qcombobox.h> #include <qfile.h> #include <qlayout.h> #include <qmessagebox.h> +#include <qpushbutton.h> +#include <qtextview.h> #include <qtimer.h> #include <qwhatsthis.h> ModulesInfo::ModulesInfo( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 4 ); layout->setMargin( 4 ); - ModulesView = new QListView( this ); + ModulesView = new OListView( this ); int colnum = ModulesView->addColumn( tr( "Module" ) ); colnum = ModulesView->addColumn( tr( "Size" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Use#" ) ); ModulesView->setColumnAlignment( colnum, Qt::AlignRight ); colnum = ModulesView->addColumn( tr( "Used by" ) ); @@ -51,14 +55,14 @@ 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*) ) ); + connect( ModulesView, SIGNAL( rightButtonPressed(OListViewItem*,const QPoint&,int) ), + this, SLOT( viewModules(OListViewItem*) ) ); } CommandCB = new QComboBox( FALSE, this ); CommandCB->insertItem( "modprobe -r" ); CommandCB->insertItem( "rmmod" ); // I can't think of other useful commands yet. Anyone? @@ -90,26 +94,26 @@ void ModulesInfo::updateData() { char modname[64]; char usage[200]; int modsize, usecount; QString selectedmod; - QListViewItem *curritem = ModulesView->currentItem(); + OListViewItem *curritem = static_cast<OListViewItem*>( ModulesView->currentItem() ); if ( curritem ) { selectedmod = curritem->text( 0 ); } ModulesView->clear(); FILE *procfile = fopen( ( QString ) ( "/proc/modules"), "r"); if ( procfile ) { - QListViewItem *newitem; - QListViewItem *selecteditem = 0x0; + OListViewItem *newitem; + OListViewItem *selecteditem = 0x0; while ( true ) { modname[0] = '\0'; usage[0] = '\0'; int success = fscanf( procfile, "%s%d%d%[^\n]", modname, &modsize, &usecount, usage ); @@ -118,13 +122,13 @@ void ModulesInfo::updateData() QString qmodname = QString( modname ); QString qmodsize = QString::number( modsize ).rightJustify( 6, ' ' ); QString qusecount = QString::number( usecount ).rightJustify( 2, ' ' ); QString qusage = QString( usage ); - newitem = new QListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); + newitem = new OListViewItem( ModulesView, qmodname, qmodsize, qusecount, qusage ); if ( qmodname == selectedmod ) { selecteditem = newitem; } } ModulesView->setCurrentItem( selecteditem ); @@ -137,13 +141,13 @@ void ModulesInfo::slotSendClicked() { if ( !ModulesView->currentItem() ) { return; } - QString capstr = tr( "You really want to execute %1 for this module?" ).arg( CommandCB->currentText() ); + QString capstr = tr( "You really want to execute\n%1 for this module?" ).arg( CommandCB->currentText() ); QString modname = ModulesView->currentItem()->text( 0 ); if ( QMessageBox::warning( this, modname, capstr, QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape ) == QMessageBox::Yes ) { @@ -156,13 +160,13 @@ void ModulesInfo::slotSendClicked() if ( stream ) pclose( stream ); } } -void ModulesInfo::viewModules( QListViewItem *modules ) +void ModulesInfo::viewModules( OListViewItem *modules ) { QString modname = modules->text( 0 ); QString capstr = "Module: "; capstr.append( modname ); ModulesDtl->setCaption( capstr ); QString command = "/sbin/modinfo "; |