Page Menu
Home
GnuPG
Search
Configure Global Search
Log In
Files
F26446052
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Size
16 KB
Subscribers
None
View Options
diff --git a/src/core/fileopener.h b/src/core/fileopener.h
index da61298..c13616c 100644
--- a/src/core/fileopener.h
+++ b/src/core/fileopener.h
@@ -1,21 +1,21 @@
// SPDX-FileCopyrightText: 2023 g10 Code GmbH
// SPDX-FileContributor: Carl Schwan <carl.schwan@gnupg.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include "mimetreeparser_core_export.h"
#include <KMime/Message>
namespace MimeTreeParser
{
namespace Core
{
namespace FileOpener
{
/// Open messages from file
-QList<KMime::Message::Ptr> MIMETREEPARSER_CORE_EXPORT openFile(const QString &fileName);
+[[nodiscard]] QList<KMime::Message::Ptr> MIMETREEPARSER_CORE_EXPORT openFile(const QString &fileName);
}
}
}
diff --git a/src/core/htmlutils.h b/src/core/htmlutils.h
index 0ed5d24..81bdba3 100644
--- a/src/core/htmlutils.h
+++ b/src/core/htmlutils.h
@@ -1,11 +1,11 @@
// SPDX-FileCopyrightText: 2017 Christian Mollekopf <mollekopf@kolabsys.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include <QString>
namespace MimeTreeParser
{
-QString linkify(const QString &in);
+[[nodiscard]] QString linkify(const QString &in);
}
diff --git a/src/core/messageparser.h b/src/core/messageparser.h
index 8040c1c..384b73b 100644
--- a/src/core/messageparser.h
+++ b/src/core/messageparser.h
@@ -1,59 +1,59 @@
// SPDX-FileCopyrightText: 2016 Christian Mollekopf <mollekopf@kolabsys.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include <QObject>
#include <QString>
#include <KMime/Message>
#include <QAbstractItemModel>
#include "mimetreeparser_core_export.h"
#include "partmodel.h"
#include <memory>
class MessagePartPrivate;
class AttachmentModel;
class MIMETREEPARSER_CORE_EXPORT MessageParser : public QObject
{
Q_OBJECT
Q_PROPERTY(KMime::Message::Ptr message READ message WRITE setMessage NOTIFY htmlChanged)
Q_PROPERTY(PartModel *parts READ parts NOTIFY htmlChanged)
Q_PROPERTY(QAbstractItemModel *attachments READ attachments NOTIFY htmlChanged)
Q_PROPERTY(QString structureAsString READ structureAsString NOTIFY htmlChanged)
Q_PROPERTY(bool loaded READ loaded NOTIFY htmlChanged)
Q_PROPERTY(QString subject READ subject NOTIFY htmlChanged)
Q_PROPERTY(QString from READ from NOTIFY htmlChanged)
Q_PROPERTY(QString sender READ sender NOTIFY htmlChanged)
Q_PROPERTY(QString to READ to NOTIFY htmlChanged)
Q_PROPERTY(QString cc READ cc NOTIFY htmlChanged)
Q_PROPERTY(QString bcc READ bcc NOTIFY htmlChanged)
Q_PROPERTY(QDateTime date READ date NOTIFY htmlChanged)
public:
explicit MessageParser(QObject *parent = Q_NULLPTR);
~MessageParser();
- KMime::Message::Ptr message() const;
+ [[nodiscard]] KMime::Message::Ptr message() const;
void setMessage(const KMime::Message::Ptr message);
PartModel *parts() const;
AttachmentModel *attachments() const;
- QString structureAsString() const;
- bool loaded() const;
-
- QString subject() const;
- QString from() const;
- QString sender() const;
- QString to() const;
- QString cc() const;
- QString bcc() const;
- QDateTime date() const;
+ [[nodiscard]] QString structureAsString() const;
+ [[nodiscard]] bool loaded() const;
+
+ [[nodiscard]] QString subject() const;
+ [[nodiscard]] QString from() const;
+ [[nodiscard]] QString sender() const;
+ [[nodiscard]] QString to() const;
+ [[nodiscard]] QString cc() const;
+ [[nodiscard]] QString bcc() const;
+ [[nodiscard]] QDateTime date() const;
Q_SIGNALS:
void htmlChanged();
private:
std::unique_ptr<MessagePartPrivate> d;
};
diff --git a/src/core/messagepart.h b/src/core/messagepart.h
index b5dde51..7c11165 100644
--- a/src/core/messagepart.h
+++ b/src/core/messagepart.h
@@ -1,376 +1,376 @@
// SPDX-FileCopyrightText: 2015 Sandro Knauß <knauss@kolabsys.com>
// SPDX-License-Identifier: LGPL-2.0-or-later
#pragma once
#include "mimetreeparser_core_export.h"
#include "partmetadata.h"
#include <gpgme++/decryptionresult.h>
#include <gpgme++/importresult.h>
#include <gpgme++/verificationresult.h>
#include <KMime/Message>
#include <QMap>
#include <QSharedPointer>
#include <QString>
namespace KMime
{
class Content;
}
namespace QGpgME
{
class Protocol;
}
namespace MimeTreeParser
{
/** Flags for the encryption state. */
typedef enum { KMMsgEncryptionStateUnknown, KMMsgNotEncrypted, KMMsgPartiallyEncrypted, KMMsgFullyEncrypted, KMMsgEncryptionProblematic } KMMsgEncryptionState;
/** Flags for the signature state. */
typedef enum { KMMsgSignatureStateUnknown, KMMsgNotSigned, KMMsgPartiallySigned, KMMsgFullySigned, KMMsgSignatureProblematic } KMMsgSignatureState;
class ObjectTreeParser;
class MultiPartAlternativeBodyPartFormatter;
class SignedMessagePart;
class EncryptedMessagePart;
class MIMETREEPARSER_CORE_EXPORT MessagePart : public QObject
{
Q_OBJECT
Q_PROPERTY(bool attachment READ isAttachment CONSTANT)
Q_PROPERTY(bool root READ isRoot CONSTANT)
Q_PROPERTY(bool isHtml READ isHtml CONSTANT)
Q_PROPERTY(QString plaintextContent READ plaintextContent CONSTANT)
Q_PROPERTY(QString htmlContent READ htmlContent CONSTANT)
public:
enum Disposition { Inline, Attachment, Invalid };
using Ptr = QSharedPointer<MessagePart>;
using List = QList<Ptr>;
MessagePart(ObjectTreeParser *otp, const QString &text, KMime::Content *node = nullptr);
virtual ~MessagePart();
- virtual QString text() const;
+ [[nodiscard]] virtual QString text() const;
void setText(const QString &text);
virtual bool isAttachment() const;
void setIsRoot(bool root);
- bool isRoot() const;
+ [[nodiscard]] bool isRoot() const;
void setParentPart(MessagePart *parentPart);
MessagePart *parentPart() const;
- virtual QString plaintextContent() const;
- virtual QString htmlContent() const;
+ [[nodiscard]] virtual QString plaintextContent() const;
+ [[nodiscard]] virtual QString htmlContent() const;
- virtual bool isHtml() const;
+ [[nodiscard]] virtual bool isHtml() const;
[[nodiscard]] QByteArray mimeType() const;
[[nodiscard]] QByteArray charset() const;
[[nodiscard]] QString filename() const;
[[nodiscard]] Disposition disposition() const;
[[nodiscard]] bool isText() const;
enum Error {
NoError = 0,
PassphraseError,
NoKeyError,
UnknownError,
};
[[nodiscard]] Error error() const;
[[nodiscard]] QString errorString() const;
PartMetaData *partMetaData();
void appendSubPart(const MessagePart::Ptr &messagePart);
const QList<MessagePart::Ptr> &subParts() const;
[[nodiscard]] bool hasSubParts() const;
KMime::Content *node() const;
virtual KMMsgSignatureState signatureState() const;
virtual KMMsgEncryptionState encryptionState() const;
[[nodiscard]] QList<SignedMessagePart *> signatures() const;
[[nodiscard]] QList<EncryptedMessagePart *> encryptions() const;
/**
* Retrieve the header @header in this part or any parent parent.
*
* Useful for MemoryHole support.
*/
KMime::Headers::Base *header(const char *header) const;
void bindLifetime(KMime::Content *);
protected:
void parseInternal(KMime::Content *node, bool onlyOneMimePart = false);
void parseInternal(const QByteArray &data);
[[nodiscard]] QString renderInternalText() const;
QString mText;
ObjectTreeParser *mOtp;
PartMetaData mMetaData;
MessagePart *mParentPart;
KMime::Content *mNode;
QList<KMime::Content *> mNodesToDelete;
Error mError;
private:
QList<MessagePart::Ptr> mBlocks;
bool mRoot;
};
class MIMETREEPARSER_CORE_EXPORT MimeMessagePart : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<MimeMessagePart> Ptr;
MimeMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, bool onlyOneMimePart = false);
virtual ~MimeMessagePart();
- QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
- QString plaintextContent() const Q_DECL_OVERRIDE;
- QString htmlContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString plaintextContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString htmlContent() const Q_DECL_OVERRIDE;
private:
friend class AlternativeMessagePart;
};
class MIMETREEPARSER_CORE_EXPORT MessagePartList : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<MessagePartList> Ptr;
MessagePartList(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node);
virtual ~MessagePartList() = default;
- QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
- QString plaintextContent() const Q_DECL_OVERRIDE;
- QString htmlContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString plaintextContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString htmlContent() const Q_DECL_OVERRIDE;
};
class MIMETREEPARSER_CORE_EXPORT TextMessagePart : public MessagePartList
{
Q_OBJECT
public:
typedef QSharedPointer<TextMessagePart> Ptr;
TextMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node);
virtual ~TextMessagePart() = default;
- KMMsgSignatureState signatureState() const Q_DECL_OVERRIDE;
- KMMsgEncryptionState encryptionState() const Q_DECL_OVERRIDE;
+ [[nodiscard]] KMMsgSignatureState signatureState() const Q_DECL_OVERRIDE;
+ [[nodiscard]] KMMsgEncryptionState encryptionState() const Q_DECL_OVERRIDE;
private:
void parseContent();
KMMsgSignatureState mSignatureState;
KMMsgEncryptionState mEncryptionState;
friend class ObjectTreeParser;
};
class MIMETREEPARSER_CORE_EXPORT AttachmentMessagePart : public TextMessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<AttachmentMessagePart> Ptr;
AttachmentMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node);
virtual ~AttachmentMessagePart() = default;
- virtual bool isAttachment() const Q_DECL_OVERRIDE
+ [[nodiscard]] virtual bool isAttachment() const Q_DECL_OVERRIDE
{
return true;
}
};
class MIMETREEPARSER_CORE_EXPORT HtmlMessagePart : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<HtmlMessagePart> Ptr;
HtmlMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node);
virtual ~HtmlMessagePart() = default;
- bool isHtml() const Q_DECL_OVERRIDE
+ [[nodiscard]] bool isHtml() const Q_DECL_OVERRIDE
{
return true;
};
};
class MIMETREEPARSER_CORE_EXPORT AlternativeMessagePart : public MessagePart
{
Q_OBJECT
public:
enum HtmlMode {
Normal, ///< A normal plaintext message, non-multipart
Html, ///< A HTML message, non-multipart
MultipartPlain, ///< A multipart/alternative message, the plain text part is currently displayed
MultipartHtml, ///< A multipart/altervative message, the HTML part is currently displayed
MultipartIcal ///< A multipart/altervative message, the ICal part is currently displayed
};
typedef QSharedPointer<AlternativeMessagePart> Ptr;
AlternativeMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node);
virtual ~AlternativeMessagePart();
- QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
- bool isHtml() const Q_DECL_OVERRIDE;
+ [[nodiscard]] bool isHtml() const Q_DECL_OVERRIDE;
- QString plaintextContent() const Q_DECL_OVERRIDE;
- QString htmlContent() const Q_DECL_OVERRIDE;
- QString icalContent() const;
+ [[nodiscard]] QString plaintextContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString htmlContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString icalContent() const;
- QList<HtmlMode> availableModes();
+ [[nodiscard]] QList<HtmlMode> availableModes();
private:
QMap<HtmlMode, MessagePart::Ptr> mChildParts;
friend class ObjectTreeParser;
friend class MultiPartAlternativeBodyPartFormatter;
};
class MIMETREEPARSER_CORE_EXPORT CertMessagePart : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<CertMessagePart> Ptr;
CertMessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, QGpgME::Protocol *cryptoProto);
virtual ~CertMessagePart();
- QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
private:
const QGpgME::Protocol *mCryptoProto;
GpgME::ImportResult mInportResult;
};
class MIMETREEPARSER_CORE_EXPORT EncapsulatedRfc822MessagePart : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<EncapsulatedRfc822MessagePart> Ptr;
EncapsulatedRfc822MessagePart(MimeTreeParser::ObjectTreeParser *otp, KMime::Content *node, const KMime::Message::Ptr &message);
virtual ~EncapsulatedRfc822MessagePart() = default;
- QString text() const Q_DECL_OVERRIDE;
- QString from() const;
- QDateTime date() const;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString from() const;
+ [[nodiscard]] QDateTime date() const;
private:
const KMime::Message::Ptr mMessage;
};
class MIMETREEPARSER_CORE_EXPORT EncryptedMessagePart : public MessagePart
{
Q_OBJECT
Q_PROPERTY(bool decryptMessage READ decryptMessage WRITE setDecryptMessage)
Q_PROPERTY(bool isEncrypted READ isEncrypted)
Q_PROPERTY(bool isNoSecKey READ isNoSecKey)
Q_PROPERTY(bool passphraseError READ passphraseError)
public:
typedef QSharedPointer<EncryptedMessagePart> Ptr;
EncryptedMessagePart(ObjectTreeParser *otp,
const QString &text,
const QGpgME::Protocol *protocol,
KMime::Content *node,
KMime::Content *encryptedNode = nullptr,
bool parseAfterDecryption = true);
virtual ~EncryptedMessagePart() = default;
- QString text() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString text() const Q_DECL_OVERRIDE;
void setDecryptMessage(bool decrypt);
[[nodiscard]] bool decryptMessage() const;
void setIsEncrypted(bool encrypted);
[[nodiscard]] bool isEncrypted() const;
[[nodiscard]] bool isDecryptable() const;
[[nodiscard]] bool isNoSecKey() const;
[[nodiscard]] bool passphraseError() const;
void startDecryption(KMime::Content *data);
void startDecryption();
QByteArray mDecryptedData;
- QString plaintextContent() const override;
- QString htmlContent() const override;
+ [[nodiscard]] QString plaintextContent() const override;
+ [[nodiscard]] QString htmlContent() const override;
const QGpgME::Protocol *cryptoProto() const;
std::vector<std::pair<GpgME::DecryptionResult::Recipient, GpgME::Key>> decryptRecipients() const;
private:
- bool decrypt(KMime::Content &data);
+ [[nodiscard]] bool decrypt(KMime::Content &data);
bool mParseAfterDecryption{true};
protected:
bool mPassphraseError;
bool mNoSecKey;
bool mDecryptMessage;
const QGpgME::Protocol *mCryptoProto;
QByteArray mVerifiedText;
std::vector<std::pair<GpgME::DecryptionResult::Recipient, GpgME::Key>> mDecryptRecipients;
KMime::Content *mEncryptedNode;
};
class MIMETREEPARSER_CORE_EXPORT SignedMessagePart : public MessagePart
{
Q_OBJECT
Q_PROPERTY(bool isSigned READ isSigned CONSTANT)
public:
typedef QSharedPointer<SignedMessagePart> Ptr;
SignedMessagePart(ObjectTreeParser *otp,
const QGpgME::Protocol *protocol,
KMime::Content *node,
KMime::Content *signedData,
bool parseAfterDecryption = true);
virtual ~SignedMessagePart();
void setIsSigned(bool isSigned);
- bool isSigned() const;
+ [[nodiscard]] bool isSigned() const;
void startVerification();
- QString plaintextContent() const Q_DECL_OVERRIDE;
- QString htmlContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString plaintextContent() const Q_DECL_OVERRIDE;
+ [[nodiscard]] QString htmlContent() const Q_DECL_OVERRIDE;
const QGpgME::Protocol *cryptoProto() const;
private:
void sigStatusToMetaData();
void setVerificationResult(const GpgME::VerificationResult &result, const QByteArray &signedData);
bool mParseAfterDecryption{true};
protected:
const QGpgME::Protocol *mCryptoProto;
KMime::Content *mSignedData;
std::vector<GpgME::Signature> mSignatures;
friend EncryptedMessagePart;
};
class MIMETREEPARSER_CORE_EXPORT HeadersPart : public MessagePart
{
Q_OBJECT
public:
typedef QSharedPointer<HeadersPart> Ptr;
HeadersPart(ObjectTreeParser *otp, KMime::Content *node);
virtual ~HeadersPart() = default;
};
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jul 17, 12:24 AM (23 h, 53 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2a/be/f5ecbde59edafaa8577c44b0ed1a
Attached To
rMTP MIME Tree Parser
Event Timeline
Log In to Comment