Diffstat (limited to 'noncore/settings/sysinfo/processdetail.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/sysinfo/processdetail.cpp | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/noncore/settings/sysinfo/processdetail.cpp b/noncore/settings/sysinfo/processdetail.cpp new file mode 100644 index 0000000..1ca1e72 --- a/dev/null +++ b/noncore/settings/sysinfo/processdetail.cpp | |||
@@ -0,0 +1,85 @@ | |||
1 | /********************************************************************** | ||
2 | ** ProcessDetail | ||
3 | ** | ||
4 | ** Display process information | ||
5 | ** | ||
6 | ** Copyright (C) 2002, Dan Williams | ||
7 | ** williamsdr@acm.org | ||
8 | ** http://draknor.net | ||
9 | ** | ||
10 | ** This file may be distributed and/or modified under the terms of the | ||
11 | ** GNU General Public License version 2 as published by the Free Software | ||
12 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
13 | ** packaging of this file. | ||
14 | ** | ||
15 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
16 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
17 | ** | ||
18 | **********************************************************************/ | ||
19 | |||
20 | #include "processdetail.h" | ||
21 | |||
22 | #include <sys/types.h> | ||
23 | #include <signal.h> | ||
24 | |||
25 | #include <qcombobox.h> | ||
26 | #include <qpushbutton.h> | ||
27 | #include <qtextview.h> | ||
28 | #include <qlayout.h> | ||
29 | #include <qlistview.h> | ||
30 | #include <qmessagebox.h> | ||
31 | |||
32 | ProcessDetail::ProcessDetail( QWidget* parent, const char* name, bool modal, WFlags fl ) | ||
33 | : QDialog( parent, name, modal, fl ) | ||
34 | { | ||
35 | pid = 0; | ||
36 | |||
37 | QGridLayout *layout = new QGridLayout( this ); | ||
38 | layout->setSpacing( 6 ); | ||
39 | layout->setMargin( 11 ); | ||
40 | |||
41 | SignalCB = new QComboBox( FALSE, this, "SignalCB" ); | ||
42 | SignalCB->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)7, SignalCB->sizePolicy().hasHeightForWidth() ) ); | ||
43 | SignalCB->setMinimumSize( QSize( 50, 24 ) ); | ||
44 | SignalCB->setMaximumSize( QSize( 600, 24 ) ); | ||
45 | SignalCB->insertItem( " 1: SIGHUP" ); | ||
46 | SignalCB->insertItem( " 9: SIGKILL" ); | ||
47 | SignalCB->insertItem( "15: SIGTERM" ); | ||
48 | layout->addWidget( SignalCB, 1, 0 ); | ||
49 | |||
50 | ProcessView = new QTextView( this, "ProcessView" ); | ||
51 | ProcessView->setFrameShadow( QTextView::Plain ); | ||
52 | layout->addMultiCellWidget( ProcessView, 0, 0, 0, 1 ); | ||
53 | |||
54 | SendButton = new QPushButton( this, "SendButton" ); | ||
55 | SendButton->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SendButton->sizePolicy().hasHeightForWidth() ) ); | ||
56 | SendButton->setMinimumSize( QSize( 50, 24 ) ); | ||
57 | SendButton->setMaximumSize( QSize( 50, 24 ) ); | ||
58 | SendButton->setText( tr( "Send" ) ); | ||
59 | connect( SendButton, SIGNAL( clicked() ), this, SLOT( slotSendClicked() ) ); | ||
60 | layout->addWidget( SendButton, 1, 1 ); | ||
61 | } | ||
62 | |||
63 | ProcessDetail::~ProcessDetail() | ||
64 | { | ||
65 | } | ||
66 | |||
67 | void ProcessDetail::slotSendClicked() | ||
68 | { | ||
69 | QString sigstr = SignalCB->currentText(); | ||
70 | sigstr.truncate(2); | ||
71 | int sigid = sigstr.toUInt(); | ||
72 | |||
73 | if ( !QMessageBox::information( this, caption(), | ||
74 | ( tr( "You really want to send\n" + SignalCB->currentText() + "\nto this process?") ), | ||
75 | ( tr( "Yes" ) ), ( tr( "No" ) ), 0 ) ) | ||
76 | { | ||
77 | if ( kill( pid, sigid ) == 0 ) | ||
78 | { | ||
79 | accept(); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | } | ||
84 | |||
85 | |||