1 /*
2     SPDX-FileCopyrightText: 2009 Rolf Eike Beer <kde@opensource.sf-tec.de>
3     SPDX-License-Identifier: GPL-2.0-or-later
4 */
5 
6 #ifndef KGPGSIGNUID_H
7 #define KGPGSIGNUID_H
8 
9 #include <QObject>
10 
11 #include "kgpguidtransaction.h"
12 #include "kgpgsigntransactionhelper.h"
13 
14 class KGpgSignableNode;
15 class QString;
16 
17 /**
18  * @brief transaction class to sign a single user id of a key
19  */
20 class KGpgSignUid: public KGpgUidTransaction, public KGpgSignTransactionHelper {
21 	Q_OBJECT
22 
23 	Q_DISABLE_COPY(KGpgSignUid)
24 	KGpgSignUid() = delete;
25 
26 public:
27 	/**
28 	 * @brief constructor
29 	 * @param parent parent object
30 	 * @param signer id of the key to sign with
31 	 * @param uid node to sign
32 	 * @param local if signature should be local (not exportable)
33 	 * @param checking how carefully the identity of the key owner was checked
34 	 *
35 	 * See setUid() for description of uid.
36 	 */
37 	KGpgSignUid(QObject *parent, const QString &signer, const KGpgSignableNode *uid, const bool local, const carefulCheck checking);
38 	/**
39 	 * @brief destructor
40 	 */
41     ~KGpgSignUid() override;
42 
43 	/**
44 	 * @brief set node to sign
45 	 * @param uid node to sign
46 	 *
47 	 * If uid is a KGpgKeyNode only the primary id of that key is
48 	 * signed. If you want to sign all user ids at once use
49 	 * KGpgSignKey instead. Legal values for uid are also KGpgUidNode
50 	 * and KGpgUatNode.
51 	 */
52 	void setUid(const KGpgSignableNode *uid);
53 
54 protected:
55 	bool preStart() override;
56 	bool nextLine(const QString &line) override;
57 	ts_boolanswer boolQuestion(const QString &line) override;
58 	bool passphraseReceived() override;
59 
60 	KGpgTransaction *asTransaction() override;
61 	void replaceCmd(const QString &cmd) override;
62 
63 private:
64 	int m_cmdPos;		///< position of the command in GnuPG command line
65 };
66 
67 #endif // KGPGSIGNUID_H
68