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