File indexing completed on 2024-06-23 05:13:41
0001 /* -*- mode: c++; c-basic-offset:4 -*- 0002 commands/gnupgprocesscommand.h 0003 0004 This file is part of Kleopatra, the KDE keymanager 0005 SPDX-FileCopyrightText: 2008 Klarälvdalens Datakonsult AB 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include <commands/command.h> 0013 0014 #include <QStringList> 0015 class QString; 0016 class QProcess; 0017 0018 namespace Kleo 0019 { 0020 namespace Commands 0021 { 0022 0023 class GnuPGProcessCommand : public Command 0024 { 0025 Q_OBJECT 0026 protected: 0027 GnuPGProcessCommand(QAbstractItemView *view, KeyListController *parent); 0028 explicit GnuPGProcessCommand(KeyListController *parent); 0029 explicit GnuPGProcessCommand(const GpgME::Key &key); 0030 explicit GnuPGProcessCommand(const std::vector<GpgME::Key> &keys); 0031 ~GnuPGProcessCommand() override; 0032 0033 public: 0034 QDialog *dialog() const; 0035 void setShowsOutputWindow(bool show); 0036 0037 private: 0038 virtual bool preStartHook(QWidget *parentWidget) const; 0039 0040 virtual QStringList arguments() const = 0; 0041 0042 virtual QString errorCaption() const = 0; 0043 virtual QString successCaption() const; 0044 0045 virtual QString crashExitMessage(const QStringList &args) const = 0; 0046 virtual QString errorExitMessage(const QStringList &args) const = 0; 0047 virtual QString successMessage(const QStringList &args) const; 0048 0049 virtual void postSuccessHook(QWidget *parentWidget); 0050 0051 protected: 0052 QString errorString() const; 0053 void setIgnoresSuccessOrFailure(bool ignore); 0054 bool ignoresSuccessOrFailure() const; 0055 bool showsOutputWindow() const; 0056 0057 QProcess *process(); 0058 0059 void doStart() override; 0060 void doCancel() override; 0061 0062 QMetaObject::Connection m_procReadyReadStdErrConnection; 0063 0064 private: 0065 class Private; 0066 inline Private *d_func(); 0067 inline const Private *d_func() const; 0068 }; 0069 0070 } 0071 }