File indexing completed on 2024-04-28 09:46:04

0001 /*
0002     SPDX-FileCopyrightText: 2010-2022 Rolf Eike Beer <kde@opensource.sf-tec.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KGPGGENERATEREVOKE_H
0007 #define KGPGGENERATEREVOKE_H
0008 
0009 #include "kgpgtransaction.h"
0010 
0011 #include "core/kgpgkey.h"
0012 
0013 #include <QUrl>
0014 #include <QObject>
0015 
0016 class QString;
0017 
0018 /**
0019  * @brief generate a revokation certificate
0020  */
0021 class KGpgGenerateRevoke: public KGpgTransaction {
0022     Q_OBJECT
0023 
0024     Q_DISABLE_COPY(KGpgGenerateRevoke)
0025     KGpgGenerateRevoke() = delete;
0026 public:
0027     /**
0028      * @brief KGpgGenerateRevoke's constructor
0029      * @param parent parent object
0030      * @param keyID key fingerprint to generate revokation certificate for
0031      * @param revokeUrl place to store the certificate (may be empty)
0032      * @param reason revokation reason
0033      * @param description text description for revokation
0034      */
0035     KGpgGenerateRevoke(QObject *parent, const QString &keyID, const QUrl &revokeUrl, const int reason, const QString &description);
0036     ~KGpgGenerateRevoke() override = default;
0037 
0038     /**
0039      * @brief returns the revokation certificate
0040      */
0041     const QString &getOutput() const;
0042 
0043 Q_SIGNALS:
0044     void revokeCertificate(const QString &cert);
0045 
0046 protected:
0047     bool preStart() override;
0048     bool nextLine(const QString &line) override;
0049     ts_boolanswer boolQuestion(const QString &line) override;
0050     void finish() override;
0051     bool passphraseReceived() override;
0052     ts_boolanswer confirmOverwrite (QUrl &currentFile) override;
0053 
0054 private:
0055     QString m_keyid;
0056     QUrl m_revUrl;
0057     int m_reason;
0058     QString m_description;
0059     QString m_output;
0060 };
0061 
0062 #endif // KGPGGENERATEREVOKE_H