File indexing completed on 2024-04-21 05:50:42
0001 /* 0002 SPDX-FileCopyrightText: 2009-2022 Rolf Eike Beer <kde@opensource.sf-tec.de> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #ifndef KGPGKEYSERVERGETTRANSACTION_H 0007 #define KGPGKEYSERVERGETTRANSACTION_H 0008 0009 #include <QObject> 0010 #include <QString> 0011 #include <QStringList> 0012 0013 #include "kgpgkeyservertransaction.h" 0014 0015 /** 0016 * @brief base class for transactions downloading from key servers 0017 */ 0018 class KGpgKeyserverGetTransaction: public KGpgKeyserverTransaction { 0019 Q_OBJECT 0020 0021 Q_DISABLE_COPY(KGpgKeyserverGetTransaction) 0022 /** 0023 * @brief forbidden 0024 */ 0025 KGpgKeyserverGetTransaction() = delete; 0026 0027 public: 0028 /** 0029 * @brief construct a new transaction for the given keyserver 0030 * @param parent object that owns the transaction 0031 * @param keyserver keyserver to work with 0032 * @param keys the key ids to get 0033 * @param withProgress show a progress window with cancel button 0034 * @param proxy http proxy to use 0035 * 0036 * You should call this from the childrens constructor to set up 0037 * everything properly 0038 */ 0039 KGpgKeyserverGetTransaction(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress = false, const QString &proxy = QString()); 0040 ~KGpgKeyserverGetTransaction() override = default; 0041 0042 void setKeyIds(const QStringList &keys); 0043 0044 const QStringList &getLog() const; 0045 0046 protected: 0047 virtual QString getGpgCommand() const = 0; 0048 bool preStart() override; 0049 bool nextLine(const QString &line) override; 0050 0051 private: 0052 int m_cmdpos; 0053 QStringList m_keys; 0054 QStringList m_log; 0055 }; 0056 0057 /** 0058 * @brief class for downloading new keys from keyserver 0059 */ 0060 class KGpgReceiveKeys: public KGpgKeyserverGetTransaction { 0061 Q_OBJECT 0062 0063 public: 0064 /** 0065 * @brief construct a new transaction for the given keyserver 0066 * @param parent object that owns the transaction 0067 * @param keyserver keyserver to work with 0068 * @param keys the key ids to get 0069 * @param withProgress show a progress window with cancel button 0070 * @param proxy http proxy to use 0071 */ 0072 KGpgReceiveKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress = false, const QString &proxy = QString()); 0073 ~KGpgReceiveKeys() override = default; 0074 0075 protected: 0076 QString getGpgCommand() const override; 0077 }; 0078 0079 /** 0080 * @brief class for refreshing keys already in the keyring from keyserver 0081 */ 0082 class KGpgRefreshKeys: public KGpgKeyserverGetTransaction { 0083 Q_OBJECT 0084 0085 public: 0086 /** 0087 * @brief construct a new transaction for the given keyserver 0088 * @param parent object that owns the transaction 0089 * @param keyserver keyserver to work with 0090 * @param keys the key ids to get 0091 * @param withProgress show a progress window with cancel button 0092 * @param proxy http proxy to use 0093 */ 0094 KGpgRefreshKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const bool withProgress = false, const QString &proxy = QString()); 0095 ~KGpgRefreshKeys() override = default; 0096 0097 protected: 0098 QString getGpgCommand() const override; 0099 }; 0100 0101 #endif // KGPGUIDTRANSACTION_H