File indexing completed on 2024-06-23 05:19:20
0001 /* 0002 SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <gpgme++/error.h> 0010 0011 #include <QObject> 0012 #include <QString> 0013 0014 #include "enums.h" 0015 #include "interfaces/bodypart.h" 0016 0017 namespace MimeTreeParser 0018 { 0019 class CryptoBodyPartMemento : public QObject, public Interface::BodyPartMemento 0020 { 0021 Q_OBJECT 0022 public: 0023 CryptoBodyPartMemento(); 0024 ~CryptoBodyPartMemento() override; 0025 0026 virtual bool start() = 0; 0027 virtual void exec() = 0; 0028 [[nodiscard]] bool isRunning() const; 0029 0030 [[nodiscard]] const QString &auditLogAsHtml() const 0031 { 0032 return m_auditLog; 0033 } 0034 0035 [[nodiscard]] GpgME::Error auditLogError() const 0036 { 0037 return m_auditLogError; 0038 } 0039 0040 void detach() override; 0041 0042 Q_SIGNALS: 0043 void update(MimeTreeParser::UpdateMode); 0044 0045 protected Q_SLOTS: 0046 void notify() 0047 { 0048 Q_EMIT update(MimeTreeParser::Force); 0049 } 0050 0051 protected: 0052 void setAuditLog(const GpgME::Error &err, const QString &log); 0053 void setRunning(bool running); 0054 0055 private: 0056 bool m_running = false; 0057 QString m_auditLog; 0058 GpgME::Error m_auditLogError; 0059 }; 0060 }