File indexing completed on 2024-04-14 05:43:30

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 KGPGSENDKEYS_H
0007 #define KGPGSENDKEYS_H
0008 
0009 #include <QObject>
0010 #include <QString>
0011 #include <QStringList>
0012 
0013 #include "kgpgkeyservertransaction.h"
0014 
0015 /**
0016  * @brief class for uploading keys from the keyring to a keyserver
0017  */
0018 class KGpgSendKeys: public KGpgKeyserverTransaction {
0019     Q_OBJECT
0020 
0021     Q_DISABLE_COPY(KGpgSendKeys)
0022     /**
0023      * @brief forbidden
0024      */
0025     KGpgSendKeys() = delete;
0026 public:
0027     /**
0028      * @brief construct a new transaction for the given keyserver
0029      * @param parent object that own the transaction
0030      * @param keyserver keyserver to work with
0031      * @param keys the key ids to get
0032      * @param attropt attributes to export (@see setAttributeOptions())
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     KGpgSendKeys(QObject *parent, const QString &keyserver, const QStringList &keys, const QString &attropt = QString(), const bool withProgress = false, const QString &proxy = QString());
0040     ~KGpgSendKeys() override = default;
0041 
0042     void setKeyIds(const QStringList &keys);
0043     /**
0044      * @brief set which attributes are exported
0045      * @param opt GnuPG attribute options
0046      *
0047      * If opt is empty no attributes are exported.
0048      */
0049     void setAttributeOptions(const QString &opt);
0050 
0051     const QStringList &getLog() const;
0052 
0053 protected:
0054     bool preStart() override;
0055     bool nextLine(const QString &line) override;
0056 
0057 private:
0058     int m_attrpos;
0059     QString m_attributeopt;
0060     QStringList m_keys;
0061     QStringList m_log;
0062 };
0063 
0064 #endif // KGPGSENDKEYS_H