33 #include <config-kleopatra.h>
39 #include <kmessagebox.h>
40 #include <kpushbutton.h>
41 #include <KStandardGuiItem>
42 #include <kglobalsettings.h>
46 #include <qtextedit.h>
47 #include <QFontMetrics>
50 #include <QVBoxLayout>
51 #include <QHBoxLayout>
52 #include <QCloseEvent>
55 :
QDialog( parent ), _process(0)
57 QVBoxLayout* topLayout =
new QVBoxLayout(
this );
58 topLayout->setSpacing( 4 );
59 topLayout->setMargin( 10 );
61 topLayout->addWidget(
new QLabel( i18n(
"CRL cache dump:"),
this ) );
63 _textView =
new QTextEdit(
this );
64 _textView->setFont( KGlobalSettings::fixedFont() );
65 _textView->setReadOnly(
true);
66 topLayout->addWidget( _textView );
68 QHBoxLayout* hbLayout =
new QHBoxLayout();
69 topLayout->addItem( hbLayout );
71 _updateButton =
new KPushButton( i18n(
"&Update"),
this );
72 _closeButton =
new KPushButton( KStandardGuiItem::close(),
this );
74 hbLayout->addWidget( _updateButton );
75 hbLayout->addStretch();
76 hbLayout->addWidget( _closeButton );
79 connect( _updateButton, SIGNAL(clicked()),
81 connect( _closeButton, SIGNAL(clicked()),
82 this, SLOT(close()) );
84 resize( _textView->fontMetrics().width(
'M' ) * 80,
85 _textView->fontMetrics().lineSpacing() * 25 );
87 _timer =
new QTimer(
this );
93 delete _process; _process = 0;
97 QDialog::closeEvent( e );
98 delete _process; _process = 0;
103 _updateButton->setEnabled(
false );
107 _process =
new KProcess();
108 *_process <<
"gpgsm" <<
"--call-dirmngr" <<
"listcrls";
109 connect( _process, SIGNAL(readyReadStandardOutput()),
this, SLOT(
slotReadStdout()));
110 connect( _process, SIGNAL(finished(
int,QProcess::ExitStatus)),
113 if( _process->state() == QProcess::Running ) _process->kill();
114 _process->setOutputChannelMode(KProcess::OnlyStdoutChannel);
116 if( !_process->waitForStarted()){
117 KMessageBox::error(
this, i18n(
"Unable to start gpgsm process. Please check your installation." ), i18n(
"Certificate Manager Error" ) );
120 _timer->start( 1000 );
125 _buffer.append( _process->readAllStandardOutput() );
129 _textView->append( _buffer );
137 _updateButton->setEnabled(
true );
144 if( _status != QProcess::NormalExit ) {
145 KMessageBox::error(
this, i18n(
"The GpgSM process ended prematurely because of an unexpected error." ), i18n(
"Certificate Manager Error" ) );
149 #include "crlview.moc"
void closeEvent(QCloseEvent *)
CRLView(QWidget *parent=0)
void slotProcessExited(int, QProcess::ExitStatus)