File indexing completed on 2024-04-14 05:43:31
0001 /* 0002 SPDX-FileCopyrightText: 2008-2022 Rolf Eike Beer <kde@opensource.sf-tec.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KGPGUIDTRANSACTION_H 0007 #define KGPGUIDTRANSACTION_H 0008 0009 #include <QObject> 0010 #include <QString> 0011 0012 #include "kgpgtransaction.h" 0013 0014 /** 0015 * @brief base class for transactions involving only one user id of a key 0016 */ 0017 class KGpgUidTransaction: public KGpgTransaction { 0018 Q_OBJECT 0019 0020 Q_DISABLE_COPY(KGpgUidTransaction) 0021 public: 0022 /** 0023 * @brief construct a new transaction for the given key and uid 0024 * @param parent object that own the transaction 0025 * @param keyid key to work with 0026 * @param uid uid to work with 0027 * 0028 * You should call this from the childrens constructor to set up 0029 * everything properly 0030 */ 0031 explicit KGpgUidTransaction(QObject *parent, const QString &keyid = QString(), const QString &uid = QString()); 0032 ~KGpgUidTransaction() override = default; 0033 0034 /** 0035 * @brief set the key id of the transaction to the given value 0036 * @param keyid fingerprint of the key to work with 0037 */ 0038 void setKeyId(const QString &keyid); 0039 /** 0040 * @brief return the key id of the current transaction 0041 */ 0042 QString getKeyId(void) const; 0043 /** 0044 * @brief set the uid number of the transaction to the given value 0045 * @param uid the number of the user id to work with 0046 */ 0047 void setUid(const QString &uid); 0048 /** 0049 * @brief set the uid number of the transaction to the given value 0050 * @param uid the number of the user id to work with 0051 * 0052 * @overload 0053 */ 0054 void setUid(const unsigned int uid); 0055 0056 protected: 0057 bool preStart() override; 0058 0059 /** 0060 * @brief handle common GnuPG messages for uid transactions 0061 * @param line GnuPG message 0062 * @return true if "quit" should be sent to process 0063 * 0064 * You should call these function for all messages in nextLine() 0065 * you do not need to handle yourself. 0066 */ 0067 bool standardCommands(const QString &line); 0068 0069 private: 0070 QString m_uid; 0071 int m_uidpos; 0072 QString m_keyid; 0073 int m_keyidpos; 0074 }; 0075 0076 #endif // KGPGUIDTRANSACTION_H