File indexing completed on 2025-01-19 04:46:49

0001 /*
0002   SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <MimeTreeParser/MessagePart>
0010 
0011 #include <QDateTime>
0012 #include <QString>
0013 
0014 #include <gpgme++/key.h>
0015 
0016 namespace MimeTreeParser
0017 {
0018 namespace Interface
0019 {
0020 class BodyPart;
0021 }
0022 }
0023 namespace KMime
0024 {
0025 class Content;
0026 }
0027 
0028 class PgpKeyMessagePart : public MimeTreeParser::MessagePart
0029 {
0030     Q_OBJECT
0031 public:
0032     explicit PgpKeyMessagePart(MimeTreeParser::Interface::BodyPart *part);
0033     ~PgpKeyMessagePart() override = default;
0034 
0035     [[nodiscard]] QDateTime keyDate() const;
0036     [[nodiscard]] QString userID() const;
0037     [[nodiscard]] QString keyID() const;
0038     [[nodiscard]] QString fingerprint() const;
0039 
0040     [[nodiscard]] QString error() const;
0041     void setError(const QString &error);
0042 
0043     void setKey(const GpgME::Key &key);
0044     [[nodiscard]] GpgME::Key key() const;
0045 
0046     [[nodiscard]] QByteArray rawKey() const;
0047 
0048     void setSearchRunning(bool searchRunning);
0049     [[nodiscard]] bool searchRunning() const;
0050 
0051 protected:
0052     void parseContent(KMime::Content *node);
0053 
0054     QDateTime mKeyDate;
0055     QString mUserID;
0056     QString mKeyID;
0057     QString mFingerprint;
0058     QString mError;
0059     GpgME::Key mKey;
0060     bool mSearchRunning = false;
0061 };