File indexing completed on 2022-09-27 16:32:24

0001 /*
0002     SPDX-FileCopyrightText: 2010, 2012 Rolf Eike Beer <kde@opensource.sf-tec.de>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef KGPGDELSIGN_H
0007 #define KGPGDELSIGN_H
0008 
0009 #include "kgpguidtransaction.h"
0010 
0011 #include "core/KGpgSignNode.h"
0012 
0013 #include <QObject>
0014 #include <QString>
0015 
0016 /**
0017  * @brief delete signatures from user ids
0018  */
0019 class KGpgDelSign: public KGpgUidTransaction {
0020     Q_OBJECT
0021 
0022     Q_DISABLE_COPY(KGpgDelSign)
0023     KGpgDelSign() = delete;
0024 public:
0025     /**
0026      * @brief construct a new transaction to delete signatures
0027      * @param parent object that own the transaction
0028      * @param signids list of signature ids to remove
0029      *
0030      * All members of signids need to have the same parent node, i.e.
0031      * they not even may be signatures to different uids of the same key.
0032      */
0033     KGpgDelSign(QObject *parent, const KGpgSignNode::List &signids);
0034     /**
0035      * @brief construct a new transaction to delete signatures
0036      * @param parent object that own the transaction
0037      * @param signid signature to delete
0038      */
0039     KGpgDelSign(QObject *parent, KGpgSignNode *signid);
0040 
0041     ~KGpgDelSign() override;
0042 
0043     /**
0044      * @brief set the ids to delete
0045      * @param keyids fingerprints of the signatures to delete
0046      *
0047      * This will replace all previously set signature ids.
0048      */
0049     void setSignIds(const KGpgSignNode::List &keyids);
0050     /**
0051      * @brief set the id to delete
0052      * @param keyid fingerprint of the signatures to delete
0053      * @overload
0054      *
0055      * This will replace all previously set signature ids.
0056      */
0057     void setSignId(KGpgSignNode *keyid);
0058     /**
0059      * @brief return the signature ids to delete
0060      */
0061     KGpgSignNode::List getSignIds(void) const;
0062 
0063 protected:
0064     bool nextLine(const QString &line) override;
0065     ts_boolanswer boolQuestion(const QString &line) override;
0066 
0067 private:
0068     KGpgSignNode::List m_signids;   ///< the list of ids to delete
0069     QString m_cachedid; ///< the next id GnuPG will ask to delete
0070 };
0071 
0072 #endif // KGPGDELSIGN_H