summaryrefslogtreecommitdiff
path: root/noncore/settings/sysinfo/modulesdetail.cpp
Unidiff
Diffstat (limited to 'noncore/settings/sysinfo/modulesdetail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/sysinfo/modulesdetail.cpp85
1 files changed, 85 insertions, 0 deletions
diff --git a/noncore/settings/sysinfo/modulesdetail.cpp b/noncore/settings/sysinfo/modulesdetail.cpp
new file mode 100644
index 0000000..48d47f6
--- a/dev/null
+++ b/noncore/settings/sysinfo/modulesdetail.cpp
@@ -0,0 +1,85 @@
1/**********************************************************************
2** ModulesDetail
3**
4** Display module information
5**
6** Copyright (C) 2002, Michael Lauer
7** mickey@tm.informatik.uni-frankfurt.de
8** http://www.Vanille.de
9**
10** Based on ProcessDetail by Dan Williams <williamsdr@acm.org>
11**
12** This file may be distributed and/or modified under the terms of the
13** GNU General Public License version 2 as published by the Free Software
14** Foundation and appearing in the file LICENSE.GPL included in the
15** packaging of this file.
16**
17** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
18** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19**
20**********************************************************************/
21
22#include "modulesdetail.h"
23
24#include <sys/types.h>
25#include <stdio.h>
26#include <qcombobox.h>
27#include <qpushbutton.h>
28#include <qtextview.h>
29#include <qlayout.h>
30#include <qlistview.h>
31#include <qmessagebox.h>
32
33ModulesDetail::ModulesDetail( QWidget* parent, const char* name, WFlags fl )
34 : QWidget( parent, name, fl )
35{
36 modname = "";
37
38 QGridLayout *layout = new QGridLayout( this );
39 layout->setSpacing( 4 );
40 layout->setMargin( 4 );
41
42 CommandCB = new QComboBox( FALSE, this, "CommandCB" );
43 CommandCB->insertItem( "modprobe -r" );
44 CommandCB->insertItem( "rmmod" );
45 // I can't think of other useful commands yet. Anyone?
46
47 layout->addWidget( CommandCB, 1, 0 );
48
49 ModulesView = new QTextView( this, "ModulesView" );
50 layout->addMultiCellWidget( ModulesView, 0, 0, 0, 1 );
51
52 SendButton = new QPushButton( this, "SendButton" );
53 SendButton->setMinimumSize( QSize( 50, 24 ) );
54 SendButton->setMaximumSize( QSize( 50, 24 ) );
55 SendButton->setText( tr( "Send" ) );
56 connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) );
57 layout->addWidget( SendButton, 1, 1 );
58}
59
60ModulesDetail::~ModulesDetail()
61{
62}
63
64void ModulesDetail::slotSendClicked()
65{
66 QString command = QString( "/sbin/" )
67 + CommandCB->currentText()
68 + QString( " " ) + modname;
69
70 if ( QMessageBox::warning( this, caption(),
71 tr( "You really want to \n" + CommandCB->currentText() + "\nthis Module?"),
72 QMessageBox::Yes | QMessageBox::Default, QMessageBox::No | QMessageBox::Escape )
73 == QMessageBox::Yes )
74 {
75 FILE* stream = popen( command, "r" );
76 if ( stream )
77 pclose( stream );
78 {
79 hide();
80 }
81 }
82
83}
84
85